Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Helper class for providing quiz settings, to make setting up quiz form manageable. More...
Static Public Member Functions | |
static | add_prefix (string $name) |
Add prefix to string. | |
static | add_seb_settings_fields (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform) |
Add setting fields. | |
static | build_setting_capability_name (string $settingname) |
Build a capability name for the provided SEB setting. | |
static | can_change_seb_allowedbrowserexamkeys (\context $context) |
Check if the current user can change Allowed Browser Exam Keys setting. | |
static | can_change_seb_showsebdownloadlink (\context $context) |
Check if the current user can change Show Safe Exam Browser download button setting. | |
static | can_configure_manually (\context $context) |
Check if the current user can config SEB manually. | |
static | can_configure_seb (\context $context) |
Check if the current user can configure SEB. | |
static | can_manage_seb_config_setting (string $settingname, context $context) |
Check if the current user can manage provided SEB setting. | |
static | can_upload_seb_file (\context $context) |
Check if the current user can upload own SEB config file. | |
static | can_use_seb_template (\context $context) |
Check if the current user can use preconfigured templates. | |
static | delete_uploaded_config_file (string $cmid) |
Cleanup function to delete the saved config when it has not been specified. | |
static | filter_plugin_settings (stdClass $settings) |
Filter quiz settings for this plugin only. | |
static | get_current_user_draft_file (string $itemid) |
Try and get a file in the user draft filearea by itemid. | |
static | get_filemanager_options () |
Returns a list of options for the file manager element. | |
static | get_module_context_sebconfig_file (string $cmid) |
Get the file that is stored in the course module file area. | |
static | get_quiz_hideifs () |
Get the conditions that an element should be hid in the form. | |
static | get_requiresafeexambrowser_options (\context $context) |
Returns a list of all options of SEB usage. | |
static | get_seb_config_element_defaults () |
Get the default values of the quiz settings. | |
static | get_seb_config_element_types () |
Get the types of the quiz settings elements. | |
static | get_seb_config_elements () |
Get the type of element for each of the form elements in quiz settings. | |
static | get_seb_settings_map () |
Helper method to return a map of all settings. | |
static | is_conflicting_permissions (\context $context) |
Check that we have conflicting permissions. | |
static | is_seb_settings_locked ($quizid) |
Check if settings is locked. | |
static | save_filemanager_sebconfigfile_draftarea (string $draftitemid, string $cmid) |
Saves filemanager_sebconfigfile files to the moodle storage backend. | |
static | validate_draftarea_configfile ($itemid) |
Validate that if a file has been uploaded by current user, that it is a valid PLIST XML file. | |
Public Attributes | |
const | USE_SEB_CLIENT_CONFIG = 4 |
Use client config. | |
const | USE_SEB_CONFIG_MANUALLY = 1 |
Use SEB and configure it manually. | |
const | USE_SEB_NO = 0 |
No SEB should be used. | |
const | USE_SEB_TEMPLATE = 2 |
Use SEB config from pre configured template. | |
const | USE_SEB_UPLOAD_CONFIG = 3 |
Use SEB config from uploaded config file. | |
Static Protected Member Functions | |
static | add_help_button (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform, string $elementname) |
Add help button to the element. | |
static | add_seb_allowedbrowserexamkeys (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform) |
Add Allowed Browser Exam Keys setting. | |
static | add_seb_config_elements (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform) |
Add SEB config elements. | |
static | add_seb_config_file (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform) |
Add upload config file element. | |
static | add_seb_header_element (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform) |
Add SEB header element to the form. | |
static | add_seb_show_download_link (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform) |
Add Show Safe Exam Browser download button. | |
static | add_seb_templates (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform) |
Add Templates element. | |
static | add_seb_usage_options (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform) |
Add SEB usage element with all available options. | |
static | build_config_capabilities_to_check (string $settingname, array $settings) |
Helper method to build a list of capabilities to check. | |
static | freeze_element (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform, string $elementname) |
Freeze form element. | |
static | get_template_options () |
Returns a list of templates. | |
static | get_uploaded_seb_file_download_link (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform) |
Return uploaded SEB config file link. | |
static | hide_seb_elements (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform) |
Hide SEB elements if required. | |
static | insert_element (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform, HTML_QuickForm_element $element, $before='security') |
Insert form element. | |
static | lock_seb_elements (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform) |
Lock SEB elements if required. | |
static | remove_element (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform, string $elementname) |
Remove element from the form. | |
static | set_default (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform, string $elementname, $value) |
Set default value for the element. | |
static | set_type (\mod_quiz_mod_form $quizform, MoodleQuickForm $mform, string $elementname, string $type) |
Set element type. | |
Helper class for providing quiz settings, to make setting up quiz form manageable.
|
staticprotected |
Add help button to the element.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
string | $elementname | Element name. |
|
static |
Add prefix to string.
string | $name | String to add prefix to. |
string | String with prefix. |
|
staticprotected |
Add Allowed Browser Exam Keys setting.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
|
staticprotected |
Add SEB config elements.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
|
staticprotected |
Add upload config file element.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
|
staticprotected |
Add SEB header element to the form.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
|
static |
Add setting fields.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
|
staticprotected |
Add Show Safe Exam Browser download button.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
|
staticprotected |
Add Templates element.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
|
staticprotected |
Add SEB usage element with all available options.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
|
staticprotected |
Helper method to build a list of capabilities to check.
string | $settingname | Given setting name to build caps for. |
array | $settings | A list of settings to go through. |
array |
|
static |
Build a capability name for the provided SEB setting.
string | $settingname | Name of the setting. |
string |
|
static |
Check if the current user can change Allowed Browser Exam Keys setting.
context | $context | Context to check access in. |
bool |
|
static |
Check if the current user can change Show Safe Exam Browser download button setting.
context | $context | Context to check access in. |
bool |
|
static |
Check if the current user can config SEB manually.
context | $context | Context to check access in. |
bool |
|
static |
Check if the current user can configure SEB.
context | $context | Context to check access in. |
bool |
|
static |
Check if the current user can manage provided SEB setting.
string | $settingname | Name of the setting. |
context | $context | Context to check access in. |
bool |
|
static |
Check if the current user can upload own SEB config file.
context | $context | Context to check access in. |
bool |
|
static |
Check if the current user can use preconfigured templates.
context | $context | Context to check access in. |
bool |
|
static |
Cleanup function to delete the saved config when it has not been specified.
This will be called when settings_provider\USE_SEB_UPLOAD_CONFIG is not true.
string | $cmid | The cmid of for the quiz. |
bool | Always true or exception if error occurred |
|
static |
Filter quiz settings for this plugin only.
stdClass | $settings | Quiz settings. |
stdClass | Filtered settings. |
|
staticprotected |
Freeze form element.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
string | $elementname | Element name. |
|
static |
Try and get a file in the user draft filearea by itemid.
string | $itemid | Item ID of the file. |
stored_file|null | Returns null if no file is found. |
|
static |
Returns a list of options for the file manager element.
array |
|
static |
Get the file that is stored in the course module file area.
string | $cmid | The course module id which is used as an itemid reference. |
stored_file|null | Returns null if no file is found. |
|
static |
Get the conditions that an element should be hid in the form.
Expects matching using 'eq'.
Array key is name of 'form element'/'database column (excluding prefix)'. Values are instances of hideif_rule class.
array | List of rules per element. |
|
static |
Returns a list of all options of SEB usage.
context | $context | Context used with capability checking selection options. |
array |
|
static |
Get the default values of the quiz settings.
Array key is name of 'form element'/'database column (excluding prefix)'.
array | List of settings and their defaults. |
|
static |
Get the types of the quiz settings elements.
array | List of types for the setting elements. |
|
static |
Get the type of element for each of the form elements in quiz settings.
Contains all setting elements. Array key is name of 'form element'/'database column (excluding prefix)'.
array | All quiz form elements to be added and their types. |
|
static |
Helper method to return a map of all settings.
array |
|
staticprotected |
Returns a list of templates.
array |
|
staticprotected |
Return uploaded SEB config file link.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
string |
|
staticprotected |
Hide SEB elements if required.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
|
staticprotected |
Insert form element.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
HTML_QuickForm_element | $element | Element to insert. |
string | $before | Insert element before. |
|
static |
Check that we have conflicting permissions.
In Some point we can have settings save by the person who use specific type of SEB usage (e.g. use templates). But then another person who can't use template (but still can update other settings) edit the same quiz. This is conflict of permissions and we'd like to build the settings form having this in mind.
context | $context | Context used with capability checking. |
bool |
|
static |
Check if settings is locked.
int | $quizid | Quiz ID. |
bool |
|
staticprotected |
Lock SEB elements if required.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
|
staticprotected |
Remove element from the form.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
string | $elementname | Element name. |
|
static |
Saves filemanager_sebconfigfile files to the moodle storage backend.
string | $draftitemid | The id of the draft area to use. |
string | $cmid | The cmid of for the quiz. |
bool | Always true |
|
staticprotected |
Set default value for the element.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
string | $elementname | Element name. |
mixed | $value | Default value. |
|
staticprotected |
Set element type.
mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
string | $elementname | Element name. |
string | $type | Type of the form element. |
|
static |
Validate that if a file has been uploaded by current user, that it is a valid PLIST XML file.
This function is only called if requiresafeexambrowser == settings_provider\USE_SEB_UPLOAD_CONFIG.
string | $itemid | Item ID of file in user draft file area. |
void|lang_string |
const quizaccess_seb\settings_provider::USE_SEB_CLIENT_CONFIG = 4 |
Use client config.
Not SEB config is required.