Moodle Plugins directory: Filtered course list | Moodle.org
Filtered course list
The Filtered Course List block displays a configurable list of courses. It is intended as a replacement for the My Courses block, although both may be used. It is maintained by the Collaborative Liberal Arts Moodle Project (CLAMP).
An administrator can apply various filters by which to organize a user's course listing in the block. Courses can be sorted by category, shortname matches or completion status. If all of the courses in a given semester have a shortname ending in a semester code, for instance, then the administrator can designate those courses to appear under "Current courses," "Future courses" or any other heading. Regex matching is supported.
Administrators can designate multiple collapsible headings and choose which of those headings, if any, should be expanded by default.
Other options include the ability to hide the block from guests or anonymous visitors, to choose whether an admin sees all courses or her own, and to hide or reveal a link to a more comprehensive course search.
I need your help, I don't know how to show all the courses without generating a link to the category, that is, I want the list of courses that fall within that category to appear in the block itself.
Thank you so much!
Thank you very much for answering my question, yesterday I was testing the block more thoroughly and I understand what you are saying, in effect the block only shows the courses in which the user is enrolled.
Is there a way to show all the courses () visible to the user of the platform? (regardless of whether you are enrolled or not).
Thank you very much and success!
PD: The structure of the platform is as follows
-Subjects
Institutions
Subjects (courses)
-Postgraduate
-Tutorials
$this->mycourses = enrol_get_my_courses(null, "$sortstring");
With
if (is_siteadmin()){
$this->mycourses = core_course_category::get(0)->get_courses(array('recursive' => true));
} else {
$this->mycourses = enrol_get_my_courses(null, "$sortstring");
}
This will give the administrators that much wanted capability to filter all courses as they need, and other users will see only courses where they are enroled as that was the main purpose of the plugin. With that said, I have problem with 'generic_list' shown to users in cases where they don't have enroled courses in specified category. Can you please help me with that because I don't have time to find in the code where to turn it off, and replace with "no courses" for example.
Thanks in advance!
The code in question is in "block_filtered_course_list.php" file around line 264 (last if-else if).
Instead of:
if (count($this->rubrics) > 0) {
$content = new \block_filtered_course_list\output\content($this->rubrics, $this->instance->id);
$this->content->text = $output->render($content);
} else if ($this->fclconfig->filters != BLOCK_FILTERED_COURSE_LIST_GENERIC_CONFIG) {
$this->liststyle = 'generic_list';
$this->fclconfig->filters = 'generic|e';
$this->_process_filtered_list();
}
that is showing all courses, I put:
// My replacment code for no courses enroled message instead of generic list.
$usernome = fullname($USER);
if (count($this->rubrics) > 0) {
$content = new \block_filtered_course_list\output\content($this->rubrics, $this->instance->id);
$this->content->text = $output->render($content);
} else {
$this->content = new stdClass();
$this->content->text = '
Sorry '.$usernome.',
';you don\'t have enroled courses in this
type of filtered categories.
$this->content->footer = '';
return $this->content;
}
As you can see $usernome should be defined before If-else.
I found this personalized message is much more adequate for users without enrolment, and you can change message to better suit your system.
Of course this is not the best practice in moodle plugin development, and this message should be actually placed in language strings file and called here, but I didn't have time, sorry.
I hope somebody will find this useful.
Also, any inklings of Moodle making the functionality of this plugin available in core?
Lastly, wondering if you have seen similar categorization abilities created in other plugins for the "/grade/report/overview/index.php" grades page for students, to group and sort those courses (especially useful when multiple years of courses are on one Moodle instance)?
Nathan
When I add filter text to Filter configuration field, nothing is changing. Why it is so?
A bit lost with the mobile app right now, but this would be the n°1 customization we'd need to just start using mobile. Cheers and thanks !