first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,46 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Privacy Subsystem implementation for quizaccess_securewindow.
*
* @package quizaccess_securewindow
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace quizaccess_securewindow\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for quizaccess_securewindow implementing null_provider.
*
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -0,0 +1,32 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for the quizaccess_securewindow plugin.
*
* @package quizaccess
* @subpackage securewindow
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['pluginname'] = 'JavaScript security quiz access rule';
$string['popupwithjavascriptsupport'] = 'Full screen pop-up with some JavaScript security';
$string['privacy:metadata'] = 'The JavaScript security quiz access rule plugin does not store any personal data.';
+83
View File
@@ -0,0 +1,83 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
use mod_quiz\local\access_rule_base;
use mod_quiz\quiz_settings;
/**
* A rule for ensuring that the quiz is opened in a popup, with some JavaScript
* to prevent copying and pasting, etc.
*
* @package quizaccess_securewindow
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class quizaccess_securewindow extends access_rule_base {
/** @var array options that should be used for opening the secure popup. */
protected static $popupoptions = [
'left' => 0,
'top' => 0,
'fullscreen' => true,
'scrollbars' => true,
'resizeable' => false,
'directories' => false,
'toolbar' => false,
'titlebar' => false,
'location' => false,
'status' => false,
'menubar' => false,
];
public static function make(quiz_settings $quizobj, $timenow, $canignoretimelimits) {
if ($quizobj->get_quiz()->browsersecurity !== 'securewindow') {
return null;
}
return new self($quizobj, $timenow);
}
public function attempt_must_be_in_popup() {
return !$this->quizobj->is_preview_user();
}
public function get_popup_options() {
return self::$popupoptions;
}
public function setup_attempt_page($page) {
$page->set_popup_notification_allowed(false); // Prevent message notifications.
$page->set_title($this->quizobj->get_course()->shortname . ': ' . $page->title);
$page->set_pagelayout('secure');
if ($this->quizobj->is_preview_user()) {
return;
}
$page->add_body_class('quiz-secure-window');
$page->requires->js_init_call('M.mod_quiz.secure_window.init',
null, false, quiz_get_js_module());
}
/**
* @return array key => lang string any choices to add to the quiz Browser
* security settings menu.
*/
public static function get_browser_security_choices() {
return ['securewindow' =>
get_string('popupwithjavascriptsupport', 'quizaccess_securewindow')];
}
}
@@ -0,0 +1,56 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace quizaccess_securewindow;
use mod_quiz\quiz_settings;
use quizaccess_securewindow;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/mod/quiz/accessrule/securewindow/rule.php');
/**
* Unit tests for the quizaccess_securewindow plugin.
*
* @package quizaccess_securewindow
* @copyright 2008 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*
* @covers \mod_quiz\local\access_rule_base
* @covers \quizaccess_securewindow
*/
class rule_test extends \basic_testcase {
// Nothing very testable in this class, just test that it obeys the general access rule contact.
public function test_securewindow_access_rule(): void {
$quiz = new \stdClass();
$quiz->browsersecurity = 'securewindow';
$cm = new \stdClass();
$cm->id = 0;
$quizobj = new quiz_settings($quiz, $cm, null);
$rule = new quizaccess_securewindow($quizobj, 0);
$attempt = new \stdClass();
$this->assertFalse($rule->prevent_access());
$this->assertEmpty($rule->description());
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
$this->assertFalse($rule->is_finished(0, $attempt));
$this->assertFalse($rule->end_time($attempt));
$this->assertFalse($rule->time_left_display($attempt, 0));
}
}
@@ -0,0 +1,32 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Version information for the quizaccess_securewindow plugin.
*
* @package quizaccess
* @subpackage securewindow
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2024042200;
$plugin->requires = 2024041600;
$plugin->component = 'quizaccess_securewindow';