diff --git a/lang/en_utf8/quiz.php b/lang/en_utf8/quiz.php
index 97ee55342a1..76280224976 100644
--- a/lang/en_utf8/quiz.php
+++ b/lang/en_utf8/quiz.php
@@ -47,7 +47,7 @@ $string['attempts'] = 'Attempts';
$string['attemptsonly'] = 'Show only students with attempts';
$string['attemptsallowed'] = 'Attempts allowed';
$string['attemptselection'] = 'Select which attempts to analyze per user: ';
-$string['attemptsexist'] = 'This quiz has already been attempted.
You can no longer add or remove questions.';
+$string['attemptsexist'] = 'You can no longer add or remove questions.';
$string['attemptsunlimited'] = 'Unlimited attempts';
$string['back'] = 'Back to preview question';
$string['backtoquiz'] = 'Back to quiz editing';
@@ -305,6 +305,7 @@ $string['notavailabletostudents'] = 'Note: This quiz is not currently available
$string['notenoughanswers'] = 'This type of question requires at least $a answers';
$string['notenoughsubquestions'] = 'Not enough sub-questions have been defined!
Do you want to go back and fix this question?';
$string['notimedependentitems'] = 'Time dependent items are not currently supported by the quiz module. As a work around, set a time limit for the whole quiz. Do you wish to choose a different item (or use the current item regardless)?';
+$string['numattempts'] = '$a->studentnum $a->studentstring have made $a->attemptnum attempts';
$string['numberabbr'] = '#';
$string['numerical'] = 'Numerical';
$string['none']= 'None';
diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php
index 45ab9cc08a2..81a7391ee5a 100644
--- a/mod/quiz/edit.php
+++ b/mod/quiz/edit.php
@@ -322,17 +322,14 @@ if (self.name == 'editquestion') {
print_simple_box_start("center");
- $attemptcount = count_records('quiz_attempts', 'quiz', $modform->instance, 'preview', 0);
-
- $strviewallanswers = get_string("viewallanswers","quiz",$attemptcount);
- $strattemptsexist = get_string("attemptsexist","quiz");
- $usercount = count_records_select('quiz_attempts', "quiz = '$modform->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
- $strusers = $course->students;
+ $a->attemptnum = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0);
+ $a->studentnum = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
+ $a->studentstring = $course->students;
if (! $cm = get_coursemodule_from_instance("quiz", $modform->instance, $course->id)) {
error("Course Module ID was incorrect");
}
echo "
\n";
- echo "$strattemptsexist
id\">$strviewallanswers ($usercount $strusers)";
+ echo "id\">".get_string('numattempts', 'quiz', $a)."
".get_string("attemptsexist","quiz");
echo "
\n";
$sumgrades = quiz_print_question_list($modform, false, $SESSION->quiz_showbreaks, $SESSION->quiz_reordertool);
diff --git a/mod/quiz/index.php b/mod/quiz/index.php
index cd3ce6a3dd6..71c0f335375 100644
--- a/mod/quiz/index.php
+++ b/mod/quiz/index.php
@@ -104,12 +104,11 @@
$closequiz = $quiz->timeclose ? userdate($quiz->timeclose) : '';
if (isteacher($course->id)) {
- if ($usercount = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)')) {
- $attemptcount = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0);
- $strviewallreports = get_string('viewallreports', 'quiz', $attemptcount);
- $gradecol = "id\">$strviewallreports ($usercount $strusers)";
+ if ($a->attemptnum = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0)) {
+ $a->studentnum = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
+ $a->studentstring = $course->students;
+ $gradecol = "id\">".get_string('numattempts', 'quiz', $a).'';
} else {
- $answercount = 0;
$gradecol = "";
}
} else {
diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php
index 1dfdbd39315..0005d9a6ba9 100644
--- a/mod/quiz/report/overview/report.php
+++ b/mod/quiz/report/overview/report.php
@@ -62,7 +62,13 @@ class quiz_report extends quiz_default_report {
}
break;
}
-
+ /// Print information on the number of existing attempts
+ if ($a->attemptnum = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0)) {
+ $a->studentnum = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
+ $a->studentstring = $course->students;
+
+ notify(get_string('numattempts', 'quiz', $a));
+ }
/// Check to see if groups are being used in this quiz
if ($groupmode = groupmode($course, $cm)) { // Groups are being used
if (!$download) {
diff --git a/mod/quiz/view.php b/mod/quiz/view.php
index fac72b62b56..daf99697485 100644
--- a/mod/quiz/view.php
+++ b/mod/quiz/view.php
@@ -115,14 +115,11 @@
// This is all the teacher will get
if ($isteacher) {
-
- if ($attemptcount = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0)) {
-
- $strviewallanswers = get_string("viewallanswers", "quiz", $attemptcount);
- $usercount = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
- $strusers = $course->students;
+ if ($a->attemptnum = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0)) {
+ $a->studentnum = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
+ $a->studentstring = $course->students;
- notify("id\">$strviewallanswers ($usercount $strusers)");
+ notify("id\">".get_string('numattempts', 'quiz', $a).'');
}
echo '';