]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14655 fix display of Choice when "show results after closed" is selected.
authordanmarsden <danmarsden>
Mon, 11 Aug 2008 04:19:34 +0000 (04:19 +0000)
committerdanmarsden <danmarsden>
Mon, 11 Aug 2008 04:19:34 +0000 (04:19 +0000)
mod/choice/view.php

index 1344b71a275507bbe095325d2402006cb8a9208c..a125063b8a56c9a6aa1f5c21d4cf28d06d8677d8 100644 (file)
@@ -92,7 +92,7 @@
     }
 
 /// Print the form
-
+    $choiceopen = true;
     $timenow = time();
     if ($choice->timeclose !=0) {
         if ($choice->timeopen > $timenow ) {
             exit;
         } else if ($timenow > $choice->timeclose) {
             print_simple_box(get_string("expired", "choice", userdate($choice->timeclose)), "center");
-            print_footer($course);
-            exit;
+            $choiceopen = false;
         }
     }
 
-    if ( (!$current or $choice->allowupdate) and
-         ($choice->timeclose >= time() or $choice->timeclose == 0) and
+    if ( (!$current or $choice->allowupdate) and $choiceopen and
           has_capability('mod/choice:choose', $context) ) {
     // They haven't made their choice yet or updates allowed and choice is open
 
 
     if ( $choice->showresults == CHOICE_SHOWRESULTS_ALWAYS or
         ($choice->showresults == CHOICE_SHOWRESULTS_AFTER_ANSWER and $current ) or
-        ($choice->showresults == CHOICE_SHOWRESULTS_AFTER_CLOSE and $choice->timeclose <= time() ) )  {
+        ($choice->showresults == CHOICE_SHOWRESULTS_AFTER_CLOSE and !$choiceopen ) )  {
 
         choice_show_results($choice, $course, $cm, $allresponses); //show table with students responses.
 
         print_simple_box(get_string('noresultsviewable', 'choice'), 'center');
     }
 
-
     print_footer($course);
 
 /// Mark as viewed
     $completion=new completion_info($course);
     $completion->set_module_viewed($cm);
-?>
+?>
\ No newline at end of file