]> git.mjollnir.org Git - moodle.git/commitdiff
Merging fix for MDL-12605 from MOODLE_19_STABLE
authormark-nielsen <mark-nielsen>
Sat, 29 Dec 2007 22:18:19 +0000 (22:18 +0000)
committermark-nielsen <mark-nielsen>
Sat, 29 Dec 2007 22:18:19 +0000 (22:18 +0000)
lang/en_utf8/lesson.php
mod/lesson/action/continue.php

index 92cb254043412a954bb723c3b615ccdb04054d59..8b2b1acbcf7b89a0036c3190e4e237b2174ea744 100644 (file)
@@ -203,7 +203,6 @@ $string['or'] = 'OR';
 $string['ordered'] = 'Ordered';
 $string['other'] = 'Other';
 $string['outof'] = 'Out of $a';
-$string['outoftime'] = 'Out of time';
 $string['overview'] = 'Overview';
 $string['page'] = 'Page: $a';
 $string['pagecontents'] = 'Page contents';
@@ -262,7 +261,6 @@ $string['startlesson'] = 'Start lesson';
 $string['studentattemptlesson'] = '$a->lastname, $a->firstname\'s attempt number $a->attempt';
 $string['studentname'] = '$a Name';
 $string['studentoneminwarning'] = 'Warning: You have 1 minute or less to finish the lesson.';
-$string['studentoutoftime'] = 'Attention: You ran out of time for this lesson. Your last answer does not count because it was answered after the time was up.  Please push the continue button to finish the lesson.';
 $string['studentresponse'] = '{$a}\'s response';
 $string['submitname'] = 'Submit name';
 $string['teacherjumpwarning'] = 'An $a->cluster jump or an $a->unseen jump is being used in this lesson.  The Next Page jump will be used instead.  Login as a student to test these jumps.';
index 05d6cb312e918dc5aa8df0c414ae6a8e9883b88d..18e73edb676a6ec8bf597750ebabb6b02435ef44 100644 (file)
@@ -19,7 +19,6 @@
 
     // This is the code updates the lesson time for a timed test
     // get time information for this user
-    $outoftime = false;
     $timer = new stdClass;
     if (!has_capability('mod/lesson:manage', $context)) {
         if (!$timer = get_records_select('lesson_timer', "lessonid = $lesson->id AND userid = $USER->id", 'starttime')) {
         }
         
         if ($lesson->timed) {
-            if ((($timer->starttime + $lesson->maxtime * 60) - time()) < 60 && !((($timer->starttime + $lesson->maxtime * 60) - time()) < 0)) {
-                lesson_set_message(get_string("studentoneminwarning", "lesson"));
-            } else if (($timer->starttime + $lesson->maxtime * 60) < time()) {
-                lesson_set_message(get_string("studentoutoftime", "lesson"));
-                $outoftime = true;
-            }
-            if ((($timer->starttime + $lesson->maxtime * 60) - time()) <= 0) {
+            $timeleft = ($timer->starttime + $lesson->maxtime * 60) - time();
+
+            if ($timeleft <= 0) {
                 // Out of time
                 lesson_set_message(get_string('eolstudentoutoftime', 'lesson'));
-                redirect("$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&amp;pageid=".LESSON_EOL."&outoftime=normal", get_string("outoftime", "lesson"));
+                redirect("$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&amp;pageid=".LESSON_EOL."&outoftime=normal");
+                die; // Shouldn't be reached, but make sure
+            } else if ($timeleft < 60) {
+                // One minute warning
+                lesson_set_message(get_string("studentoneminwarning", "lesson"));
             }
         }
         
             }
             
             $attempt->timeseen = time();
-            // dont want to insert the attempt if they ran out of time
-            if (!$outoftime) {
-                // if allow modattempts, then update the old attempt record, otherwise, insert new answer record
-                if (isset($USER->modattempts[$lesson->id])) {
-                    $attempt->retry = $nretakes - 1; // they are going through on review, $nretakes will be too high
-                }
-                if (!$newattemptid = insert_record("lesson_attempts", $attempt)) {
-                    error("Continue: attempt not inserted");
-                }
+            // if allow modattempts, then update the old attempt record, otherwise, insert new answer record
+            if (isset($USER->modattempts[$lesson->id])) {
+                $attempt->retry = $nretakes - 1; // they are going through on review, $nretakes will be too high
+            }
+            if (!$newattemptid = insert_record("lesson_attempts", $attempt)) {
+                error("Continue: attempt not inserted");
             }
             // "number of attempts remaining" message if $lesson->maxattempts > 1
             // displaying of message(s) is at the end of page for more ergonomic display
     }
 
     // TODO: merge with the jump code above.  This is where some jump numbers are interpreted
-    if($outoftime) {
-        $newpageid = LESSON_EOL;  // ran out of time for the test, so go to eol
-    } elseif (isset($USER->modattempts[$lesson->id])) {
+    if (isset($USER->modattempts[$lesson->id])) {
         // make sure if the student is reviewing, that he/she sees the same pages/page path that he/she saw the first time
         if ($USER->modattempts[$lesson->id] == $pageid) {  // remember, this session variable holds the pageid of the last page that the user saw
             $newpageid = LESSON_EOL;