Browse Source

Fixed bugs with date ranges

MOODLE_23_STABLE
Artem Andreev 14 years ago
parent
commit
c6bcee3abb
  1. 11
      locallib.php
  2. 6
      manage.php
  3. 6
      report.php

11
locallib.php

@ -299,8 +299,9 @@ function print_user_attendaces($user, $cm, $attforblock, $course = 0, $printing
else else
set_current_date ($course->id, $current); set_current_date ($course->id, $current);
list($startdate, $enddate) = $ret = print_filter_controls("view.php", $id, $studentid);
print_filter_controls("view.php", $id, $studentid); $startdate = $ret['startdate'];
$enddate = $ret['enddate'];
if ($startdate && $enddate) { if ($startdate && $enddate) {
$where = "ats.courseid={$course->id} AND al.studentid = {$user->id} AND ats.sessdate >= $startdate AND ats.sessdate < $enddate"; $where = "ats.courseid={$course->id} AND al.studentid = {$user->id} AND ats.sessdate >= $startdate AND ats.sessdate < $enddate";
@ -363,7 +364,7 @@ function print_filter_controls($url, $id, $studentid=0, $sort=NULL, $printselect
case 'weeks': case 'weeks':
$format = get_string('strftimedm', 'attforblock'); $format = get_string('strftimedm', 'attforblock');
$startdate = make_timestamp($year, $mon, $mday - $wday + 1); $startdate = make_timestamp($year, $mon, $mday - $wday + 1);
$enddate = make_timestamp($year, $mon, $mday + 7 - $wday); $enddate = make_timestamp($year, $mon, $mday + 7 - $wday + 1) - 1;
$prevcur = $startdate - WEEKSECS; $prevcur = $startdate - WEEKSECS;
$nextcur = $startdate + WEEKSECS; $nextcur = $startdate + WEEKSECS;
$curdatetxt = userdate($startdate, $format)." - ".userdate($enddate, $format); $curdatetxt = userdate($startdate, $format)." - ".userdate($enddate, $format);
@ -378,7 +379,7 @@ function print_filter_controls($url, $id, $studentid=0, $sort=NULL, $printselect
break; break;
case 'alltaken': case 'alltaken':
$startdate = 1; $startdate = 1;
$enddate = $current; $enddate = time();
break; break;
case 'all': case 'all':
$startdate = 0; $startdate = 0;
@ -520,7 +521,7 @@ function print_filter_controls($url, $id, $studentid=0, $sort=NULL, $printselect
echo "</div>"; echo "</div>";
return array($startdate, $enddate, $currentgroup); return array('startdate' => $startdate, 'enddate' => $enddate, 'currentgroup' => $currentgroup);
} }
function plug_yui_calendar($current) { function plug_yui_calendar($current) {

6
manage.php

@ -103,8 +103,10 @@ function print_sessions_list($course) {
else else
set_current_date ($course->id, $current); set_current_date ($course->id, $current);
list($startdate, $enddate, $currentgroup) = $ret = print_filter_controls("manage.php", $id, 0, NULL, SESSION_TYPE_SELECTOR);
print_filter_controls("manage.php", $id, 0, NULL, SESSION_TYPE_SELECTOR); $startdate = $ret['startdate'];
$enddate = $ret['enddate'];
$currentgroup = $ret['currentgroup'];
if ($startdate && $enddate) { if ($startdate && $enddate) {
$where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate"; $where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate";

6
report.php

@ -68,8 +68,10 @@
else else
set_current_date ($course->id, $current); set_current_date ($course->id, $current);
list($startdate, $enddate, $currentgroup) = $ret = print_filter_controls("report.php", $id, 0, $sort, GROUP_SELECTOR);
print_filter_controls("report.php", $id, 0, $sort, GROUP_SELECTOR); $startdate = $ret['startdate'];
$enddate = $ret['enddate'];
$currentgroup = $ret['currentgroup'];
if ($startdate && $enddate) { if ($startdate && $enddate) {
$where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate"; $where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate";

Loading…
Cancel
Save