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;
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() {
25 return (!empty($USER->editing
));
29 function url_get_path() {
31 return $CFG->wwwroot
.'/tag/index.php';
35 function url_get_parameters() {
37 $param['id'] = $this->id
;
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() {
62 //----------- printing funtions -----------
64 function print_header() {
68 $tagname = tag_display_name($this->tag_object
);
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;
78 if( $this->user_allowed_editing() ) {
79 $button = update_tag_button($this->id
);
81 print_header_simple($title, '', $navigation, '', '', '', $button);
84 function print_footer() {
89 page_map_class(PAGE_TAG_INDEX
, 'page_tag');