Merge branch 'MDL-82512' of https://github.com/dravek/moodle into main

This commit is contained in:
Paul Holden
2024-07-22 12:31:21 +01:00
2 changed files with 16 additions and 0 deletions
@@ -393,6 +393,16 @@ class file extends base {
return $mimetypes;
});
// Author.
$filters[] = (new filter(
text::class,
'author',
new lang_string('author', 'core_repository'),
$this->get_entity_name(),
"{$filesalias}.author"
))
->add_joins($this->get_joins());
// License (consider null = 'unknown/license not specified' for filtering purposes).
$filters[] = (new filter(
select::class,
@@ -231,6 +231,12 @@ final class files_test extends core_reportbuilder_testcase {
'file:type_operator' => select::EQUAL_TO,
'file:type_value' => 'image/png',
], 0],
'Filter author' => ['file:author', [
'file:author_operator' => text::IS_EMPTY,
], 4],
'Filter author (non match)' => ['file:author', [
'file:author_operator' => text::IS_NOT_EMPTY,
], 0],
'Filter license' => ['file:license', [
'file:license_operator' => select::EQUAL_TO,
'file:license_value' => 'unknown',