]> git.mjollnir.org Git - moodle.git/commitdiff
If a quiz has been attempted and the teacher is editing the quiz,
authormoodler <moodler>
Wed, 19 May 2004 03:22:21 +0000 (03:22 +0000)
committermoodler <moodler>
Wed, 19 May 2004 03:22:21 +0000 (03:22 +0000)
then let them know about the attempts.

bug 321

Thanks, Bernard!

lang/en/quiz.php
mod/quiz/edit.php

index 8cdfc4ec8de20b1976c7ed7dd286c0475b0f7dc6..69c6ca589f1488e1500e4a5df85d741080ab1e0b 100644 (file)
@@ -24,6 +24,7 @@ $string['attemptlast'] = 'Last attempt';
 $string['attemptquiznow'] = 'Attempt quiz now';
 $string['attempts'] = 'Attempts';
 $string['attemptsallowed'] = 'Attempts allowed';
+$string['attemptsexist'] = 'This quiz has already been attempted';
 $string['attemptincomplete'] = 'That attempt (by $a) is not yet completed.';
 $string['attemptsunlimited'] = 'Unlimited attempts';
 $string['backtoquiz'] = 'Back to quiz editing';
index 204baaddd2272934e3eb3ffdbb5ea0f26f88d267..7b0c3549636e21b5925ffb0f57e8c309ca1e95cc 100644 (file)
 
     $strname    = get_string('name');
     $strquizzes = get_string('modulenameplural', 'quiz');
-    $strediting = get_string(isset($modform->instance) ? "editingquiz"
-                                                       : "editquestions",
-                             "quiz");
+    $strediting = get_string(isset($modform->instance) ? "editingquiz" : "editquestions", "quiz");
     $strheading = empty($modform->name) ? $strediting : $modform->name;
 
     print_header("$course->shortname: $strediting", "$course->shortname: $strheading",
         ?>
         <center>
         <p>&nbsp;</p>
+        <?php
+
+        if ($attemptcount = count_records_select("quiz_attempts", "quiz = '$modform->instance' AND timefinish > 0"))  {
+            $strviewallanswers  = get_string("viewallanswers","quiz",$attemptcount);
+            $strattemptsexist  = get_string("attemptsexist","quiz");
+            $usercount = count_records("quiz_grades", "quiz", "$modform->instance");
+            $strusers  = get_string("users");
+            notify("$strattemptsexist<br /><a href=\"report.php?id=$modform->instance\">$strviewallanswers ($usercount $strusers)</a>");
+        }
+
+        ?>
         <form  name="theform" method="post" action=<?php echo $modform->destination ?>>
         <input type="hidden" name="course"  value="<?php  p($modform->course) ?>">
         <input type="submit" value="<?php  print_string("savequiz", "quiz") ?>">
         </form>
         </center>
         <?php
+
+
         print_simple_box_end();
         echo '</td><td valign="top" width="50%">';
     }