Checklist
Maintained by
Davo Smith
A checklist can be created by a teacher (or generated from the activities in a course) and then the students or teachers can check-off each item as they are completed.
Comments
Comments are no longer open for new posts. Existing comments remain available to read.
If you think there is a specific bug in the checklist plugin, then I suggest you open up a ticket in GitHub where you describe step-by-step what you are doing, exactly what you expect to happen and what actually happens. I cannot promise I'll look at it quickly, but I will try to review it at some point.
I tried to reach out to you on this, but it doesn't look like I'm able to send you a direct Moodle message.
Could you drop me an email to moodle@davosmith.co.uk to discuss this patch you have listed above, because I'm really struggling to understand what problem you are trying to solve here?
This activity already fully supports filtering the list of users by group - to check it works, I've just added a Behat test here: https://github.com/davosmith/moodle-checklist/blob/master/tests/behat/groups.feature
This test is passing for Moodle 4.1-5.1 and shows the standard groups selector working as I would expect - a teacher can select different groups from the drop-down and the list of students is filtered according to this list. I'd really like to understand what is different on your system and why you need to modify the code to get it to work? (Or to see if I've completely misunderstood what you're trying to do).
mod/checklist/report.php:
Simplified the script to a minimal bootstrap that delegates all rendering (header, content, footer, and controls) to checklist_class->report().
Some variants of report.php were doing a mixture of:
Calling $OUTPUT->header()/$OUTPUT->footer() directly (risking moodle_page::set_state errors, since the class also outputs headers), or
Injecting UI elements (like a second group control), causing duplication and layout issues.
Full Code:
require(__DIR__ . '/../../config.php');
require_once($CFG->dirroot . '/mod/checklist/locallib.php');
$id = required_param('id', PARAM_INT);
$studentid = optional_param('studentid', 0, PARAM_INT);
$url = new moodle_url('/mod/checklist/report.php', ['id' => $id]);
if ($studentid) {
$url->param('studentid', $studentid);
}
$cm = get_coursemodule_from_id('checklist', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', ['id' => $cm->course], '*', MUST_EXIST);
$checklist = $DB->get_record('checklist', ['id' => $cm->instance], '*', MUST_EXIST);
$PAGE->set_url($url);
require_login($course, true, $cm);
$context = context_module::instance($cm->id);
require_capability('mod/checklist:viewreports', $context);
$chk = new checklist_class($cm->id, $studentid, $checklist, $cm, $course);
echo $chk->report();
mod/checklist/locallib.php
I replaced the stock group label with a real dropdown and made sure the selection is applied to the user queries. I also added a small, consistent bottom margin so the dropdown doesn’t collide with the “Hide optional items” button.
Inside checklist_class->report() find this block:
$out .= groups_print_activity_menu($this->cm, $thisurl, true);
$activegroup = groups_get_activity_group($this->cm, true);
if ($activegroup == 0) {
if (groups_get_activity_groupmode($this->cm) == SEPARATEGROUPS) {
if (!has_capability('moodle/site:accessallgroups', $this->context)) {
$activegroup = -1; // Not allowed to access any groups.
}
}
}
Replace that entire block with:
// --- Group selector (always a real dropdown) ---
$activegroup = groups_get_activity_group($this->cm, true); // Moodle's current group (may be 0)
// Build a course group list the current user can access.
$coursecontext = context_course::instance($this->course->id);
$canseeall = has_capability('moodle/site:accessallgroups', $coursecontext);
if ($canseeall) {
$groups = groups_get_all_groups($this->course->id, 0, 0, 'g.id, g.name');
} else {
global $USER;
$groups = groups_get_all_groups($this->course->id, $USER->id, 0, 'g.id, g.name');
}
$menugroups = [0 => get_string('allparticipants')];
foreach ($groups as $g) {
$menugroups[$g->id] = format_string($g->name, true, ['context' => $coursecontext]);
}
// Render a dropdown that sets the ?group= URL parameter.
$select = new single_select($thisurl, 'group', $menugroups, $activegroup, null);
$select->label = get_string('groups');
$select->formid = 'checklist-report-groupselector';
// Compact, consistent spacing
$out .= html_writer::tag(
'span',
$OUTPUT->render($select),
['style' => 'display:inline-block;margin-right:1rem;margin-bottom:8px;']
);
// Respect Separate groups rules when viewer lacks access-all.
if ($activegroup == 0) {
if (groups_get_activity_groupmode($this->cm) == SEPARATEGROUPS) {
if (!has_capability('moodle/site:accessallgroups', $this->context)) {
$activegroup = -1; // No permitted groups -> show no users.
}
}
}
// Use the explicit selection from the URL if present.
$activegroup = optional_param('group', $activegroup, PARAM_INT);
Hope this helps someone!
I've not tried this in ages, but, as far as I can see, the report on user progress is already filtered by group, so I'm not quite sure what you're asking for (unless the filter is currently broken?)
I have this plugin and it's working wonderfully on 5.1+
What I would like to do is be able to filter by group in the 'view progress > edit checks" view, as we have a large number of learners. Has anybody figured a way to enable this filter?
Thank you
i get the error message on mobile app of moodle.
At background runs Moodle 3.9.4+
Alternatively, if you are wanting to fund this development, please contact me directly and I can look to see if this could be completed during my working day.
Would it be possible to add a feature to mod_checklist allowing group-based collaborative validation?
The idea: when one member of a group checks a task, it gets marked as completed for all members of that group.
This would be very useful for shared workflows in group activities.
Thanks for considering!
I'd need to know exactly which version of Moodle and which version of the plugin you were using in order to investigate any further.
I've not looked at what is involved in adding subsection support to the checklist activity, so I don't know how complicated it would be.
I'm very unlikely to look at it anytime soon (I do very little Moodle development in my free time), but I'd certainly review a well written patch that implemented such a feature (as long as it had good automated test coverage and followed the Moodle coding guidelines).