2008-01-09 16:51:35 +01:00
|
|
|
<?php
|
2008-12-05 08:25:04 +01:00
|
|
|
/* Service creation: only useful services are created */
|
2008-01-09 16:51:35 +01:00
|
|
|
$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
|
|
|
|
|
2008-04-17 11:10:30 +02:00
|
|
|
require_once('sidebar.linkedtags.inc.php');
|
2008-01-09 16:51:35 +01:00
|
|
|
|
2008-05-10 10:59:41 +02:00
|
|
|
/* Manage input */
|
|
|
|
$user = isset($user)?$user:'';
|
|
|
|
$userid = isset($userid)?$userid:0;
|
|
|
|
$currenttag = isset($currenttag)?$currenttag:'';
|
|
|
|
$summarizeLinkedTags = isset($summarizeLinkedTags)?$summarizeLinkedTags:false;
|
|
|
|
|
|
|
|
|
2008-01-09 16:51:35 +01:00
|
|
|
$logged_on_userid = $userservice->getCurrentUserId();
|
|
|
|
if ($logged_on_userid === false) {
|
2009-01-06 17:39:02 +01:00
|
|
|
$logged_on_userid = NULL;
|
2008-01-09 16:51:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$explodedTags = array();
|
2008-05-10 10:59:41 +02:00
|
|
|
if (strlen($currenttag)>0) {
|
2009-01-06 17:39:02 +01:00
|
|
|
$explodedTags = explode('+', $currenttag);
|
2008-01-09 16:51:35 +01:00
|
|
|
} else {
|
2009-01-06 17:39:02 +01:00
|
|
|
if($summarizeLinkedTags == true) {
|
|
|
|
$orphewTags = $tag2tagservice->getOrphewTags('>', $userid, 4, "nb");
|
|
|
|
} else {
|
|
|
|
$orphewTags = $tag2tagservice->getOrphewTags('>', $userid);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($orphewTags as $orphewTag) {
|
|
|
|
$explodedTags[] = $orphewTag['tag'];
|
|
|
|
}
|
2008-01-09 16:51:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
2008-03-14 15:24:43 +01:00
|
|
|
<?php
|
|
|
|
if(($logged_on_userid != null) && ($userid === $logged_on_userid)) {
|
2009-01-06 17:39:02 +01:00
|
|
|
$editingMode = true;
|
2008-03-14 15:24:43 +01:00
|
|
|
} else {
|
2009-01-06 17:39:02 +01:00
|
|
|
$editingMode = false;
|
2008-03-14 15:24:43 +01:00
|
|
|
}
|
2009-01-06 17:39:02 +01:00
|
|
|
|
|
|
|
$this->includeTemplate("dojo.inc");
|
2008-03-14 15:24:43 +01:00
|
|
|
?>
|
|
|
|
|
|
|
|
<?php if(count($explodedTags)>0 || $editingMode):?>
|
|
|
|
|
2009-01-06 17:39:02 +01:00
|
|
|
<h2><?php
|
|
|
|
|
|
|
|
|
|
|
|
echo T_('Linked Tags').' ';
|
|
|
|
//if($userid != null) {
|
|
|
|
$cUser = $userservice->getUser($userid);
|
|
|
|
//echo '<small><a href="'.createURL('alltags', $cUser['username']).'">('.T_('all tags').')</a></small>';
|
|
|
|
//}
|
|
|
|
?></h2>
|
2008-03-14 15:24:43 +01:00
|
|
|
<?php //endif?>
|
2008-01-22 17:16:06 +01:00
|
|
|
|
2009-01-06 17:39:02 +01:00
|
|
|
<div id="related">
|
|
|
|
|
|
|
|
<!-- table-->
|
|
|
|
<?php
|
|
|
|
if($editingMode) {
|
|
|
|
//echo '<tr><td></td><td>';
|
|
|
|
echo '<p style="margin-bottom: 13px;text-align:center;">';
|
|
|
|
echo ' (<a href="'. createURL('tag2tagadd','') .'" rel="tag">'.T_('Add new link').'</a>) ';
|
|
|
|
echo ' (<a href="'. createURL('tag2tagdelete','') .'" rel="tag">'.T_('Delete link').'</a>)';
|
|
|
|
echo '</p>';
|
|
|
|
//echo '</td></tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(strlen($user)==0) {
|
|
|
|
$cat_url = createURL('tags', '%2$s');
|
|
|
|
}
|
|
|
|
|
|
|
|
$stopList = array();
|
|
|
|
foreach($explodedTags as $explodedTag) {
|
|
|
|
if(!in_array($explodedTag, $stopList)) {
|
|
|
|
|
2008-02-05 14:30:33 +01:00
|
|
|
|
2008-02-20 14:43:06 +01:00
|
|
|
|
2008-01-28 15:55:07 +01:00
|
|
|
// fathers tag
|
2009-01-06 17:39:02 +01:00
|
|
|
/*$fatherTags = $tag2tagservice->getLinkedTags($explodedTag, '>', $userid, true);
|
2008-01-28 15:55:07 +01:00
|
|
|
if(count($fatherTags)>0) {
|
2009-01-06 17:39:02 +01:00
|
|
|
foreach($fatherTags as $fatherTag) {
|
|
|
|
echo '<tr><td></td><td>';
|
|
|
|
echo '<a href="'. sprintf($cat_url, filter($user, 'url'), filter($fatherTag, 'url')) .'" rel="tag">('. filter($fatherTag) .')</a>';
|
|
|
|
echo '</td></tr>';
|
|
|
|
}
|
2008-01-28 15:55:07 +01:00
|
|
|
}
|
|
|
|
|
2008-01-28 16:02:58 +01:00
|
|
|
$displayLinkedTags = displayLinkedTags($explodedTag, '>', $userid, $cat_url, $user, $editingMode, null, 1);
|
2008-01-28 15:55:07 +01:00
|
|
|
echo $displayLinkedTags['output'];
|
|
|
|
if(is_array($displayLinkedTags['stopList'])) {
|
2009-01-06 17:39:02 +01:00
|
|
|
$stopList = array_merge($stopList, $displayLinkedTags['stopList']);
|
|
|
|
}*/
|
|
|
|
echo '<div dojoType="dojo.data.ItemFileReadStore" url="'.ROOT.'ajax/getlinkedtags.php?tag='.$explodedTag.'&uId='.$userid.'" jsid="linkedTagStore" ></div>';
|
|
|
|
echo '<div dojoType="dijit.Tree" store="linkedTagStore" labelAttr="name" >';
|
|
|
|
echo '<script type="dojo/method" event="onClick" args="item">';
|
|
|
|
$returnUrl = sprintf($cat_url, filter($user, 'url'), filter('', 'url'));
|
|
|
|
echo 'window.location = "'.$returnUrl.'"+item.name';
|
|
|
|
echo '</script>';
|
|
|
|
echo '<script type="dojo/method" event="getLabelClass" args="item">';
|
|
|
|
echo 'return \'treeTag\';';
|
|
|
|
echo '</script>';
|
|
|
|
echo '</div>';
|
2008-01-09 16:51:35 +01:00
|
|
|
}
|
2009-01-06 17:39:02 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<!-- /table-->
|
2008-01-09 16:51:35 +01:00
|
|
|
</div>
|
2008-02-20 14:47:33 +01:00
|
|
|
|
|
|
|
<?php endif?>
|