Moodle PHP Documentation 4.1
Moodle 4.1dev (Build: 20220512) (5e5e12e0)
Namespaces | Classes | Functions | Variables
quizaccess_seb

Namespaces

namespace  quizaccess_seb
  
 
namespace  quizaccess_seb\event
  
 
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
 Implementation of the quizaccess_seb plugin. More...
 
class  quizaccess_seb\access_manager
 Manage the access to the quiz. More...
 
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\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\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. More...
 
 attempt_quiz ($quiz, $user)
 Answer questions for a quiz + user. More...
 
 create_module_test_file (string $xml, string $cmid)
 Create a file in a modules filearea. More...
 
 create_template (string $xml=null)
 Create test template. More...
 
 create_test_draftarea_file (string $xml)
 Creates a file in the user draft area. More...
 
 create_test_quiz ($course, $requiresafeexambrowser=settings_provider::USE_SEB_NO)
 Create a test quiz for the specified course. More...
 
 get_access_manager ()
 Get access manager for testing. More...
 
 get_test_settings ()
 Get a test object containing mock test settings. More...
 
 make_rule ()
 A helper method to make the rule form the currently created quiz and course. More...
 
 quizaccess_seb_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array())
 Serve the files. More...
 
 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. More...
 
 xmldb_quizaccess_seb_install ()
 Custom code to be run on installing the plugin.
 
 xmldb_quizaccess_seb_upgrade ($oldversion)
 Function to upgrade quizaccess_seb plugin. More...
 

Variables

global $ADMIN
 
 $capabilities
 
global $CFG
 
global $CFG
 
 $definitions
 
 $plugin = 2022041200
 
stdClass $quiz
 $quiz A test quiz.
 
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. More...
 
$plugin version = 2022041900
 

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::access_manager

◆ get_test_settings()

get_test_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
quiz_access_rule_base|null

◆ quizaccess_seb_pluginfile()

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

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' => [
'simplekeys' => true,
'simpledata' => true,
'staticacceleration' => true,
],
'config' => [
'simplekeys' => true,
'simpledata' => true,
'staticacceleration' => true,
],
'configkey' => [
'simplekeys' => true,
'simpledata' => true,
'staticacceleration' => true,
],
]
const MODE_APPLICATION
Application caches.
Definition: store.php:138

◆ 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