Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
mod_quiz\repaginate Class Reference

The repaginate class will rearrange questions in pages. More...

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.
 

Detailed Description

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.

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

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: