MDL-13590 - adding locallib.php for HEAD
[moodle.git] / tag / search.php
CommitLineData
c933a060 1<?php
2
3require_once('../config.php');
4require_once('lib.php');
5require_once($CFG->dirroot.'/lib/weblib.php');
6
7global $CFG;
8require_login();
9
10if( empty($CFG->usetags)) {
11 error(get_string('tagsaredisabled', 'tag'));
12}
13
14$query = optional_param('query', '', PARAM_TEXT);
15$page = optional_param('page', 0, PARAM_INT); // which page to show
16$perpage = optional_param('perpage', 18, PARAM_INT);
17
18$navlinks = array();
19$navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
20$navigation = build_navigation($navlinks);
21
c933a060 22$systemcontext = get_context_instance(CONTEXT_SYSTEM);
23if ( has_capability('moodle/tag:manage',$systemcontext) ) {
24 $manage_link = "<a href=\"{$CFG->wwwroot}/tag/manage.php\">" . get_string('managetags', 'tag') . "</a>" ;
c933a060 25}
26
5557c75a 27print_header_simple(get_string('tags', 'tag'), '', $navigation, '', '', '', $manage_link);
bb062447 28
c933a060 29print_heading(get_string('searchtags', 'tag'), '', 2);
30
bb062447 31print_tag_search_box();
c933a060 32
33if(!empty($query)) {
bb062447 34 print_tag_search_results($query, $page, $perpage);
c933a060 35}
36
37echo '<br/><br/>';
38
39print_box_start('generalbox', 'big-tag-cloud-box');
bb062447 40print_tag_cloud(popular_tags_count(150), false, 170,70);
c933a060 41print_box_end();
42
43print_footer();
44
45?>