-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add section filter to overview #60
base: master
Are you sure you want to change the base?
Conversation
This allow to still show the menu to switch section
Is it possible to merge it ? @jonof Thanks. |
$sql = "SELECT DISTINCT s.id, s.section | ||
FROM {course_sections} s | ||
WHERE s.course = :courseid | ||
AND s.sequence <> ''"; | ||
$params = array('courseid' => $courseid); | ||
$sectionrecords = $DB->get_records_sql($sql, $params); | ||
$sections = array_values($sectionrecords); | ||
$numberofsections = count($sections); | ||
$sectionstodisplay = array(0 => get_string('allsections', 'block_completion_progress')); | ||
for ($i = 0; $i < $numberofsections; $i++) { | ||
$sectionstodisplay[$sections[$i]->id] = get_section_name($courseid, $sections[$i]->section); | ||
} | ||
echo ' ' .get_string('section') . ' '; | ||
echo $OUTPUT->single_select($PAGE->url, 'section', $sectionstodisplay, $section); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using this instead:
// Output the sections menu.
$format = course_get_format($COURSE);
if ($format->uses_sections()) {
$sections = [ -1 => get_string('allsections', 'block_completion_progress') ];
foreach ($format->get_sections() as $sectinfo) {
$sections[$sectinfo->section] = $format->get_section_name($sectinfo);
}
echo ' ' . get_string('section') . ' ';
echo $OUTPUT->single_select($PAGE->url, 'section', $sections, $section);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other adjustments as a consequence of using the section number instead of its record ID are obviously necessary with that change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I will check that :)
Just saw this - I would suggest updating the overview report to use the new \core_user\table\participants class with the new participants_filterset before you start adding extra filters like this. (I have a heavily custom version of Michael's old block on a clients site and I was coming here to see if anyone had updated the overview report to use the new classes.) |
I will check that too when I have time, I am currently a little busy with all covid stuff. |
Fix #59
Work with any section type (thematics, weekly, etc.).