Skip to content

Commit

Permalink
Fix 'Deprecation warning for 3.11' - #99.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Jun 12, 2021
1 parent 44a27b0 commit ddc6f62
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes.md
Expand Up @@ -6,6 +6,7 @@ Version 3.11.0.1 - TBD
2. Reset language improvements in line with global default tracking as implemented in 3.10.0.2.
3. Improved backup restore with numsections.
4. Added 'Toggle blocks location' functionality, thanks to John Joubert (https://github.com/John-Joubert) for the patch - #100.
5. Fix 'Deprecation warning for 3.11' - #99.

Version 3.10.1.1 - 07/03/2021
-----------------------------
Expand Down
20 changes: 17 additions & 3 deletions classes/course_renderer.php
Expand Up @@ -150,6 +150,7 @@ public function course_section_cm($course, &$completioninfo, cm_info $mod, $sect
if ($this->page->user_is_editing()) { // Don't display the activity meta when editing so that drag and drop is not broken.
return parent::course_section_cm($course, $completioninfo, $mod, $sectionreturn, $displayoptions);
}
global $USER;

$output = '';
/* We return empty string (because course module will not be displayed at all)
Expand Down Expand Up @@ -208,10 +209,23 @@ public function course_section_cm($course, &$completioninfo, cm_info $mod, $sect
$output .= $contentpart;
}

$modicons = $this->course_section_cm_completion($course, $completioninfo, $mod, $displayoptions);
// Fetch completion details.
$showcompletionconditions = $course->showcompletionconditions == COMPLETION_SHOW_CONDITIONS;
$completiondetails = \core_completion\cm_completion_details::get_instance($mod, $USER->id, $showcompletionconditions);
$ismanualcompletion = $completiondetails->has_completion() && !$completiondetails->is_automatic();

if (!empty($modicons)) {
$output .= html_writer::span($modicons, 'actions');
// Fetch activity dates.
$activitydates = [];
if ($course->showactivitydates) {
$activitydates = \core\activity_dates::get_dates_for_module($mod, $USER->id);
}

/* Show the activity information if:
- The course's showcompletionconditions setting is enabled; or
- The activity tracks completion manually; or
- There are activity dates to be shown. */
if ($showcompletionconditions || $ismanualcompletion || $activitydates) {
$output .= $this->output->activity_information($mod, $completiondetails, $activitydates);
}

// Show availability info (if module is not available).
Expand Down

0 comments on commit ddc6f62

Please sign in to comment.