MDL-75375 cache: Fix file store path cleaning
[moodle.git] / tag / search.php
blob3526fa973f13d5d4c05ca6c257daebc0ea2cfaaa
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.
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/>.
17 /**
18 * @package core
19 * @subpackage tag
20 * @copyright 2007 Luiz Cruz <luiz.laydner@gmail.com>
21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 require_once('../config.php');
26 require_login();
28 if (empty($CFG->usetags)) {
29 print_error('tagsaredisabled', 'tag');
32 $query = optional_param('query', '', PARAM_RAW);
33 $tagcollid = optional_param('tc', 0, PARAM_INT);
34 $edit = optional_param('edit', -1, PARAM_BOOL);
36 $params = array();
37 if ($query !== '') {
38 $params['query'] = $query;
40 if ($tagcollid) {
41 $params['tc'] = $tagcollid;
44 $PAGE->set_url(new moodle_url('/tag/search.php', $params));
45 $PAGE->set_context(context_system::instance());
46 $PAGE->set_pagelayout('standard');
48 $PAGE->set_title(get_string('tags', 'tag'));
49 $PAGE->set_heading($SITE->fullname);
51 $buttons = '';
52 if (has_capability('moodle/tag:manage', context_system::instance())) {
53 $buttons .= $OUTPUT->single_button(new moodle_url('/tag/manage.php'),
54 get_string('managetags', 'tag'), 'GET');
56 if ($PAGE->user_allowed_editing()) {
57 if ($edit != -1) {
58 $USER->editing = $edit;
60 $buttons .= $OUTPUT->edit_button(clone($PAGE->url));
62 $PAGE->set_button($buttons);
64 $tagrenderer = $PAGE->get_renderer('core', 'tag');
65 $pagecontents = $tagrenderer->tag_search_page($query, $tagcollid);
67 echo $OUTPUT->header();
68 echo $pagecontents;
69 echo $OUTPUT->footer();