Browse Source

allow admin to set default values for record own attendance/random pass.

MOODLE_33_STABLE
Dan Marsden 8 years ago
parent
commit
67f2402a22
  1. 9
      add_form.php
  2. 3
      lang/en/attendance.php
  3. 10
      settings.php

9
add_form.php

@ -48,6 +48,8 @@ class mod_attendance_add_form extends moodleform {
$cm = $this->_customdata['cm']; $cm = $this->_customdata['cm'];
$modcontext = $this->_customdata['modcontext']; $modcontext = $this->_customdata['modcontext'];
$pluginconfig = get_config('attendance');
$mform->addElement('header', 'general', get_string('addsession', 'attendance')); $mform->addElement('header', 'general', get_string('addsession', 'attendance'));
$groupmode = groups_get_activity_groupmode($cm); $groupmode = groups_get_activity_groupmode($cm);
@ -135,6 +137,13 @@ class mod_attendance_add_form extends moodleform {
$mform->addHelpButton('passwordgrp', 'passwordgrp', 'attendance'); $mform->addHelpButton('passwordgrp', 'passwordgrp', 'attendance');
$mform->disabledif('randompassword', 'studentscanmark', 'notchecked'); $mform->disabledif('randompassword', 'studentscanmark', 'notchecked');
$mform->disabledif('studentpassword', 'randompassword', 'checked'); $mform->disabledif('studentpassword', 'randompassword', 'checked');
if (isset($pluginconfig->studentscanmark_default)) {
$mform->setDefault('studentscanmark', $pluginconfig->studentscanmark_default);
}
if (isset($pluginconfig->randompassword_default)) {
$mform->setDefault('randompassword', $pluginconfig->randompassword_default);
}
} else { } else {
$mform->addElement('hidden', 'studentscanmark', '0'); $mform->addElement('hidden', 'studentscanmark', '0');
$mform->settype('studentscanmark', PARAM_INT); $mform->settype('studentscanmark', PARAM_INT);

3
lang/en/attendance.php

@ -373,3 +373,6 @@ $string['requiresubnet_help'] = 'Attendance recording may be restricted to parti
$string['defaultsettings'] = 'Default attendance settings'; $string['defaultsettings'] = 'Default attendance settings';
$string['defaultsettings_help'] = 'These settings define the defaults for all new attendances'; $string['defaultsettings_help'] = 'These settings define the defaults for all new attendances';
$string['defaultstatus'] = 'Default status set'; $string['defaultstatus'] = 'Default status set';
$string['defaultsessionsettings'] = 'Default session settings';
$string['defaultsessionsettings_help'] = 'These settings define the defaults for all new sessions';

10
settings.php

@ -54,4 +54,14 @@ if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configtext('attendance/subnet', $settings->add(new admin_setting_configtext('attendance/subnet',
get_string('requiresubnet', 'attendance'), get_string('requiresubnet_help', 'attendance'), '', PARAM_RAW)); get_string('requiresubnet', 'attendance'), get_string('requiresubnet_help', 'attendance'), '', PARAM_RAW));
$name = new lang_string('defaultsessionsettings', 'mod_attendance');
$description = new lang_string('defaultsessionsettings_help', 'mod_attendance');
$settings->add(new admin_setting_heading('defaultsessionsettings', $name, $description));
$settings->add(new admin_setting_configcheckbox('attendance/studentscanmark_default',
get_string('studentscanmark', 'attendance'), '', 0));
$settings->add(new admin_setting_configcheckbox('attendance/randompassword_default',
get_string('randompassword', 'attendance'), '', 0));
} }

Loading…
Cancel
Save