Browse Source

Fix #365 - allow automarking to be used when studentscanmark is off.

MOODLE_36_STABLE
Dan Marsden 6 years ago
parent
commit
3918bc41f1
  1. 122
      add_form.php
  2. 33
      classes/structure.php
  3. 65
      locallib.php
  4. 39
      renderer.php
  5. 90
      update_form.php

122
add_form.php

@ -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'));

33
classes/structure.php

@ -558,30 +558,31 @@ class mod_attendance_structure {
if (!empty($formdata->autoassignstatus)) { if (!empty($formdata->autoassignstatus)) {
$sess->autoassignstatus = $formdata->autoassignstatus; $sess->autoassignstatus = $formdata->autoassignstatus;
} }
if (!empty(get_config('attendance', 'studentscanmark')) && $studentscanmark = get_config('attendance', 'studentscanmark');
if (!empty($studentscanmark) &&
!empty($formdata->studentscanmark)) { !empty($formdata->studentscanmark)) {
$sess->studentscanmark = $formdata->studentscanmark; $sess->studentscanmark = $formdata->studentscanmark;
$sess->studentpassword = $formdata->studentpassword; $sess->studentpassword = $formdata->studentpassword;
$sess->autoassignstatus = $formdata->autoassignstatus; $sess->autoassignstatus = $formdata->autoassignstatus;
if (!empty($formdata->usedefaultsubnet)) {
$sess->subnet = $this->subnet;
} else {
$sess->subnet = $formdata->subnet;
}
if (!empty($formdata->automark)) {
$sess->automark = $formdata->automark;
}
if (!empty($formdata->preventsharedip)) {
$sess->preventsharedip = $formdata->preventsharedip;
}
if (!empty($formdata->preventsharediptime)) {
$sess->preventsharediptime = $formdata->preventsharediptime;
}
if (!empty($formdata->includeqrcode)) { if (!empty($formdata->includeqrcode)) {
$sess->includeqrcode = $formdata->includeqrcode; $sess->includeqrcode = $formdata->includeqrcode;
} }
}
if (!empty($formdata->usedefaultsubnet)) {
$sess->subnet = $this->subnet;
} else {
$sess->subnet = $formdata->subnet;
}
if (!empty($formdata->automark)) {
$sess->automark = $formdata->automark;
}
if (!empty($formdata->preventsharedip)) {
$sess->preventsharedip = $formdata->preventsharedip;
}
if (!empty($formdata->preventsharediptime)) {
$sess->preventsharediptime = $formdata->preventsharediptime;
} }
$sess->timemodified = time(); $sess->timemodified = time();

65
locallib.php

@ -634,18 +634,26 @@ function attendance_construct_sessions_data_for_add($formdata, mod_attendance_st
$sess->absenteereport = $absenteereport; $sess->absenteereport = $absenteereport;
$sess->studentpassword = ''; $sess->studentpassword = '';
$sess->includeqrcode = 0; $sess->includeqrcode = 0;
if (!empty($formdata->usedefaultsubnet)) {
$sess->subnet = $att->subnet;
} else {
$sess->subnet = $formdata->subnet;
}
$sess->automark = $formdata->automark;
$sess->automarkcompleted = 0;
if (!empty($formdata->preventsharedip)) {
$sess->preventsharedip = $formdata->preventsharedip;
}
if (!empty($formdata->preventsharediptime)) {
$sess->preventsharediptime = $formdata->preventsharediptime;
}
if (isset($formdata->studentscanmark)) { // Students will be able to mark their own attendance. if (isset($formdata->studentscanmark)) { // Students will be able to mark their own attendance.
$sess->studentscanmark = 1; $sess->studentscanmark = 1;
if (!empty($formdata->usedefaultsubnet)) {
$sess->subnet = $att->subnet;
} else {
$sess->subnet = $formdata->subnet;
}
$sess->automark = $formdata->automark;
if (isset($formdata->autoassignstatus)) { if (isset($formdata->autoassignstatus)) {
$sess->autoassignstatus = 1; $sess->autoassignstatus = 1;
} }
$sess->automarkcompleted = 0;
if (!empty($formdata->randompassword)) { if (!empty($formdata->randompassword)) {
$sess->studentpassword = attendance_random_string(); $sess->studentpassword = attendance_random_string();
} else if (!empty($formdata->studentpassword)) { } else if (!empty($formdata->studentpassword)) {
@ -654,18 +662,6 @@ function attendance_construct_sessions_data_for_add($formdata, mod_attendance_st
if (!empty($formdata->includeqrcode)) { if (!empty($formdata->includeqrcode)) {
$sess->includeqrcode = $formdata->includeqrcode; $sess->includeqrcode = $formdata->includeqrcode;
} }
if (!empty($formdata->preventsharedip)) {
$sess->preventsharedip = $formdata->preventsharedip;
}
if (!empty($formdata->preventsharediptime)) {
$sess->preventsharediptime = $formdata->preventsharediptime;
}
} else {
$sess->subnet = '';
$sess->automark = 0;
$sess->automarkcompleted = 0;
$sess->preventsharedip = 0;
$sess->preventsharediptime = '';
} }
$sess->statusset = $formdata->statusset; $sess->statusset = $formdata->statusset;
@ -695,6 +691,22 @@ function attendance_construct_sessions_data_for_add($formdata, mod_attendance_st
$sess->absenteereport = $absenteereport; $sess->absenteereport = $absenteereport;
$sess->includeqrcode = 0; $sess->includeqrcode = 0;
if (!empty($formdata->usedefaultsubnet)) {
$sess->subnet = $att->subnet;
} else {
$sess->subnet = $formdata->subnet;
}
if (!empty($formdata->automark)) {
$sess->automark = $formdata->automark;
}
if (!empty($formdata->preventsharedip)) {
$sess->preventsharedip = $formdata->preventsharedip;
}
if (!empty($formdata->preventsharediptime)) {
$sess->preventsharediptime = $formdata->preventsharediptime;
}
if (isset($formdata->studentscanmark) && !empty($formdata->studentscanmark)) { if (isset($formdata->studentscanmark) && !empty($formdata->studentscanmark)) {
// Students will be able to mark their own attendance. // Students will be able to mark their own attendance.
$sess->studentscanmark = 1; $sess->studentscanmark = 1;
@ -709,21 +721,6 @@ function attendance_construct_sessions_data_for_add($formdata, mod_attendance_st
if (!empty($formdata->includeqrcode)) { if (!empty($formdata->includeqrcode)) {
$sess->includeqrcode = $formdata->includeqrcode; $sess->includeqrcode = $formdata->includeqrcode;
} }
if (!empty($formdata->usedefaultsubnet)) {
$sess->subnet = $att->subnet;
} else {
$sess->subnet = $formdata->subnet;
}
if (!empty($formdata->automark)) {
$sess->automark = $formdata->automark;
}
if (!empty($formdata->preventsharedip)) {
$sess->preventsharedip = $formdata->preventsharedip;
}
if (!empty($formdata->preventsharediptime)) {
$sess->preventsharediptime = $formdata->preventsharediptime;
}
} }
$sess->statusset = $formdata->statusset; $sess->statusset = $formdata->statusset;

39
renderer.php

@ -1742,11 +1742,6 @@ class mod_attendance_renderer extends plugin_renderer_base {
protected function render_attendance_preferences_data($prefdata) { protected function render_attendance_preferences_data($prefdata) {
$this->page->requires->js('/mod/attendance/module.js'); $this->page->requires->js('/mod/attendance/module.js');
$studentscanmark = false;
if (!empty(get_config('attendance', 'studentscanmark'))) {
$studentscanmark = true;
}
$table = new html_table(); $table = new html_table();
$table->width = '100%'; $table->width = '100%';
$table->head = array('#', $table->head = array('#',
@ -1754,15 +1749,15 @@ class mod_attendance_renderer extends plugin_renderer_base {
get_string('description'), get_string('description'),
get_string('points', 'attendance')); get_string('points', 'attendance'));
$table->align = array('center', 'center', 'center', 'center', 'center', 'center'); $table->align = array('center', 'center', 'center', 'center', 'center', 'center');
if ($studentscanmark) {
$table->head[] = get_string('studentavailability', 'attendance').
$this->output->help_icon('studentavailability', 'attendance');
$table->align[] = 'center';
$table->head[] = get_string('setunmarked', 'attendance'). $table->head[] = get_string('studentavailability', 'attendance').
$this->output->help_icon('setunmarked', 'attendance'); $this->output->help_icon('studentavailability', 'attendance');
$table->align[] = 'center'; $table->align[] = 'center';
}
$table->head[] = get_string('setunmarked', 'attendance').
$this->output->help_icon('setunmarked', 'attendance');
$table->align[] = 'center';
$table->head[] = get_string('action'); $table->head[] = get_string('action');
$i = 1; $i = 1;
@ -1783,14 +1778,13 @@ class mod_attendance_renderer extends plugin_renderer_base {
$cells[] = $this->construct_text_input('description['.$st->id.']', 30, 30, $st->description) . $cells[] = $this->construct_text_input('description['.$st->id.']', 30, 30, $st->description) .
$emptydescription; $emptydescription;
$cells[] = $this->construct_text_input('grade['.$st->id.']', 4, 4, $st->grade); $cells[] = $this->construct_text_input('grade['.$st->id.']', 4, 4, $st->grade);
if ($studentscanmark) { $checked = '';
$checked = ''; if ($st->setunmarked) {
if ($st->setunmarked) { $checked = ' checked ';
$checked = ' checked ';
}
$cells[] = $this->construct_text_input('studentavailability['.$st->id.']', 4, 5, $st->studentavailability);
$cells[] = '<input type="radio" name="setunmarked" value="'.$st->id.'"'.$checked.'>';
} }
$cells[] = $this->construct_text_input('studentavailability['.$st->id.']', 4, 5, $st->studentavailability);
$cells[] = '<input type="radio" name="setunmarked" value="'.$st->id.'"'.$checked.'>';
$cells[] = $this->construct_preferences_actions_icons($st, $prefdata); $cells[] = $this->construct_preferences_actions_icons($st, $prefdata);
$table->data[$i] = new html_table_row($cells); $table->data[$i] = new html_table_row($cells);
@ -1802,9 +1796,8 @@ class mod_attendance_renderer extends plugin_renderer_base {
$table->data[$i][] = $this->construct_text_input('newacronym', 2, 2); $table->data[$i][] = $this->construct_text_input('newacronym', 2, 2);
$table->data[$i][] = $this->construct_text_input('newdescription', 30, 30); $table->data[$i][] = $this->construct_text_input('newdescription', 30, 30);
$table->data[$i][] = $this->construct_text_input('newgrade', 4, 4); $table->data[$i][] = $this->construct_text_input('newgrade', 4, 4);
if ($studentscanmark) { $table->data[$i][] = $this->construct_text_input('newstudentavailability', 4, 5);
$table->data[$i][] = $this->construct_text_input('newstudentavailability', 4, 5);
}
$table->data[$i][] = $this->construct_preferences_button(get_string('add', 'attendance'), $table->data[$i][] = $this->construct_preferences_button(get_string('add', 'attendance'),
mod_attendance_preferences_page_params::ACTION_ADD); mod_attendance_preferences_page_params::ACTION_ADD);

90
update_form.php

@ -128,20 +128,25 @@ class mod_attendance_update_form extends moodleform {
} }
// 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);
$mform->setExpanded('headerstudentmarking');
$mform->addElement('header', 'headerstudentmarking', get_string('studentmarking', 'attendance'), true);
$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);
}
$options2 = attendance_get_automarkoptions(); $options2 = attendance_get_automarkoptions();
$mform->addElement('select', 'automark', get_string('automark', 'attendance'), $options2); $mform->addElement('select', 'automark', get_string('automark', 'attendance'), $options2);
$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');
if (!empty($studentscanmark)) {
$mform->addElement('text', 'studentpassword', get_string('studentpassword', 'attendance')); $mform->addElement('text', 'studentpassword', get_string('studentpassword', 'attendance'));
$mform->setType('studentpassword', PARAM_TEXT); $mform->setType('studentpassword', PARAM_TEXT);
$mform->addHelpButton('studentpassword', 'passwordgrp', 'attendance'); $mform->addHelpButton('studentpassword', 'passwordgrp', 'attendance');
@ -153,50 +158,35 @@ class mod_attendance_update_form extends moodleform {
$mform->addElement('checkbox', 'autoassignstatus', '', get_string('autoassignstatus', 'attendance')); $mform->addElement('checkbox', 'autoassignstatus', '', get_string('autoassignstatus', 'attendance'));
$mform->addHelpButton('autoassignstatus', 'autoassignstatus', 'attendance'); $mform->addHelpButton('autoassignstatus', 'autoassignstatus', 'attendance');
$mform->hideif('autoassignstatus', 'studentscanmark', 'notchecked'); $mform->hideif('autoassignstatus', 'studentscanmark', 'notchecked');
$mgroup = array();
$mgroup[] = & $mform->createElement('text', 'subnet', get_string('requiresubnet', 'attendance'));
$mform->setDefault('subnet', $this->_customdata['att']->subnet);
$mgroup[] = & $mform->createElement('checkbox', 'usedefaultsubnet', get_string('usedefaultsubnet', 'attendance'));
$mform->setDefault('usedefaultsubnet', 1);
$mform->setType('subnet', PARAM_TEXT);
$mform->addGroup($mgroup, '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');
$mform->addElement('hidden', 'automarkcompleted', '0');
$mform->settype('automarkcompleted', PARAM_INT);
$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('preventsharediptime', PARAM_INT);
$mform->hideif('preventsharedgroup', 'studentscanmark', 'notchecked');
$mform->hideIf('preventsharediptime', 'preventsharedip', 'noteq', ATTENDANCE_SHAREDIP_MINUTES);
} else {
$mform->addElement('hidden', 'studentscanmark', '0');
$mform->settype('studentscanmark', PARAM_INT);
$mform->addElement('hidden', 'subnet', '0');
$mform->settype('subnet', PARAM_TEXT);
$mform->addElement('hidden', 'automark', '0');
$mform->settype('automark', PARAM_INT);
$mform->addElement('hidden', 'automarkcompleted', '0');
$mform->settype('automarkcompleted', PARAM_INT);
$mform->addElement('hidden', 'autoassignstatus', '0');
$mform->setType('autoassignstatus', PARAM_INT);
} }
$mgroup = array();
$mgroup[] = & $mform->createElement('text', 'subnet', get_string('requiresubnet', 'attendance'));
$mform->setDefault('subnet', $this->_customdata['att']->subnet);
$mgroup[] = & $mform->createElement('checkbox', 'usedefaultsubnet', get_string('usedefaultsubnet', 'attendance'));
$mform->setDefault('usedefaultsubnet', 1);
$mform->setType('subnet', PARAM_TEXT);
$mform->addGroup($mgroup, 'subnetgrp', get_string('requiresubnet', 'attendance'), array(' '), false);
$mform->setAdvanced('subnetgrp');
$mform->addHelpButton('subnetgrp', 'requiresubnet', 'attendance');
$mform->hideif('subnet', 'usedefaultsubnet', 'checked');
$mform->addElement('hidden', 'automarkcompleted', '0');
$mform->settype('automarkcompleted', PARAM_INT);
$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('preventsharediptime', PARAM_INT);
$mform->setDefaults($data); $mform->setDefaults($data);
$this->add_action_buttons(true); $this->add_action_buttons(true);
} }

Loading…
Cancel
Save