]> git.mjollnir.org Git - moodle.git/commitdiff
Merging fixes for MDL-12383 and MDL-12605 from MOODLE_19_STABLE
authormark-nielsen <mark-nielsen>
Sat, 29 Dec 2007 22:48:48 +0000 (22:48 +0000)
committermark-nielsen <mark-nielsen>
Sat, 29 Dec 2007 22:48:48 +0000 (22:48 +0000)
mod/lesson/view.php

index 5f43117b560b51dcdd304a19836b52406dca195f..3243160def9bf97c0b81a0fdf1f366bb07c48cf9 100644 (file)
             if(has_capability('mod/lesson:manage', $context)) {
                 lesson_set_message(get_string('teachertimerwarning', 'lesson'));
             } else {
-                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."&amp;outoftime=normal", get_string("outoftime", "lesson"));
-                }
-                // update clock when viewing a new page... no special treatment
-                if ((($timer->starttime + $lesson->maxtime * 60) - time()) < 60) {
+                    redirect("$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&amp;pageid=".LESSON_EOL."&amp;outoftime=normal");
+                    die; // Shouldn't be reached, but make sure
+                } else if ($timeleft < 60) {
+                    // One minute warning
                     lesson_set_message(get_string('studentoneminwarning', 'lesson'));
-                }    
+                }
             }
         }
 
                     break;
                     
                 case LESSON_MATCHING :
-                    echo '<tr><td><table width="100%">';
                     // don't suffle answers (could be an option??)
                     foreach ($answers as $answer) {
                         // get all the response
                             } 
                         }
                     }
-                    echo '</table></td></tr></table>';
+                    echo '</table>';
                     print_simple_box_end();
                     lesson_print_submit_link(get_string('pleasematchtheabovepairs', 'lesson'), 'answerform');
                     break;