require_once('../config.php');
require_once('lib.php');
+require_once('pagelib.php');
require_once($CFG->dirroot.'/lib/weblib.php');
+if (!empty($THEME->customcorners)) {
+ require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
+}
require_login();
}
$tagid = optional_param('id', 0, PARAM_INT); // tag id
+$edit = optional_param('edit', -1, PARAM_BOOL);
$userpage = optional_param('userpage', 0, PARAM_INT); // which page to show
-$perpage = optional_param('perpage', 20, PARAM_INT);
+$perpage = optional_param('perpage', 24, PARAM_INT);
$tag = tag_by_id($tagid);
redirect($CFG->wwwroot.'/tag/search.php');
}
-$tagname = tag_display_name($tag);
+//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();
+
+
+echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
+echo '<tr valign="top">';
+
+//----------------- left column -----------------
+
+$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
+
+echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="left-column">';
+if(blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
+ if (!empty($THEME->customcorners)) print_custom_corners_start();
+ blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
+ if (!empty($THEME->customcorners)) print_custom_corners_end();
+}
+echo '</td>';
+
+
+
+//----------------- middle column -----------------
-$navlinks = array();
-$navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
-$navlinks[] = array('name' => $tagname, 'link' => '', 'type' => '');
+echo '<td valign="top" id="middle-column">';
-$navigation = build_navigation($navlinks);
-print_header_simple(get_string('tag', 'tag') . ' - ' . $tagname, '', $navigation);
+if (!empty($THEME->customcorners)) print_custom_corners_start(TRUE);
+
+
+$tagname = tag_display_name($tag);
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
if ($tag->flag > 0 && has_capability('moodle/tag:manage', $systemcontext)) {
$tagname = '<span class="flagged-tag">' . $tagname . '</span>';
}
-print_heading($tagname, '', 2);
-
-print_tag_management_box($tag);
+print_heading($tagname, '', 2, 'headingblock header tag-heading');
print_tag_description_box($tag);
-$usercount = count_items_tagged_with($tagid,'user');
+$usercount = count_items_tagged_with($tag->id,'user');
if ($usercount > 0) {
- print_heading(get_string('userstaggedwith', 'tag', $tagname) . ': ' . $usercount, '', 3);
+ $heading = get_string('userstaggedwith', 'tag', $tagname) . ': ' . $usercount;
+ print_heading($heading, '', 3);
+
+ $baseurl = $CFG->wwwroot.'/tag/index.php?id=' . $tag->id;
- $baseurl = $CFG->wwwroot.'/tag/index.php?id=' . $tagid;
-
print_paging_bar($usercount, $userpage, $perpage, $baseurl.'&', 'userpage');
-
+
print_tagged_users_table($tag, $userpage * $perpage, $perpage);
}
-print_footer();
+if (!empty($THEME->customcorners)) print_custom_corners_end();
+echo '</td>';
+
+
+
+//----------------- right column -----------------
+
+$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
+
+echo '<td style="vertical-align: top; width: '.$blocks_preferred_width.'px;" id="right-column">';
+if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
+ if (!empty($THEME->customcorners)) print_custom_corners_start();
+ blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
+ if (!empty($THEME->customcorners)) print_custom_corners_end();
+}
+echo '</td>';
+
+/// Finish the page
+echo '</tr></table>';
+
+$PAGE->print_footer();
?>
}
//$value = preg_replace('|[^\w ]|i', '', strtolower(trim($tag_names_csv)));
- $value = preg_replace('|[\!\@\#\$\%\^\&\*\(\)\-\+\=\~\`\.\[\]\{\}\:\;\?\´\^\\\/\<\>\|]|i', '', trim($value));
+ $value = preg_replace('|[\!\@\#\$\%\^\&\*\(\)\-\+\=\~\`\\"\'\_.\[\]\{\}\:\;\?\´\^\\\/\<\>\|]|i', '', trim($value));
//removes excess white spaces
$value = preg_replace('/\s\s+/', ' ', $value);
}
-function is_tag_clean($tag_names_csv) {
-
-}
-
function tag_flag_inappropriate($tag_names_or_ids_csv){
$tag_ids_csv = tag_id_from_string($tag_names_or_ids_csv);
$tags[] = tag_display_name($tag);
}
- return implode(',', $tags);
+ return implode(', ', $tags);
}
$tagname = tag_display_name($tag_object);
$related_tags = related_tags($tag_object->id); //get_item_tags('tags',$tag_object->id);
-
print_box_start('generalbox', 'tag-description');
+ print_tag_management_box($tag_object);
+
if (!empty($tag_object->description)) {
echo format_text($tag_object->description, $tag_object->descriptionformat );
}
if ($related_tags) {
- echo '<br/><b>'.get_string('relatedtags','tag').': </b>' . tag_links_csv($related_tags);
+ echo '<br/><br/><b>'.get_string('relatedtags','tag').': </b>' . tag_links_csv($related_tags);
}
print_box_end();
if($tags) { // there are results to display!!
- print_heading(get_string('searchresultsfor', 'tag') . " \"{$query}\" : {$count}", '', 3);
+ print_heading(get_string('searchresultsfor', 'tag', $query) . " : {$count}", '', 3);
//print a link "Add $query to my interests"
if (!empty($addtaglink)) {
}
else { //no results were found!!
- print_heading(get_string('noresultsfor', 'tag') . " \"{$query}\" ", '', 3);
+ print_heading(get_string('noresultsfor', 'tag', $query), '', 3);
//print a link "Add $query to my interests"
if (!empty($addtaglink)) {
$navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
$navigation = build_navigation($navlinks);
-
-print_header_simple(get_string('tags', 'tag'), '', $navigation);
-
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
if ( has_capability('moodle/tag:manage',$systemcontext) ) {
$manage_link = "<a href=\"{$CFG->wwwroot}/tag/manage.php\">" . get_string('managetags', 'tag') . "</a>" ;
- print_box($manage_link, '', 'tags-management-links');
}
+print_header_simple(get_string('tags', 'tag'), '', $navigation, '', '', '', $manage_link);
+
print_heading(get_string('searchtags', 'tag'), '', 2);
print_tag_search_box();