Blocks: Filtered course list

block_filtered_course_list
Maintained by Picture of Kevin Wiliarty Kevin Wiliarty
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).
457 sites
488 downloads
28 fans

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.

Screenshots

Screenshot #0

Contributors

Picture of Kevin Wiliarty
Kevin Wiliarty (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of MAG II
    Fri, 26 Oct 2018, 9:44 PM
    Yes there are a handful of courses that do not require enrollments to access. So courses with guest access, yes.
  • Picture of MAG II
    Fri, 26 Oct 2018, 9:48 PM
    Apologies for flooding the thread, but to add to what I was saying about being able to access all courses from this block - I was hoping to have a courses link for all courses in this block, kind of like what is available with the standard Navigation block.
  • Picture of Kevin Wiliarty
    Sat, 27 Oct 2018, 2:15 AM
    Don't worry about flooding the thread; I'm grateful for the questions and ideas.

    You could make an "All my courses" rubric by using a regex filter like this: `regex | collapsed | All my courses | .` The dot at the end matches anything, but that won't include courses with guest access, so I think it's not what you're looking for, either. In general the filters start from a list of courses that the user is enrolled in, so it would take a different filter to show courses with guest access. I think it could be done, and I've added it as a possibility to the roadmap, but I'm not sure when I'll be able to have a closer look. Are you by chance a developer?
  • Picture of Kevin Wiliarty
    Sun, 11 Nov 2018, 2:31 AM
    @MAG II: I've just released version 3.4.1 (for Moodle 3.3, 3.4, 3.5) that includes an "enrolment" filter. You can use it to show courses with guest enrolment, self enrolment or both. Usage details are here: https://github.com/CLAMP-IT/moodle-blocks_filtered_course_list/wiki/Filter-by-enrolment-method .
  • Picture of Brandon Jimenez
    Fri, 1 Feb 2019, 1:13 AM
    Hi Kevin:

    First of all, thanks for this amazing plug. Right now i'm trying to get a very simple filter to show all the active courses to the user even if he's not enrolled in them. My course structure is as follows (all courses have manual enrolment)

    Category 1
    - course 1 - shortname 1xx
    - course 2
    etc
    Category 2
    |
    - course 3 - shortname 2xx
    - course 4
    etc

    However, i haven't been able to produce the desired results, using the various methods you mentioned in your documentation:
    e.g.
    regex | expanded | 100-level courses | 1\d\d (as my shortname starts with 1xx
    category | collapsed | 0 (= top level) | 0 (= all decendants)
    regex | collapsed | All my courses | .
    i tried
    category | collapsed | 2 (to show only category ID 2) | 0 (= all decendants)
    and finally:
    enrolment | collapsed | guest, self | Available courses
    however i changed "guest, self" to "manual" and it returned me a "Can not find data record in database table course." (i can't have them as self-register)

    and always shows me only the courses that the user is registered in, and if a user has no courses enrolled, then a simple list of categories.
    I have moodle 3.5.4+ and FCLv3.4.2
  • Picture of Brandon Jimenez
    Fri, 1 Feb 2019, 3:02 AM
    a little edit to my previous post:
    i replaced line 133 in block_filtered_course_list.php from

    $this->mycourses = enrol_get_my_courses(null, "$sortstring");

    to:
    $this->mycourses = coursecat::get(0)->get_courses(array('recursive' => true));

    which solves the problem but doesn't allow me to keep updating your oh so good plug-in. Is there any chance this can be added as a preference in future versions?
  • Picture of Kevin Wiliarty
    Fri, 1 Feb 2019, 3:17 AM
    Hi, Brandon. Thanks for commenting here and even for identifying a possible code solution. I'll have a closer look soon and get back to you in the next day or two.
  • Picture of Kevin Wiliarty
    Fri, 1 Feb 2019, 10:26 PM
    Hi again, Brandon. First of all, thank you again for taking the time to let me know about this problem. I think you've raised two issues, one general and one specific. In general, it seems that you would like to display all the courses on your site, not just the courses a user is enrolled in. And then specifically, you are getting an error when you try to use the `enrolment` filter to show courses with manual enrolments.

    To the general issue: Throughout its history, the primary intent of the Filtered course list block has been to organize and present the courses a user has access to. (Typically this means the courses a user is enrolled in, but I'll address a couple exceptions below.) Nearly all of the filters therefore start from the list of a user's enrolled courses and then return a subset of that already limited list. This principle is at the core of the block's behaviour, so it is no surprise that that is what you are seeing for most of the filter types. The line that you have suggested changing is indeed where that initial limitation applies. Changing it in the way you suggest fundamentally alters the behaviour of the block in exactly the way you describe, but that changed behaviour is at odds with the main intent of the block, so it is not something that I would include in a future version.

    Admittedly, there are a couple exceptions to the general principle that a user sees only their own courses. 1) Anonymous users and admins (depending on certain settings) may see a "generic" list. A generic list shows either a list of all the courses or (if the number of courses is above a configurable threshold) all of the top-level categories on a site. The rationale behind showing a generic list is that anonymous users by definition do not have any enrolments while admins have access to all courses regardless of their enrolments. If you want everyone to see a generic list you can add this line to your filter `generic | expanded`. Please note, though, that unless you have disabled it, the Filtered course list block already automatically includes a link to Moodle's native "All courses" page where users can view and search all courses in the way that you seem to be looking for. Maybe that even solves your main issue?

    To your specific issue: The other place where the Filtered course list block might show courses that a user is not enrolled in is with the `enrolment` filter. The rationale here is that a user may have access to (and so should see) certain courses they are not yet enrolled in. In particular, this is true for courses with `guest` or `self` enrolments, and that is why the documentation and examples emphasize those two types. That being said, what you are trying to do *should* also work, so I consider it a bug that you are seeing that error message, and I would love to get to the bottom of it. Unfortunately I cannot reproduce the error. I've tried using exactly the versions you specify. I've tried on sites with no courses, with only a few courses, and with thousands of courses. I've tried on fresh installations as well as old ones, viewing them as an admin and as a regular user. I would really appreciate any additional information you can offer me on how to reproduce the error. If you have debugging set to full are you getting any kind of stack trace? Approximately how many courses/users/enrolments are on your site? Have you changed any other Filtered course list settings? Does the manual enrolment filter work correctly when you change line 133? Does the problem come back with your restore that line? Sorry to come back with questions rather than answers, and thanks in advance for any help you can offer.
  • Picture of Nicolas Ndalpe
    Sat, 2 Feb 2019, 5:58 PM
    Hi Kevin,
    Great plugin! I was just wondering if the plugin is compatible with a Multi language Moodle? My categories and courses are translated into many language and when I expand a category I see course name like this:

    {mlang en}Day 1 - Course Content{mlang}{mlang ms}Hari 1 - Isi Kandungan Kursus{mlang}

    Tell me how I can help further

    Thx
  • Picture of Kevin Wiliarty
    Sun, 3 Feb 2019, 8:16 AM
    Hi Nicolas,

    I'll be happy to look into this. Can you let me know which plugins you are using? It seems there is more than one that works with the {mlang} tags. It may not matter, but I may as well try to work with the same one you are using.

    Cheers,
    Kevin
  • Picture of Kevin Wiliarty
    Sun, 3 Feb 2019, 8:24 PM
    Hi again, Nicolas. So, in fact, the issue is not specifically related to multilang, but to any kind of filter. The Filtered course list block does not currently run course titles through filters, but I agree that it should (just as the native Moodle blocks do). Thanks for helping to identify this problem. I will work to fix it.
  • Picture of Kevin Wiliarty
    Mon, 4 Feb 2019, 9:19 PM
    Hi Nicolas, I've created and resolved an issue for applying filters to rubric headings and course titles. You can view it on Github at https://github.com/CLAMP-IT/moodle-blocks_filtered_course_list/issues/134. I have confirmed that this addresses the multi-language filtering in particular. I still need to backport this and test it for some earlier versions, and there is one more unrelated issue that I need to resolve, but I would hope to have a release some time this week.
  • Picture of Brandon Jimenez
    Mon, 4 Feb 2019, 10:43 PM
    Hello Kevin:

    In reading that line of code, i realized exactly what you wrote, that the filter will always get the courses that the user is enrolled in. That being said, due to some specifics of the site i work in, i have to show the combo list in the dashboard, instead of the Site Home, where said setting does exist. So i changed it to fetch all the courses in the site, then used your simplest example filter (category | collapsed | 0 (= top level) | 0 (= all decendants)) and it worked perfectly. My "suggestion" (i have no idea if it's even a suggestion) would be: is it possible to create a setting, a general setting, in which the user fetches all the courses, or just the enrolled ones? Something in the lines of :

    if ($setting == 1){
    $this->mycourses = enrol_get_my_courses(null, "$sortstring");
    }
    else{
    $this->mycourses = coursecat::get(0)->get_courses(array('recursive' => true));
    }

    However, i don't know if it would impact a lot your plugin.

    Anyway....thanks a lot! smile
  • Picture of Kevin Wiliarty
    Tue, 5 Feb 2019, 1:35 AM
    Hi, Brandon. While it would be possible to add a setting like that, I don't think an all-or-nothing approach would be very satisfying. It would apply to every filter in every instance of the block throughout an entire site. I can easily imagine that an admin might want to have some enrolment-aware filters alongside some enrolment-agnostic filters, for instance. Maybe a better approach would be to create distinct filters that have the alternate functionality you are looking for. Recent versions of the Filtered course list can use third-party filters, so you could even write your own to do exactly what you want. There's some documentation about how to do that here: https://github.com/CLAMP-IT/moodle-blocks_filtered_course_list/wiki/External-filters, and I am happy to field any questions you might have. I think your filter you need to differ only slightly from the existing category filter.
  • Picture of Kevin Wiliarty
    Tue, 5 Feb 2019, 8:14 AM
    Hi Nicolas, I've just released v4.1.1 (for Moodle 3.6) and v3.4.3 (for Moodle 3.3, 3.4 and 3.5), both of which should be compatible with content filters. Let me know if you run into any difficulties.
1 2 3 4
Please login to post comments