diff --git a/add_form.php b/add_form.php index 2a52de3..9b2b7b1 100644 --- a/add_form.php +++ b/add_form.php @@ -48,6 +48,8 @@ class mod_attendance_add_form extends moodleform { $cm = $this->_customdata['cm']; $modcontext = $this->_customdata['modcontext']; + $pluginconfig = get_config('attendance'); + $mform->addElement('header', 'general', get_string('addsession', 'attendance')); $groupmode = groups_get_activity_groupmode($cm); @@ -135,6 +137,13 @@ class mod_attendance_add_form extends moodleform { $mform->addHelpButton('passwordgrp', 'passwordgrp', 'attendance'); $mform->disabledif('randompassword', 'studentscanmark', 'notchecked'); $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 { $mform->addElement('hidden', 'studentscanmark', '0'); $mform->settype('studentscanmark', PARAM_INT); diff --git a/lang/en/attendance.php b/lang/en/attendance.php index 997c03a..c99893e 100644 --- a/lang/en/attendance.php +++ b/lang/en/attendance.php @@ -372,4 +372,7 @@ $string['subnetwrong'] = 'Attendance can only be recorded from certain locations $string['requiresubnet_help'] = 'Attendance recording may be restricted to particular subnets by specifying a comma-separated list of partial or full IP addresses.'; $string['defaultsettings'] = 'Default attendance settings'; $string['defaultsettings_help'] = 'These settings define the defaults for all new attendances'; -$string['defaultstatus'] = 'Default status set'; \ No newline at end of file +$string['defaultstatus'] = 'Default status set'; + +$string['defaultsessionsettings'] = 'Default session settings'; +$string['defaultsessionsettings_help'] = 'These settings define the defaults for all new sessions'; \ No newline at end of file diff --git a/settings.php b/settings.php index 25a1b8f..ed71efc 100644 --- a/settings.php +++ b/settings.php @@ -54,4 +54,14 @@ if ($ADMIN->fulltree) { $settings->add(new admin_setting_configtext('attendance/subnet', 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)); }