Retrieve course list

Retrieve course list

by robert flook -
Number of replies: 11
Hi,

I have been tasked with putting together a new theme for moodle in my school. What I need to do is to populate a drop down menu with all the courses available which match a specific ID. It would seem that usually the category.php file displays this info, but I can't seem to find out if there is a function I can call to retrieve this data easily. I would rather not have to write some code if something else is already in place. Can anyone help here?

Many thanks

rob
Average of ratings: -
In reply to robert flook

Re: Retrieve course list

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
What ID are trying to match them to?

I have just been writing a page for my Moodle that will display all courses which have guest access enabled. I will post it up when I finish it; it might point you in the right direction...

Jon
In reply to Jon Witts

Re: Retrieve course list

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
OK,

So here is the finished script... We are using guest access to get our parents to access information in our VLE and this script produces a list of all courses with guest access enabled... It is not very elegant but it does the job!

Jon
In reply to robert flook

Re: Retrieve course list

by Barry Oosthuizen -
Hi Robert,

The Course Category / Course Dropdown Navigation menu in the Beaux Theme (partly based on "a theme with automatic menus") might have something (in the topmenu.php file) that points you in the right direction as well.

Cheers,

Barry
In reply to Barry Oosthuizen

Re: Retrieve course list

by Tieku Bortei-Doku -

Barry,

How easy is it to incorporate the Beaux theme's menu in other Moodle Themes?

Tieku

In reply to Tieku Bortei-Doku

Re: Retrieve course list

by Barry Oosthuizen -
I found it pretty easy, though I do remember fiddling with it a bit at first.
In reply to Barry Oosthuizen

Re: Retrieve course list

by Tieku Bortei-Doku -
Can you outline the steps to incorporate the Beaux theme's menu in other Moodle Themes?
In reply to Tieku Bortei-Doku

Re: Retrieve course list

by Barry Oosthuizen -
Sorry no, it would be much quicker and beneficial for me to create a new blank theme from scratch wink, but I've got other things to do right now.
In reply to Barry Oosthuizen

Re: Retrieve course list

by Tieku Bortei-Doku -

Barry,

Why is the menu link in the Beaux theme going to:

domain.com/course/view.php?id=13

instead of

domain.com/moodle/course/view.php?id=13

for one of my courses?

Tieku

In reply to Tieku Bortei-Doku

Re: Retrieve course list

by Barry Oosthuizen -
Hi Tieku,

For the automatic menu, I based my theme on the 'A theme with automatic menus' and didn't spend too much time trying to perfect it. The culprit will be in the topmenu.php file.

To fix it, find all occurrences of $CFG->wwwroot and replace it with $CFG->webroot

Cheers,

Barry
In reply to Barry Oosthuizen

Re: Retrieve course list

by Tieku Bortei-Doku -
That did not work. Changed all $CFG->wwwroot to $CFG->webroot in topmenu.php file. Still the same. Is there anything else I need to change?