MDL-50550 wiki: Added unit tests for mod_wiki_get_wikis_by_courses
[moodle.git] / tag / search.php
CommitLineData
c933a060 1<?php
2
000ebd5c
DM
3// This file is part of Moodle - http://moodle.org/
4//
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.
9//
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.
14//
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/>.
17
18/**
19 * @package core
20 * @subpackage tag
21 * @copyright 2007 Luiz Cruz <luiz.laydner@gmail.com>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
c933a060 25require_once('../config.php');
26require_once('lib.php');
48d56528 27require_once('locallib.php');
c933a060 28
c933a060 29require_login();
30
e562ecdc 31if (empty($CFG->usetags)) {
48d56528 32 print_error('tagsaredisabled', 'tag');
c933a060 33}
34
48d56528 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);
c933a060 38
d4a03c00 39$params = array();
7c4efe3b 40if ($query !== '') {
d4a03c00 41 $params['query'] = $query;
42}
7c4efe3b 43if ($page !== 0) {
d4a03c00 44 $params['page'] = $page;
45}
7c4efe3b 46if ($perpage !== 18) {
d4a03c00 47 $params['perpage'] = $perpage;
48}
7c4efe3b 49$PAGE->set_url(new moodle_url('/tag/search.php', $params));
43731030 50$PAGE->set_context(context_system::instance());
7c4efe3b 51$PAGE->set_pagelayout('standard');
d4a03c00 52
43731030 53$systemcontext = context_system::instance();
3d535996 54$manage_link = '&nbsp;';
c933a060 55
968583af 56$PAGE->set_title(get_string('tags', 'tag'));
4e1f6047 57$PAGE->set_heading($SITE->fullname);
968583af 58echo $OUTPUT->header();
03ce38cd 59
4e1f6047
DW
60echo $OUTPUT->heading(get_string('searchtags', 'tag'), 2);
61
5fc1ea54 62if ( has_capability('moodle/tag:manage',$systemcontext) ) {
565b14d2 63 echo '<div class="managelink"><a href="'. $CFG->wwwroot .'/tag/manage.php">' . get_string('managetags', 'tag') . '</a></div>' ;
5fc1ea54 64}
03ce38cd 65
3d535996 66tag_print_search_box();
c933a060 67
68if(!empty($query)) {
3d535996 69 tag_print_search_results($query, $page, $perpage);
c933a060 70}
71
72echo '<br/><br/>';
73
456d32fd 74echo $OUTPUT->box_start('generalbox', 'big-tag-cloud-box');
7dd764b8 75tag_print_cloud(null, 150);
456d32fd 76echo $OUTPUT->box_end();
c933a060 77
1dd2ba54 78echo $OUTPUT->footer();