mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-82114 files: report entity filters for file component/area.
This commit is contained in:
parent
5aef789ac6
commit
956c64f0b4
@ -425,6 +425,26 @@ class file extends base {
|
||||
))
|
||||
->add_joins($this->get_joins());
|
||||
|
||||
// Component.
|
||||
$filters[] = (new filter(
|
||||
text::class,
|
||||
'component',
|
||||
new lang_string('plugin'),
|
||||
$this->get_entity_name(),
|
||||
"{$filesalias}.component"
|
||||
))
|
||||
->add_joins($this->get_joins());
|
||||
|
||||
// Area.
|
||||
$filters[] = (new filter(
|
||||
text::class,
|
||||
'area',
|
||||
new lang_string('pluginarea'),
|
||||
$this->get_entity_name(),
|
||||
"{$filesalias}.filearea"
|
||||
))
|
||||
->add_joins($this->get_joins());
|
||||
|
||||
// Time created.
|
||||
$filters[] = (new filter(
|
||||
date::class,
|
||||
|
@ -36,7 +36,7 @@ require_once("{$CFG->dirroot}/reportbuilder/tests/helpers.php");
|
||||
* @copyright 2022 Paul Holden <paulh@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class files_test extends core_reportbuilder_testcase {
|
||||
final class files_test extends core_reportbuilder_testcase {
|
||||
|
||||
/**
|
||||
* Test default datasource
|
||||
@ -205,7 +205,7 @@ class files_test extends core_reportbuilder_testcase {
|
||||
*
|
||||
* @return array[]
|
||||
*/
|
||||
public function datasource_filters_provider(): array {
|
||||
public static function datasource_filters_provider(): array {
|
||||
return [
|
||||
// File.
|
||||
'Filter directory' => ['file:directory', [
|
||||
@ -247,6 +247,22 @@ class files_test extends core_reportbuilder_testcase {
|
||||
'file:contenthash_operator' => text::IS_EQUAL_TO,
|
||||
'file:contenthash_value' => 'f00f',
|
||||
], 0],
|
||||
'Filter component' => ['file:component', [
|
||||
'file:component_operator' => text::IS_EQUAL_TO,
|
||||
'file:component_value' => 'course',
|
||||
], 2],
|
||||
'Filter component (no match)' => ['file:component', [
|
||||
'file:component_operator' => text::IS_EQUAL_TO,
|
||||
'file:component_value' => 'reportbuilder',
|
||||
], 0],
|
||||
'Filter area' => ['file:area', [
|
||||
'file:area_operator' => text::IS_EQUAL_TO,
|
||||
'file:area_value' => 'summary',
|
||||
], 2],
|
||||
'Filter area (no match)' => ['file:area', [
|
||||
'file:area_operator' => text::IS_EQUAL_TO,
|
||||
'file:area_value' => 'report',
|
||||
], 0],
|
||||
'Filter time created' => ['file:timecreated', [
|
||||
'file:timecreated_operator' => date::DATE_RANGE,
|
||||
'file:timecreated_from' => 1622502000,
|
||||
|
Loading…
x
Reference in New Issue
Block a user