aboutsummaryrefslogtreecommitdiff
path: root/templates/sidebar.block.menu.php
blob: de4f0f7640b91f6a6affd40db511d09ab4c7970a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
$userservice =& ServiceFactory::getServiceInstance('UserService');

require_once('sidebar.linkedtags.inc.php');

$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;
}

if(strlen($user)==0) {
    $cat_url = createURL('tags', '%2$s');
}

$menuTags = $tag2tagservice->getMenuTags($userid);
if (sizeof($menuTags) > 0 || ($userid != 0 && $userid === $logged_on_userid)) {
?>

<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>';
	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>)';
	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>

<?php $cUser = $userservice->getUser($userid); ?>
<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> &rarr;</p>

</div>

<?php
}
?>