3 // This file is part of Moodle - http://moodle.org/
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
21 * @copyright 2007 Luiz Cruz <luiz.laydner@gmail.com>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 require_once('../config.php');
26 require_once('lib.php');
27 require_once('locallib.php');
31 if (empty($CFG->usetags
)) {
32 print_error('tagsaredisabled', 'tag');
35 $query = optional_param('query', '', PARAM_RAW
);
36 $page = optional_param('page', 0, PARAM_INT
); // which page to show
37 $perpage = optional_param('perpage', 18, PARAM_INT
);
41 $params['query'] = $query;
44 $params['page'] = $page;
46 if ($perpage !== 18) {
47 $params['perpage'] = $perpage;
49 $PAGE->set_url(new moodle_url('/tag/search.php', $params));
50 $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM
));
51 $PAGE->set_pagelayout('standard');
53 $systemcontext = get_context_instance(CONTEXT_SYSTEM
);
54 $manage_link = ' ';
56 $PAGE->set_title(get_string('tags', 'tag'));
57 $PAGE->set_heading($SITE->fullname
.': '.$PAGE->title
);
58 echo $OUTPUT->header();
60 if ( has_capability('moodle/tag:manage',$systemcontext) ) {
61 echo '<div class="managelink"><a href="'. $CFG->wwwroot
.'/tag/manage.php">' . get_string('managetags', 'tag') . '</a></div>' ;
64 echo $OUTPUT->heading(get_string('searchtags', 'tag'), 2);
66 tag_print_search_box();
69 tag_print_search_results($query, $page, $perpage);
74 echo $OUTPUT->box_start('generalbox', 'big-tag-cloud-box');
76 echo $OUTPUT->box_end();
78 echo $OUTPUT->footer();