dbnschools / moodle-theme_fordson

Theme for Moodle 3.3+
43 stars 40 forks source link

Option for Course Dashboard to only show teachers in the same group as the student? #40

Closed Robynstar closed 5 years ago

Robynstar commented 6 years ago

Would it be possible to have an option for Courses (with Group Mode turned on) to only show a student the teachers in the same group as them in the Course Dashboard? We've had a client ask us this, as they tend to have ~20 teachers in a course (to provide contact elements to students spread across the whole country) and are finding the Course Dashboard gets a little unwieldy with so many teachers listed! Also because any student is unlikely to have contact with any teachers other than the ones in their group. I've told them no for the moment, but wanted to see if anyone else would find this useful, if it would be a feature worth adding?

dbnschools commented 6 years ago

If you have code that would allow for this I would be interested in seeing it. We don't have plans for it right now.

Robynstar commented 6 years ago

Ok I will look at putting some together, although not right now as I'm trying to get some code into Moodle core! Is it OK if this stays open for a while in the meantime?

dbnschools commented 6 years ago

OK. Sounds good.

Robynstar commented 5 years ago

Just to let you know that the client has given the green light on me going ahead with this once the dust from upgrading to 3.6 has fully settled :)

Robynstar commented 5 years ago

Ok I have got this working in our dev environment, how would you like to look at it? Just a pull request?

dbnschools commented 5 years ago

If you want to send me the changed files or code that would be easier.

Robynstar commented 5 years ago

settings/menu_settings.php I added the new settings option starting from line 113 Also tidied up a few copied settings descriptions

lang/en/theme_fordson.php Just the title/description strings for the new setting - lines 323, 324

classes/output/core_renderer.php From line 1270 added a check for if the setting is enabled (and if the user is IN a group at all!), and if so create an array of group ids the user is in. 1289/1330 inside the two loops collecting course_teacher and course_other added a loop seeing if any of the groups each staff member is in matches one of the student's groups Then on 1367 I also added a check for whether Badges are enabled -> whether to include the Badges links on the Teacher dashboard, as if Badges are disabled those links will give an error.

templates/teacherdash.mustache 45/59 added the check for whether Badges are enabled

And obviously the version needs to be bumped up as well but considering how maaaaaany times I did that I figured it was better to just let you do it once on your end :stuck_out_tongue:

Let me know if you want any of this changed/reverted/killed with fire...

show_group_teachers_only.zip

dbnschools commented 5 years ago

Robynstar, This looks really good. I am testing and trying to break things. It will be included in the next release. Thank you SO MUCH. I think people will find this useful.

I am holding off on show/hide badges and other links in the teacher dashboard because I want to take a longer look at tying these menu items to specific permissions in a role. So if you do not have permission to award a badge the links will not appear. Same for all the other stuff.

Robynstar commented 5 years ago

No worries, nice to be able to help out rather than just ask you an endless string of daft questions! :smiley:

And what I mean by the Badges check I added is if you have disabled Badges site-wide (/admin/settings.php?section=optionalsubsystems -> enablebadges) then the section for Badges links doesn't get included on the teacher dashboard, regardless of whether you have the permissions to add a Badge etc.

Robynstar commented 5 years ago

A new version including this code, hurrah!

Although currently it's only filtering teachers, and not filtering non-editing teachers. In classes/output/core_renderer.php the groups loop on line 1408 is not included in the non-editing teachers section below (would start on line 1449). Is this deliberate or an accidental omission?

dbnschools commented 5 years ago

You are right. I must have missed the non-editing teacher code. I just put it in there and will re-publish.

dbnschools commented 5 years ago

It's been published and fixed. Thank you very much for helping on this. I will add credit on moodle.org in the plugin description.