Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 402] [Versions 311 and 403]

Defines the quiz repaginate class.

Copyright: 2014 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 234 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: repaginate  - X-Ref

The repaginate class will rearrange questions in pages.

The quiz setting allows users to write quizzes with one question per page,
n questions per page, or all questions on one page.

__construct($quizid = 0, $slots = null)   X-Ref
Constructor.

param: int $quizid the id of the quiz being manipulated.
param: stdClass[] $slots the quiz_slots for that quiz.

repaginate_this_slot($slot, $newpagenumber)   X-Ref
Repaginate a given slot with the given pagenumber.

param: stdClass $slot
param: int $newpagenumber
return: stdClass

get_this_slot($slots, $slotnumber)   X-Ref
Return current slot object.

param: array $slots
param: int $slotnumber
return: stdClass $slot

get_slots_by_slot_number($slots)   X-Ref
Return array of slots with slot number as key

param: stdClass[] $slots
return: stdClass[]

get_slots_by_slotid($slots)   X-Ref
Return array of slots with slot id as key

param: stdClass[] $slots
return: stdClass[]

repaginate_slots($nextslotnumber, $type)   X-Ref
Repaginate, update DB and slots object

param: int $nextslotnumber
param: int $type repaginate::LINK or repaginate::UNLINK.

repaginate_next_slot($nextslotnumber, $type)   X-Ref
Repaginate next slot and return the modified slot object

param: int $nextslotnumber
param: int $type repaginate::LINK or repaginate::UNLINK.
return: stdClass|null

repaginate_n_question_per_page($slots, $number)   X-Ref
Return the slots with the new pagination, regardless of current pagination.

param: stdClass[] $slots the slots to repaginate.
param: int $number number of question per page
return: stdClass[] the updated slots.

repaginate_the_rest($quizslots, $slotfrom, $type, $dbupdate = true)   X-Ref
Repaginate the rest.

param: stdClass[] $quizslots
param: int $slotfrom
param: int $type
param: bool $dbupdate
return: stdClass[]