Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
quizaccess_seb

Namespaces

namespace  quizaccess_seb
  
 
namespace  quizaccess_seb\event
  
 
namespace  quizaccess_seb\external
  
 
namespace  quizaccess_seb\local\form
  
 
namespace  quizaccess_seb\local\table
  
 
namespace  quizaccess_seb\privacy
  
 

Classes

class  backup_quizaccess_seb_subplugin
 Backup instructions for the seb (Safe Exam Browser) quiz access subplugin. More...
 
class  behat_quizaccess_seb_generator
 Behat data generator for quizaccess_seb. More...
 
class  quizaccess_seb
 
class  quizaccess_seb\config_key
 Class for generating and representing a Safe Exam Browser config key. More...
 
class  quizaccess_seb\event\access_prevented
 Event for when access to a quiz is prevented by this subplugin. More...
 
class  quizaccess_seb\event\template_created
 Event for when a template is created. More...
 
class  quizaccess_seb\event\template_deleted
 Event for when a template is deleted. More...
 
class  quizaccess_seb\event\template_disabled
 Event for when a template is disabled. More...
 
class  quizaccess_seb\event\template_enabled
 Event for when a template is enabled. More...
 
class  quizaccess_seb\event\template_updated
 Event for when a template is updated. More...
 
class  quizaccess_seb\external\validate_quiz_keys
 
class  quizaccess_seb\helper
 Helper class. More...
 
class  quizaccess_seb\hideif_rule
 Class to store data for "hide if" rules for the settings form. More...
 
class  quizaccess_seb\link_generator
 Generate the links to open/download the Safe Exam Browser with correct settings. More...
 
class  quizaccess_seb\local\form\template
 Form for manipulating with the template records. More...
 
class  quizaccess_seb\local\table\template_list
 Templates table. More...
 
class  quizaccess_seb\privacy\provider
 Privacy Subsystem implementation for quizaccess_seb. More...
 
class  quizaccess_seb\property_list
 Wrapper for CFPropertyList to handle low level iteration. More...
 
class  quizaccess_seb\seb_access_manager
 Manage the access to the quiz. More...
 
class  quizaccess_seb\seb_quiz_settings
 Entity model representing quiz settings for the seb plugin. More...
 
class  quizaccess_seb\settings_provider
 Helper class for providing quiz settings, to make setting up quiz form manageable. More...
 
class  quizaccess_seb\template
 Entity model representing template settings for the seb plugin. More...
 
class  quizaccess_seb\template_controller
 Class for manipulating with the template records. More...
 
class  quizaccess_seb_generator
 Data generator the quizaccess_seb plugin. More...
 
class  restore_quizaccess_seb_subplugin
 Restore instructions for the seb (Safe Exam Browser) quiz access subplugin. More...
 

Functions

 assign_user_capability ($capability, $contextid, $roleid=null)
 Assign a capability to $USER The function creates a student $USER if $USER->id is empty.
 
 attempt_quiz ($quiz, $user)
 Answer questions for a quiz + user.
 
 create_module_test_file (string $xml, string $cmid)
 Create a file in a modules filearea.
 
 create_template (string $xml=null)
 Create test template.
 
 create_test_draftarea_file (string $xml)
 Creates a file in the user draft area.
 
 create_test_quiz ($course, $requiresafeexambrowser=settings_provider::USE_SEB_NO)
 Create a test quiz for the specified course.
 
 get_access_manager ()
 Get access manager for testing.
 
 get_test_settings (array $settings=[])
 Get a test object containing mock test settings.
 
 make_rule ()
 A helper method to make the rule form the currently created quiz and course.
 
 quizaccess_seb_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=[])
 Serve the files.
 
 set_up_quiz_view_page ()
 A helper method to set up quiz view page.
 
 strip_all_prefixes (\stdClass $settings)
 Strip the seb_ prefix from each setting key.
 
 xmldb_quizaccess_seb_install ()
 Custom code to be run on installing the plugin.
 
 xmldb_quizaccess_seb_upgrade ($oldversion)
 Function to upgrade quizaccess_seb plugin.
 

Variables

global $ADMIN
 
 $capabilities
 
global $CFG
 
global quizaccess_seb\external::$CFG
 
 $definitions
 
 $functions
 
 $plugin = 2023041800
 
stdClass $quiz
 $quiz A test quiz.
 
 $renamedclasses
 
