/** * * @copyright 2019 Maksud R * @package mod_attendance * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * */ class attendance_QRCodeRotate { constructor() { this.sessionId = 0; this.password = ""; this.qrCodeInstance = ""; this.qrCodeHTMLElement = ""; } start(sessionId, qrCodeHTMLElement, textPasswordHTMLElement, timerHTMLElement) { this.sessionId = sessionId; this.qrCodeHTMLElement = qrCodeHTMLElement; this.textPasswordHTMLElement = textPasswordHTMLElement; this.timerHTMLElement = timerHTMLElement; this.fetchAndRotate(); } qrCodeSetUp() { this.qrCodeInstance = new QRCode(this.qrCodeHTMLElement, { text: '', width: 328, height: 328, colorDark : "#000000", colorLight : "#ffffff", correctLevel : QRCode.CorrectLevel.H }); } changeQRCode(password) { var qrcodeurl = document.URL.substr(0,document.URL.lastIndexOf('/')) + '/attendance.php?qrpass=' + password + '&sessid=' + this.sessionId; this.qrCodeInstance.clear(); this.qrCodeInstance.makeCode(qrcodeurl); // display new password this.textPasswordHTMLElement.innerHTML = '