2008-04-17 10:02:09 +02:00
< ? php
2008-12-05 08:25:04 +01:00
/* Service creation: only useful services are created */
2009-10-03 23:52:30 +02:00
$tag2tagservice = SemanticScuttle_Service_Factory :: getServiceInstance ( 'Tag2Tag' );
2008-12-05 08:25:04 +01:00
2008-04-17 10:02:09 +02:00
2008-04-17 11:10:30 +02:00
require_once ( 'sidebar.linkedtags.inc.php' );
2008-04-17 10:02:09 +02:00
2008-05-10 10:59:41 +02:00
/* Manage input */
$userid = isset ( $userid ) ? $userid : 0 ;
$user = isset ( $user ) ? $user : null ;
2008-04-17 10:02:09 +02: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 20:32:15 +01:00
if ( ! isset ( $user ) || $user == '' ) {
2008-04-17 10:02:09 +02:00
$cat_url = createURL ( 'tags' , '%2$s' );
}
$menuTags = $tag2tagservice -> getMenuTags ( $userid );
2008-04-24 10:48:57 +02:00
if ( sizeof ( $menuTags ) > 0 || ( $userid != 0 && $userid === $logged_on_userid )) {
2008-04-17 10:02:09 +02: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 10:48:57 +02: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 10:02:09 +02: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 10:48:57 +02:00
< ? php $cUser = $userservice -> getUser ( $userid ); ?>
2008-05-09 09:29:50 +02:00
< ? php if ( $userid > 0 ) : ?>
< ? php if ( $userid == $logged_on_userid ) : ?>
2008-04-24 10:48:57 +02: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 09:29:50 +02: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 10:48:57 +02:00
2008-05-09 09:29:50 +02: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 10:02:09 +02:00
</ div >
< ? php
}
?>