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.
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.
Other adjustments as a consequence of using the section number instead of its record ID are obviously necessary with that change.
|
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.).