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;
15 return PAGE_TAG_INDEX
;
18 function user_allowed_editing() {
20 $systemcontext = get_context_instance(CONTEXT_SYSTEM
);
21 return has_capability('moodle/tag:editblocks', $systemcontext);
25 function user_is_editing() {
28 return (!empty($USER->editing
));
32 function url_get_path() {
34 return $CFG->wwwroot
.'/tag/index.php';
38 function url_get_parameters() {
40 $param['id'] = $this->id
;
44 function blocks_default_position() {
45 return BLOCK_POS_LEFT
;
48 function blocks_get_positions() {
49 return array(BLOCK_POS_LEFT
, BLOCK_POS_RIGHT
);
52 function blocks_move_position(&$instance, $move) {
53 if($instance->position
== BLOCK_POS_LEFT
&& $move == BLOCK_MOVE_RIGHT
) {
54 return BLOCK_POS_RIGHT
;
55 } else if ($instance->position
== BLOCK_POS_RIGHT
&& $move == BLOCK_MOVE_LEFT
) {
56 return BLOCK_POS_LEFT
;
58 return $instance->position
;
61 function get_format_name() {
66 //----------- printing funtions -----------
68 function print_header() {
72 $tag = $this->tag_object
;
74 $tagname = tag_display_name($tag);
77 $navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
78 $navlinks[] = array('name' => $tagname, 'link' => '', 'type' => '');
80 $navigation = build_navigation($navlinks);
81 $title = get_string('tag', 'tag') . ' - ' . $tagname;
84 if( $this->user_allowed_editing() ) {
85 $button = update_tag_button($this->id
);
87 print_header_simple($title, '', $navigation, '', '', '', $button);
92 function print_footer() {
101 page_map_class(PAGE_TAG_INDEX
, 'page_tag');