dirroot.'/lib/weblib.php'); require_once($CFG->dirroot.'/blog/lib.php'); require_login(); if (empty($CFG->usetags)) { print_error('tagsaredisabled', 'tag'); } $tagid = optional_param('id', 0, PARAM_INT); // tag id $tagname = optional_param('tag', '', PARAM_TAG); // tag $edit = optional_param('edit', -1, PARAM_BOOL); $userpage = optional_param('userpage', 0, PARAM_INT); // which page to show $perpage = optional_param('perpage', 24, PARAM_INT); if ($tagname) { $tag = tag_get('name', $tagname, '*'); } else if ($tagid) { $tag = tag_get('id', $tagid, '*'); } if (empty($tag)) { redirect($CFG->wwwroot.'/tag/search.php'); } //create a new page_tag object, defined in pagelib.php $PAGE = page_create_object(PAGE_TAG_INDEX, $tag->id); $pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH); $PAGE->tag_object = $tag; if (($edit != -1) and $PAGE->user_allowed_editing()) { $USER->editing = $edit; } $PAGE->print_header(); // Manage all tags links $systemcontext = get_context_instance(CONTEXT_SYSTEM); if (has_capability('moodle/tag:manage', $systemcontext)) { echo '' ; } echo ''; echo ''; //----------------- left column ----------------- $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210); if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) { echo ''; } //----------------- middle column ----------------- echo ''; //----------------- right column ----------------- $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210); if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) { echo ''; } /// Finish the page echo '
'; blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); echo ''; $tagname = tag_display_name($tag); if ($tag->flag > 0 && has_capability('moodle/tag:manage', $systemcontext)) { $tagname = '' . $tagname . ''; } print_heading($tagname, '', 2, 'headingblock header tag-heading'); tag_print_management_box($tag); tag_print_description_box($tag); $usercount = tag_record_count('user', $tag->id); if ($usercount > 0) { //user table box print_box_start('generalbox', 'tag-user-table'); $heading = get_string('userstaggedwith', 'tag', $tagname) . ': ' . $usercount; print_heading($heading, '', 3); $baseurl = $CFG->wwwroot.'/tag/index.php?id=' . $tag->id; print_paging_bar($usercount, $userpage, $perpage, $baseurl.'&', 'userpage'); tag_print_tagged_users_table($tag, $userpage * $perpage, $perpage); print_box_end(); } // Print last 10 blogs // I was not able to use get_items_tagged_with() because it automatically // tries to join on 'blog' table, since the itemtype is 'blog'. However blogs // uses the post table so this would not really work. - Yu 29/8/07 if (has_capability('moodle/blog:view', $systemcontext)) { // You have to see blogs obviously if ($blogs = blog_fetch_entries('', 10, 0, 'site', '', $tag->id)) { print_box_start('generalbox', 'tag-blogs'); print_heading(get_string('relatedblogs', 'tag'), '', 3); echo ''; echo '

'.get_string('seeallblogs', 'tag').'...

'; print_box_end(); } } echo '
'; blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); echo '
'; $PAGE->print_footer(); ?>