Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

(no description)

File Size: 233 lines (7 kb)
Included or required:0 times
Referenced: 1 time
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[]