Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
lesson_page_type_manager Class Reference

A management class for page types. More...

Public Member Functions

 get_add_page_type_links ($previd)
 Returns an array of links to use as add page links.
 
 get_page_form ($type, $arguments)
 Fetches an mform that can be used to create/edit an page.
 
 get_page_type_idstring ($id)
 Returns the basic string used to identify a page type provided with an id.
 
 get_page_type_strings ($type=null, $special=true)
 Returns an array of strings to describe the loaded page types.
 
 load_all_pages (lesson $lesson)
 This function loads ALL pages that belong to the lesson.
 
 load_lesson_types (lesson $lesson)
 Finds and loads all lesson page types in mod/lesson/pagetypes.
 
 load_page ($pageid, lesson $lesson)
 Loads a page for the provided lesson given it's id.
 

Static Public Member Functions

static get (lesson $lesson)
 Retrieves the lesson page type manager object.
 

Protected Member Functions

 check_page_order ($page1, $page2)
 This function detects errors in the ordering between 2 pages and updates the page records.
 

Protected Attributes

array $types = array()
 An array of different page type classes.
 

Detailed Description

A management class for page types.

This class is responsible for managing the different pages. A manager object can be retrieved by calling the following line of code: $manager = lesson_page_type_manager\get($lesson); The first time the page type manager is retrieved the it includes all of the different page types located in mod/lesson/pagetypes.

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

Member Function Documentation

◆ check_page_order()

lesson_page_type_manager::check_page_order ( $page1,
$page2 )
protected

This function detects errors in the ordering between 2 pages and updates the page records.

Parameters
stdClass$page1Either the first of 2 pages or null if the $page2 param is the first in the list.
stdClass$page1Either the second of 2 pages or null if the $page1 param is the last in the list.

◆ get()

static lesson_page_type_manager::get ( lesson $lesson)
static

Retrieves the lesson page type manager object.

If the object hasn't yet been created it is created here.

@staticvar lesson_page_type_manager $pagetypemanager

Parameters
lesson$lesson
Return values
lesson_page_type_manager

◆ get_add_page_type_links()

lesson_page_type_manager::get_add_page_type_links ( $previd)

Returns an array of links to use as add page links.

Parameters
int$previdThe id of the previous page
Return values
array

◆ get_page_form()

lesson_page_type_manager::get_page_form ( $type,
$arguments )

Fetches an mform that can be used to create/edit an page.

Parameters
int$typeThe id for the page type
array$argumentsAny arguments to pass to the mform
Return values
lesson_add_page_form_base

◆ get_page_type_idstring()

lesson_page_type_manager::get_page_type_idstring ( $id)

Returns the basic string used to identify a page type provided with an id.

This string can be used to instantiate or identify the page type class. If the page type id is unknown then 'unknown' is returned

Parameters
int$id
Return values
string

◆ get_page_type_strings()

lesson_page_type_manager::get_page_type_strings ( $type = null,
$special = true )

Returns an array of strings to describe the loaded page types.

Parameters
int$typeCan be used to return JUST the string for the requested type
Return values
array

◆ load_all_pages()

lesson_page_type_manager::load_all_pages ( lesson $lesson)

This function loads ALL pages that belong to the lesson.

Parameters
lesson$lesson
Return values
arrayAn array of lesson_page_type_*

◆ load_lesson_types()

lesson_page_type_manager::load_lesson_types ( lesson $lesson)

Finds and loads all lesson page types in mod/lesson/pagetypes.

Parameters
lesson$lesson

◆ load_page()

lesson_page_type_manager::load_page ( $pageid,
lesson $lesson )

Loads a page for the provided lesson given it's id.

This function loads a page from the lesson when given both the lesson it belongs to as well as the page's id. If the page doesn't exist an error is thrown

Parameters
int$pageidThe id of the page to load
lesson$lessonThe lesson the page belongs to
Return values
lesson_pageA class that extends lesson_page

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