|
|
@ -1104,7 +1104,8 @@ function attendance_renderqrcode($session) { |
|
|
|
global $CFG; |
|
|
|
|
|
|
|
if (strlen($session->studentpassword) > 0) { |
|
|
|
$qrcodeurl = $CFG->wwwroot . '/mod/attendance/attendance.php?qrpass=' . $session->studentpassword . '&sessid=' . $session->id; |
|
|
|
$qrcodeurl = $CFG->wwwroot . '/mod/attendance/attendance.php?qrpass=' . |
|
|
|
$session->studentpassword . '&sessid=' . $session->id; |
|
|
|
} else { |
|
|
|
$qrcodeurl = $CFG->wwwroot . '/mod/attendance/attendance.php?sessid=' . $session->id; |
|
|
|
} |
|
|
@ -1127,7 +1128,8 @@ function attendance_generate_passwords($session) { |
|
|
|
$password = array(); |
|
|
|
|
|
|
|
for ($i = 0; $i < 30; $i++) { |
|
|
|
array_push($password, array("attendanceid" => $session->id, "password" => mt_rand(1000, 10000), "expirytime" => time() + ($attconfig->rotateqrcodeinterval * $i))); |
|
|
|
array_push($password, array("attendanceid" => $session->id, |
|
|
|
"password" => mt_rand(1000, 10000), "expirytime" => time() + ($attconfig->rotateqrcodeinterval * $i))); |
|
|
|
} |
|
|
|
|
|
|
|
$DB->insert_records('attendance_rotate_passwords', $password); |
|
|
@ -1139,7 +1141,7 @@ function attendance_generate_passwords($session) { |
|
|
|
* @param stdClass $session |
|
|
|
*/ |
|
|
|
function attendance_renderqrcoderotate($session) { |
|
|
|
// load requered js |
|
|
|
// Load required js. |
|
|
|
echo html_writer::tag('script', '', |
|
|
|
[ |
|
|
|
'src' => 'js/qrcode/qrcode.min.js', |
|
|
@ -1152,12 +1154,12 @@ function attendance_renderqrcoderotate($session) { |
|
|
|
'type' => 'text/javascript' |
|
|
|
] |
|
|
|
); |
|
|
|
echo html_writer::tag('div', '', ['id' => 'rotate-time']); // div to display timer |
|
|
|
echo html_writer::tag('div', '', ['id' => 'rotate-time']); // Div to display timer. |
|
|
|
echo html_writer::tag('h3', get_string('passwordgrp', 'attendance')); |
|
|
|
echo html_writer::tag('div', '', ['id' => 'text-password']); // div to display password |
|
|
|
echo html_writer::tag('div', '', ['id' => 'text-password']); // Div to display password. |
|
|
|
echo html_writer::tag('h3', get_string('qrcode', 'attendance')); |
|
|
|
echo html_writer::tag('div', '', ['id' => 'qrcode']); // div to display qr code |
|
|
|
// js to start the password manager |
|
|
|
echo html_writer::tag('div', '', ['id' => 'qrcode']); // Div to display qr code. |
|
|
|
// Js to start the password manager. |
|
|
|
echo ' |
|
|
|
<script type="text/javascript"> |
|
|
|
let qrCodeRotate = new attendance_QRCodeRotate(); |
|
|
|