Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]
Implementation of the quizaccess_seb plugin.
Author: | Andrew Madden <andrewmadden@catalyst-au.net> |
Author: | Dmitrii Metelkin <dmitriim@catalyst-au.net> |
Copyright: | 2019 Catalyst IT |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 597 lines (23 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
quizaccess_seb:: (25 methods):
__construct()
make()
add_settings_form_fields()
validate_settings_form_fields()
save_settings()
delete_settings()
get_settings_sql()
prevent_access()
get_user_finished_attempts()
prevent_display_blocks()
get_reason_text()
get_invalid_key_error_message()
get_require_seb_error_message()
get_quit_button()
description()
setup_attempt_page()
display_buttons()
get_action_buttons()
get_download_seb_button()
get_launch_seb_button()
get_download_config_button()
get_seb_download_url()
should_display_download_seb_link()
redirect_to_seb_config_link()
should_redirect_to_seb_config_link()
Class: quizaccess_seb - X-Ref
Implementation of the quizaccess_seb plugin.__construct(quiz $quizobj, int $timenow, access_manager $accessmanager) X-Ref |
Create an instance of this rule for a particular quiz. param: quiz $quizobj information about the quiz in question. param: int $timenow the time that should be considered as 'now'. param: access_manager $accessmanager the quiz accessmanager. |
make(quiz $quizobj, $timenow, $canignoretimelimits) X-Ref |
Return an appropriately configured instance of this rule, if it is applicable to the given quiz, otherwise return null. param: quiz $quizobj information about the quiz in question. param: int $timenow the time that should be considered as 'now'. param: bool $canignoretimelimits whether the current user is exempt from return: quiz_access_rule_base|null the rule, if applicable, else null. |
add_settings_form_fields(mod_quiz_mod_form $quizform, MoodleQuickForm $mform) X-Ref |
Add any fields that this rule requires to the quiz settings form. This method is called from {@link mod_quiz_mod_form::definition()}, while the security section is being built. param: mod_quiz_mod_form $quizform the quiz settings form that is being built. param: MoodleQuickForm $mform the wrapped MoodleQuickForm. |
validate_settings_form_fields(array $errors,array $data, $files, mod_quiz_mod_form $quizform) X-Ref |
Validate the data from any form fields added using {@link add_settings_form_fields()}. param: array $errors the errors found so far. param: array $data the submitted form data. param: array $files information about any uploaded files. param: mod_quiz_mod_form $quizform the quiz form object. return: array $errors the updated $errors array. |
save_settings($quiz) X-Ref |
Save any submitted settings when the quiz settings form is submitted. This is called from {@link quiz_after_add_or_update()} in lib.php. param: object $quiz the data from the quiz form, including $quiz->id |
delete_settings($quiz) X-Ref |
Delete any rule-specific settings when the quiz is deleted. This is called from {@link quiz_delete_instance()} in lib.php. param: object $quiz the data from the database, including $quiz->id |
get_settings_sql($quizid) X-Ref |
Return the bits of SQL needed to load all the settings from all the access plugins in one DB query. The easiest way to understand what you need to do here is probalby to read the code of {@link quiz_access_manager::load_settings()}. If you have some settings that cannot be loaded in this way, then you can use the {@link get_extra_settings()} method instead, but that has performance implications. param: int $quizid the id of the quiz we are loading settings for. This return: array with three elements: |
prevent_access() X-Ref |
Whether the user should be blocked from starting a new attempt or continuing an attempt now. return: string false if access should be allowed, a message explaining the |
get_user_finished_attempts() X-Ref |
Returns a list of finished attempts for the current user. return: array |
prevent_display_blocks() X-Ref |
Prevent block displaying as configured. |
get_reason_text(string $identifier) X-Ref |
Returns reason for access prevention as a text. param: string $identifier Reason string identifier. return: string |
get_invalid_key_error_message() X-Ref |
Return error message when a SEB key is not valid. return: string |
get_require_seb_error_message() X-Ref |
Return error message when a SEB browser is not used. return: string |
get_quit_button() X-Ref |
Helper function to display an Exit Safe Exam Browser button if configured to do so and attempts are > 0. return: string empty or a button which has the configured seb quit link. |
description() X-Ref |
Information, such as might be shown on the quiz view page, relating to this restriction. There is no obligation to return anything. If it is not appropriate to tell students about this rule, then just return ''. return: mixed a message, or array of messages, explaining the restriction |
setup_attempt_page($page) X-Ref |
Sets up the attempt (review or summary) page with any special extra properties required by this rule. param: moodle_page $page the page object to initialise. |
display_buttons(string $buttonshtml, $class = '', array $attributes = null) X-Ref |
Prepare buttons HTML code for being displayed on the screen. param: string $buttonshtml Html string of the buttons. param: string $class Optional CSS class (or classes as space-separated list) param: array $attributes Optional other attributes as array return: string HTML code of the provided buttons. |
get_action_buttons() X-Ref |
Get buttons to prompt user to download SEB or config file or launch SEB. return: string Html block of all action buttons. |
get_download_seb_button() X-Ref |
Get a button to download SEB. return: string A link to download SafeExam Browser. |
get_launch_seb_button() X-Ref |
Get a button to launch Safe Exam Browser. return: string A link to launch Safe Exam Browser. |
get_download_config_button() X-Ref |
Get a button to download Safe Exam Browser config. return: string A link to launch Safe Exam Browser. |
get_seb_download_url() X-Ref |
Returns SEB download URL. return: string |
should_display_download_seb_link() X-Ref |
Check if we should display a link to download Safe Exam Browser. return: bool |
redirect_to_seb_config_link() X-Ref |
Redirect to SEB config link. This will force Safe Exam Browser to be reconfigured. |
should_redirect_to_seb_config_link() X-Ref |
Check if we need to redirect to SEB config link. return: bool |