"This course" menu doesn't appear consistently in Essential theme

"This course" menu doesn't appear consistently in Essential theme

Crystal Cooper發表於
Number of replies: 9

Hello all,

We've recently noticed that the This Course menu doesn't appear on all pages within a course. Here is where we expect it to appear, which does apply to most pages within the course:

this course available


However on some pages it vanishes. For example, under course administration, it doesn't show under anything in the Enrolled Users section, or under Reports

this course missing


Does anyone know if this is expected behaviour or not? It's not a huge issue, but we are trying to encourage academic staff to make more use of this menu, so it confuses them when it can't be found.

This is on Moodle 2.8.8+ (Build: 20150924) and Essential 2015061904 2.8.1.10 (Build: 2015061903).

Thanks,

Crystal

評比平均分數: -
In reply to Crystal Cooper

Re: "This course" menu doesn't appear consistently in Essential theme

Gareth J Barnard發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片

In the M3.0 version it only appears (intentionally) on the course, incourse and report layouts: https://github.com/gjb2048/moodle-theme_essential/blob/master/classes/output/core_renderer.php#L493-L496.  Enrolled users is an admin layout.  Therefore would make no sense.

In reply to Gareth J Barnard

Re: "This course" menu doesn't appear consistently in Essential theme

Richard Oelmann發表於
Core developers的相片 Plugin developers的相片 Testers的相片

I kind of get where Gareth is coming from as an admin page, but I can also see Crystal's apparent view that this is a course admin page (the breadcrumb for the course is still shown), so in that case maybe it does make sense to have the This Course menu showing on course related admin pages.

Could it use the course-x bodyclass, rather than the page layout perhaps? Front page and as far as I can see all the Site Admin pages (which Gareth is quite right, it makes no sense to have the This Course menu on) are all given the body class course-1, while courses, course 'sub'pages and even course admin pages all appear to have course-(theirid).

Just an idea 微笑


PS

'This is on Moodle 2.8.8+ (Build: 20150924) and Essential 2015061904 2.8.1.10 (Build: 2015061903).'

'In the M3.0 version'

(Seems to have been there since 2.8.1.5 - https://github.com/gjb2048/moodle-theme_essential/commit/ca11c38ca25ae84b9b39afdd495a3d2ab74aab3 - so seems to be a fairly accepted way of it working over that period of time if Crystal is the first to raise it as an issue 微笑 )

In reply to Richard Oelmann

Re: "This course" menu doesn't appear consistently in Essential theme

Gareth J Barnard發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片

Ok.  The 'This course' menu is really for the users of the course.  The admins / teachers really have no use for it outside of the course / incourse layouts.  If you're doing admin things then you are doing 'admin' things.  The body classes are hard to pull apart at the server end.  There might be some sort of 'incourse()' PHP method.  But at the moment I see no point in changing the code for the reasons already stated.

In reply to Gareth J Barnard

Re: "This course" menu doesn't appear consistently in Essential theme

Crystal Cooper發表於

Richard, you're right that it's been like this for several versions - my team's been aware of it for a while but none of us got around to actually asking the question until now 微笑

The reason it's come up as an issue is because less experienced users don't necessarily distinguish between the course pages and the admin related to that course page - if they are "inside" a course they expect things to remain consistent.

Gareth, I would point out that admins and teachers do have use for the menu. As administrators it's really helpful when academics or students contact us for support, so we don't have to skim through the entire course to locate the quiz or Turnitin or whatever they want help with. It's a common workflow to first check that a student is correctly enrolled, and then we want to jump to the activity they were having issues with, which means we have to first return to the main course page to get to the This Course menu.

But it sounds like it's a major code change for a minor problem, so no worries 微笑

評比平均分數:Useful (1)
In reply to Crystal Cooper

Re: "This course" menu doesn't appear consistently in Essential theme

Richard Oelmann發表於
Core developers的相片 Plugin developers的相片 Testers的相片

Actually I don't think its that big on 2.8 that you are using

In essential/renderers/core_renderer.php it already appears to have the line

if (isset($this->page->course->id) && $this->page->course->id > 1) {

Which I believe means that the menu is only returned if the course ID is set and is greater than 1. So if you remove/comment out the line that refers to the page layouts completely, then the This Course menu should appear on all pages that have a course ID (which may or may not be what you want!), other than those linked to site pages such as most admin pages, which (I think) all have a course ID of 1.

if (($this->page->pagelayout != 'course') && ($this->page->pagelayout != 'incourse') && ($this->page->pagelayout != 'report')) {

NOTE: I have not tested this as i do not have a 2.8 Moodle or this version of Essential installed on my work PC, it is only based on a review of the code!

Also note: Based on Gareth's (completely understandable) reasoning, this would not be a change that would be supported or added to the main download of the theme, but a single hack for your own site which would then need maintaining separately if and when you upgrade.


Hope that helps

Richard

In reply to Richard Oelmann

Re: "This course" menu doesn't appear consistently in Essential theme

Mary Evans發表於

Hi Richard,

I think this is a bit dangerous if you don't mind me saying so.

If it were me I would rather add to this line and add only those pagelayouts which are appropriate otherwise you may end up with said menu on a page that is dysfunctional.

If you go to the Debugging page and turn on the setting that allows "Page info" to be listed in the footer, then you will see which page layouts are needed, and my guess is that you probably only need the Admin one adding to that list like so.

        if (($this->page->pagelayout != 'admin') && ($this->page->pagelayout != 'course') &&
            ($this->page->pagelayout != 'incourse') && ($this->page->pagelayout != 'report')) {
            return '';
        }

Just a thought.

Edited 11:19am 5/4/2016 - For reference this is the line I am talking about: 

https://github.com/gjb2048/moodle-theme_essential/blob/MOODLE_28/renderers/core_renderer.php#L338

Cheers

Mary

評比平均分數:Useful (1)
In reply to Mary Evans

Re: "This course" menu doesn't appear consistently in Essential theme

Richard Oelmann發表於
Core developers的相片 Plugin developers的相片 Testers的相片

Hmmm - OK.

I'm not sure what other page layouts are possible within a course that would have the menu displayed anyway (e.g. embedded or popup layouts shouldn't really be displaying any menu, so this wouldn't get added as there isn't a menu called in the first place). Login, mydashboard, frontpage and coursecategory layouts shouldn't have a course ID >1 (if one is set at all), while the mypublic that is used for the user profile within a course could just as easily be said to need the This Course menu as the enrol users page Crystal raised. I haven't done a full test of everything, but i have certainly clicked through quite a few and can't see anything that i think would cause problems.

However, your point that it may appear where it is not wanted is definitely a valid one, which is why I did point out that it may or may not be what Crystal really wants.

Certainly adding admin to the page layouts allowing the This Course is a good option (and then potentially mypublic for consistency), but we are then basically adding every possible layout that could have the menu in it and so i felt it was better to just remove the conditional statement in the first place. A judgement call, certainly, not sure one I'd call 'dangerous' but certainly happy to take your view point and add the further comment that as your suggestion minimises the potential alterations, it is probably easier to maintain following any future upgrades too (it's certainly more obvious where to add the extra layouts to the relevant class in Gareth's Essential for Moodle3).

R

In reply to Richard Oelmann

Re: "This course" menu doesn't appear consistently in Essential theme

Gareth J Barnard發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片
In reply to Gareth J Barnard

Re: "This course" menu doesn't appear consistently in Essential theme

Crystal Cooper發表於

Cheers! We'll still be on Moodle 2.8 until the new academic year, but this will be a great help when we upgrade.