MDL-19822 Converted print_box* to $OUTPUT->box*
[moodle.git] / tag / search.php
CommitLineData
c933a060 1<?php
2
3require_once('../config.php');
4require_once('lib.php');
48d56528 5require_once('locallib.php');
c933a060 6
c933a060 7require_login();
8
e562ecdc 9if (empty($CFG->usetags)) {
48d56528 10 print_error('tagsaredisabled', 'tag');
c933a060 11}
12
48d56528 13$query = optional_param('query', '', PARAM_RAW);
14$page = optional_param('page', 0, PARAM_INT); // which page to show
15$perpage = optional_param('perpage', 18, PARAM_INT);
c933a060 16
d4a03c00 17$params = array();
18if ($query) {
19 $params['query'] = $query;
20}
21if ($page) {
22 $params['page'] = $page;
23}
24if ($perpage) {
25 $params['perpage'] = $perpage;
26}
27$PAGE->set_url('tag/search.php', $params);
cfc3f57e 28$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
d4a03c00 29
c933a060 30$navlinks = array();
31$navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
32$navigation = build_navigation($navlinks);
33
48d56528 34$systemcontext = get_context_instance(CONTEXT_SYSTEM);
3d535996 35$manage_link = '&nbsp;';
c933a060 36
03ce38cd 37print_header_simple(get_string('tags', 'tag'), '', $navigation);
38
5fc1ea54 39if ( has_capability('moodle/tag:manage',$systemcontext) ) {
565b14d2 40 echo '<div class="managelink"><a href="'. $CFG->wwwroot .'/tag/manage.php">' . get_string('managetags', 'tag') . '</a></div>' ;
5fc1ea54 41}
03ce38cd 42
73aec3a7 43echo $OUTPUT->heading(get_string('searchtags', 'tag'), 2);
c933a060 44
3d535996 45tag_print_search_box();
c933a060 46
47if(!empty($query)) {
3d535996 48 tag_print_search_results($query, $page, $perpage);
c933a060 49}
50
51echo '<br/><br/>';
52
53print_box_start('generalbox', 'big-tag-cloud-box');
cf79f661 54tag_print_cloud(150);
c933a060 55print_box_end();
56
1dd2ba54 57echo $OUTPUT->footer();
c933a060 58
59?>