2008-04-17 08:02:09 +00:00
< ? php
2008-12-05 07:25:04 +00:00
/* Service creation: only useful services are created */
2009-10-23 17:13:16 +00:00
$tag2tagservice = SemanticScuttle_Service_Factory :: get ( 'Tag2Tag' );
2008-12-05 07:25:04 +00:00
2008-04-17 08:02:09 +00:00
2008-04-17 09:10:30 +00:00
require_once ( 'sidebar.linkedtags.inc.php' );
2008-04-17 08:02:09 +00:00
2008-05-10 08:59:41 +00:00
/* Manage input */
$userid = isset ( $userid ) ? $userid : 0 ;
$user = isset ( $user ) ? $user : null ;
2008-04-17 08:02:09 +00:00
$logged_on_userid = $userservice -> getCurrentUserId ();
if ( $logged_on_userid === false ) {
$logged_on_userid = NULL ;
}
// editing mode
if (( $logged_on_userid != null ) && ( $userid === $logged_on_userid )) {
$editingMode = true ;
} else {
$editingMode = false ;
}
2008-11-30 19:32:15 +00:00
if ( ! isset ( $user ) || $user == '' ) {
2008-04-17 08:02:09 +00:00
$cat_url = createURL ( 'tags' , '%2$s' );
}
$menuTags = $tag2tagservice -> getMenuTags ( $userid );
2008-04-24 08:48:57 +00:00
if ( sizeof ( $menuTags ) > 0 || ( $userid != 0 && $userid === $logged_on_userid )) {
2008-04-17 08:02:09 +00:00
?>
< h2 >
< ? php
echo '<span title="' . sprintf ( T_ ( 'Tags included into the tag \'%s\'' ), $GLOBALS [ 'menuTag' ]) . '">' . T_ ( 'Menu Tags' ) . '</span> ' ;
//}
?>
</ h2 >
< div id = " related " >
< table >
< ? php
if ( $editingMode ) {
echo '<tr><td></td><td>' ;
2008-04-24 08:48:57 +00:00
echo ' (<a href="' . createURL ( 'tag2tagadd' , 'menu' ) . '" rel="tag">' . T_ ( 'Add new link' ) . '</a>) ' ;
echo ' (<a href="' . createURL ( 'tag2tagdelete' , 'menu' ) . '" rel="tag">' . T_ ( 'Delete link' ) . '</a>)' ;
2008-04-17 08:02:09 +00:00
echo '</td></tr>' ;
}
$stopList = array ();
foreach ( $menuTags as $menuTag ) {
$tag = $menuTag [ 'tag' ];
if ( ! in_array ( $tag , $stopList )) {
$displayLinkedTags = displayLinkedTags ( $tag , '>' , $userid , $cat_url , $user , $editingMode , null , 1 );
echo $displayLinkedTags [ 'output' ];
if ( is_array ( $displayLinkedTags [ 'stopList' ])) {
$stopList = array_merge ( $stopList , $displayLinkedTags [ 'stopList' ]);
}
}
}
?>
</ table >
2008-04-24 08:48:57 +00:00
< ? php $cUser = $userservice -> getUser ( $userid ); ?>
2008-05-09 07:29:50 +00:00
< ? php if ( $userid > 0 ) : ?>
< ? php if ( $userid == $logged_on_userid ) : ?>
2008-04-24 08:48:57 +00:00
< p style = " text-align:right " >< a href = " <?php echo createURL('alltags', $cUser['username'] ); ?> " title = " <?php echo T_('See all your tags')?> " >< ? php echo T_ ( 'all your tags' ); ?> </a> →</p>
2008-05-09 07:29:50 +00:00
< ? php else : ?>
< p style = " text-align:right " >< a href = " <?php echo createURL('alltags', $cUser['username'] ); ?> " title = " <?php echo T_('See all tags from this user')?> " >< ? php echo T_ ( 'all tags from this user' ); ?> </a> →</p>
< ? php endif ; ?>
2008-04-24 08:48:57 +00:00
2008-05-09 07:29:50 +00:00
< ? php else : ?>
< p style = " text-align:right " >< a href = " <?php echo createURL('populartags', $cUser['username'] ); ?> " title = " <?php echo T_('See popular tags')?> " >< ? php echo T_ ( 'Popular Tags' ); ?> </a> →</p>
< ? php endif ; ?>
2008-04-17 08:02:09 +00:00
</ div >
< ? php
}
?>