Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Defines the \mod_quiz\local\structure\slot_random class.

Copyright: 2018 Shamim Rezaie <shamim@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 196 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

slot_random:: (6 methods):
  __construct()
  get_quiz()
  set_quiz()
  set_tags()
  set_tags_by_id()
  insert()


Class: slot_random  - X-Ref

Class slot_random, represents a random question slot type.

__construct($slotrecord = null)   X-Ref
slot_random constructor.

param: \stdClass $slotrecord Represents a record in the quiz_slots table.

get_quiz()   X-Ref
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: mixed

set_quiz($quiz)   X-Ref
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.

param: \stdClass $quiz The qui object.

set_tags($tags)   X-Ref
Set some tags for this quiz slot.

param: \core_tag_tag[] $tags

set_tags_by_id($tagids)   X-Ref
Set some tags for this quiz slot. This function uses tag ids to find tags.

param: int[] $tagids

insert($page)   X-Ref
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.

param: int $page The page that this slot will be inserted at.