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]

Page helper.

Copyright: 2015 Frédéric Massart - FMCorz.net
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 476 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: page_helper  - X-Ref

Page helper.

setup_for_course(moodle_url $url, $course, $subtitle = '')   X-Ref
Set-up a course page.

Example:
list($title, $subtitle) = page_helper::setup_for_course($pagecontextid, $url, $course, $pagetitle);
echo $OUTPUT->heading($title);
echo $OUTPUT->heading($subtitle, 3);

param: moodle_url $url The current page.
param: stdClass $course The course.
param: string $subtitle The title of the subpage, if any.
return: array With the following:

setup_for_template($pagecontextid, moodle_url $url, $template = null, $subtitle = '',$returntype = null)   X-Ref
Set-up a template page.

Example:
list($title, $subtitle) = page_helper::setup_for_template($pagecontextid, $url, $template, $pagetitle);
echo $OUTPUT->heading($title);
echo $OUTPUT->heading($subtitle, 3);

param: int $pagecontextid The page context ID.
param: moodle_url $url The current page.
param: \core_competency\template $template The template, if any.
param: string $subtitle The title of the subpage, if any.
param: string $returntype The desired return page.
return: array With the following:

setup_for_plan($userid, moodle_url $url, $plan = null, $subtitle = '', $returntype = null)   X-Ref
Set-up a plan page.

Example:
list($title, $subtitle) = page_helper::setup_for_plan($url, $template, $pagetitle);
echo $OUTPUT->heading($title);
echo $OUTPUT->heading($subtitle, 3);

param: int $userid The user ID.
param: moodle_url $url The current page.
param: \core_competency\plan $plan The plan, if any.
param: string $subtitle The title of the subpage, if any.
param: string $returntype The desired return page.
return: array With the following:

setup_for_user_evidence($userid, moodle_url $url, $evidence = null, $subtitle = '', $returntype = null)   X-Ref
Set-up a user evidence page.

Example:
list($title, $subtitle) = page_helper::setup_for_user_evidence($url, $template, $pagetitle);
echo $OUTPUT->heading($title);
echo $OUTPUT->heading($subtitle, 3);

param: int $userid The user ID.
param: moodle_url $url The current page.
param: \core_competency\user_evidence $evidence The user evidence, if any.
param: string $subtitle The title of the subpage, if any.
param: string $returntype The desired return page.
return: array With the following:

setup_for_framework($id, $pagecontextid, $framework = null, $returntype = null)   X-Ref
Set-up a framework page.

Example:
list($pagetitle, $pagesubtitle, $url, $frameworksurl) = page_helper::setup_for_framework($id, $pagecontextid);
echo $OUTPUT->heading($pagetitle);
echo $OUTPUT->heading($pagesubtitle, 3);

param: int $id The framework ID.
param: int $pagecontextid The page context ID.
param: \core_competency\competency_framework $framework The framework.
param: string $returntype The desired return page.
return: array With the following:

setup_for_competency($pagecontextid, moodle_url $url, $framework, $competency = null, $parent = null)   X-Ref
Set-up a competency page.

Example:
list($title, $subtitle) = page_helper::setup_for_competency($pagecontextid, $url, $competency, $pagetitle);
echo $OUTPUT->heading($title);
echo $OUTPUT->heading($subtitle, 3);

param: int $pagecontextid The page context ID.
param: moodle_url $url The current page.
param: \core_competency\competency_framework $framework The competency framework.
param: \core_competency\competency $competency The competency, if any.
param: \core_competency\competency $parent The parent competency, if any.
return: array With the following: