mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-73726 reportbuilder: restrict schedule formats to enabled types.
This commit is contained in:
parent
473ac1285e
commit
72286f9296
@ -339,10 +339,10 @@ class schedule {
|
||||
* @return string[]
|
||||
*/
|
||||
public static function get_format_options(): array {
|
||||
$dataformats = core_plugin_manager::instance()->get_plugins_of_type('dataformat');
|
||||
$dataformats = dataformat::get_enabled_plugins();
|
||||
|
||||
return array_map(static function(dataformat $dataformat): string {
|
||||
return $dataformat->displayname;
|
||||
return array_map(static function(string $pluginname): string {
|
||||
return get_string('dataformat', 'dataformat_' . $pluginname);
|
||||
}, $dataformats);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ use core_reportbuilder\local\entities\user;
|
||||
use core_reportbuilder\local\filters\date;
|
||||
use core_reportbuilder\local\filters\text;
|
||||
use core_reportbuilder\local\helpers\format;
|
||||
use core_reportbuilder\local\helpers\schedule as helper;
|
||||
use core_reportbuilder\local\models\report;
|
||||
use core_reportbuilder\local\models\schedule;
|
||||
use core_reportbuilder\local\report\action;
|
||||
@ -198,8 +197,11 @@ class report_schedules extends system_report {
|
||||
->add_fields("{$tablealias}.format")
|
||||
->set_is_sortable(true)
|
||||
->add_callback(static function(string $format): string {
|
||||
$formats = helper::get_format_options();
|
||||
return $formats[$format] ?? '';
|
||||
if (get_string_manager()->string_exists('dataformat', 'dataformat_' . $format)) {
|
||||
return get_string('dataformat', 'dataformat_' . $format);
|
||||
} else {
|
||||
return $format;
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user