diff --git a/classes/form/search.php b/classes/form/search.php index b82ca39..5f12627 100644 --- a/classes/form/search.php +++ b/classes/form/search.php @@ -54,6 +54,8 @@ public function definition() { $this->tag_elements(); $this->add_action_buttons(false, get_string('search')); + $mform->addElement('cancel', 'reset', get_string('reset')); + $mform->disabledIf('reset', 'query', 'eq', ''); } /** diff --git a/classes/media_manager.php b/classes/media_manager.php index 7ea3c13..75ee6c7 100644 --- a/classes/media_manager.php +++ b/classes/media_manager.php @@ -89,6 +89,11 @@ public function __construct(string $source, ?stdClass $record = null, int $page 'class' => 'form-inline', ]); + if ($this->search->is_cancelled()) { + $url = new moodle_url('/admin/tool/mediatime/index.php'); + redirect($url); + } + $rs = self::search((array)$this->search->get_data()); foreach ($rs as $media) { if (in_array($media->source, $plugins)) {