Skip to content

Instantly share code, notes, and snippets.

@nadavkav
Last active October 25, 2022 16:36
Show Gist options
  • Save nadavkav/e704d784e696dd14ff3f2b5ae015c9cc to your computer and use it in GitHub Desktop.
Save nadavkav/e704d784e696dd14ff3f2b5ae015c9cc to your computer and use it in GitHub Desktop.
Add MEDIAL "Dashboard" link to course menu
// This function can be added to the end of local/helixmedia/lib.php
// Add MEDIAL "Dashboard" link to course menu
function local_helixmedia_extend_navigation_course($parentnode, $course, $context) {
//if ($settingnode = $parentnode->find('courseadmin', navigation_node::TYPE_COURSE)) {
global $CFG;
require_once($CFG->dirroot.'/mod/helixmedia/lib.php');
$preid = helixmedia_preallocate_id();
$name = get_string('pluginname', 'helixmedia');
$url = new moodle_url('/mod/helixmedia/launch.php',
array('type' => '3', 'l' => $preid, 'course' => $PAGE->course->id,
'ret' => base64_encode(curpageurl()) ));
$navnode = navigation_node::create(
$name,
$url,
navigation_node::NODETYPE_LEAF,
'medial',
'medial',
new pix_icon('i/edit', $name)
);
if ($PAGE->url->compare($url, URL_MATCH_BASE)) {
$navnode->make_active();
}
//$settingnode->add_node($navnode);
$parentnode->add_node($navnode);
//}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment