'user/'.$user->uid.'/mytags',
'title' => t('MyTags'),
'description' => t('My Personal Tags'),
'type' => MENU_IS_LOCAL_TASK,
'callback' => 'mytags_show'
);
$items[] = array('path' => 'user/'.$user->uid.'/mytags/term',
'title' => t('My Tags'),
'callback' => 'mytags_term_page',
'type' => MENU_CALLBACK);
return $items;
}
function mytags_show() {
global $user;
return mytags_community_tags_display('user', NULL, $user->uid, NULL);
}
function mytags_term_page($tid) {
if ($tid) {
global $user;
$myterm=taxonomy_get_term($tid);
$output = '
See '. l('all items tagged with '. $myterm -> name, taxonomy_term_path($myterm)). '
';
$output .= 'Here are articles you have tagged with '. $myterm->name. '
';
$sql = 'SELECT DISTINCT(ct.nid) FROM {community_tags} ct where ct.tid=%d AND ct.uid=%d';
$sqlcount = 'SELECT COUNT(DISTINCT(ct.nid)) FROM {community_tags} ct where ct.tid=%d AND ct.uid=%d';
$result = pager_query($sql, variable_get('default_nodes_main', 10), 0, $sql_count,$tid,$user->uid,$tid,$user->uid);
$output .= taxonomy_render_nodes($result);
}
else {
drupal_not_found();
}
return $output;
}
function theme_mytags_tagadelic_weighted($terms) {
global $user;
foreach ($terms as $term) {
$output .= l($term->name, 'user/'.$user->uid.'/mytags/term/'.$term->tid, array('class'=>"tagadelic level$term->weight")) ." \n";
}
return $output;
}
function mytags_community_tags_display($type = 'global', $limit = NULL, $arg1 = NULL, $arg2 = NULL) {
$result = _community_tags_get_tag_result($type, $limit, $arg1, $arg2);
$weighted_tags = tagadelic_build_weighted_tags($result);
$sorted_tags = tagadelic_sort_tags($weighted_tags);
return theme('mytags_community_tags', $sorted_tags);
}
function theme_mytags_community_tags($tags) {
return ''. (count($tags) ? theme('mytags_tagadelic_weighted', $tags) : t('None')) .'
';
}