Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Protected Attributes | List of all members
mod_quiz\local\structure\slot_random Class Reference

Class slot_random, represents a random question slot type. More...

Public Member Functions

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

Protected Attributes

stdClass $quiz = null
 The quiz this question slot belongs to.
 
stdClass $record
 Slot's properties. More...
 
core_tag_tag[] $tags = []
 List of tags for this slot.
 

Detailed Description

Class slot_random, represents a random question slot type.

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

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