mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 04:33:13 +01:00
MDL-65067 analytics: Strengthen format_weeks detection
The public function get_section_dates($section, $startdate = false) is only defined in format_weeks, not in format_base. As other formats can (and format_topcoll has) declare a different get_section_dates public method, merely checking that it exists is not sufficient to guarantee that it can be called with just a section object. Check that the format either is, or is a subclass of format_weeks.
This commit is contained in:
parent
49f2581ef8
commit
62e1b79cb0
@ -836,7 +836,8 @@ abstract class community_of_inquiry_activity extends linear {
|
||||
// When the course is using format weeks we use the week's end date.
|
||||
$format = course_get_format($activity->get_modinfo()->get_course());
|
||||
// We should change this in MDL-60702.
|
||||
if (method_exists($format, 'get_section_dates')) {
|
||||
if (get_class($format) == 'format_weeks' || is_subclass_of($format, 'format_weeks')
|
||||
&& method_exists($format, 'get_section_dates')) {
|
||||
$dates = $format->get_section_dates($section);
|
||||
|
||||
// We need to consider the +2 hours added by get_section_dates.
|
||||
|
Loading…
x
Reference in New Issue
Block a user