- Posts: 6
Feature Requests
Please do NOT use this section of the forum to request help if Joomdle does not work for you in some particular way. Your post will be deleted.
Please do NOT use this section of the forum to request help if Joomdle does not work for you in some particular way. Your post will be deleted.
Show enrolled courses from particular category
- Jake
- Topic Author
- Offline
- New Member
-
Less
More
11 years 5 months ago #1
by Jake
Show enrolled courses from particular category was created by Jake
Is it possible to use the Joomdle "My Courses" module to display courses that the student is enrolled in, but only from specific categories?
We have a category in Moodle that has a few categories for top level courses, and then another with other categories for sub courses meta linked to the top level ones and want to display top level courses in a module first, and then have some info and display the sub courses under that info.
At the moment they are all displayed together in the same "My Courses" module and it's not very user friendly for our students.
We have a category in Moodle that has a few categories for top level courses, and then another with other categories for sub courses meta linked to the top level ones and want to display top level courses in a module first, and then have some info and display the sub courses under that info.
At the moment they are all displayed together in the same "My Courses" module and it's not very user friendly for our students.
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7909
11 years 5 months ago #2
by Antonio Durán
Replied by Antonio Durán on topic Show enrolled courses from particular category
At this point,what you want is not possible.
I guess we could add a category setting in module, to show only courses from desired categories.
However, I am not sure how you would get this:
> display top level courses in a module first, and then have some info and display the sub courses under that info.
I guess we could add a category setting in module, to show only courses from desired categories.
However, I am not sure how you would get this:
> display top level courses in a module first, and then have some info and display the sub courses under that info.
Please Log in or Create an account to join the conversation.
- Jake
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 6
11 years 5 months ago #3
by Jake
Replied by Jake on topic Show enrolled courses from particular category
That's basically all I want. To show only courses from a particular category in the module.
Then I could have two "my courses" modules, but each one would display courses from a different category. I'd add some html modules in between them to show the info that I needed.
Is this possible? To have a "My Courses" module that only shows courses from a particular category?
Would I have to dig into the PHP code of the "Joomdle Courses" module to find the code that let's it filter by category and implement that in the "My Courses" module?
Then I could have two "my courses" modules, but each one would display courses from a different category. I'd add some html modules in between them to show the info that I needed.
Is this possible? To have a "My Courses" module that only shows courses from a particular category?
Would I have to dig into the PHP code of the "Joomdle Courses" module to find the code that let's it filter by category and implement that in the "My Courses" module?
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7909
11 years 5 months ago #4
by Antonio Durán
Replied by Antonio Durán on topic Show enrolled courses from particular category
If you can code, it should not be difficult to do little modifications to my_courses module to get what you want.
You can just add a new parameter to the module configuration, and use it on the courses loop, checking the category so that only selected categories are shown.
You can just add a new parameter to the module configuration, and use it on the courses loop, checking the category so that only selected categories are shown.
Please Log in or Create an account to join the conversation.
- Jake
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 6
11 years 5 months ago #5
by Jake
Replied by Jake on topic Show enrolled courses from particular category
I haven't managed to get it working yet, but I think I'm close.
I've made a field in the .xml file for the my_courses module that lists the categories and returns an array of numbers, stole it out of the joomdle_courses module.
In the my_courses module .php file, if I use this function:
I get a full list of all courses in Moodle and can then filter it by category with:
I want the courses that the student is enrolled in, so I try using this function in place of the 'getCourseList' one:
But if I then try use the filter_by_value, it won't work, it returns 0 results. I'm thinking it's because the 'getMyCourses' function doesn't give me the 'cat_id'.
I'm still digging, could you can point me in the direction of where I could find those two functions and how that make their arrays? I'm guessing I just need to make the 'getMyCourses' function include the 'cat_id' in it's array.
I've made a field in the .xml file for the my_courses module that lists the categories and returns an array of numbers, stole it out of the joomdle_courses module.
In the my_courses module .php file, if I use this function:
$cursos = JoomdleHelperContent::getCourseList
I get a full list of all courses in Moodle and can then filter it by category with:
$cursos = modJoomdleCoursesHelper::filter_by_value ($cursos, 'cat_id', $cats_shown );
I want the courses that the student is enrolled in, so I try using this function in place of the 'getCourseList' one:
$cursos = JoomdleHelperContent::getMyCourses ();
But if I then try use the filter_by_value, it won't work, it returns 0 results. I'm thinking it's because the 'getMyCourses' function doesn't give me the 'cat_id'.
I'm still digging, could you can point me in the direction of where I could find those two functions and how that make their arrays? I'm guessing I just need to make the 'getMyCourses' function include the 'cat_id' in it's array.
Please Log in or Create an account to join the conversation.
- Jake
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 6
11 years 5 months ago #6
by Jake
Replied by Jake on topic Show enrolled courses from particular category
Nevermind! Found it just after I posted this!
I had to go look in the Joomdle auth plugin in moodle, in it's helper.php file.
I found that the 'getMyCourses' function returns the category as 'category' instead of 'cat_id' in the 'getCourseList' function.
So now I just filter the results from 'getMyCourses' like this:
And it works!
I had to go look in the Joomdle auth plugin in moodle, in it's helper.php file.
I found that the 'getMyCourses' function returns the category as 'category' instead of 'cat_id' in the 'getCourseList' function.
So now I just filter the results from 'getMyCourses' like this:
Code:
$cursos = modJoomdleCoursesHelper::filter_by_value ($cursos, 'category', $cats_shown );
And it works!
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7909
11 years 5 months ago #7
by Antonio Durán
Replied by Antonio Durán on topic Show enrolled courses from particular category
Great. I am glad to know you got it working.
Please Log in or Create an account to join the conversation.