1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
namespace core_admin\table;
|
|
|
18 |
|
|
|
19 |
use moodle_url;
|
|
|
20 |
use stdClass;
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* Media plugin admin settings.
|
|
|
24 |
*
|
|
|
25 |
* @package core_admin
|
|
|
26 |
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
|
|
|
27 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
28 |
*/
|
|
|
29 |
class media_management_table extends \core_admin\table\plugin_management_table {
|
|
|
30 |
/** @var array The list of used extensions */
|
|
|
31 |
protected array $usedextensions = [];
|
|
|
32 |
|
|
|
33 |
protected function get_plugintype(): string {
|
|
|
34 |
return 'media';
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
protected function get_action_url(array $params = []): moodle_url {
|
|
|
38 |
return new moodle_url('/admin/media.php', $params);
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
protected function get_column_list(): array {
|
|
|
42 |
$columns = parent::get_column_list();
|
|
|
43 |
return array_merge(
|
|
|
44 |
array_slice($columns, 0, 1, true),
|
|
|
45 |
['supports' => get_string('supports', 'core_media')],
|
|
|
46 |
array_slice($columns, 1, null, true),
|
|
|
47 |
);
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
protected function col_name(stdClass $row): string {
|
|
|
51 |
global $OUTPUT, $PAGE;
|
|
|
52 |
|
|
|
53 |
$name = $row->plugininfo->name;
|
|
|
54 |
if ($PAGE->theme->resolve_image_location('icon', 'media_' . $name, false)) {
|
|
|
55 |
$icon = $OUTPUT->pix_icon('icon', '', "media_{$name}", ['class' => 'icon pluginicon']);
|
|
|
56 |
} else {
|
|
|
57 |
$icon = $OUTPUT->pix_icon('spacer', '', 'moodle', ['class' => 'icon pluginicon noicon']);
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
$help = '';
|
|
|
61 |
if (get_string_manager()->string_exists('pluginname_help', 'media_' . $name)) {
|
|
|
62 |
$help = ' ' . $OUTPUT->help_icon('pluginname', 'media_' . $name);
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
return $icon . $row->plugininfo->displayname . $help;
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
protected function col_supports(stdClass $row): string {
|
|
|
69 |
return $row->plugininfo->supports($this->usedextensions);
|
|
|
70 |
}
|
|
|
71 |
}
|