Browse Source

Fix #460 - add default handling for qrcode rotation

and inclusion in import sessions.
MOODLE_37_STABLE
Dan Marsden 4 years ago
parent
commit
85362c9a40
  1. 5
      add_form.php
  2. 12
      classes/import/sessions.php
  3. 3
      settings.php

5
add_form.php

@ -247,9 +247,8 @@ class mod_attendance_add_form extends moodleform {
if (isset($pluginconfig->includeqrcode_default)) { if (isset($pluginconfig->includeqrcode_default)) {
$mform->setDefault('includeqrcode', $pluginconfig->includeqrcode_default); $mform->setDefault('includeqrcode', $pluginconfig->includeqrcode_default);
} }
// TODO - Change in DB and provide value. if (isset($pluginconfig->rotateqrcode_default)) {
if (isset($pluginconfig->includeqrcode_default)) { $mform->setDefault('rotateqrcode', $pluginconfig->rotateqrcode_default);
$mform->setDefault('rotateqrcode', $pluginconfig->includeqrcode_default);
} }
if (isset($pluginconfig->automark_default)) { if (isset($pluginconfig->automark_default)) {
$mform->setDefault('automark', $pluginconfig->automark_default); $mform->setDefault('automark', $pluginconfig->automark_default);

12
classes/import/sessions.php

@ -112,6 +112,7 @@ class sessions {
get_string('preventsharediptime', 'attendance'), get_string('preventsharediptime', 'attendance'),
get_string('calendarevent', 'attendance'), get_string('calendarevent', 'attendance'),
get_string('includeqrcode', 'attendance'), get_string('includeqrcode', 'attendance'),
get_string('rotateqrcode', 'attendance'),
); );
} }
@ -151,7 +152,8 @@ class sessions {
'preventsharedip' => $data->header16, 'preventsharedip' => $data->header16,
'preventsharediptime' => $data->header17, 'preventsharediptime' => $data->header17,
'calendarevent' => $data->header18, 'calendarevent' => $data->header18,
'includeqrcode' => $data->header19 'includeqrcode' => $data->header19,
'rotateqrcode' => $data->header20,
); );
} else { } else {
return array( return array(
@ -174,7 +176,8 @@ class sessions {
'preventsharedip' => 16, 'preventsharedip' => 16,
'preventsharediptime' => 17, 'preventsharediptime' => 17,
'calendarevent' => 18, 'calendarevent' => 18,
'includeqrcode' => 19 'includeqrcode' => 19,
'rotateqrcode' => 20
); );
} }
} }
@ -357,6 +360,11 @@ class sessions {
} }
} }
if ($mapping['rotateqrcode'] == -1) {
$session->rotateqrcode = $pluginconfig->rotateqrcode_default;
} else {
$session->rotateqrcode = $this->get_column_data($row, $mapping['rotateqrcode']);
}
$session->statusset = 0; $session->statusset = 0;

3
settings.php

@ -136,6 +136,9 @@ if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configcheckbox('attendance/includeqrcode_default', $settings->add(new admin_setting_configcheckbox('attendance/includeqrcode_default',
get_string('includeqrcode', 'attendance'), '', 0)); get_string('includeqrcode', 'attendance'), '', 0));
$settings->add(new admin_setting_configcheckbox('attendance/rotateqrcode_default',
get_string('rotateqrcode', 'attendance'), '', 0));
$settings->add(new admin_setting_configcheckbox('attendance/autoassignstatus', $settings->add(new admin_setting_configcheckbox('attendance/autoassignstatus',
get_string('autoassignstatus', 'attendance'), '', 0)); get_string('autoassignstatus', 'attendance'), '', 0));

Loading…
Cancel
Save