General developer forum

 
 
Picture of Adam Morris
2.4 and page->navigation->get('mycourses') in output renderer
 

In my theme, each top_level category represents a tab on the tab bar. I just upgrade to Moodle 2.4.

So in 2.4, I need a way to get a tree of the current user's courses (where the branches are the categories, and the courses are the leaves), since that I can't do this with the code in the subject header anymore in 2.4.

(I also can't seem to access the tracker right now for some reason, as I was hoping there was an estimation on when this issue might get solved.)

There is get_course_category_tree which gives us the tree structure for all courses, and then enrol_get_my_courses which gives me an array of the user's courses. I could go through and make a new tree structure that is the (logical) intersection of these two results, but that would be pretty bad:

-> I'd effectively be finding each course in the database twice

Is there a better solution readily available I just don't know about (I hope).

 
Average of ratings: -
Picture of Adam Morris
Re: 2.4 and page->navigation->get('mycourses') in output renderer
 

The solution I came up with is attached. It's pretty ugly.

 

 
Average of ratings: -
Picture of Adam Morris
Re: 2.4 and page->navigation->get('mycourses') in output renderer
 

Does anybody comment if the issue demonstrated here: 

http://docs.moodle.org/dev/Adding_courses_and_categories_to_the_custom_menu

has been fixed in Moodle 2.5?

 
Average of ratings: -
Picture of Charles Fulton
Re: 2.4 and page->navigation->get('mycourses') in output renderer
Group Developers

I wound up implementing the fix from the bottom of the page ("How to add 'My Courses' to the Custom Menu Bar for Moodle 2.4") in my own custom theme and it worked like a charm. I haven't tested against 2.5 though.

 
Average of ratings: -
Picture of Jesus Francisco Sanchez Franco
Re: 2.4 and page->navigation->get('mycourses') in output renderer
 

I was in the same situation than you and the solution that i applied was create my own renderer funtions in renderer.php to show the structure.

 
Average of ratings: -