mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-33017 navigation: added current course and simplified loading
This commit is contained in:
parent
6caf3f5c74
commit
58b602da8e
3 changed files with 195 additions and 222 deletions
|
@ -36,7 +36,7 @@ try {
|
|||
// Start buffer capture so that we can `remove` any errors
|
||||
ob_start();
|
||||
// Require id This is the key for whatever branch we want to get
|
||||
$branchid = required_param('id', PARAM_INT);
|
||||
$branchid = required_param('id', PARAM_ALPHANUM);
|
||||
// This identifies the type of the branch we want to get
|
||||
$branchtype = required_param('type', PARAM_INT);
|
||||
// This identifies the block instance requesting AJAX extension
|
||||
|
@ -87,8 +87,14 @@ try {
|
|||
}
|
||||
$converter = new navigation_json();
|
||||
|
||||
// Find the actuall branch we are looking for
|
||||
$branch = $navigation->find($branchid, $branchtype);
|
||||
// Find the actual branch we are looking for
|
||||
if ($branchtype != 0) {
|
||||
$branch = $navigation->find($branchid, $branchtype);
|
||||
} else if ($branchid === 'mycourses' || $branchid === 'courses') {
|
||||
$branch = $navigation->find($branchid, navigation_node::TYPE_ROOTNODE);
|
||||
} else {
|
||||
throw new coding_exception('Invalid branch type/id passed to AJAX call to load branches.');
|
||||
}
|
||||
|
||||
// Remove links to categories if required.
|
||||
if (!$linkcategories) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue