Advice to create a displayable menu for categories listing all courses

Advice to create a displayable menu for categories listing all courses

by Mari Cruz García -
Number of replies: 0

Hello,

I need to displayed the list of all our courses in a block which will be only available to admins and course officer. I have done that by modifying the code of the block ‘Courses’. However, what I would like to do know is to show in that block the list of all our categories so that when admins click on that list all the courses under that categories appear, exactly the same as ‘My courses’ in the navigation bar (see the screenshot attached).

 

This is the code to list all the courses:

 

if (empty($CFG->disablemycourses) and isloggedin() and !isguestuser() and

          (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) and $adminseesall)) {    // Just print My Courses

            if ($courses = get_courses('all', 'c.fullname ASC')) {

                foreach ($courses as $course) {

                    $linkcss = $course->visible ? "" : " class=\"dimmed\" ";

                    $this->content->items[]="<a $linkcss title=\"" . format_string($course->shortname) . "\" ".

                               "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">".$icon.format_string($course->fullname). "</a>";

                }

                $this->title = get_string('mycourses');

 

But, in I don’t know in which part of the Navigation bar block is implemented the code to show a displayable menu like the one in the screenshot.

 

Can you please advice?

Average of ratings: -