moving user bulk operations to admin/user/
[moodle-pu.git] / tag / index.php
blobd3c60a57e22baf84b5588ecc5c3c3d9871eb1d04
1 <?php // $Id$
3 require_once('../config.php');
4 require_once('lib.php');
5 require_once('pagelib.php');
6 require_once($CFG->dirroot.'/lib/weblib.php');
8 require_login();
10 if (empty($CFG->usetags)) {
11 error(get_string('tagsaredisabled', 'tag'));
14 $tagid = optional_param('id', 0, PARAM_INT); // tag id
15 $edit = optional_param('edit', -1, PARAM_BOOL);
16 $userpage = optional_param('userpage', 0, PARAM_INT); // which page to show
17 $perpage = optional_param('perpage', 24, PARAM_INT);
19 $tag = tag_by_id($tagid);
21 if (!$tag) {
22 redirect($CFG->wwwroot.'/tag/search.php');
25 //create a new page_tag object, defined in pagelib.php
26 $PAGE = page_create_object(PAGE_TAG_INDEX, $tag->id);
27 $pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH);
28 $PAGE->tag_object = $tag;
30 if (($edit != -1) and $PAGE->user_allowed_editing()) {
31 $USER->editing = $edit;
35 $PAGE->print_header();
38 echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
39 echo '<tr valign="top">';
41 //----------------- left column -----------------
43 $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
45 echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="left-column">';
46 if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
47 blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
49 echo '</td>';
53 //----------------- middle column -----------------
55 echo '<td valign="top" id="middle-column">';
58 $tagname = tag_display_name($tag);
60 $systemcontext = get_context_instance(CONTEXT_SYSTEM);
61 if ($tag->flag > 0 && has_capability('moodle/tag:manage', $systemcontext)) {
62 $tagname = '<span class="flagged-tag">' . $tagname . '</span>';
65 print_heading($tagname, '', 2, 'headingblock header tag-heading');
67 print_tag_description_box($tag);
70 $usercount = count_items_tagged_with($tag->id,'user');
72 if ($usercount > 0) {
74 $heading = get_string('userstaggedwith', 'tag', $tagname) . ': ' . $usercount;
75 print_heading($heading, '', 3);
77 $baseurl = $CFG->wwwroot.'/tag/index.php?id=' . $tag->id;
79 print_paging_bar($usercount, $userpage, $perpage, $baseurl.'&amp;', 'userpage');
81 print_tagged_users_table($tag, $userpage * $perpage, $perpage);
85 echo '</td>';
89 //----------------- right column -----------------
91 $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
93 echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="right-column">';
94 if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
95 blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
97 echo '</td>';
99 /// Finish the page
100 echo '</tr></table>';
104 $PAGE->print_footer();