$currentitypath = optional_param('currentitypath', '', PARAM_TEXT); if (!empty($currentitypath)) { //parameter is set directly, so use it $USER->currentitypath = $currentitypath; } else { //determine whether to unset the parameter based on comparing the current //page type with the last entity set $effective_entity_type = $page->get_page_context(); if (isset($USER->currentitypath)) { $id = optional_param('id', 0, PARAM_INT); // TBV $parts = explode('/', $USER->currentitypath); $final_part = $parts[count($parts) - 1]; $parts = explode('-', $final_part); if (!$id || $parts[0] != $effective_entity_type) { unset($USER->currentitypath); } } } if ($page instanceof newpage) { global $CURMAN; $CURMAN->page = $page; $page->print_page(); die; } /// This page has been customized to work in the "My Moodle" page of Moodle. include 'mymoodlepagestart.php'; /// This is standard curriculum manager. echo $page->get_body(); /// This page has been customized to work in the "My Moodle" page of Moodle. include 'mymoodlepageend.php';