Browse Source

Fixed dates range for 0 week days

MOODLE_23_STABLE
Artem Andreev 13 years ago
parent
commit
0f7ceac84f
  1. 9
      locallib.php

9
locallib.php

@ -183,9 +183,12 @@ class att_page_with_filter_controls {
} }
public function init_start_end_date() { public function init_start_end_date() {
global $CFG;
$date = usergetdate($this->curdate); $date = usergetdate($this->curdate);
$mday = $date['mday']; $mday = $date['mday'];
$wday = $date['wday']; $wday = $date['wday'] - $CFG->calendar_startwday;
if ($wday < 0) $wday += 7;
$mon = $date['mon']; $mon = $date['mon'];
$year = $date['year']; $year = $date['year'];
@ -195,8 +198,8 @@ class att_page_with_filter_controls {
$this->enddate = make_timestamp($year, $mon, $mday + 1); $this->enddate = make_timestamp($year, $mon, $mday + 1);
break; break;
case VIEW_WEEKS: case VIEW_WEEKS:
$this->startdate = make_timestamp($year, $mon, $mday - $wday + 1); $this->startdate = make_timestamp($year, $mon, $mday - $wday);
$this->enddate = make_timestamp($year, $mon, $mday + 7 - $wday + 1) - 1; $this->enddate = make_timestamp($year, $mon, $mday + 7 - $wday) - 1;
break; break;
case VIEW_MONTHS: case VIEW_MONTHS:
$this->startdate = make_timestamp($year, $mon); $this->startdate = make_timestamp($year, $mon);

Loading…
Cancel
Save