Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250530) (c39b7370636)
|
Public Member Functions | |
__get ($name) | |
PHP overloading magic to make the $PAGE->course syntax work by redirecting it to the corresponding $PAGE->magic_get_course() method if there is one, and throwing an exception if not. | |
__set ($name, $value) | |
PHP overloading magic to catch obvious coding errors. | |
debug_summary () | |
Get a description of this page. | |
end_collecting_javascript_requirements () | |
Switches back from collecting fragment JS requirement to the original requirement manager. | |
force_settings_menu ($forced=true) | |
Force the settings menu to be displayed on this page. | |
get_renderer ($component, $subtype=null, $target=null) | |
Returns instance of page renderer. | |
has_navbar () | |
Checks to see if there are any items on the navbar object. | |
is_settings_menu_forced () | |
Check to see if the settings menu is forced to display on this activity / resource page. | |
start_collecting_javascript_requirements () | |
Switches from the regular requirements manager to the fragment requirements manager to capture all necessary JavaScript to display a chunk of HTML such as an mform. | |
user_allowed_editing () | |
Does the user have permission to see this page in editing mode. | |
user_can_edit_blocks () | |
Does the user have permission to edit blocks on this page. | |
user_is_editing () | |
Should the current user see this page in editing mode. | |
Protected Member Functions | |
magic_get_activityheader () | |
Returns the activity header object. | |
magic_get_activityname () | |
Please do not call this method directly, use the ->activityname syntax. | |
magic_get_activityrecord () | |
Please do not call this method directly, use the ->activityrecord syntax. | |
magic_get_alternateversions () | |
The list of alternate versions of this page. | |
magic_get_blockmanipulations () | |
Returns an array of minipulations or false if there are none to make. | |
magic_get_blocks () | |
Please do not call this method directly, use the ->blocks syntax. | |
magic_get_bodyclasses () | |
Please do not call this method directly, use the ->bodyclasses syntax. | |
magic_get_bodyid () | |
Please do not call this method directly, use the ->pagetype syntax. | |
magic_get_button () | |
Please do not call this method directly, use the ->button syntax. | |
magic_get_cacheable () | |
Please do not call this method directly, use the ->cacheable syntax. | |
magic_get_categories () | |
Please do not call this method directly, use the ->categories syntax. | |
magic_get_category () | |
Please do not call this method directly, use the ->category syntax. | |
magic_get_cm () | |
Please do not call this method directly, use the ->cm syntax. | |
magic_get_context () | |
Please do not call this method directly, use the ->context syntax. | |
magic_get_course () | |
Please do not call this method directly, use the ->course syntax. | |
magic_get_devicetypeinuse () | |
Please do not call this method directly, use the ->devicetypeinuse syntax. | |
magic_get_docspath () | |
Please do not call this method directly, use the ->docspath syntax. | |
magic_get_flatnav () | |
Returns the flat navigation object. | |
magic_get_focuscontrol () | |
Please do not call this method directly, use the ->focuscontrol syntax. | |
magic_get_headerprinted () | |
Please do not call this method directly, use the ->headerprinted syntax. | |
magic_get_heading () | |
Please do not call this method directly, use the ->heading syntax. | |
magic_get_headingmenu () | |
Please do not call this method directly, use the ->heading syntax. | |
magic_get_layout_options () | |
Please do not call this method directly, use the ->layout_options syntax. | |
magic_get_navbar () | |
Return a navbar object. | |
magic_get_navigation () | |
Return the navigation object. | |
magic_get_opencontainers () | |
Please do not call this method directly use the ->opencontainers syntax. | |
magic_get_pagelayout () | |
Please do not call this method directly, use the ->pagelayout syntax. | |
magic_get_pagetype () | |
Please do not call this method directly, use the ->pagetype syntax. | |
magic_get_periodicrefreshdelay () | |
Please do not call this method directly use the ->periodicrefreshdelay syntax moodle_page::__get(). | |
magic_get_primarynav () | |
Returns the primary navigation object. | |
magic_get_primarynavcombined () | |
Returns the primary navigation object. | |
magic_get_requestip () | |
Returns request IP address. | |
magic_get_requestorigin () | |
Returns the origin of current request. | |
magic_get_requires () | |
Please do not call this method directly, use the ->requires syntax. | |
magic_get_secondarynav () | |
Returns the secondary navigation object. | |
magic_get_settingsnav () | |
Returns the settings navigation object. | |
magic_get_state () | |
Please do not call this method directly, use the ->state syntax. | |
magic_get_subpage () | |
Please do not call this method directly, use the ->subpage syntax. | |
magic_get_theme () | |
Please do not call this method directly, use the ->theme syntax. | |
magic_get_title () | |
Please do not call this method directly, use the ->title syntax. | |
magic_get_url () | |
Please do not call this method directly, use the ->url syntax. | |
Protected Attributes | |
string | $_activekeysecondary = null |
the key of the secondary node to be activated. | |
string | $_activenodeprimary = null |
the key of the primary node to be activated. | |
activity_header | $_activityheader |
The activity header for the page. | |
array | $_alternateversions = array() |
An array of links to alternative versions of this page. | |
bool | $_block_actions_done = false |
An internal flag to record when block actions have been processed. | |
block_manager | $_blocks = null |
The blocks manager for this page. | |
string | $_blockseditingcap = 'moodle/site:manageblocks' |
The capability required by the user in order to edit blocks and block settings on this page. | |
array | $_bodyclasses = array() |
An array of CSS classes that should be added to the body tag in HTML. | |
string | $_button = '' |
HTML to go where the turn on editing button is located. | |
bool | $_cacheable = true |
Sets whether this page should be cached by the browser or not. | |
array | $_categories = null |
This holds any categories that $_course belongs to, starting with the particular category it belongs to, and working out through any parent categories to the top level. | |
cm_info | $_cm = null |
If this page belongs to a module, this is the cm_info module description object. | |
context | $_context = null |
The context that this page belongs to. | |
stdClass | $_course = null |
The course currently associated with this page. | |
string | $_devicetypeinuse = null |
Is set to the name of the device type in use. | |
string | $_docspath = null |
Set a different path to use for the 'Documentation for this page' link. | |
flat_navigation | $_flatnav = null |
Contains a list of nav nodes, most closely related to the current page. | |
string | $_focuscontrol = '' |
Can be set to the ID of an element on the page, if done that element receives focus when the page loads. | |
bool | $_forcelockallblocks = false |
Whether to override/remove all editing capabilities for blocks on the page. | |
bool | $_forcesettingsmenu = false |
Is the settings menu being forced to display on this page (activities / resources only). | |
bool | $_hassecondarynavigation = true |
Should the secondary menu be rendered. | |
bool | $_hastablistsecondarynavigation = false |
Should the secondary menu be rendered as a tablist as opposed to a menubar. | |
array | $_headeractions = [] |
Array of header actions HTML to add to the page header actions menu. | |
string | $_heading = '' |
The string to use as the heading of the page. | |
string | $_headingmenu = null |
The menu (or actions) to display in the heading. | |
bool | $_https_login_required = false |
Used to determine if HTTPS should be required for login. | |
array | $_layout_options = null |
List of theme layout options, these are ignored by core. | |
array | $_legacybrowsers = array('MSIE' => 6.0) |
Associative array of browser shortnames (as used by check_browser_version) and their minimum required versions. | |
string | $_legacyclass = null |
A legacy class that will be added to the body tag. | |
stdClass | $_module = null |
If $_cm is not null, then this will hold the corresponding row from the modname table. | |
navbar | $_navbar = null |
Contains the navbar structure. | |
global_navigation | $_navigation = null |
Contains the global navigation structure. | |
bool | $_navigationoverflow = true |
The value of displaying the navigation overflow. | |
xhtml_container_stack | $_opencontainers |
Tracks XHTML tags on this page that have been opened but not closed. | |
array | $_othereditingcaps = array() |
An array of any other capabilities the current user must have in order to editing the page and/or its content (not just blocks). | |
string | $_pagelayout = 'base' |
The pagelayout to use when displaying this page. | |
string | $_pagetype = null |
The pagetype is used to describe the page and defaults to a representation of the physical path to the page e.g. | |
int | $_periodicrefreshdelay = null |
Sets the page to refresh after a given delay (in seconds) using meta refresh in standard_head_html() in outputlib.php If set to null(default) the page is not refreshed. | |
bool | $_popup_notification_allowed = true |
Determines if popup notifications allowed on this page. | |
primary | $_primarynav = null |
Contains the nav nodes that will appear in the primary navigation. | |
primaryoutput | $_primarynavcombined = null |
Contains the combined nav nodes that will appear in the primary navigation. | |
bool | $_regionmainsettingsinheader = false |
Should the region main settings menu be rendered in the header. | |
page_requirements_manager | $_requires = null |
Page requirements manager. | |
secondary | $_secondarynav = null |
Contains the nav nodes that will appear in the secondary navigation. | |
settings_navigation | $_settingsnav = null |
Contains the settings navigation structure. | |
bool bool | $_showcourseindex = true |
Indicates whether the course index drawer should be shown. | |
int | $_state = self::STATE_BEFORE_HEADER |
The current state of the page. | |
string | $_subpage = '' |
An optional arbitrary parameter that can be set on pages where the context and pagetype is not enough to identify the page. | |
theme_config | $_theme = null |
The theme to use with this page. | |
string | $_title = '' |
The title for the page. | |
moodle_url | $_url = null |
The URL for this page. | |
array | $_wherethemewasinitialised = null |
stack trace. | |
page_requirements_manager | $savedrequires = null |
Saves the requirement manager object used before switching to to fragments one. | |
moodle_page::__get | ( | $name | ) |
PHP overloading magic to make the $PAGE->course syntax work by redirecting it to the corresponding $PAGE->magic_get_course() method if there is one, and throwing an exception if not.
string | $name | property name |
mixed |
coding_exception |
moodle_page::__set | ( | $name, | |
$value ) |
PHP overloading magic to catch obvious coding errors.
This method has been created to catch obvious coding errors where the developer has tried to set a page property using $PAGE->key = $value. In the moodle_page class all properties must be set using the appropriate $PAGE->set_something($value) method.
string | $name | property name |
mixed | $value | Value |
void | Throws exception if field not defined in page class |
coding_exception |
moodle_page::debug_summary | ( | ) |
Get a description of this page.
Normally displayed in the footer in developer debug mode.
string |
moodle_page::force_settings_menu | ( | $forced = true | ) |
Force the settings menu to be displayed on this page.
This will only force the settings menu on an activity / resource page that is being displayed on a theme that uses a settings menu.
bool | $forced | default of true, can be sent false to turn off the force. |
moodle_page::get_renderer | ( | $component, | |
$subtype = null, | |||
$target = null ) |
Returns instance of page renderer.
string | $component | name such as 'core', 'mod_forum' or 'qtype_multichoice'. |
string | $subtype | optional subtype such as 'news' resulting to 'mod_forum_news' |
string | $target | one of rendering target constants |
renderer_base |
moodle_page::has_navbar | ( | ) |
Checks to see if there are any items on the navbar object.
bool | true if there are, false if not |
moodle_page::is_settings_menu_forced | ( | ) |
Check to see if the settings menu is forced to display on this activity / resource page.
This only applies to themes that use the settings menu.
bool | True if the settings menu is forced to display. |
|
protected |
Returns the activity header object.
activity_header |
|
protected |
Please do not call this method directly, use the ->activityname syntax.
string | the The type of activity we are in, for example 'forum' or 'quiz'. Will be null if this page is not within a module. |
|
protected |
Please do not call this method directly, use the ->activityrecord syntax.
stdClass | the row from the activities own database table (for example the forum or quiz table) that this page belongs to. Will be null if this page is not within a module. |
|
protected |
The list of alternate versions of this page.
array | mime type => object with ->url and ->title. |
|
protected |
Returns an array of minipulations or false if there are none to make.
bool|array |
|
protected |
Please do not call this method directly, use the ->blocks syntax.
block_manager | the blocks manager object for this page. |
|
protected |
Please do not call this method directly, use the ->bodyclasses syntax.
string | the class names to put on the body element in the HTML. |
|
protected |
Please do not call this method directly, use the ->pagetype syntax.
string | The id to use on the body tag, uses magic_get_pagetype(). |
|
protected |
Please do not call this method directly, use the ->button syntax.
string | the HTML to go where the Turn editing on button normally goes. |
|
protected |
Please do not call this method directly, use the ->cacheable syntax.
bool | can this page be cached by the user's browser. |
|
protected |
Please do not call this method directly, use the ->categories syntax.
array | an array of all the categories the page course belongs to, starting with the immediately containing category, and working out to the top-level category. This may be the empty array if we are in the front page course. |
|
protected |
Please do not call this method directly, use the ->category syntax.
stdClass|null | the category that the page course belongs to. If there isn't one (that is, if this is the front page course) returns null. |
|
protected |
Please do not call this method directly, use the ->cm syntax.
cm_info | the course_module that this page belongs to. Will be null if this page is not within a module. This is a full cm object, as loaded by get_coursemodule_from_id or get_coursemodule_from_instance, so the extra modname and name fields are present. |
|
protected |
Please do not call this method directly, use the ->context syntax.
context | the main context to which this page belongs. |
|
protected |
Please do not call this method directly, use the ->course syntax.
stdClass | the current course that we are inside - a row from the course table. (Also available as $COURSE global.) If we are not inside an actual course, this will be the site course. |
|
protected |
Please do not call this method directly, use the ->devicetypeinuse syntax.
string | The device type being used. |
|
protected |
Please do not call this method directly, use the ->docspath syntax.
string | the path to the Documentation for this page. |
|
protected |
Returns the flat navigation object.
flat_navigation |
|
protected |
Please do not call this method directly, use the ->focuscontrol syntax.
string | the id of the HTML element to be focused when the page has loaded. |
|
protected |
Please do not call this method directly, use the ->headerprinted syntax.
bool | has the header already been printed? |
|
protected |
Please do not call this method directly, use the ->heading syntax.
string | the main heading that should be displayed at the top of the <body>. |
|
protected |
Please do not call this method directly, use the ->heading syntax.
string | The menu (or actions) to display in the heading |
|
protected |
Please do not call this method directly, use the ->layout_options syntax.
array | returns arrays with options for layout file |
|
protected |
Return a navbar object.
navbar |
|
protected |
Return the navigation object.
global_navigation |
|
protected |
Please do not call this method directly use the ->opencontainers syntax.
xhtml_container_stack | tracks XHTML tags on this page that have been opened but not closed. mainly for internal use by the rendering code. |
|
protected |
Please do not call this method directly, use the ->pagelayout syntax.
string | the general type of page this is. For example 'standard', 'popup', 'home'. Allows the theme to display things differently, if it wishes to. |
|
protected |
Please do not call this method directly, use the ->pagetype syntax.
string | e.g. 'my-index' or 'mod-quiz-attempt'. |
|
protected |
Please do not call this method directly use the ->periodicrefreshdelay syntax moodle_page::__get().
int | The periodic refresh delay to use with meta refresh |
|
protected |
Returns the primary navigation object.
primary |
|
protected |
Returns the primary navigation object.
primaryoutput |
|
protected |
Returns request IP address.
string | IP address or null if unknown |
|
protected |
Returns the origin of current request.
Note: constants are not required because we need to use these values in logging and reports.
string | 'web', 'ws', 'cli', 'restore', etc. |
|
protected |
Please do not call this method directly, use the ->requires syntax.
page_requirements_manager | tracks the JavaScript, CSS files, etc. required by this page. |
|
protected |
Returns the secondary navigation object.
secondary |
|
protected |
Returns the settings navigation object.
settings_navigation |
|
protected |
Please do not call this method directly, use the ->state syntax.
integer | one of the STATE_XXX constants. You should not normally need to use this in your code. It is intended for internal use by this class and its friends like print_header, to check that everything is working as expected. Also accessible as $PAGE->state. |
|
protected |
Please do not call this method directly, use the ->subpage syntax.
string | The subpage identifier, if any. |
|
protected |
Please do not call this method directly, use the ->theme syntax.
theme_config | the initialised theme for this page. |
|
protected |
Please do not call this method directly, use the ->title syntax.
string | the title that should go in the <head> section of the HTML of this page. |
|
protected |
Please do not call this method directly, use the ->url syntax.
moodle_url | the clean URL required to load the current page. (You should normally use this in preference to $ME or $FULLME.) |
moodle_page::start_collecting_javascript_requirements | ( | ) |
Switches from the regular requirements manager to the fragment requirements manager to capture all necessary JavaScript to display a chunk of HTML such as an mform.
This is for use by the get_fragment() web service and not for use elsewhere.
moodle_page::user_allowed_editing | ( | ) |
Does the user have permission to see this page in editing mode.
bool |
moodle_page::user_can_edit_blocks | ( | ) |
Does the user have permission to edit blocks on this page.
Can be forced to false by calling the force_lock_all_blocks() method.
bool |
moodle_page::user_is_editing | ( | ) |
Should the current user see this page in editing mode.
That is, are they allowed to edit this page, and are they currently in editing mode.
bool |
|
protected |
An array of links to alternative versions of this page.
Primarily used for RSS versions of the current page.
|
protected |
An internal flag to record when block actions have been processed.
Remember block actions occur on the current URL and it is important that even they are never executed more than once.
|
protected |
The blocks manager for this page.
It is responsible for the blocks and there content on this page.
|
protected |
HTML to go where the turn on editing button is located.
This is nearly a legacy item and not used very often any more.
|
protected |
Sets whether this page should be cached by the browser or not.
If it is set to true (default) the page is served with caching headers.
|
protected |
This holds any categories that $_course belongs to, starting with the particular category it belongs to, and working out through any parent categories to the top level.
These are loaded progressively, if needed. There are three states. $_categories = null initially when nothing is loaded; $_categories = array($id => $cat, $parentid => null) when we have loaded $_course->category, but not any parents; and a complete array once everything is loaded.
|
protected |
The course currently associated with this page.
If not has been provided the front page course is used.
|
protected |
Is set to the name of the device type in use.
This will we worked out when it is first used.
|
protected |
Set a different path to use for the 'Documentation for this page' link.
By default, it uses the path of the file for instance mod/quiz/attempt.
|
protected |
Is the settings menu being forced to display on this page (activities / resources only).
This is only used by themes that use the settings menu.
|
protected |
The string to use as the heading of the page.
Shown near the top of the page within most themes.
|
protected |
List of theme layout options, these are ignored by core.
To be used in individual theme layout files only.
|
protected |
If $_cm is not null, then this will hold the corresponding row from the modname table.
For example, if $_cm->modname is 'quiz', this will be a row from the quiz table.
|
protected |
The pagelayout to use when displaying this page.
The pagelayout needs to have been defined by the theme in use, or one of its parents. By default base is used however standard is the more common layout. Note that this gets automatically set by core during operations like require_login.
|
protected |
The pagetype is used to describe the page and defaults to a representation of the physical path to the page e.g.
my-index, mod-quiz-attempt
|
protected |
Determines if popup notifications allowed on this page.
Code such as the quiz module disables popup notifications in situations such as upgrading or completing a quiz.
|
protected |
Contains the combined nav nodes that will appear in the primary navigation.
Includes - primarynav, langmenu, usermenu
|
protected |
Page requirements manager.
It is responsible for all JavaScript and CSS resources required by this page.
|
protected |
The current state of the page.
The state a page is within determines what actions are possible for it.
|
protected |
The theme to use with this page.
This has to be properly initialised via moodle_page::initialise_theme_and_output() which happens magically before any operation that requires it.
|
protected |
The title for the page.
Used within the title tag in the HTML head.
|
protected |
The URL for this page.
This is mandatory and must be set before output is started.
|
protected |
stack trace.
Then the theme is initialised, we save the stack trace, for use in error messages.