MDL-8566, add lang string to MOODLE_19_STABLE, see tracker
[moodle-linuxchix.git] / tag / pagelib.php
blobd18908fdd9b9caf8c77af42cabd38328ba243034
1 <?php
3 require_once($CFG->libdir.'/pagelib.php');
4 require_once('lib.php');
6 define('PAGE_TAG_INDEX', 'tag-index');
7 define('TAG_FORMAT', 'tag');
9 class page_tag extends page_base {
11 var $tag_object = NULL;
13 function get_type() {
14 return PAGE_TAG_INDEX;
17 function user_allowed_editing() {
18 $systemcontext = get_context_instance(CONTEXT_SYSTEM);
19 return has_capability('moodle/tag:editblocks', $systemcontext);
22 function user_is_editing() {
23 global $USER;
25 return (!empty($USER->editing));
29 function url_get_path() {
30 global $CFG;
31 return $CFG->wwwroot.'/tag/index.php';
35 function url_get_parameters() {
36 $param = array();
37 $param['id'] = $this->id;
38 return $param;
41 function blocks_default_position() {
42 return BLOCK_POS_LEFT;
45 function blocks_get_positions() {
46 return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT);
49 function blocks_move_position(&$instance, $move) {
50 if($instance->position == BLOCK_POS_LEFT && $move == BLOCK_MOVE_RIGHT) {
51 return BLOCK_POS_RIGHT;
52 } else if ($instance->position == BLOCK_POS_RIGHT && $move == BLOCK_MOVE_LEFT) {
53 return BLOCK_POS_LEFT;
55 return $instance->position;
58 function get_format_name() {
59 return TAG_FORMAT;
62 //----------- printing funtions -----------
64 function print_header() {
66 global $USER, $CFG;
68 $tagname = tag_display_name($this->tag_object);
70 $navlinks = array();
71 $navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
72 $navlinks[] = array('name' => $tagname, 'link' => '', 'type' => '');
74 $navigation = build_navigation($navlinks);
75 $title = get_string('tag', 'tag') .' - '. $tagname;
77 $button = '';
78 if( $this->user_allowed_editing() ) {
79 $button = update_tag_button($this->id);
81 print_header_simple($title, '', $navigation, '', '', '', $button);
84 function print_footer() {
85 print_footer();
89 page_map_class(PAGE_TAG_INDEX, 'page_tag');