Merge branch 'MDL-86678' of https://github.com/paulholden/moodle
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
issueNumber: MDL-86678
|
||||
notes:
|
||||
core_reportbuilder:
|
||||
- message: >-
|
||||
The base entity class now implements a default `initialise` method, that
|
||||
will automatically call each of the following methods to load entity
|
||||
report data:
|
||||
|
||||
|
||||
* `get_available_columns()`
|
||||
|
||||
* `get_available_filters()`
|
||||
|
||||
* `get_available_conditions()`
|
||||
|
||||
|
||||
This change allows for a lot of boilerplate to be removed from report
|
||||
entity classes
|
||||
type: improved
|
||||
@@ -65,34 +65,12 @@ class task_log extends base {
|
||||
return new lang_string('entitytasklog', 'admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
global $DB;
|
||||
|
||||
$tablealias = $this->get_table_alias('task_log');
|
||||
@@ -270,7 +248,7 @@ class task_log extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$tablealias = $this->get_table_alias('task_log');
|
||||
|
||||
// Name filter (Filter by classname).
|
||||
|
||||
@@ -55,34 +55,12 @@ class role extends base {
|
||||
return new lang_string('role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$contextalias = $this->get_table_alias('context');
|
||||
$rolealias = $this->get_table_alias('role');
|
||||
|
||||
@@ -181,7 +159,7 @@ class role extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$rolealias = $this->get_table_alias('role');
|
||||
|
||||
// Name filter.
|
||||
|
||||
@@ -53,34 +53,12 @@ class role_assignment extends base {
|
||||
return new lang_string('roleassignment', 'core_role');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$raalias = $this->get_table_alias('role_assignments');
|
||||
|
||||
// Time modified column.
|
||||
@@ -123,7 +101,7 @@ class role_assignment extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$raalias = $this->get_table_alias('role_assignments');
|
||||
|
||||
// Time modified filter.
|
||||
|
||||
+2
-24
@@ -53,34 +53,12 @@ class admin_preset extends base {
|
||||
return new lang_string('pluginname', 'tool_admin_presets');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$apalias = $this->get_table_alias('adminpresets');
|
||||
|
||||
// Name.
|
||||
@@ -126,7 +104,7 @@ class admin_preset extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$apalias = $this->get_table_alias('adminpresets');
|
||||
|
||||
// Name.
|
||||
|
||||
@@ -53,30 +53,12 @@ class ai_action_register extends base {
|
||||
return new lang_string('aiactionregister', 'core_ai');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns.
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$mainalias = $this->get_table_alias('ai_action_register');
|
||||
$generatetextalias = 'aagt';
|
||||
$summarisetextalias = 'aast';
|
||||
@@ -205,7 +187,7 @@ class ai_action_register extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$mainalias = $this->get_table_alias('ai_action_register');
|
||||
$generatetextalias = 'aagt';
|
||||
$summarisetextalias = 'aast';
|
||||
|
||||
@@ -46,30 +46,12 @@ class ai_policy_register extends base {
|
||||
return new lang_string('aipolicyregister', 'core_ai');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns.
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$tablealias = $this->get_table_alias('ai_policy_register');
|
||||
|
||||
// Time accepted column.
|
||||
@@ -92,7 +74,7 @@ class ai_policy_register extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$tablealias = $this->get_table_alias('ai_policy_register');
|
||||
|
||||
// Time accepted filter.
|
||||
|
||||
@@ -66,34 +66,12 @@ class badge extends base {
|
||||
return new lang_string('badgedetails', 'core_badges');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$badgealias = $this->get_table_alias('badge');
|
||||
$contextalias = $this->get_table_alias('context');
|
||||
|
||||
@@ -296,7 +274,7 @@ class badge extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$badgealias = $this->get_table_alias('badge');
|
||||
|
||||
// Name.
|
||||
|
||||
@@ -53,34 +53,12 @@ class badge_issued extends base {
|
||||
return new lang_string('badgeissued', 'core_badges');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$badgeissuedalias = $this->get_table_alias('badge_issued');
|
||||
|
||||
// Date issued.
|
||||
@@ -127,7 +105,7 @@ class badge_issued extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$badgealias = $this->get_table_alias('badge_issued');
|
||||
|
||||
// Date issued.
|
||||
|
||||
@@ -61,34 +61,12 @@ class blog extends base {
|
||||
return new lang_string('blog', 'core_blog');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$postalias = $this->get_table_alias('post');
|
||||
|
||||
// Title.
|
||||
@@ -231,7 +209,7 @@ class blog extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
global $DB;
|
||||
|
||||
$postalias = $this->get_table_alias('post');
|
||||
|
||||
@@ -36,6 +36,9 @@ use core_reportbuilder\local\report\{column, filter};
|
||||
*/
|
||||
class cohort extends base {
|
||||
|
||||
/** @var custom_fields $customfields */
|
||||
private custom_fields $customfields;
|
||||
|
||||
/**
|
||||
* Database tables that this entity uses
|
||||
*
|
||||
@@ -65,7 +68,7 @@ class cohort extends base {
|
||||
public function initialise(): base {
|
||||
$tablealias = $this->get_table_alias('cohort');
|
||||
|
||||
$customfields = (new custom_fields(
|
||||
$this->customfields = (new custom_fields(
|
||||
"{$tablealias}.id",
|
||||
$this->get_entity_name(),
|
||||
'core_cohort',
|
||||
@@ -73,20 +76,7 @@ class cohort extends base {
|
||||
))
|
||||
->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 = array_merge($this->get_all_filters(), $customfields->get_filters());
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
return parent::initialise();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,7 +84,7 @@ class cohort extends base {
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$tablealias = $this->get_table_alias('cohort');
|
||||
$contextalias = $this->get_table_alias('context');
|
||||
|
||||
@@ -252,7 +242,8 @@ class cohort extends base {
|
||||
};
|
||||
});
|
||||
|
||||
return $columns;
|
||||
// Merge with custom field columns.
|
||||
return array_merge($columns, $this->customfields->get_columns());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,7 +251,7 @@ class cohort extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$tablealias = $this->get_table_alias('cohort');
|
||||
|
||||
// Cohort select filter.
|
||||
@@ -367,7 +358,8 @@ class cohort extends base {
|
||||
))
|
||||
->add_joins($this->get_joins());
|
||||
|
||||
return $filters;
|
||||
// Merge with custom field filters.
|
||||
return array_merge($filters, $this->customfields->get_filters());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,34 +54,12 @@ class cohort_member extends base {
|
||||
return new lang_string('cohortmember', 'core_cohort');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$tablealias = $this->get_table_alias('cohort_members');
|
||||
|
||||
// Time added column.
|
||||
@@ -104,7 +82,7 @@ class cohort_member extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$tablealias = $this->get_table_alias('cohort_members');
|
||||
|
||||
// Time added filter.
|
||||
|
||||
@@ -56,34 +56,12 @@ class comment extends base {
|
||||
return new lang_string('comment', 'core_comment');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$commentalias = $this->get_table_alias('comments');
|
||||
$contextalias = $this->get_table_alias('context');
|
||||
|
||||
@@ -160,7 +138,7 @@ class comment extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$commentalias = $this->get_table_alias('comments');
|
||||
|
||||
// Content.
|
||||
|
||||
@@ -56,34 +56,12 @@ class competency extends base {
|
||||
return new lang_string('competency', 'core_competency');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$contextalias = $this->get_table_alias('context');
|
||||
$competencyalias = $this->get_table_alias('competency');
|
||||
|
||||
@@ -162,7 +140,7 @@ class competency extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$competencyalias = $this->get_table_alias('competency');
|
||||
|
||||
// Name.
|
||||
|
||||
@@ -56,34 +56,12 @@ class framework extends base {
|
||||
return new lang_string('competencyframework', 'core_competency');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$frameworkalias = $this->get_table_alias('competency_framework');
|
||||
$contextalias = $this->get_table_alias('context');
|
||||
|
||||
@@ -187,7 +165,7 @@ class framework extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$frameworkalias = $this->get_table_alias('competency_framework');
|
||||
|
||||
// Name.
|
||||
|
||||
@@ -55,34 +55,12 @@ class usercompetency extends base {
|
||||
return new lang_string('usercompetency', 'core_competency');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$usercompetencyalias = $this->get_table_alias('competency_usercomp');
|
||||
|
||||
// Status.
|
||||
@@ -142,7 +120,7 @@ class usercompetency extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$usercompetencyalias = $this->get_table_alias('competency_usercomp');
|
||||
|
||||
// Status.
|
||||
|
||||
@@ -56,32 +56,12 @@ class access extends base {
|
||||
return new lang_string('courseaccess', 'course');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
foreach ($this->get_all_columns() as $column) {
|
||||
$this->add_column($column);
|
||||
}
|
||||
|
||||
// All the filters defined by the entity can also be used as conditions.
|
||||
foreach ($this->get_all_filters() as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$tablealias = $this->get_table_alias('user_lastaccess');
|
||||
$user = $this->get_table_alias('user');
|
||||
|
||||
@@ -113,7 +93,7 @@ class access extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$tablealias = $this->get_table_alias('user_lastaccess');
|
||||
|
||||
// Last course access filter.
|
||||
|
||||
@@ -76,32 +76,12 @@ class completion extends base {
|
||||
return new lang_string('coursecompletion', 'completion');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
foreach ($this->get_all_columns() as $column) {
|
||||
$this->add_column($column);
|
||||
}
|
||||
|
||||
// All the filters defined by the entity can also be used as conditions.
|
||||
foreach ($this->get_all_filters() as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
[
|
||||
'course' => $course,
|
||||
'course_completions' => $coursecompletion,
|
||||
@@ -305,7 +285,7 @@ class completion extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$coursecompletion = $this->get_table_alias('course_completions');
|
||||
|
||||
// Completed status filter.
|
||||
|
||||
@@ -60,34 +60,12 @@ class course_category extends base {
|
||||
return new lang_string('coursecategory');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$tablealias = $this->get_table_alias('course_categories');
|
||||
$tablealiascontext = $this->get_table_alias('context');
|
||||
|
||||
@@ -231,7 +209,7 @@ class course_category extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$tablealias = $this->get_table_alias('course_categories');
|
||||
|
||||
// Select category filter.
|
||||
|
||||
@@ -62,32 +62,12 @@ class enrolment extends base {
|
||||
return new lang_string('enrolment', 'enrol');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
foreach ($this->get_all_columns() as $column) {
|
||||
$this->add_column($column);
|
||||
}
|
||||
|
||||
// All the filters defined by the entity can also be used as conditions.
|
||||
foreach ($this->get_all_filters() as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$userenrolments = $this->get_table_alias('user_enrolments');
|
||||
|
||||
// Enrolment time created.
|
||||
@@ -172,7 +152,7 @@ class enrolment extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$userenrolments = $this->get_table_alias('user_enrolments');
|
||||
|
||||
// Enrolment time created.
|
||||
|
||||
@@ -53,34 +53,12 @@ class enrol extends base {
|
||||
return new lang_string('enrolmentmethod', 'core_enrol');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
global $DB;
|
||||
|
||||
$enrolalias = $this->get_table_alias('enrol');
|
||||
@@ -184,7 +162,7 @@ class enrol extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
global $DB;
|
||||
|
||||
$enrolalias = $this->get_table_alias('enrol');
|
||||
|
||||
@@ -68,34 +68,12 @@ class file extends base {
|
||||
return new lang_string('file');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$filesalias = $this->get_table_alias('files');
|
||||
|
||||
// Name.
|
||||
@@ -289,7 +267,7 @@ class file extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$filesalias = $this->get_table_alias('files');
|
||||
|
||||
// Directory.
|
||||
|
||||
@@ -98,17 +98,7 @@ class grade_items extends base {
|
||||
$showonlyactiveenrol = $this->report->show_only_active();
|
||||
$this->ungradedcounts = $this->report->ungraded_counts(false, false, $showonlyactiveenrol);
|
||||
|
||||
$columns = $this->get_all_columns();
|
||||
foreach ($columns as $column) {
|
||||
$this->add_column($column);
|
||||
}
|
||||
|
||||
$filters = $this->get_all_filters();
|
||||
foreach ($filters as $filter) {
|
||||
$this->add_filter($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
return parent::initialise();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +106,7 @@ class grade_items extends base {
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
|
||||
$tablealias = $this->get_table_alias('grade_items');
|
||||
$selectsql = "$tablealias.id, $tablealias.itemname, $tablealias.iteminstance, $tablealias.calculation,
|
||||
@@ -221,7 +211,7 @@ class grade_items extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$tablealias = $this->get_table_alias('grade_items');
|
||||
|
||||
// Activity type filter (for performance only load options on demand).
|
||||
|
||||
@@ -42,6 +42,9 @@ require_once("{$CFG->libdir}/grouplib.php");
|
||||
*/
|
||||
class group extends base {
|
||||
|
||||
/** @var custom_fields $customfields */
|
||||
private custom_fields $customfields;
|
||||
|
||||
/**
|
||||
* Database tables that this entity uses
|
||||
*
|
||||
@@ -71,7 +74,7 @@ class group extends base {
|
||||
public function initialise(): base {
|
||||
$groupsalias = $this->get_table_alias('groups');
|
||||
|
||||
$customfields = (new custom_fields(
|
||||
$this->customfields = (new custom_fields(
|
||||
"{$groupsalias}.id",
|
||||
$this->get_entity_name(),
|
||||
'core_group',
|
||||
@@ -79,20 +82,7 @@ class group extends base {
|
||||
))
|
||||
->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 = array_merge($this->get_all_filters(), $customfields->get_filters());
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
return parent::initialise();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +90,7 @@ class group extends base {
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$contextalias = $this->get_table_alias('context');
|
||||
$groupsalias = $this->get_table_alias('groups');
|
||||
|
||||
@@ -254,7 +244,8 @@ class group extends base {
|
||||
->set_is_sortable(true)
|
||||
->set_callback([format::class, 'userdate']);
|
||||
|
||||
return $columns;
|
||||
// Merge with custom field columns.
|
||||
return array_merge($columns, $this->customfields->get_columns());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,7 +253,7 @@ class group extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$groupsalias = $this->get_table_alias('groups');
|
||||
|
||||
// Name filter.
|
||||
@@ -321,6 +312,7 @@ class group extends base {
|
||||
))
|
||||
->add_joins($this->get_joins());
|
||||
|
||||
return $filters;
|
||||
// Merge with custom field filters.
|
||||
return array_merge($filters, $this->customfields->get_filters());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,34 +53,12 @@ class group_member extends base {
|
||||
return new lang_string('groupmember', 'core_group');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$groupsmembersalias = $this->get_table_alias('groups_members');
|
||||
|
||||
// Time added column.
|
||||
@@ -114,7 +92,7 @@ class group_member extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$groupsmembersalias = $this->get_table_alias('groups_members');
|
||||
|
||||
// Time added filter.
|
||||
|
||||
@@ -35,6 +35,9 @@ use core_reportbuilder\local\report\{column, filter};
|
||||
*/
|
||||
class grouping extends base {
|
||||
|
||||
/** @var custom_fields $customfields */
|
||||
private custom_fields $customfields;
|
||||
|
||||
/**
|
||||
* Database tables that this entity uses
|
||||
*
|
||||
@@ -64,7 +67,7 @@ class grouping extends base {
|
||||
public function initialise(): base {
|
||||
$groupingsalias = $this->get_table_alias('groupings');
|
||||
|
||||
$customfields = (new custom_fields(
|
||||
$this->customfields = (new custom_fields(
|
||||
"{$groupingsalias}.id",
|
||||
$this->get_entity_name(),
|
||||
'core_group',
|
||||
@@ -72,20 +75,7 @@ class grouping extends base {
|
||||
))
|
||||
->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 = array_merge($this->get_all_filters(), $customfields->get_filters());
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
return parent::initialise();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +83,7 @@ class grouping extends base {
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$contextalias = $this->get_table_alias('context');
|
||||
$groupingsalias = $this->get_table_alias('groupings');
|
||||
|
||||
@@ -181,7 +171,8 @@ class grouping extends base {
|
||||
->set_is_sortable(true)
|
||||
->set_callback([format::class, 'userdate']);
|
||||
|
||||
return $columns;
|
||||
// Merge with custom field columns.
|
||||
return array_merge($columns, $this->customfields->get_columns());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,7 +180,7 @@ class grouping extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$groupingsalias = $this->get_table_alias('groupings');
|
||||
|
||||
// Name filter.
|
||||
@@ -222,6 +213,7 @@ class grouping extends base {
|
||||
))
|
||||
->add_joins($this->get_joins());
|
||||
|
||||
return $filters;
|
||||
// Merge with custom field filters.
|
||||
return array_merge($filters, $this->customfields->get_filters());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,34 +55,12 @@ class context extends base {
|
||||
return new lang_string('context');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
global $DB;
|
||||
|
||||
$contextalias = $this->get_table_alias('context');
|
||||
@@ -195,7 +173,7 @@ class context extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$contextalias = $this->get_table_alias('context');
|
||||
|
||||
// Level.
|
||||
|
||||
@@ -53,34 +53,12 @@ class conversation extends base {
|
||||
return new lang_string('conversation', 'core_message');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$conversationalias = $this->get_table_alias('message_conversations');
|
||||
|
||||
// Type.
|
||||
@@ -152,7 +130,7 @@ class conversation extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$conversationalias = $this->get_table_alias('message_conversations');
|
||||
|
||||
// Type.
|
||||
|
||||
@@ -53,34 +53,12 @@ class message extends base {
|
||||
return new lang_string('message', 'core_message');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$messagealias = $this->get_table_alias('messages');
|
||||
|
||||
// Subject.
|
||||
@@ -135,7 +113,7 @@ class message extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$messagealias = $this->get_table_alias('messages');
|
||||
|
||||
// Subject.
|
||||
|
||||
@@ -55,34 +55,12 @@ class discussion extends base {
|
||||
return new lang_string('discussion', 'mod_forum');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
[
|
||||
'context' => $contextalias,
|
||||
'forum_discussions' => $discussionalias,
|
||||
@@ -153,7 +131,7 @@ class discussion extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$discussionalias = $this->get_table_alias('forum_discussions');
|
||||
|
||||
// Name.
|
||||
|
||||
@@ -55,34 +55,12 @@ class forum extends base {
|
||||
return new lang_string('forum', 'mod_forum');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
[
|
||||
'context' => $contextalias,
|
||||
'forum' => $forumalias,
|
||||
@@ -184,7 +162,7 @@ class forum extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$forumalias = $this->get_table_alias('forum');
|
||||
|
||||
// Name.
|
||||
|
||||
@@ -55,34 +55,12 @@ class post extends base {
|
||||
return new lang_string('post', 'mod_forum');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
[
|
||||
'context' => $contextalias,
|
||||
'forum_posts' => $postalias,
|
||||
@@ -189,7 +167,7 @@ class post extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$postalias = $this->get_table_alias('forum_posts');
|
||||
|
||||
// Subject.
|
||||
|
||||
@@ -55,31 +55,12 @@ class tool_types extends base {
|
||||
return new lang_string('entitycourseexternaltools', 'mod_lti');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_columns();
|
||||
foreach ($columns as $column) {
|
||||
$this->add_column($column);
|
||||
}
|
||||
|
||||
$filters = $this->get_all_filters();
|
||||
foreach ($filters as $filter) {
|
||||
$this->add_filter($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$tablealias = $this->get_table_alias('lti_types');
|
||||
|
||||
// Name column.
|
||||
@@ -146,7 +127,7 @@ class tool_types extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$tablealias = $this->get_table_alias('lti_types');
|
||||
|
||||
return [
|
||||
|
||||
@@ -59,34 +59,12 @@ class note extends base {
|
||||
return new lang_string('note', 'core_notes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$postalias = $this->get_table_alias('post');
|
||||
|
||||
// Content.
|
||||
@@ -158,7 +136,7 @@ class note extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$postalias = $this->get_table_alias('post');
|
||||
|
||||
// Content.
|
||||
|
||||
@@ -55,31 +55,12 @@ class config_change extends base {
|
||||
return new lang_string('entityconfigchange', 'report_configlog');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_columns();
|
||||
foreach ($columns as $column) {
|
||||
$this->add_column($column);
|
||||
}
|
||||
|
||||
$filters = $this->get_all_filters();
|
||||
foreach ($filters as $filter) {
|
||||
$this->add_filter($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$tablealias = $this->get_table_alias('config_log');
|
||||
|
||||
// Time modified column.
|
||||
@@ -155,7 +136,7 @@ class config_change extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$tablealias = $this->get_table_alias('config_log');
|
||||
|
||||
// Time modified filter.
|
||||
|
||||
@@ -51,26 +51,12 @@ class theme extends base {
|
||||
return new lang_string('theme');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the entity.
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_columns();
|
||||
foreach ($columns as $column) {
|
||||
$this->add_column($column);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns.
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
global $DB;
|
||||
$themealias = $this->get_table_alias('config_plugins');
|
||||
$sqlsubstring = $DB->sql_substr("{$themealias}.plugin", 7);
|
||||
|
||||
@@ -18,11 +18,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace core_reportbuilder\local\entities;
|
||||
|
||||
use coding_exception;
|
||||
use core\exception\coding_exception;
|
||||
use core\lang_string;
|
||||
use core_reportbuilder\local\helpers\{database, join_trait};
|
||||
use core_reportbuilder\local\report\column;
|
||||
use core_reportbuilder\local\report\filter;
|
||||
use lang_string;
|
||||
use core_reportbuilder\local\report\{column, filter};
|
||||
|
||||
/**
|
||||
* Base class for all report entities
|
||||
@@ -35,26 +34,26 @@ abstract class base {
|
||||
|
||||
use join_trait;
|
||||
|
||||
/** @var string $entityname Internal reference to name of entity */
|
||||
private $entityname = null;
|
||||
/** @var string|null $entityname Internal reference to name of entity */
|
||||
private string|null $entityname = null;
|
||||
|
||||
/** @var lang_string $entitytitle Used as a title for the entity in reports */
|
||||
private $entitytitle = null;
|
||||
/** @var lang_string|null $entitytitle Used as a title for the entity in reports */
|
||||
private lang_string|null $entitytitle = null;
|
||||
|
||||
/** @var array $tablealiases Database tables that this entity uses and their aliases */
|
||||
private $tablealiases = [];
|
||||
/** @var string[] $tablealiases Database tables that this entity uses and their aliases */
|
||||
private array $tablealiases = [];
|
||||
|
||||
/** @var array $tablejoinaliases Database tables that have already been joined to the report and their aliases */
|
||||
private $tablejoinaliases = [];
|
||||
/** @var string[] $tablejoinaliases Database tables that have already been joined to the report and their aliases */
|
||||
private array $tablejoinaliases = [];
|
||||
|
||||
/** @var column[] $columns List of columns for the entity */
|
||||
private $columns = [];
|
||||
private array $columns = [];
|
||||
|
||||
/** @var filter[] $filters List of filters for the entity */
|
||||
private $filters = [];
|
||||
private array $filters = [];
|
||||
|
||||
/** @var filter[] $conditions List of conditions for the entity */
|
||||
private $conditions = [];
|
||||
private array $conditions = [];
|
||||
|
||||
/**
|
||||
* Database tables that the entity expects to be present in the main SQL or in JOINs added to it
|
||||
@@ -96,13 +95,27 @@ abstract class base {
|
||||
* Initialise the entity, called automatically when it is added to a report
|
||||
*
|
||||
* This is where entity defines all its columns and filters by calling:
|
||||
* - {@see add_column}
|
||||
* - {@see add_filter}
|
||||
* - etc
|
||||
* - {@see get_available_columns}
|
||||
* - {@see get_available_filters}
|
||||
* - {@see get_available_conditions}
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
abstract public function initialise(): self;
|
||||
public function initialise(): self {
|
||||
foreach ($this->get_available_columns() as $column) {
|
||||
$this->add_column($column);
|
||||
}
|
||||
|
||||
foreach ($this->get_available_filters() as $filter) {
|
||||
$this->add_filter($filter);
|
||||
}
|
||||
|
||||
foreach ($this->get_available_conditions() as $condition) {
|
||||
$this->add_condition($condition);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default machine-readable name for this entity that will be used in the internal names of the columns/filters
|
||||
@@ -289,6 +302,15 @@ abstract class base {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Columns available from this entity
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_available_columns(): array {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a column to the entity
|
||||
*
|
||||
@@ -317,11 +339,20 @@ abstract class base {
|
||||
* @throws coding_exception For invalid column name
|
||||
*/
|
||||
final public function get_column(string $name): column {
|
||||
if (!array_key_exists($name, $this->columns)) {
|
||||
$columns = $this->get_columns();
|
||||
if (!array_key_exists($name, $columns)) {
|
||||
throw new coding_exception('Invalid column name', $name);
|
||||
}
|
||||
return $columns[$name];
|
||||
}
|
||||
|
||||
return $this->columns[$name];
|
||||
/**
|
||||
* Filters available from this entity
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_available_filters(): array {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -352,18 +383,29 @@ abstract class base {
|
||||
* @throws coding_exception For invalid filter name
|
||||
*/
|
||||
final public function get_filter(string $name): filter {
|
||||
if (!array_key_exists($name, $this->filters)) {
|
||||
$filters = $this->get_filters();
|
||||
if (!array_key_exists($name, $filters)) {
|
||||
throw new coding_exception('Invalid filter name', $name);
|
||||
}
|
||||
return $filters[$name];
|
||||
}
|
||||
|
||||
return $this->filters[$name];
|
||||
/**
|
||||
* Conditions available from this entity
|
||||
*
|
||||
* By default, all the filters defined by the entity can also be used as conditions
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_available_conditions(): array {
|
||||
return $this->get_filters();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a condition to the entity
|
||||
*
|
||||
* @param filter $condition
|
||||
* @return $this
|
||||
* @return self
|
||||
*/
|
||||
final protected function add_condition(filter $condition): self {
|
||||
$this->conditions[$condition->get_name()] = $condition;
|
||||
@@ -387,10 +429,10 @@ abstract class base {
|
||||
* @throws coding_exception For invalid condition name
|
||||
*/
|
||||
final public function get_condition(string $name): filter {
|
||||
if (!array_key_exists($name, $this->conditions)) {
|
||||
$conditions = $this->get_conditions();
|
||||
if (!array_key_exists($name, $conditions)) {
|
||||
throw new coding_exception('Invalid condition name', $name);
|
||||
}
|
||||
|
||||
return $this->conditions[$name];
|
||||
return $conditions[$name];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ require_once($CFG->dirroot . '/course/lib.php');
|
||||
*/
|
||||
class course extends base {
|
||||
|
||||
/** @var custom_fields $customfields */
|
||||
private custom_fields $customfields;
|
||||
|
||||
/**
|
||||
* Database tables that this entity uses
|
||||
*
|
||||
@@ -80,7 +83,7 @@ class course extends base {
|
||||
public function initialise(): base {
|
||||
$tablealias = $this->get_table_alias('course');
|
||||
|
||||
$customfields = (new custom_fields(
|
||||
$this->customfields = (new custom_fields(
|
||||
"{$tablealias}.id",
|
||||
$this->get_entity_name(),
|
||||
'core_course',
|
||||
@@ -88,20 +91,7 @@ class course extends base {
|
||||
))
|
||||
->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 = array_merge($this->get_all_filters(), $customfields->get_filters());
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_condition($filter)
|
||||
->add_filter($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
return parent::initialise();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,7 +182,7 @@ class course extends base {
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$coursefields = $this->get_course_fields();
|
||||
$tablealias = $this->get_table_alias('course');
|
||||
$contexttablealias = $this->get_table_alias('context');
|
||||
@@ -271,7 +261,8 @@ class course extends base {
|
||||
$columns[] = $column;
|
||||
}
|
||||
|
||||
return $columns;
|
||||
// Merge with custom field columns.
|
||||
return array_merge($columns, $this->customfields->get_columns());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,7 +270,7 @@ class course extends base {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$filters = [];
|
||||
$tablealias = $this->get_table_alias('course');
|
||||
|
||||
@@ -323,7 +314,8 @@ class course extends base {
|
||||
))
|
||||
->add_joins($this->get_joins());
|
||||
|
||||
return $filters;
|
||||
// Merge with custom field filters.
|
||||
return array_merge($filters, $this->customfields->get_filters());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,6 +50,9 @@ use core_reportbuilder\local\report\filter;
|
||||
*/
|
||||
class user extends base {
|
||||
|
||||
/** @var user_profile_fields $userprofilefields */
|
||||
private user_profile_fields $userprofilefields;
|
||||
|
||||
/**
|
||||
* Database tables that this entity uses
|
||||
*
|
||||
@@ -81,26 +84,13 @@ class user extends base {
|
||||
public function initialise(): base {
|
||||
$tablealias = $this->get_table_alias('user');
|
||||
|
||||
$userprofilefields = (new user_profile_fields(
|
||||
$this->userprofilefields = (new user_profile_fields(
|
||||
"{$tablealias}.id",
|
||||
$this->get_entity_name(),
|
||||
))
|
||||
->add_joins($this->get_joins());
|
||||
|
||||
$columns = array_merge($this->get_all_columns(), $userprofilefields->get_columns());
|
||||
foreach ($columns as $column) {
|
||||
$this->add_column($column);
|
||||
}
|
||||
|
||||
// All the filters defined by the entity can also be used as conditions.
|
||||
$filters = array_merge($this->get_all_filters(), $userprofilefields->get_filters());
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_condition($filter)
|
||||
->add_filter($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
return parent::initialise();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,7 +165,7 @@ class user extends base {
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$usertablealias = $this->get_table_alias('user');
|
||||
$contexttablealias = $this->get_table_alias('context');
|
||||
|
||||
@@ -308,7 +298,8 @@ class user extends base {
|
||||
$columns[] = $column;
|
||||
}
|
||||
|
||||
return $columns;
|
||||
// Merge with user profile field columns.
|
||||
return array_merge($columns, $this->userprofilefields->get_columns());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -455,7 +446,7 @@ class user extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$tablealias = $this->get_table_alias('user');
|
||||
|
||||
// Fullname filter.
|
||||
@@ -532,7 +523,8 @@ class user extends base {
|
||||
))
|
||||
->add_joins($this->get_joins());
|
||||
|
||||
return $filters;
|
||||
// Merge with user profile field filters.
|
||||
return array_merge($filters, $this->userprofilefields->get_filters());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -387,19 +387,28 @@ class base_test_entity extends base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise entity
|
||||
* Entity available columns
|
||||
*
|
||||
* @return base
|
||||
* @return column[]
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$column = (new column(
|
||||
protected function get_available_columns(): array {
|
||||
$columns[] = (new column(
|
||||
'test',
|
||||
new lang_string('no'),
|
||||
$this->get_entity_name()
|
||||
))
|
||||
->add_field('no');
|
||||
|
||||
$filter = (new filter(
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Entity available filters
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_available_filters(): array {
|
||||
$filters[] = (new filter(
|
||||
text::class,
|
||||
'test',
|
||||
new lang_string('no'),
|
||||
@@ -407,10 +416,7 @@ class base_test_entity extends base {
|
||||
))
|
||||
->set_field_sql('no');
|
||||
|
||||
return $this
|
||||
->add_column($column)
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
return $filters;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,34 +55,12 @@ class collection extends base {
|
||||
return new lang_string('tagcollection', 'core_tag');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$collectionalias = $this->get_table_alias('tag_coll');
|
||||
|
||||
// Name.
|
||||
@@ -154,7 +132,7 @@ class collection extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$collectionalias = $this->get_table_alias('tag_coll');
|
||||
|
||||
// Name.
|
||||
|
||||
@@ -67,34 +67,12 @@ class instance extends base {
|
||||
return new lang_string('taginstance', 'core_tag');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$instancealias = $this->get_table_alias('tag_instance');
|
||||
|
||||
// Area.
|
||||
@@ -179,7 +157,7 @@ class instance extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
global $DB;
|
||||
|
||||
$instancealias = $this->get_table_alias('tag_instance');
|
||||
|
||||
@@ -59,34 +59,12 @@ class tag extends base {
|
||||
return new lang_string('tag', 'core_tag');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$tagalias = $this->get_table_alias('tag');
|
||||
|
||||
// Name.
|
||||
@@ -231,7 +209,7 @@ class tag extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
protected function get_available_filters(): array {
|
||||
$tagalias = $this->get_table_alias('tag');
|
||||
|
||||
// Name.
|
||||
|
||||
@@ -54,33 +54,12 @@ class service extends base {
|
||||
return new lang_string('service', 'core_webservice');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$tokenalias = $this->get_table_alias('external_services');
|
||||
|
||||
// Service name column.
|
||||
@@ -109,9 +88,7 @@ class service extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
global $DB;
|
||||
|
||||
protected function get_available_filters(): array {
|
||||
$tablealias = $this->get_table_alias('external_services');
|
||||
|
||||
// Service Name filter.
|
||||
|
||||
@@ -53,34 +53,12 @@ class token extends base {
|
||||
return new lang_string('token', 'core_webservice');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the entity
|
||||
*
|
||||
* @return base
|
||||
*/
|
||||
public function initialise(): base {
|
||||
$columns = $this->get_all_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();
|
||||
foreach ($filters as $filter) {
|
||||
$this
|
||||
->add_filter($filter)
|
||||
->add_condition($filter);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of all available columns
|
||||
*
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
protected function get_available_columns(): array {
|
||||
$tokenalias = $this->get_table_alias('external_tokens');
|
||||
|
||||
// Token name column.
|
||||
@@ -138,9 +116,7 @@ class token extends base {
|
||||
*
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
global $DB;
|
||||
|
||||
protected function get_available_filters(): array {
|
||||
$tokenalias = $this->get_table_alias('external_tokens');
|
||||
|
||||
// Name filter.
|
||||
|
||||
Reference in New Issue
Block a user