. /** * Provides useful functions related to setting up the page. * * @package mod_htmlcert * @copyright 2016 Mark Nelson , 2021 Klaus-Uwe Mitterer * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace mod_htmlcert; defined('MOODLE_INTERNAL') || die(); /** * Class helper. * * Provides useful functions. * * @package mod_htmlcert * @copyright 2016 Mark Nelson , Klaus-Uwe Mitterer * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class page_helper { /** * Sets up the page variables. * * @param \moodle_url $pageurl * @param \context $context * @param string $title the page title */ public static function page_setup($pageurl, $context, $title) { global $COURSE, $PAGE, $SITE; $PAGE->set_url($pageurl); $PAGE->set_context($context); $PAGE->set_title(format_string($title)); // If we are in the system context then we are managing templates, and we want to show that in the navigation. if ($context->contextlevel == CONTEXT_SYSTEM) { $PAGE->set_pagelayout('admin'); $PAGE->set_heading($SITE->fullname); $urloverride = new \moodle_url('/admin/settings.php?section=modsettinghtmlcert'); \navigation_node::override_active_url($urloverride); } else { $PAGE->set_heading(format_string($COURSE->fullname)); } } }