|
@ -189,27 +189,33 @@ class mod_attendance_add_form extends moodleform { |
|
|
$mform->setType('previoussessiondate', PARAM_INT); |
|
|
$mform->setType('previoussessiondate', PARAM_INT); |
|
|
|
|
|
|
|
|
// Students can mark own attendance. |
|
|
// 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->addElement('header', 'headerstudentmarking', get_string('studentmarking', 'attendance'), true); |
|
|
$mform->setExpanded('headerstudentmarking'); |
|
|
if (!empty($pluginconfig->studentrecordingexpanded)) { |
|
|
} |
|
|
$mform->setExpanded('headerstudentmarking'); |
|
|
|
|
|
} |
|
|
|
|
|
if (!empty($studentscanmark)) { |
|
|
$mform->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark', 'attendance')); |
|
|
$mform->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark', 'attendance')); |
|
|
$mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance'); |
|
|
$mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance'); |
|
|
|
|
|
} else { |
|
|
|
|
|
$mform->addElement('hidden', 'studentscanmark', '0'); |
|
|
|
|
|
$mform->settype('studentscanmark', PARAM_INT); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$options = attendance_get_automarkoptions(); |
|
|
$options = attendance_get_automarkoptions(); |
|
|
|
|
|
|
|
|
$mform->addElement('select', 'automark', get_string('automark', 'attendance'), $options); |
|
|
$mform->addElement('select', 'automark', get_string('automark', 'attendance'), $options); |
|
|
$mform->setType('automark', PARAM_INT); |
|
|
$mform->setType('automark', PARAM_INT); |
|
|
$mform->addHelpButton('automark', 'automark', 'attendance'); |
|
|
$mform->addHelpButton('automark', 'automark', 'attendance'); |
|
|
$mform->hideif('automark', 'studentscanmark', 'notchecked'); |
|
|
$mform->setDefault('automark', $this->_customdata['att']->automark); |
|
|
$mform->setDefault('automark', $this->_customdata['att']->automark); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($studentscanmark)) { |
|
|
$mgroup = array(); |
|
|
$mgroup = array(); |
|
|
|
|
|
|
|
|
$mgroup[] = & $mform->createElement('text', 'studentpassword', get_string('studentpassword', 'attendance')); |
|
|
$mgroup[] = &$mform->createElement('text', 'studentpassword', get_string('studentpassword', 'attendance')); |
|
|
$mgroup[] = & $mform->createElement('checkbox', 'randompassword', '', get_string('randompassword', 'attendance')); |
|
|
$mgroup[] = &$mform->createElement('checkbox', 'randompassword', '', get_string('randompassword', 'attendance')); |
|
|
$mgroup[] = & $mform->createElement('checkbox', 'includeqrcode', '', get_string('includeqrcode', 'attendance')); |
|
|
$mgroup[] = &$mform->createElement('checkbox', 'includeqrcode', '', get_string('includeqrcode', 'attendance')); |
|
|
$mform->addGroup($mgroup, 'passwordgrp', get_string('passwordgrp', 'attendance'), array(' '), false); |
|
|
$mform->addGroup($mgroup, 'passwordgrp', get_string('passwordgrp', 'attendance'), array(' '), false); |
|
|
|
|
|
|
|
|
$mform->setType('studentpassword', PARAM_TEXT); |
|
|
$mform->setType('studentpassword', PARAM_TEXT); |
|
@ -237,63 +243,41 @@ class mod_attendance_add_form extends moodleform { |
|
|
if (isset($pluginconfig->automark_default)) { |
|
|
if (isset($pluginconfig->automark_default)) { |
|
|
$mform->setDefault('automark', $pluginconfig->automark_default); |
|
|
$mform->setDefault('automark', $pluginconfig->automark_default); |
|
|
} |
|
|
} |
|
|
$mgroup2 = array(); |
|
|
} |
|
|
$mgroup2[] = & $mform->createElement('text', 'subnet', get_string('requiresubnet', 'attendance')); |
|
|
$mgroup2 = array(); |
|
|
if (empty(get_config('attendance', 'subnetactivitylevel'))) { |
|
|
$mgroup2[] = & $mform->createElement('text', 'subnet', get_string('requiresubnet', 'attendance')); |
|
|
$mform->setDefault('subnet', get_config('attendance', 'subnet')); |
|
|
if (empty(get_config('attendance', 'subnetactivitylevel'))) { |
|
|
} else { |
|
|
$mform->setDefault('subnet', get_config('attendance', 'subnet')); |
|
|
$mform->setDefault('subnet', $this->_customdata['att']->subnet); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$mgroup2[] = & $mform->createElement('checkbox', 'usedefaultsubnet', get_string('usedefaultsubnet', 'attendance')); |
|
|
|
|
|
$mform->setDefault('usedefaultsubnet', 1); |
|
|
|
|
|
$mform->setType('subnet', PARAM_TEXT); |
|
|
|
|
|
|
|
|
|
|
|
$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(); |
|
|
|
|
|
$options = attendance_get_sharedipoptions(); |
|
|
|
|
|
$mgroup3[] = & $mform->createElement('select', 'preventsharedip', |
|
|
|
|
|
get_string('preventsharedip', 'attendance'), $options); |
|
|
|
|
|
$mgroup3[] = & $mform->createElement('text', 'preventsharediptime', |
|
|
|
|
|
get_string('preventsharediptime', 'attendance'), '', 'test'); |
|
|
|
|
|
$mform->addGroup($mgroup3, 'preventsharedgroup', get_string('preventsharedip', 'attendance'), array(' '), false); |
|
|
|
|
|
$mform->addHelpButton('preventsharedgroup', 'preventsharedip', 'attendance'); |
|
|
|
|
|
$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); |
|
|
|
|
|
} |
|
|
|
|
|
if (isset($pluginconfig->preventsharediptime)) { |
|
|
|
|
|
$mform->setDefault('preventsharediptime', $pluginconfig->preventsharediptime); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
$mform->addElement('hidden', 'studentscanmark', '0'); |
|
|
$mform->setDefault('subnet', $this->_customdata['att']->subnet); |
|
|
$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; |
|
|
$mgroup2[] = & $mform->createElement('checkbox', 'usedefaultsubnet', get_string('usedefaultsubnet', 'attendance')); |
|
|
$mform->addElement('hidden', 'preventsharediptime', $sharedtime); |
|
|
$mform->setDefault('usedefaultsubnet', 1); |
|
|
$mform->setType('preventsharediptime', PARAM_INT); |
|
|
$mform->setType('subnet', PARAM_TEXT); |
|
|
|
|
|
|
|
|
|
|
|
$mform->addGroup($mgroup2, 'subnetgrp', get_string('requiresubnet', 'attendance'), array(' '), false); |
|
|
|
|
|
$mform->setAdvanced('subnetgrp'); |
|
|
|
|
|
$mform->addHelpButton('subnetgrp', 'requiresubnet', 'attendance'); |
|
|
|
|
|
$mform->hideif('subnet', 'usedefaultsubnet', 'checked'); |
|
|
|
|
|
|
|
|
|
|
|
$mgroup3 = array(); |
|
|
|
|
|
$options = attendance_get_sharedipoptions(); |
|
|
|
|
|
$mgroup3[] = & $mform->createElement('select', 'preventsharedip', |
|
|
|
|
|
get_string('preventsharedip', 'attendance'), $options); |
|
|
|
|
|
$mgroup3[] = & $mform->createElement('text', 'preventsharediptime', |
|
|
|
|
|
get_string('preventsharediptime', 'attendance'), '', 'test'); |
|
|
|
|
|
$mform->addGroup($mgroup3, 'preventsharedgroup', get_string('preventsharedip', 'attendance'), array(' '), false); |
|
|
|
|
|
$mform->addHelpButton('preventsharedgroup', 'preventsharedip', 'attendance'); |
|
|
|
|
|
$mform->setAdvanced('preventsharedgroup'); |
|
|
|
|
|
$mform->setType('preventsharedip', PARAM_INT); |
|
|
|
|
|
$mform->setType('preventsharediptime', PARAM_INT); |
|
|
|
|
|
|
|
|
|
|
|
if (isset($pluginconfig->preventsharedip)) { |
|
|
|
|
|
$mform->setDefault('preventsharedip', $pluginconfig->preventsharedip); |
|
|
|
|
|
} |
|
|
|
|
|
if (isset($pluginconfig->preventsharediptime)) { |
|
|
|
|
|
$mform->setDefault('preventsharediptime', $pluginconfig->preventsharediptime); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('add', 'attendance')); |
|
|
$this->add_action_buttons(true, get_string('add', 'attendance')); |
|
|