1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-23 17:34:56 +02:00

MDL-82503 badges: Deprecate course_badges report

This commit is contained in:
Sara Arjona 2024-08-14 13:58:43 +02:00
parent 4cdeb79566
commit 6adbe05d9f
No known key found for this signature in database
2 changed files with 25 additions and 0 deletions
.upgradenotes
badges/classes/reportbuilder/local/systemreports

@ -0,0 +1,7 @@
issueNumber: MDL-82503
notes:
core_badges:
- message: >-
The course_badges systemreport has been deprecated and merged with the
badges systemreport. Please, use the badges systemreport instead.
type: deprecated

@ -37,13 +37,19 @@ require_once("{$CFG->libdir}/badgeslib.php");
* @package core_badges
* @copyright 2023 David Carrillo <davidmc@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @deprecated since 4.5. Use badges system_report instead.
* @todo MDL-82383 This class will be deleted in Moodle 6.0.
*/
class course_badges extends system_report {
/**
* Initialise report, we need to set the main table, load our entities and set columns/filters
*
* @deprecated since 4.5. Use badges system_report instead.
*/
#[\core\attribute\deprecated('course_badges::initialise', since: '4.5', mdl: 'MDL-82503')]
protected function initialise(): void {
\core\deprecation::emit_deprecation_if_present([$this, __FUNCTION__]);
global $USER;
// Our main entity, it contains all of the column definitions that we need.
$badgeentity = new badge();
@ -84,8 +90,11 @@ class course_badges extends system_report {
* Validates access to view this report
*
* @return bool
* @deprecated since 4.5. Use badges system_report instead.
*/
#[\core\attribute\deprecated('course_badges::can_view', since: '4.5', mdl: 'MDL-82503')]
protected function can_view(): bool {
\core\deprecation::emit_deprecation_if_present([$this, __FUNCTION__]);
return has_capability('moodle/badges:viewbadges', $this->get_context());
}
@ -94,8 +103,13 @@ class course_badges extends system_report {
*
* They are provided by the entities we previously added in the {@see initialise} method, referencing each by their
* unique identifier. If custom columns are needed just for this report, they can be defined here.
*
* @param string $badgeissuedalias
* @deprecated since 4.5. Use badges system_report instead.
*/
#[\core\attribute\deprecated('course_badges::add_columns', since: '4.5', mdl: 'MDL-82503')]
protected function add_columns(): void {
\core\deprecation::emit_deprecation_if_present([$this, __FUNCTION__]);
$badgeissuedalias = $this->get_entity('badge_issued')->get_table_alias('badge_issued');
$this->add_columns_from_entities([
@ -128,8 +142,12 @@ class course_badges extends system_report {
*
* They are all provided by the entities we previously added in the {@see initialise} method, referencing each by their
* unique identifier
*
* @deprecated since 4.5. Use badges system_report instead.
*/
#[\core\attribute\deprecated('course_badges::add_filters', since: '4.5', mdl: 'MDL-82503')]
protected function add_filters(): void {
\core\deprecation::emit_deprecation_if_present([$this, __FUNCTION__]);
$this->add_filters_from_entities([
'badge:name',
'badge_issued:issued',