|
|
@ -189,27 +189,33 @@ class mod_attendance_add_form extends moodleform { |
|
|
|
$mform->setType('previoussessiondate', PARAM_INT); |
|
|
|
|
|
|
|
// Students can mark own attendance. |
|
|
|
if (!empty(get_config('attendance', 'studentscanmark'))) { |
|
|
|
$studentscanmark = get_config('attendance', 'studentscanmark'); |
|
|
|
|
|
|
|
$mform->addElement('header', 'headerstudentmarking', get_string('studentmarking', 'attendance'), true); |
|
|
|
if (!empty($pluginconfig->studentrecordingexpanded)) { |
|
|
|
$mform->setExpanded('headerstudentmarking'); |
|
|
|
} |
|
|
|
if (!empty($studentscanmark)) { |
|
|
|
$mform->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark', 'attendance')); |
|
|
|
$mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance'); |
|
|
|
} else { |
|
|
|
$mform->addElement('hidden', 'studentscanmark', '0'); |
|
|
|
$mform->settype('studentscanmark', PARAM_INT); |
|
|
|
} |
|
|
|
|
|
|
|
$options = attendance_get_automarkoptions(); |
|
|
|
|
|
|
|
$mform->addElement('select', 'automark', get_string('automark', 'attendance'), $options); |
|
|
|
$mform->setType('automark', PARAM_INT); |
|
|
|
$mform->addHelpButton('automark', 'automark', 'attendance'); |
|
|
|
$mform->hideif('automark', 'studentscanmark', 'notchecked'); |
|
|
|
$mform->setDefault('automark', $this->_customdata['att']->automark); |
|
|
|
|
|
|
|
if (!empty($studentscanmark)) { |
|
|
|
$mgroup = array(); |
|
|
|
|
|
|
|
$mgroup[] = & $mform->createElement('text', 'studentpassword', get_string('studentpassword', 'attendance')); |
|
|
|
$mgroup[] = & $mform->createElement('checkbox', 'randompassword', '', get_string('randompassword', 'attendance')); |
|
|
|
$mgroup[] = & $mform->createElement('checkbox', 'includeqrcode', '', get_string('includeqrcode', 'attendance')); |
|
|
|
$mgroup[] = &$mform->createElement('text', 'studentpassword', get_string('studentpassword', 'attendance')); |
|
|
|
$mgroup[] = &$mform->createElement('checkbox', 'randompassword', '', get_string('randompassword', 'attendance')); |
|
|
|
$mgroup[] = &$mform->createElement('checkbox', 'includeqrcode', '', get_string('includeqrcode', 'attendance')); |
|
|
|
$mform->addGroup($mgroup, 'passwordgrp', get_string('passwordgrp', 'attendance'), array(' '), false); |
|
|
|
|
|
|
|
$mform->setType('studentpassword', PARAM_TEXT); |
|
|
@ -237,6 +243,7 @@ class mod_attendance_add_form extends moodleform { |
|
|
|
if (isset($pluginconfig->automark_default)) { |
|
|
|
$mform->setDefault('automark', $pluginconfig->automark_default); |
|
|
|
} |
|
|
|
} |
|
|
|
$mgroup2 = array(); |
|
|
|
$mgroup2[] = & $mform->createElement('text', 'subnet', get_string('requiresubnet', 'attendance')); |
|
|
|
if (empty(get_config('attendance', 'subnetactivitylevel'))) { |
|
|
@ -252,8 +259,6 @@ class mod_attendance_add_form extends moodleform { |
|
|
|
$mform->addGroup($mgroup2, 'subnetgrp', get_string('requiresubnet', 'attendance'), array(' '), false); |
|
|
|
$mform->setAdvanced('subnetgrp'); |
|
|
|
$mform->addHelpButton('subnetgrp', 'requiresubnet', 'attendance'); |
|
|
|
|
|
|
|
$mform->hideif('subnetgrp', 'studentscanmark', 'notchecked'); |
|
|
|
$mform->hideif('subnet', 'usedefaultsubnet', 'checked'); |
|
|
|
|
|
|
|
$mgroup3 = array(); |
|
|
@ -267,8 +272,6 @@ class mod_attendance_add_form extends moodleform { |
|
|
|
$mform->setAdvanced('preventsharedgroup'); |
|
|
|
$mform->setType('preventsharedip', PARAM_INT); |
|
|
|
$mform->setType('preventsharediptime', PARAM_INT); |
|
|
|
$mform->hideif('preventsharedgroup', 'studentscanmark', 'notchecked'); |
|
|
|
$mform->hideIf('preventsharediptime', 'preventsharedip', 'noteq', ATTENDANCE_SHAREDIP_MINUTES); |
|
|
|
|
|
|
|
if (isset($pluginconfig->preventsharedip)) { |
|
|
|
$mform->setDefault('preventsharedip', $pluginconfig->preventsharedip); |
|
|
@ -277,25 +280,6 @@ class mod_attendance_add_form extends moodleform { |
|
|
|
$mform->setDefault('preventsharediptime', $pluginconfig->preventsharediptime); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
$mform->addElement('hidden', 'studentscanmark', '0'); |
|
|
|
$mform->settype('studentscanmark', PARAM_INT); |
|
|
|
$mform->addElement('hidden', 'automark', '0'); |
|
|
|
$mform->setType('automark', PARAM_INT); |
|
|
|
$mform->addElement('hidden', 'autoassignstatus', '0'); |
|
|
|
$mform->setType('autoassignstatus', PARAM_INT); |
|
|
|
|
|
|
|
$mform->addElement('hidden', 'subnet', ''); |
|
|
|
$mform->setType('subnet', PARAM_TEXT); |
|
|
|
|
|
|
|
$mform->addElement('hidden', 'preventsharedip', '0'); |
|
|
|
$mform->setType('preventsharedip', PARAM_INT); |
|
|
|
|
|
|
|
$sharedtime = isset($pluginconfig->preventsharediptime) ? $pluginconfig->preventsharediptime : null; |
|
|
|
$mform->addElement('hidden', 'preventsharediptime', $sharedtime); |
|
|
|
$mform->setType('preventsharediptime', PARAM_INT); |
|
|
|
} |
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('add', 'attendance')); |
|
|
|
} |
|
|
|
|
|
|
|