forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-78835 group: include custom fields in related report entities.
- Loading branch information
1 parent
67f2254
commit dae1dcc
Showing
3 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,11 +24,11 @@ | |
use stdClass; | ||
use core_reportbuilder\local\entities\base; | ||
use core_reportbuilder\local\filters\{date, text}; | ||
use core_reportbuilder\local\helpers\format; | ||
use core_reportbuilder\local\helpers\{custom_fields, format}; | ||
use core_reportbuilder\local\report\{column, filter}; | ||
|
||
/** | ||
* Group member entity | ||
* Grouping entity | ||
* | ||
* @package core_group | ||
* @copyright 2022 Paul Holden <[email protected]> | ||
|
@@ -63,13 +63,23 @@ protected function get_default_entity_title(): lang_string { | |
* @return base | ||
*/ | ||
public function initialise(): base { | ||
$columns = $this->get_all_columns(); | ||
$groupingsalias = $this->get_table_alias('groupings'); | ||
|
||
$customfields = (new custom_fields( | ||
"{$groupingsalias}.id", | ||
$this->get_entity_name(), | ||
'core_group', | ||
'grouping', | ||
)) | ||
->add_joins($this->get_joins()); | ||
|
||
$columns = array_merge($this->get_all_columns(), $customfields->get_columns()); | ||
foreach ($columns as $column) { | ||
$this->add_column($column); | ||
} | ||
|
||
// All the filters defined by the entity can also be used as conditions. | ||
$filters = $this->get_all_filters(); | ||
$filters = array_merge($this->get_all_filters(), $customfields->get_filters()); | ||
foreach ($filters as $filter) { | ||
$this | ||
->add_filter($filter) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters