I need to build a menu item under the "Site Administration->Courses" block, with minimum changes on core files. Can anyone give me some guideline about how to? Thanks!
How to build a main menu under the "Site Administration->Courses" block?
Re: How to build a main menu under the "Site Administration->Courses" block?
You can extend the navigation using a local plugin (https://docs.moodle.org/dev/Navigation_API#Local_Plugins). I can't remember the exact details of how to do it, but you basically construct a new navigation node then add it to the courses node in the menu. Hopefully you'll work it out from the documentation!
Re: How to build a main menu under the "Site Administration->Courses" block?
Thanks Michael!
Based on the document you pointed to, I can successfully add a node onto the Navigation block with below:
local/myplugin/lib.php
function local_myplugin_extends_navigation(global_navigation $navigation) {
$nodeCatalog = $navigation->add('Catalog);
}
Tying to do the similar but adding a note to SiteAdmid->Course is not working with below:
local/schedule/lib.php
function schdule_extend_navigation_course(navigation_node $parentnode, stdClass $course, context_course $context) {
$coursenode = $PAGE->navigation->find($courseid, navigation_node::TYPE_COURSE);
$thingnode = $coursenode->add(get_string('Schedule);
$thingnode->make_active();
}
Can you or any one help me to point out what is wrong? Thanks.
Re: How to build a main menu under the "Site Administration->Courses" block?
If I remember correctly, the most difficult thing with this is trying to find the correct parent node, as you need to look through the code to find out where it's created to get its key and node type. It's a long time since I did this, so I'm afraid I can't offer much more help, but maybe someone else will be able to come up with a better way to do it. Good luck!