moodle_page: MDL-12212 reimplement user_is_editing, deprecate isediting
[moodle.git] / tag / pagelib.php
CommitLineData
22792afb 1<?php
2
3require_once($CFG->libdir.'/pagelib.php');
4require_once('lib.php');
22792afb 5
2aff59d4 6define('PAGE_TAG_INDEX', 'tag-index');
938e7302 7define('TAG_FORMAT', 'tag');
22792afb 8
9class page_tag extends page_base {
10
11 var $tag_object = NULL;
22792afb 12
13 function user_allowed_editing() {
2aff59d4 14 $systemcontext = get_context_instance(CONTEXT_SYSTEM);
15 return has_capability('moodle/tag:editblocks', $systemcontext);
22792afb 16 }
17
22792afb 18 //----------- printing funtions -----------
d529807a 19
22792afb 20 function print_header() {
21
22 global $USER, $CFG;
23
2aff59d4 24 $tagname = tag_display_name($this->tag_object);
22792afb 25
26 $navlinks = array();
27 $navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
28 $navlinks[] = array('name' => $tagname, 'link' => '', 'type' => '');
29
30 $navigation = build_navigation($navlinks);
2aff59d4 31 $title = get_string('tag', 'tag') .' - '. $tagname;
22792afb 32
33 $button = '';
34 if( $this->user_allowed_editing() ) {
2aff59d4 35 $button = update_tag_button($this->id);
22792afb 36 }
37 print_header_simple($title, '', $navigation, '', '', '', $button);
22792afb 38 }
39
40 function print_footer() {
22792afb 41 print_footer();
22792afb 42 }
22792afb 43}
44
45page_map_class(PAGE_TAG_INDEX, 'page_tag');
46
47?>