MDL-36601 Ensure that reports remember all days setting
authorAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Wed, 14 Nov 2012 16:53:27 +0000 (16:53 +0000)
committerAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Thu, 29 Nov 2012 09:57:09 +0000 (09:57 +0000)
All Days was set as the nothing value, but this nothing value was used.
Additionally, an insufficient comparison meant that the selecteddate then
became Today.

report/log/locallib.php

index 9544e91..276a170 100644 (file)
@@ -281,7 +281,10 @@ function report_log_print_mnet_selector_form($hostid, $course, $selecteduser=0,
     $timemidnight = $today = usergetmidnight($timenow);
 
     // Put today up the top of the list
     $timemidnight = $today = usergetmidnight($timenow);
 
     // Put today up the top of the list
-    $dates = array("$timemidnight" => get_string("today").", ".userdate($timenow, $strftimedate) );
+    $dates = array(
+        "0" => get_string('alldays'),
+        "$timemidnight" => get_string("today").", ".userdate($timenow, $strftimedate)
+    );
 
     if (!$course->startdate or ($course->startdate > $timenow)) {
         $course->startdate = $course->timecreated;
 
     if (!$course->startdate or ($course->startdate > $timenow)) {
         $course->startdate = $course->timecreated;
@@ -295,7 +298,7 @@ function report_log_print_mnet_selector_form($hostid, $course, $selecteduser=0,
         $numdates++;
     }
 
         $numdates++;
     }
 
-    if ($selecteddate == "today") {
+    if ($selecteddate === "today") {
         $selecteddate = $today;
     }
 
         $selecteddate = $today;
     }
 
@@ -355,7 +358,7 @@ function report_log_print_mnet_selector_form($hostid, $course, $selecteduser=0,
     }
 
     echo html_writer::label(get_string('date'), 'menudate', false, array('class' => 'accesshide'));
     }
 
     echo html_writer::label(get_string('date'), 'menudate', false, array('class' => 'accesshide'));
-    echo html_writer::select($dates, "date", $selecteddate, get_string("alldays"));
+    echo html_writer::select($dates, "date", $selecteddate, false);
     echo html_writer::label(get_string('showreports'), 'menumodid', false, array('class' => 'accesshide'));
     echo html_writer::select($activities, "modid", $selectedactivity, get_string("allactivities"));
     echo html_writer::label(get_string('actions'), 'menumodaction', false, array('class' => 'accesshide'));
     echo html_writer::label(get_string('showreports'), 'menumodid', false, array('class' => 'accesshide'));
     echo html_writer::select($activities, "modid", $selectedactivity, get_string("allactivities"));
     echo html_writer::label(get_string('actions'), 'menumodaction', false, array('class' => 'accesshide'));