Browse Source

Allow default subnet setting at activity level to be hidden.

MOODLE_33_STABLE
Dan Marsden 8 years ago
parent
commit
b4ed81d27c
  1. 7
      add_form.php
  2. 2
      lang/en/attendance.php
  3. 15
      mod_form.php
  4. 4
      settings.php

7
add_form.php

@ -168,7 +168,12 @@ class mod_attendance_add_form extends moodleform {
} }
$mgroup2 = array(); $mgroup2 = array();
$mgroup2[] = & $mform->createElement('text', 'subnet', get_string('requiresubnet', 'attendance')); $mgroup2[] = & $mform->createElement('text', 'subnet', get_string('requiresubnet', 'attendance'));
$mform->setDefault('subnet', $this->_customdata['att']->subnet); if (empty(get_config('attendance', 'subnetactivitylevel'))) {
$mform->setDefault('subnet', get_config('attendance', 'subnet'));
} else {
$mform->setDefault('subnet', $this->_customdata['att']->subnet);
}
$mgroup2[] = & $mform->createElement('checkbox', 'usedefaultsubnet', get_string('usedefaultsubnet', 'attendance')); $mgroup2[] = & $mform->createElement('checkbox', 'usedefaultsubnet', get_string('usedefaultsubnet', 'attendance'));
$mform->setDefault('usedefaultsubnet', 1); $mform->setDefault('usedefaultsubnet', 1);
$mform->setType('subnet', PARAM_TEXT); $mform->setType('subnet', PARAM_TEXT);

2
lang/en/attendance.php

@ -367,6 +367,8 @@ $string['studentscanmarksessiontime_desc'] = 'If checked students can only recor
$string['studentscanmarksessiontimeend'] = 'Session end (minutes)'; $string['studentscanmarksessiontimeend'] = 'Session end (minutes)';
$string['studentscanmarksessiontimeend_desc'] = 'If the session does not have an end time, how many minutes should the session be available for students to record their attendance.'; $string['studentscanmarksessiontimeend_desc'] = 'If the session does not have an end time, how many minutes should the session be available for students to record their attendance.';
$string['submitattendance'] = 'Submit attendance'; $string['submitattendance'] = 'Submit attendance';
$string['subnetactivitylevel'] = 'Allow subnet config at activity level';
$string['subnetactivitylevel_desc'] = 'If enabled, teachers can override the default subnet at the activity level when creating an attendance. Otherwise the site default will be used when creating a session.';
$string['subnetwrong'] = 'Attendance can only be recorded from certain locations, and this computer is not on the allowed list.'; $string['subnetwrong'] = 'Attendance can only be recorded from certain locations, and this computer is not on the allowed list.';
$string['summary'] = 'Summary'; $string['summary'] = 'Summary';
$string['tablerenamefailed'] = 'Rename of old attforblock table to attendance failed'; $string['tablerenamefailed'] = 'Rename of old attforblock table to attendance failed';

15
mod_form.php

@ -59,12 +59,17 @@ class mod_attendance_mod_form extends moodleform_mod {
$this->standard_coursemodule_elements(true); $this->standard_coursemodule_elements(true);
$mform->addElement('header', 'security', get_string('extrarestrictions', 'attendance'));
// IP address. // IP address.
$mform->addElement('text', 'subnet', get_string('defaultsubnet', 'attendance'), array('size' => '164')); if (get_config('attendance', 'subnetactivitylevel')) {
$mform->setType('subnet', PARAM_TEXT); $mform->addElement('header', 'security', get_string('extrarestrictions', 'attendance'));
$mform->addHelpButton('subnet', 'defaultsubnet', 'attendance'); $mform->addElement('text', 'subnet', get_string('defaultsubnet', 'attendance'), array('size' => '164'));
$mform->setDefault('subnet', $attendanceconfig->subnet); $mform->setType('subnet', PARAM_TEXT);
$mform->addHelpButton('subnet', 'defaultsubnet', 'attendance');
$mform->setDefault('subnet', $attendanceconfig->subnet);
} else {
$mform->addElement('hidden', 'subnet', '');
$mform->setType('subnet', PARAM_TEXT);
}
$this->add_action_buttons(); $this->add_action_buttons();
} }

4
settings.php

@ -57,6 +57,10 @@ if ($ADMIN->fulltree) {
get_string('studentscanmarksessiontimeend', 'attendance'), get_string('studentscanmarksessiontimeend', 'attendance'),
get_string('studentscanmarksessiontimeend_desc', 'attendance'), '60', PARAM_INT)); get_string('studentscanmarksessiontimeend_desc', 'attendance'), '60', PARAM_INT));
$settings->add(new admin_setting_configcheckbox('attendance/subnetactivitylevel',
get_string('subnetactivitylevel', 'attendance'),
get_string('subnetactivitylevel_desc', 'attendance'), 1));
$options = array( $options = array(
ATT_VIEW_ALL => get_string('all', 'attendance'), ATT_VIEW_ALL => get_string('all', 'attendance'),
ATT_VIEW_ALLPAST => get_string('allpast', 'attendance'), ATT_VIEW_ALLPAST => get_string('allpast', 'attendance'),

Loading…
Cancel
Save