Browse Source

Allow default view on login to be set at admin level.

MOODLE_32_STABLE
Dan Marsden 8 years ago
parent
commit
39f2b19832
  1. 5
      classes/page_with_filter_controls.php
  2. 2
      lang/en/attendance.php
  3. 13
      settings.php

5
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();

2
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';

13
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');

Loading…
Cancel
Save