diff --git a/classes/page_with_filter_controls.php b/classes/page_with_filter_controls.php index 26a20b4..b88ff57 100644 --- a/classes/page_with_filter_controls.php +++ b/classes/page_with_filter_controls.php @@ -64,7 +64,7 @@ class mod_attendance_page_with_filter_controls { public $selectortype = self::SELECTOR_NONE; /** @var int default view. */ - protected $defaultview = ATT_VIEW_WEEKS; + protected $defaultview; /** @var stdClass course module record. */ private $cm; @@ -82,6 +82,9 @@ class mod_attendance_page_with_filter_controls { */ public function init($cm) { $this->cm = $cm; + if (empty($this->defaultview)) { + $this->defaultview = get_config('attendance', 'defaultview'); + } $this->init_view(); $this->init_curdate(); $this->init_start_end_date(); diff --git a/lang/en/attendance.php b/lang/en/attendance.php index afe27b8..aa778ce 100644 --- a/lang/en/attendance.php +++ b/lang/en/attendance.php @@ -108,6 +108,8 @@ $string['defaultsettings_help'] = 'These settings define the defaults for all ne $string['defaultstatus'] = 'Default status set'; $string['defaultsubnet'] = 'Default network address'; $string['defaultsubnet_help'] = 'Attendance recording may be restricted to particular subnets by specifying a comma-separated list of partial or full IP addresses. This is the default value used when creating new sessions.'; +$string['defaultview'] = 'Default view on login'; +$string['defaultview_desc'] = 'This is the default view shown to teachers on first login.'; $string['delete'] = 'Delete'; $string['deletedgroup'] = 'The group associated with this session has been deleted'; $string['deletehiddensessions'] = 'Delete all hidden sessions'; diff --git a/settings.php b/settings.php index 3760ec3..a2d0032 100644 --- a/settings.php +++ b/settings.php @@ -26,6 +26,7 @@ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { require_once(dirname(__FILE__).'/lib.php'); + require_once(dirname(__FILE__).'/locallib.php'); $tabmenu = attendance_print_settings_tabs(); $settings->add(new admin_setting_heading('attendance_header', '', $tabmenu)); @@ -56,6 +57,18 @@ if ($ADMIN->fulltree) { get_string('studentscanmarksessiontimeend', 'attendance'), get_string('studentscanmarksessiontimeend_desc', 'attendance'), '60', PARAM_INT)); + $options = array( + ATT_VIEW_ALL => get_string('all', 'attendance'), + ATT_VIEW_ALLPAST => get_string('allpast', 'attendance'), + ATT_VIEW_NOTPRESENT => get_string('lowgrade', 'attendance'), + ATT_VIEW_MONTHS => get_string('months', 'attendance'), + ATT_VIEW_WEEKS => get_string('weeks', 'attendance'), + ATT_VIEW_DAYS => get_string('days', 'attendance') + ); + + $settings->add(new admin_setting_configselect('attendance/defaultview', + get_string('defaultview', 'attendance'), + get_string('defaultview_desc', 'attendance'), ATT_VIEW_WEEKS, $options)); $name = new lang_string('defaultsettings', 'mod_attendance'); $description = new lang_string('defaultsettings_help', 'mod_attendance');