Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
mod_quiz\local\structure\slot_random Class Reference

Public Member Functions

 __construct ($slotrecord=null)
 slot_random constructor.
 
 get_quiz ()
 Returns the quiz for this question slot.
 
 insert ($page)
 Inserts the quiz slot at the $page page.
 
 set_filter_condition ($filters)
 Set filter condition.
 
 set_quiz ($quiz)
 Sets the quiz object for the quiz slot.
 
 set_tags ($tags)
 Set some tags for this quiz slot.
 
 set_tags_by_id ($tagids)
 Set some tags for this quiz slot.
 

Protected Attributes

string $filtercondition = null
 filter condition
 
stdClass $quiz = null
 The quiz this question slot belongs to.
 
stdClass $record
 Slot's properties.
 
stdClass $referencerecord
 set reference record
 
core_tag_tag[] $tags = []
 List of tags for this slot.
 

Constructor & Destructor Documentation

◆ __construct()

mod_quiz\local\structure\slot_random::__construct ( $slotrecord = null)

slot_random constructor.

Parameters
stdClass$slotrecordRepresents a record in the quiz_slots table.

Member Function Documentation

◆ get_quiz()

mod_quiz\local\structure\slot_random::get_quiz ( )

Returns the quiz for this question slot.

The quiz is fetched the first time it is requested and then stored in a member variable to be returned each subsequent time.

Return values
mixed
Exceptions
coding_exception

◆ insert()

mod_quiz\local\structure\slot_random::insert ( $page)

Inserts the quiz slot at the $page page.

It is required to call this function if you are building a quiz slot object from scratch.

Parameters
int$pageThe page that this slot will be inserted at.

◆ set_filter_condition()

mod_quiz\local\structure\slot_random::set_filter_condition ( $filters)

Set filter condition.

Parameters
stdClass$filters

◆ set_quiz()

mod_quiz\local\structure\slot_random::set_quiz ( $quiz)

Sets the quiz object for the quiz slot.

It is not mandatory to set the quiz as the quiz slot can fetch it the first time it is accessed, however it helps with the performance to set the quiz if you already have it.

Parameters
stdClass$quizThe qui object.

◆ set_tags()

mod_quiz\local\structure\slot_random::set_tags ( $tags)

Set some tags for this quiz slot.

Parameters
core_tag_tag[]$tags

◆ set_tags_by_id()

mod_quiz\local\structure\slot_random::set_tags_by_id ( $tagids)

Set some tags for this quiz slot.

This function uses tag ids to find tags.

Parameters
int[]$tagids

Member Data Documentation

◆ $record

stdClass mod_quiz\local\structure\slot_random::$record
protected

Slot's properties.

A record retrieved from the quiz_slots table.


The documentation for this class was generated from the following file: