Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
mod_quiz\repaginate Class Reference

Public Member Functions

 __construct ($quizid=0, $slots=null)
 Constructor.
 
 repaginate_n_question_per_page ($slots, $number)
 Return the slots with the new pagination, regardless of current pagination.
 
 repaginate_next_slot ($nextslotnumber, $type)
 Repaginate next slot and return the modified slot object.
 
 repaginate_slots ($nextslotnumber, $type)
 Repaginate, update DB and slots object.
 
 repaginate_the_rest ($quizslots, $slotfrom, $type, $dbupdate=true)
 Repaginate the rest.
 

Public Attributes

int const LINK = 1
 means join pages.
 
int const UNLINK = 2
 means split pages.
 

Protected Member Functions

 get_slots_by_slot_number ($slots)
 Return array of slots with slot number as key.
 
 get_slots_by_slotid ($slots)
 Return array of slots with slot id as key.
 
 get_this_slot ($slots, $slotnumber)
 Return current slot object.
 
 repaginate_this_slot ($slot, $newpagenumber)
 Repaginate a given slot with the given pagenumber.
 

Constructor & Destructor Documentation

◆ __construct()

mod_quiz\repaginate::__construct ( $quizid = 0,
$slots = null )

Constructor.

Parameters
int$quizidthe id of the quiz being manipulated.
stdClass[]$slotsthe quiz_slots for that quiz.

Member Function Documentation

◆ get_slots_by_slot_number()

mod_quiz\repaginate::get_slots_by_slot_number ( $slots)
protected

Return array of slots with slot number as key.

Parameters
stdClass[]$slots
Return values
stdClass[]

◆ get_slots_by_slotid()

mod_quiz\repaginate::get_slots_by_slotid ( $slots)
protected

Return array of slots with slot id as key.

Parameters
stdClass[]$slots
Return values
stdClass[]

◆ get_this_slot()

mod_quiz\repaginate::get_this_slot ( $slots,
$slotnumber )
protected

Return current slot object.

Parameters
array$slots
int$slotnumber
Return values
stdClass\$slot

◆ repaginate_n_question_per_page()

mod_quiz\repaginate::repaginate_n_question_per_page ( $slots,
$number )

Return the slots with the new pagination, regardless of current pagination.

Parameters
stdClass[]$slotsthe slots to repaginate.
int$numbernumber of question per page
Return values
stdClass[]the updated slots.

◆ repaginate_next_slot()

mod_quiz\repaginate::repaginate_next_slot ( $nextslotnumber,
$type )

Repaginate next slot and return the modified slot object.

Parameters
int$nextslotnumber
int$typerepaginate\LINK or repaginate\UNLINK.
Return values
stdClass|null

◆ repaginate_slots()

mod_quiz\repaginate::repaginate_slots ( $nextslotnumber,
$type )

Repaginate, update DB and slots object.

Parameters
int$nextslotnumber
int$typerepaginate\LINK or repaginate\UNLINK.

◆ repaginate_the_rest()

mod_quiz\repaginate::repaginate_the_rest ( $quizslots,
$slotfrom,
$type,
$dbupdate = true )

Repaginate the rest.

Parameters
stdClass[]$quizslots
int$slotfrom
int$type
bool$dbupdate
Return values
stdClass[]

◆ repaginate_this_slot()

mod_quiz\repaginate::repaginate_this_slot ( $slot,
$newpagenumber )
protected

Repaginate a given slot with the given pagenumber.

Parameters
stdClass$slot
int$newpagenumber
Return values
stdClass

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