This commit is contained in:
Jun Pataleta 2024-01-22 15:03:28 +08:00
commit 21b39e2f53
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
3 changed files with 7 additions and 54 deletions

View File

@ -284,46 +284,10 @@ class manager {
}
/**
* 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.');
}
/**

View File

@ -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

View File

@ -36,24 +36,10 @@ require_once($CFG->dirroot.'/course/renderer.php');
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.');
}
/**