Quantcast
Channel: General developer forum
Viewing all articles
Browse latest Browse all 37670

Re: Adding a new Site Administration Menu Item

$
0
0
by Andrew Normore.  

More Info:
I'm extending some features of the /course plugin. I'm just trying to get a user to the appropriate place. Here's some more code that I found, what exactly does this do?

// -----------
// Navigation Fix
// -----------
// Unfortunately the navigation never generates correctly for this page because technically this page doesn't actually
// exist on the navigation; you get here through the course management page.
// First up we'll try to make the course management page active seeing as that is where the user thinks they are.
// The big prolem here is that the course management page is a common page for both editing users and common users and
// is only added to the admin tree if the user has permission to edit at the system level.
$node = $PAGE->settingsnav->get('root');
if ($node) {
$node = $node->get('courses');
if ($node) {
$node = $node->get('coursemgmt');
}
}
if ($node) {
// The course management page exists so make that active.
$node->make_active();
} else {
// Failing that we'll override the URL, not as accurate and chances are things
// won't be 100% correct all the time but should work most times.
// A common reason to arrive here is having the management capability within only a particular category (not at system level).
navigation_node::override_active_url(new moodle_url('/course/index.php', array('categoryedit' => 'on')));
}

 

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 37670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>