Skip to content

Commit

Permalink
Merge branch 'MDL-74238' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Jan 22, 2024
2 parents 810554e + 7298d07 commit 21b39e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 54 deletions.
40 changes: 2 additions & 38 deletions completion/classes/manager.php
Expand Up @@ -284,46 +284,10 @@ public static function can_edit_bulk_completion($courseorid, $cm = null) {
}

/**
* Gets the available completion tabs for the current course and user.
*
* @deprecated since Moodle 4.0
* @param stdClass|int $courseorid the course object or id.
* @return tabobject[]
*/
public static function get_available_completion_tabs($courseorid) {
debugging('get_available_completion_tabs() has been deprecated. Please use ' .
'core_completion\manager::get_available_completion_options() instead.', DEBUG_DEVELOPER);

$tabs = [];

$courseid = is_object($courseorid) ? $courseorid->id : $courseorid;
$coursecontext = context_course::instance($courseid);

if (has_capability('moodle/course:update', $coursecontext)) {
$tabs[] = new tabobject(
'completion',
new moodle_url('/course/completion.php', ['id' => $courseid]),
new lang_string('coursecompletion', 'completion')
);
}

if (has_capability('moodle/course:manageactivities', $coursecontext)) {
$tabs[] = new tabobject(
'defaultcompletion',
new moodle_url('/course/defaultcompletion.php', ['id' => $courseid]),
new lang_string('defaultcompletion', 'completion')
);
}

if (self::can_edit_bulk_completion($courseorid)) {
$tabs[] = new tabobject(
'bulkcompletion',
new moodle_url('/course/bulkcompletion.php', ['id' => $courseid]),
new lang_string('bulkactivitycompletion', 'completion')
);
}

return $tabs;
public static function get_available_completion_tabs() {
throw new \coding_exception(__FUNCTION__ . '() has been removed.');
}

/**
Expand Down
3 changes: 3 additions & 0 deletions completion/upgrade.txt
Expand Up @@ -4,6 +4,9 @@ information provided here is intended especially for developers.
=== 4.4 ===
* A new method, cm_completion_details::is_overall_complete() has been added to calculate whether a module should be considered or
not completed, based on their completion options and the current value for the overall complete state.
* The following previously deprecated methods have been removed and can no longer be used:
- `core_course_bulk_activity_completion_renderer::navigation`
- `core_completion\manager::get_available_completion_tabs`

=== 4.3 ===
* A trait class, core_completion/form/form_trait has been added to reuse code for adding and validation completion settings to any
Expand Down
18 changes: 2 additions & 16 deletions course/classes/output/bulk_activity_completion_renderer.php
Expand Up @@ -36,24 +36,10 @@
class core_course_bulk_activity_completion_renderer extends plugin_renderer_base {

/**
* Render the navigation tabs for the completion page.
*
* @deprecated since Moodle 4.0
* @param int|stdClass $courseorid the course object or id.
* @param String $page the tab to focus.
* @return string html
*/
public function navigation($courseorid, $page) {
debugging('navigation() has been deprecated as the tabs navigation structure in the completion page ' .
'has been replaced with tertiary navigation. Please use render_course_completion_action_bar() instead.',
DEBUG_DEVELOPER);

$tabs = core_completion\manager::get_available_completion_tabs($courseorid);
if (count($tabs) > 1) {
return $this->tabtree($tabs, $page);
} else {
return '';
}
public function navigation() {
throw new coding_exception(__FUNCTION__ . '() has been removed.');
}

/**
Expand Down

0 comments on commit 21b39e2

Please sign in to comment.