stdClass $user
 $user A test logged-in user.
 
$plugin component = 'quizaccess_seb'
 
$plugin maturity = MATURITY_STABLE
 
trait quizaccess_seb_test_helper_trait
 A test helper trait.
 
$plugin version = 2023042400
 

Detailed Description

Function Documentation

◆ assign_user_capability()

assign_user_capability ( $capability,
$contextid,
$roleid = null )
protected

Assign a capability to $USER The function creates a student $USER if $USER->id is empty.

Parameters
string$capabilityCapability name.
int$contextidContext ID.
int$roleidRole ID.
Return values
intThe role id - mainly returned for creation, so calling function can reuse it.

◆ attempt_quiz()

attempt_quiz ( $quiz,
$user )
protected

Answer questions for a quiz + user.

Parameters
stdClass$quizQuiz to attempt.
stdClass$userA user to attempt the quiz.
Return values
array

◆ create_module_test_file()

create_module_test_file ( string $xml,
string $cmid )
protected

Create a file in a modules filearea.

Parameters
string$xmlXML content of the file.
string$cmidCourse module id.
Return values
intItem ID of file.

◆ create_template()

create_template ( string $xml = null)

Create test template.

Parameters
string | null$xmlTemplate content.
Return values
quizaccess_seb\templateJust created template.

◆ create_test_draftarea_file()

create_test_draftarea_file ( string $xml)
protected

Creates a file in the user draft area.

Parameters
string$xml
Return values
intThe user draftarea id

◆ create_test_quiz()

create_test_quiz ( $course,
$requiresafeexambrowser = settings_provider::USE_SEB_NO )
protected

Create a test quiz for the specified course.

Parameters
stdClass$course
int$requiresafeexambrowserHow to use SEB for this quiz?
Return values
array

◆ get_access_manager()

get_access_manager ( )
protected

Get access manager for testing.

Return values
quizaccess_seb\seb_access_manager

◆ get_test_settings()

get_test_settings ( array $settings = [])
protected

Get a test object containing mock test settings.

Return values
stdClassSettings.

◆ make_rule()

make_rule ( )
protected

A helper method to make the rule form the currently created quiz and course.

Return values
access_rule_base|null

◆ quizaccess_seb_pluginfile()

quizaccess_seb_pluginfile ( $course,
$cm,
$context,
$filearea,
$args,
$forcedownload,
array $options = [] )

Serve the files.

Parameters
stdClass$coursethe course object
stdClass$cmthe course module object
context$contextthe context
string$fileareathe name of the file area
array$argsextra arguments (itemid, path)
bool$forcedownloadwhether or not force download
array$optionsadditional options affecting the file serving
Return values
boolfalse if the file not found, just send the file otherwise and do not return anything

◆ strip_all_prefixes()

strip_all_prefixes ( \stdClass $settings)
protected

Strip the seb_ prefix from each setting key.

Parameters
stdClass$settingsObject containing settings.
Return values
stdClassThe modified settings object.

◆ xmldb_quizaccess_seb_upgrade()

xmldb_quizaccess_seb_upgrade ( $oldversion)

Function to upgrade quizaccess_seb plugin.

Parameters
int$oldversionThe version we are upgrading from.
Return values
boolResult.

Variable Documentation

◆ $definitions

$definitions
Initial value:
= [
'quizsettings' => [
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => true,
'simpledata' => true,
'staticacceleration' => true,
],
'config' => [
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => true,
'simpledata' => true,
'staticacceleration' => true,
],
'configkey' => [
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => true,
'simpledata' => true,
'staticacceleration' => true,
],
]

◆ $functions

$functions
Initial value:
= [
'quizaccess_seb_validate_quiz_keys' => [
'classname' => 'quizaccess_seb\external\validate_quiz_keys',
'methodname' => 'execute',
'description' => 'Validate a Safe Exam Browser config key or a browser exam key.',
'type' => 'read',
'ajax' => true,
],
]

◆ $renamedclasses

$renamedclasses
Initial value:
= [
'quizaccess_seb\quiz_settings' => 'quizaccess_seb\seb_quiz_settings',
'quizaccess_seb\access_manager' => 'quizaccess_seb\seb_access_manager',
]

◆ quizaccess_seb_test_helper_trait

trait quizaccess_seb_test_helper_trait
Initial value:
{
protected stdClass $course

A test helper trait.

It has some common helper methods.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later