How to add new menu in administration nevigation bar?

How to add new menu in administration nevigation bar?

by Sovan Bhattacharjee -
Number of replies: 3

Hyy guys I am begineer in moodle plz any body can help me how to add a plugin link as a menu under My profile setting -> activity report in left administration navigation bar. Is it possible? if possible plz plz plz help me...

Thank you! / 

Attachment Screenshot from 2015-05-21 141354.png
Average of ratings: -
In reply to Sovan Bhattacharjee

Re: How to add new menu in administration nevigation bar?

by Sovan Bhattacharjee -
any body plz help about that which I describe above. plz plz plz hlp me...
In reply to Sovan Bhattacharjee

Re: How to add new menu in administration nevigation bar?

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

Have a look at how other reports do it - e.g. at the report_outline_extend_navigation_user() callback.

Average of ratings: Useful (1)
In reply to Sovan Bhattacharjee

Re: How to add new menu in administration nevigation bar?

by Franco Pantoja -
Picture of Particularly helpful Moodlers

HI Sovan

as David tells us, you could use this function, located in report/youreport/lib.php

/**
 * This function extends the course navigation with the report items
 *
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass $course The course to object for the report
 * @param stdClass $context The context of the course
 */
function report_myreport_extend_navigation_course($navigation, $course, $context) {
    if (has_capability('report/myreport:view', $context)) {
        $url = new moodle_url('/report/myreport/index.php', array('id'=>$course->id));
        $navigation->add(get_string('pluginname', 'report_myreport'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
    }
}

I hope It can be helpful


Regards!