Browse Source

Adding expiry time margin to setting and updating settings text.

MOODLE_36_STABLE
M 6 years ago
committed by Dan Marsden
parent
commit
e734796b93
  1. 3
      attendance.php
  2. 6
      lang/en/attendance.php
  3. 4
      settings.php

3
attendance.php

@ -33,6 +33,7 @@ $id = required_param('sessid', PARAM_INT);
$qrpass = optional_param('qrpass', '', PARAM_TEXT); $qrpass = optional_param('qrpass', '', PARAM_TEXT);
$attforsession = $DB->get_record('attendance_sessions', array('id' => $id), '*', MUST_EXIST); $attforsession = $DB->get_record('attendance_sessions', array('id' => $id), '*', MUST_EXIST);
$attconfig = get_config('attendance');
$attendance = $DB->get_record('attendance', array('id' => $attforsession->attendanceid), '*', MUST_EXIST); $attendance = $DB->get_record('attendance', array('id' => $attforsession->attendanceid), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('attendance', $attendance->id, 0, false, MUST_EXIST); $cm = get_coursemodule_from_instance('attendance', $attendance->id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
@ -54,7 +55,7 @@ if ($attforsession->rotateqrcode == 1) {
// Check password // Check password
$sql = 'SELECT * FROM {attendance_rotate_passwords}'. $sql = 'SELECT * FROM {attendance_rotate_passwords}'.
' WHERE attendanceid = ? AND expirytime > ? ORDER BY expirytime ASC LIMIT 2'; ' WHERE attendanceid = ? AND expirytime > ? ORDER BY expirytime ASC LIMIT 2';
$qrpassdatabase = $DB->get_records_sql($sql, ['attendanceid' => $id, time() - 2]); $qrpassdatabase = $DB->get_records_sql($sql, ['attendanceid' => $id, time() - $attconfig->rotateqrcodeexpirymargin]);
$qrpassflag = false; $qrpassflag = false;

6
lang/en/attendance.php

@ -245,8 +245,10 @@ $string['includeall'] = 'Select all sessions';
$string['includenottaken'] = 'Include not taken sessions'; $string['includenottaken'] = 'Include not taken sessions';
$string['includeqrcode'] = 'Include QR code'; $string['includeqrcode'] = 'Include QR code';
$string['rotateqrcode'] = 'Rotate QR code'; $string['rotateqrcode'] = 'Rotate QR code';
$string['rotateqrcodeinterval'] = 'Rotate QR code interval (seconds)'; $string['rotateqrcodeinterval'] = 'Rotate QR code/password interval (seconds)';
$string['rotateqrcodeinterval_desc'] = 'Time interval (seconds) to rotate QR codes by.'; $string['rotateqrcodeinterval_desc'] = 'Time interval (seconds) to rotate QR code/password by.';
$string['rotateqrcodeexpirymargin'] = 'Rotate QR code/password expiry margin (seconds)';
$string['rotateqrcodeexpirymargin_desc'] = 'Time interval (seconds) to allow expired QR code/password by.';
$string['rotateqrcode_cleartemppass_task'] = 'Task to clear temporary passwords generated by rotate QR code functionality.'; $string['rotateqrcode_cleartemppass_task'] = 'Task to clear temporary passwords generated by rotate QR code functionality.';
$string['includeremarks'] = 'Include remarks'; $string['includeremarks'] = 'Include remarks';
$string['incorrectpassword'] = 'You have entered an incorrect password and your attendance has not been recorded, please enter the correct password.'; $string['incorrectpassword'] = 'You have entered an incorrect password and your attendance has not been recorded, please enter the correct password.';

4
settings.php

@ -56,6 +56,10 @@ if ($ADMIN->fulltree) {
get_string('rotateqrcodeinterval', 'attendance'), get_string('rotateqrcodeinterval', 'attendance'),
get_string('rotateqrcodeinterval_desc', 'attendance'), '15', PARAM_INT)); get_string('rotateqrcodeinterval_desc', 'attendance'), '15', PARAM_INT));
$settings->add(new admin_setting_configtext('attendance/rotateqrcodeexpirymargin',
get_string('rotateqrcodeexpirymargin', 'attendance'),
get_string('rotateqrcodeexpirymargin_desc', 'attendance'), '2', PARAM_INT));
$settings->add(new admin_setting_configcheckbox('attendance/studentscanmarksessiontime', $settings->add(new admin_setting_configcheckbox('attendance/studentscanmarksessiontime',
get_string('studentscanmarksessiontime', 'attendance'), get_string('studentscanmarksessiontime', 'attendance'),
get_string('studentscanmarksessiontime_desc', 'attendance'), 1)); get_string('studentscanmarksessiontime_desc', 'attendance'), 1));

Loading…
Cancel
Save