willianmano / moodle-theme_moove

A Moodle Boost child theme
GNU General Public License v3.0
171 stars 157 forks source link

Course administration area link missing, can't navigate to Groups, Enrolment methods and Permissions #383

Closed tim1mw closed 2 years ago

tim1mw commented 2 years ago

Describe the bug The course submenu for admins/teachers is missing a link to the course admin area, as accessed by the relative URL "course/admin.php?courseid=" . When using boost, this is normally accessed via the "More" menu option, however when using Moove this menu item does not go to the admin area, but instead presents an incomplete subset of the options available in the admin area. Eg, Groups, Enrolment methods and Permissions are missing.

If there is a way to access these functions, then it is very well hidden and needs to be made more prominent.

To Reproduce Steps to reproduce the behaviour:

  1. Go to a course using Moov theme
  2. Look at the "more" menu option
  3. There is no way to access Groups, Enrolment methods and Permissions options and/or course admin area.

Expected behaviour These options should either be on the menu bar strip (along with any other missing ones) or there should be a link to the course admin area so they can be accessed from there. I would prefer the latter.

Your environment (please complete the following information):

ijuanfe commented 2 years ago

Hi @tim1mw, let me kindly say to you that this is not a theme bug. Moodle changed its way to access the functionalities you mentioned by using the Participants tab. After you click on that tab, it will load a page that has a HTML select tag ('Enrolled users' option is selected by default) with multiple options to choose from, including those you need. I hope this helps.

tim1mw commented 2 years ago

@willianmano I think you have mis-understood my problem here. I can't see any way to navigate to the missing functionality via the Participants tab or to get it to provide equivalent information. The underlying course admin page that has these links is still present in Moodle 4 and is clearly linked if I use the Boost theme. So as far as I can tell there has been no change to the way that you navigate to these items, the issue is that the link to course admin is absent from Moove.

As far as I can tell the following items on course admin page are not included anywhere in the Moove menu, or pages that it links to:

Backup backup/backup.php?id= Restore backup/restorefile.php?contextid= Copy Course /backup/copy.php?id= Groups /group/index.php?id= Other Users /enrol/otherusers.php?id= Permissions /roles/permissions.php?contextid= Enrolment Methods /enrol/instances.php?id=

All of these pages exist within Moodle 4 and are accessible when using Boost, which has a link to the master course admin page where they are located. If you can point me at a way to get to all of the above pages by clicking links in Moove, then that would be great, but as far as I can tell they all inaccessible unless you manually type in the URL for the couse admin page. /course/admin.php?courseid= . A simple link to "Full Course admin" on the More menu pointing at /course/admin.php?courseid= would solve this problem.

Please re-open this issue, this is a show-stopper bug for my Moodle site.

tim1mw commented 2 years ago

So I've had a dig into this, if you debug the output of the context_header_settings_menu() method in lib/outputrenderers.php, the course admin link is present in the html output at this point, however despite being called as part of the code that generates the course page, that HTML isn't used and other html gets rendered, at some point in that process the course admin link seems to be lost.

There is probably a better solution to this, but I've solved it on my site by adding the following method to the theme lib.php file.

function theme_moove_extend_navigation_course($settingsnav, $course, $context) {
    global $CFG, $PAGE;
    // Only let users with the appropriate capability see this settings item. This is not an exhaustive list.
    $context = context_course::instance($course->id);
    if (has_capability('moodle/backup:backupcourse', $context) ||
        has_capability('moodle/course:viewparticipants', $context) ||
        has_capability('report/log:view', $context) ||
        has_capability('report/stats:view', $context) ||
        has_capability('report/completion:view', $context) ||
        has_capability('moodle/course:enrolconfig', $context)) {
        $name = get_string('courseadministration');
        $url = new moodle_url('/course/admin.php', array('courseid' => $course->id));
        $newnode = navigation_node::create(
            $name,
            $url,
            navigation_node::NODETYPE_LEAF,
            'courseadmin',
            'courseadmin',
            new pix_icon('t/edit', $name)
        );
        if ($PAGE->url->compare($url, URL_MATCH_BASE)) {
            $newnode->make_active();
        }
        $settingsnav->add_node($newnode);
    }
}

Hopefully this will be of use to others who want to access the course admin page.