Dan Marsden
9 years ago
21 changed files with 644 additions and 431 deletions
@ -0,0 +1,39 @@ |
|||||
|
<?php |
||||
|
// This file is part of Moodle - http://moodle.org/ |
||||
|
// |
||||
|
// Moodle is free software: you can redistribute it and/or modify |
||||
|
// it under the terms of the GNU General Public License as published by |
||||
|
// the Free Software Foundation, either version 3 of the License, or |
||||
|
// (at your option) any later version. |
||||
|
// |
||||
|
// Moodle is distributed in the hope that it will be useful, |
||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
// GNU General Public License for more details. |
||||
|
// |
||||
|
// You should have received a copy of the GNU General Public License |
||||
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||||
|
|
||||
|
/** |
||||
|
* Class definition for mod_attendance_manage_page_params |
||||
|
* |
||||
|
* @package mod_attendance |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* stores constants/data passed depending on view. |
||||
|
* |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
class mod_attendance_manage_page_params extends mod_attendance_page_with_filter_controls { |
||||
|
public function __construct() { |
||||
|
$this->selectortype = mod_attendance_page_with_filter_controls::SELECTOR_SESS_TYPE; |
||||
|
} |
||||
|
|
||||
|
public function get_significant_params() { |
||||
|
return array(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,224 @@ |
|||||
|
<?php |
||||
|
// This file is part of Moodle - http://moodle.org/ |
||||
|
// |
||||
|
// Moodle is free software: you can redistribute it and/or modify |
||||
|
// it under the terms of the GNU General Public License as published by |
||||
|
// the Free Software Foundation, either version 3 of the License, or |
||||
|
// (at your option) any later version. |
||||
|
// |
||||
|
// Moodle is distributed in the hope that it will be useful, |
||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
// GNU General Public License for more details. |
||||
|
// |
||||
|
// You should have received a copy of the GNU General Public License |
||||
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||||
|
|
||||
|
/** |
||||
|
* Class definition for mod_attendance_page_with_filter_controls |
||||
|
* |
||||
|
* @package mod_attendance |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* base filter controls class - overridden by different views where needed. |
||||
|
* |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
class mod_attendance_page_with_filter_controls { |
||||
|
const SELECTOR_NONE = 1; |
||||
|
const SELECTOR_GROUP = 2; |
||||
|
const SELECTOR_SESS_TYPE = 3; |
||||
|
|
||||
|
const SESSTYPE_COMMON = 0; |
||||
|
const SESSTYPE_ALL = -1; |
||||
|
const SESSTYPE_NO_VALUE = -2; |
||||
|
|
||||
|
/** @var int current view mode */ |
||||
|
public $view; |
||||
|
|
||||
|
/** @var int $view and $curdate specify displaed date range */ |
||||
|
public $curdate; |
||||
|
|
||||
|
/** @var int start date of displayed date range */ |
||||
|
public $startdate; |
||||
|
|
||||
|
/** @var int end date of displayed date range */ |
||||
|
public $enddate; |
||||
|
|
||||
|
public $selectortype = self::SELECTOR_NONE; |
||||
|
|
||||
|
protected $defaultview = ATT_VIEW_WEEKS; |
||||
|
|
||||
|
private $cm; |
||||
|
|
||||
|
private $sessgroupslist; |
||||
|
|
||||
|
private $sesstype; |
||||
|
|
||||
|
public function init($cm) { |
||||
|
$this->cm = $cm; |
||||
|
$this->init_view(); |
||||
|
$this->init_curdate(); |
||||
|
$this->init_start_end_date(); |
||||
|
} |
||||
|
|
||||
|
private function init_view() { |
||||
|
global $SESSION; |
||||
|
|
||||
|
if (isset($this->view)) { |
||||
|
$SESSION->attcurrentattview[$this->cm->course] = $this->view; |
||||
|
} else if (isset($SESSION->attcurrentattview[$this->cm->course])) { |
||||
|
$this->view = $SESSION->attcurrentattview[$this->cm->course]; |
||||
|
} else { |
||||
|
$this->view = $this->defaultview; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private function init_curdate() { |
||||
|
global $SESSION; |
||||
|
|
||||
|
if (isset($this->curdate)) { |
||||
|
$SESSION->attcurrentattdate[$this->cm->course] = $this->curdate; |
||||
|
} else if (isset($SESSION->attcurrentattdate[$this->cm->course])) { |
||||
|
$this->curdate = $SESSION->attcurrentattdate[$this->cm->course]; |
||||
|
} else { |
||||
|
$this->curdate = time(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public function init_start_end_date() { |
||||
|
global $CFG; |
||||
|
|
||||
|
// HOURSECS solves issue for weeks view with Daylight saving time and clocks adjusting by one hour backward. |
||||
|
$date = usergetdate($this->curdate + HOURSECS); |
||||
|
$mday = $date['mday']; |
||||
|
$wday = $date['wday'] - $CFG->calendar_startwday; |
||||
|
if ($wday < 0) { |
||||
|
$wday += 7; |
||||
|
} |
||||
|
$mon = $date['mon']; |
||||
|
$year = $date['year']; |
||||
|
|
||||
|
switch ($this->view) { |
||||
|
case ATT_VIEW_DAYS: |
||||
|
$this->startdate = make_timestamp($year, $mon, $mday); |
||||
|
$this->enddate = make_timestamp($year, $mon, $mday + 1); |
||||
|
break; |
||||
|
case ATT_VIEW_WEEKS: |
||||
|
$this->startdate = make_timestamp($year, $mon, $mday - $wday); |
||||
|
$this->enddate = make_timestamp($year, $mon, $mday + 7 - $wday) - 1; |
||||
|
break; |
||||
|
case ATT_VIEW_MONTHS: |
||||
|
$this->startdate = make_timestamp($year, $mon); |
||||
|
$this->enddate = make_timestamp($year, $mon + 1); |
||||
|
break; |
||||
|
case ATT_VIEW_ALLPAST: |
||||
|
$this->startdate = 1; |
||||
|
$this->enddate = time(); |
||||
|
break; |
||||
|
case ATT_VIEW_ALL: |
||||
|
$this->startdate = 0; |
||||
|
$this->enddate = 0; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private function calc_sessgroupslist_sesstype() { |
||||
|
global $SESSION; |
||||
|
|
||||
|
if (!array_key_exists('attsessiontype', $SESSION)) { |
||||
|
$SESSION->attsessiontype = array($this->cm->course => self::SESSTYPE_ALL); |
||||
|
} else if (!array_key_exists($this->cm->course, $SESSION->attsessiontype)) { |
||||
|
$SESSION->attsessiontype[$this->cm->course] = self::SESSTYPE_ALL; |
||||
|
} |
||||
|
|
||||
|
$group = optional_param('group', self::SESSTYPE_NO_VALUE, PARAM_INT); |
||||
|
if ($this->selectortype == self::SELECTOR_SESS_TYPE) { |
||||
|
if ($group > self::SESSTYPE_NO_VALUE) { |
||||
|
$SESSION->attsessiontype[$this->cm->course] = $group; |
||||
|
if ($group > self::SESSTYPE_ALL) { |
||||
|
// Set activegroup in $SESSION. |
||||
|
groups_get_activity_group($this->cm, true); |
||||
|
} else { |
||||
|
// Reset activegroup in $SESSION. |
||||
|
unset($SESSION->activegroup[$this->cm->course][VISIBLEGROUPS][$this->cm->groupingid]); |
||||
|
unset($SESSION->activegroup[$this->cm->course]['aag'][$this->cm->groupingid]); |
||||
|
unset($SESSION->activegroup[$this->cm->course][SEPARATEGROUPS][$this->cm->groupingid]); |
||||
|
} |
||||
|
$this->sesstype = $group; |
||||
|
} else { |
||||
|
$this->sesstype = $SESSION->attsessiontype[$this->cm->course]; |
||||
|
} |
||||
|
} else if ($this->selectortype == self::SELECTOR_GROUP) { |
||||
|
if ($group == 0) { |
||||
|
$SESSION->attsessiontype[$this->cm->course] = self::SESSTYPE_ALL; |
||||
|
$this->sesstype = self::SESSTYPE_ALL; |
||||
|
} else if ($group > 0) { |
||||
|
$SESSION->attsessiontype[$this->cm->course] = $group; |
||||
|
$this->sesstype = $group; |
||||
|
} else { |
||||
|
$this->sesstype = $SESSION->attsessiontype[$this->cm->course]; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (is_null($this->sessgroupslist)) { |
||||
|
$this->calc_sessgroupslist(); |
||||
|
} |
||||
|
// For example, we set SESSTYPE_ALL but user can access only to limited set of groups. |
||||
|
if (!array_key_exists($this->sesstype, $this->sessgroupslist)) { |
||||
|
reset($this->sessgroupslist); |
||||
|
$this->sesstype = key($this->sessgroupslist); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private function calc_sessgroupslist() { |
||||
|
global $USER, $PAGE; |
||||
|
|
||||
|
$this->sessgroupslist = array(); |
||||
|
$groupmode = groups_get_activity_groupmode($this->cm); |
||||
|
if ($groupmode == NOGROUPS) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if ($groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $PAGE->context)) { |
||||
|
$allowedgroups = groups_get_all_groups($this->cm->course, 0, $this->cm->groupingid); |
||||
|
} else { |
||||
|
$allowedgroups = groups_get_all_groups($this->cm->course, $USER->id, $this->cm->groupingid); |
||||
|
} |
||||
|
|
||||
|
if ($allowedgroups) { |
||||
|
if ($groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $PAGE->context)) { |
||||
|
$this->sessgroupslist[self::SESSTYPE_ALL] = get_string('all', 'attendance'); |
||||
|
} |
||||
|
// Show Common groups always. |
||||
|
$this->sessgroupslist[self::SESSTYPE_COMMON] = get_string('commonsessions', 'attendance'); |
||||
|
foreach ($allowedgroups as $group) { |
||||
|
$this->sessgroupslist[$group->id] = get_string('group') . ': ' . format_string($group->name); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public function get_sess_groups_list() { |
||||
|
if (is_null($this->sessgroupslist)) { |
||||
|
$this->calc_sessgroupslist_sesstype(); |
||||
|
} |
||||
|
|
||||
|
return $this->sessgroupslist; |
||||
|
} |
||||
|
|
||||
|
public function get_current_sesstype() { |
||||
|
if (is_null($this->sesstype)) { |
||||
|
$this->calc_sessgroupslist_sesstype(); |
||||
|
} |
||||
|
|
||||
|
return $this->sesstype; |
||||
|
} |
||||
|
|
||||
|
public function set_current_sesstype($sesstype) { |
||||
|
$this->sesstype = $sesstype; |
||||
|
} |
||||
|
} |
@ -0,0 +1,60 @@ |
|||||
|
<?php |
||||
|
// This file is part of Moodle - http://moodle.org/ |
||||
|
// |
||||
|
// Moodle is free software: you can redistribute it and/or modify |
||||
|
// it under the terms of the GNU General Public License as published by |
||||
|
// the Free Software Foundation, either version 3 of the License, or |
||||
|
// (at your option) any later version. |
||||
|
// |
||||
|
// Moodle is distributed in the hope that it will be useful, |
||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
// GNU General Public License for more details. |
||||
|
// |
||||
|
// You should have received a copy of the GNU General Public License |
||||
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||||
|
|
||||
|
/** |
||||
|
* Class definition for mod_attendance_preferences_page_params |
||||
|
* |
||||
|
* @package mod_attendance |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* base preferences page param class |
||||
|
* |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
class mod_attendance_preferences_page_params { |
||||
|
const ACTION_ADD = 1; |
||||
|
const ACTION_DELETE = 2; |
||||
|
const ACTION_HIDE = 3; |
||||
|
const ACTION_SHOW = 4; |
||||
|
const ACTION_SAVE = 5; |
||||
|
|
||||
|
/** @var int view mode of taking attendance page*/ |
||||
|
public $action; |
||||
|
|
||||
|
public $statusid; |
||||
|
|
||||
|
public $statusset; |
||||
|
|
||||
|
public function get_significant_params() { |
||||
|
$params = array(); |
||||
|
|
||||
|
if (isset($this->action)) { |
||||
|
$params['action'] = $this->action; |
||||
|
} |
||||
|
if (isset($this->statusid)) { |
||||
|
$params['statusid'] = $this->statusid; |
||||
|
} |
||||
|
if (isset($this->statusset)) { |
||||
|
$params['statusset'] = $this->statusset; |
||||
|
} |
||||
|
|
||||
|
return $params; |
||||
|
} |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
<?php |
||||
|
// This file is part of Moodle - http://moodle.org/ |
||||
|
// |
||||
|
// Moodle is free software: you can redistribute it and/or modify |
||||
|
// it under the terms of the GNU General Public License as published by |
||||
|
// the Free Software Foundation, either version 3 of the License, or |
||||
|
// (at your option) any later version. |
||||
|
// |
||||
|
// Moodle is distributed in the hope that it will be useful, |
||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
// GNU General Public License for more details. |
||||
|
// |
||||
|
// You should have received a copy of the GNU General Public License |
||||
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||||
|
|
||||
|
/** |
||||
|
* Class definition for mod_attendance_report_page_params |
||||
|
* |
||||
|
* @package mod_attendance |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* contains specific data/functions for report_page. |
||||
|
* |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
class mod_attendance_report_page_params extends mod_attendance_page_with_filter_controls { |
||||
|
public $group; |
||||
|
public $sort; |
||||
|
|
||||
|
public function __construct() { |
||||
|
$this->selectortype = self::SELECTOR_GROUP; |
||||
|
} |
||||
|
|
||||
|
public function init($cm) { |
||||
|
parent::init($cm); |
||||
|
|
||||
|
if (!isset($this->group)) { |
||||
|
$this->group = $this->get_current_sesstype() > 0 ? $this->get_current_sesstype() : 0; |
||||
|
} |
||||
|
if (!isset($this->sort)) { |
||||
|
$this->sort = ATT_SORT_LASTNAME; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public function get_significant_params() { |
||||
|
$params = array(); |
||||
|
|
||||
|
if ($this->sort != ATT_SORT_LASTNAME) { |
||||
|
$params['sort'] = $this->sort; |
||||
|
} |
||||
|
|
||||
|
return $params; |
||||
|
} |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
<?php |
||||
|
// This file is part of Moodle - http://moodle.org/ |
||||
|
// |
||||
|
// Moodle is free software: you can redistribute it and/or modify |
||||
|
// it under the terms of the GNU General Public License as published by |
||||
|
// the Free Software Foundation, either version 3 of the License, or |
||||
|
// (at your option) any later version. |
||||
|
// |
||||
|
// Moodle is distributed in the hope that it will be useful, |
||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
// GNU General Public License for more details. |
||||
|
// |
||||
|
// You should have received a copy of the GNU General Public License |
||||
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Class definition for mod_attendance_sessions_page_params |
||||
|
* |
||||
|
* @package mod_attendance |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* stores constants/data used by sessions page params. |
||||
|
* |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
class mod_attendance_sessions_page_params { |
||||
|
const ACTION_ADD = 1; |
||||
|
const ACTION_UPDATE = 2; |
||||
|
const ACTION_DELETE = 3; |
||||
|
const ACTION_DELETE_SELECTED = 4; |
||||
|
const ACTION_CHANGE_DURATION = 5; |
||||
|
const ACTION_DELETE_HIDDEN = 6; |
||||
|
|
||||
|
/** @var int view mode of taking attendance page*/ |
||||
|
public $action; |
||||
|
} |
@ -0,0 +1,92 @@ |
|||||
|
<?php |
||||
|
// This file is part of Moodle - http://moodle.org/ |
||||
|
// |
||||
|
// Moodle is free software: you can redistribute it and/or modify |
||||
|
// it under the terms of the GNU General Public License as published by |
||||
|
// the Free Software Foundation, either version 3 of the License, or |
||||
|
// (at your option) any later version. |
||||
|
// |
||||
|
// Moodle is distributed in the hope that it will be useful, |
||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
// GNU General Public License for more details. |
||||
|
// |
||||
|
// You should have received a copy of the GNU General Public License |
||||
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||||
|
|
||||
|
/** |
||||
|
* Class definition for mod_attendance_take_page_params |
||||
|
* |
||||
|
* @package mod_attendance |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* contains functions/constants used by take attendance page. |
||||
|
* |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
class mod_attendance_take_page_params { |
||||
|
const SORTED_LIST = 1; |
||||
|
const SORTED_GRID = 2; |
||||
|
|
||||
|
const DEFAULT_VIEW_MODE = self::SORTED_LIST; |
||||
|
|
||||
|
public $sessionid; |
||||
|
public $grouptype; |
||||
|
public $group; |
||||
|
public $sort; |
||||
|
public $copyfrom; |
||||
|
|
||||
|
/** @var int view mode of taking attendance page*/ |
||||
|
public $viewmode; |
||||
|
|
||||
|
public $gridcols; |
||||
|
|
||||
|
public function init() { |
||||
|
if (!isset($this->group)) { |
||||
|
$this->group = 0; |
||||
|
} |
||||
|
if (!isset($this->sort)) { |
||||
|
$this->sort = ATT_SORT_LASTNAME; |
||||
|
} |
||||
|
$this->init_view_mode(); |
||||
|
$this->init_gridcols(); |
||||
|
} |
||||
|
|
||||
|
private function init_view_mode() { |
||||
|
if (isset($this->viewmode)) { |
||||
|
set_user_preference("attendance_take_view_mode", $this->viewmode); |
||||
|
} else { |
||||
|
$this->viewmode = get_user_preferences("attendance_take_view_mode", self::DEFAULT_VIEW_MODE); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private function init_gridcols() { |
||||
|
if (isset($this->gridcols)) { |
||||
|
set_user_preference("attendance_gridcolumns", $this->gridcols); |
||||
|
} else { |
||||
|
$this->gridcols = get_user_preferences("attendance_gridcolumns", 5); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public function get_significant_params() { |
||||
|
$params = array(); |
||||
|
|
||||
|
$params['sessionid'] = $this->sessionid; |
||||
|
$params['grouptype'] = $this->grouptype; |
||||
|
if ($this->group) { |
||||
|
$params['group'] = $this->group; |
||||
|
} |
||||
|
if ($this->sort != ATT_SORT_LASTNAME) { |
||||
|
$params['sort'] = $this->sort; |
||||
|
} |
||||
|
if (isset($this->copyfrom)) { |
||||
|
$params['copyfrom'] = $this->copyfrom; |
||||
|
} |
||||
|
|
||||
|
return $params; |
||||
|
} |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
<?php |
||||
|
// This file is part of Moodle - http://moodle.org/ |
||||
|
// |
||||
|
// Moodle is free software: you can redistribute it and/or modify |
||||
|
// it under the terms of the GNU General Public License as published by |
||||
|
// the Free Software Foundation, either version 3 of the License, or |
||||
|
// (at your option) any later version. |
||||
|
// |
||||
|
// Moodle is distributed in the hope that it will be useful, |
||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
// GNU General Public License for more details. |
||||
|
// |
||||
|
// You should have received a copy of the GNU General Public License |
||||
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||||
|
|
||||
|
/** |
||||
|
* Class definition for mod_attendance_view_page_params |
||||
|
* |
||||
|
* @package mod_attendance |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* contains functions/constants used by attendance view page. |
||||
|
* |
||||
|
* @copyright 2016 Dan Marsden http://danmarsden.com |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
class mod_attendance_view_page_params extends mod_attendance_page_with_filter_controls { |
||||
|
const MODE_THIS_COURSE = 0; |
||||
|
const MODE_ALL_COURSES = 1; |
||||
|
|
||||
|
public $studentid; |
||||
|
|
||||
|
public $mode; |
||||
|
|
||||
|
public function __construct() { |
||||
|
$this->defaultview = ATT_VIEW_MONTHS; |
||||
|
} |
||||
|
|
||||
|
public function get_significant_params() { |
||||
|
$params = array(); |
||||
|
|
||||
|
if (isset($this->studentid)) { |
||||
|
$params['studentid'] = $this->studentid; |
||||
|
} |
||||
|
if ($this->mode != self::MODE_THIS_COURSE) { |
||||
|
$params['mode'] = $this->mode; |
||||
|
} |
||||
|
|
||||
|
return $params; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue