2008-01-09 15:51:35 +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-01-09 15:51:35 +00:00
|
|
|
|
2008-04-17 09:10:30 +00:00
|
|
|
require_once('sidebar.linkedtags.inc.php');
|
2008-01-09 15:51:35 +00:00
|
|
|
|
2008-05-10 08:59:41 +00:00
|
|
|
/* Manage input */
|
|
|
|
$user = isset($user)?$user:'';
|
|
|
|
$userid = isset($userid)?$userid:0;
|
|
|
|
$currenttag = isset($currenttag)?$currenttag:'';
|
|
|
|
$summarizeLinkedTags = isset($summarizeLinkedTags)?$summarizeLinkedTags:false;
|
|
|
|
|
|
|
|
|
2008-01-09 15:51:35 +00:00
|
|
|
$logged_on_userid = $userservice->getCurrentUserId();
|
|
|
|
if ($logged_on_userid === false) {
|
2009-01-06 16:39:02 +00:00
|
|
|
$logged_on_userid = NULL;
|
2008-01-09 15:51:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$explodedTags = array();
|
2008-05-10 08:59:41 +00:00
|
|
|
if (strlen($currenttag)>0) {
|
2009-01-06 16:39:02 +00:00
|
|
|
$explodedTags = explode('+', $currenttag);
|
2008-01-09 15:51:35 +00:00
|
|
|
} else {
|
2009-01-06 16:39:02 +00: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 15:51:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
2008-03-14 14:24:43 +00:00
|
|
|
<?php
|
|
|
|
if(($logged_on_userid != null) && ($userid === $logged_on_userid)) {
|
2009-01-06 16:39:02 +00:00
|
|
|
$editingMode = true;
|
2008-03-14 14:24:43 +00:00
|
|
|
} else {
|
2009-01-06 16:39:02 +00:00
|
|
|
$editingMode = false;
|
2008-03-14 14:24:43 +00:00
|
|
|
}
|
2009-01-06 16:39:02 +00:00
|
|
|
|
|
|
|
$this->includeTemplate("dojo.inc");
|
2008-03-14 14:24:43 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
<?php if(count($explodedTags)>0 || $editingMode):?>
|
|
|
|
|
2009-01-06 16:39:02 +00: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 14:24:43 +00:00
|
|
|
<?php //endif?>
|
2008-01-22 16:16:06 +00:00
|
|
|
|
2009-02-11 10:25:56 +00:00
|
|
|
<div id="related"> <?php
|
2009-01-06 16:39:02 +00:00
|
|
|
if($editingMode) {
|
|
|
|
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>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(strlen($user)==0) {
|
|
|
|
$cat_url = createURL('tags', '%2$s');
|
|
|
|
}
|
|
|
|
|
|
|
|
$stopList = array();
|
|
|
|
foreach($explodedTags as $explodedTag) {
|
|
|
|
if(!in_array($explodedTag, $stopList)) {
|
|
|
|
|
2008-02-05 13:30:33 +00:00
|
|
|
|
2008-02-20 13:43:06 +00:00
|
|
|
|
2008-01-28 14:55:07 +00:00
|
|
|
// fathers tag
|
2009-01-07 10:30:15 +00:00
|
|
|
$fatherTags = $tag2tagservice->getLinkedTags($explodedTag, '>', $userid, true);
|
2008-01-28 14:55:07 +00:00
|
|
|
if(count($fatherTags)>0) {
|
2009-01-07 10:30:15 +00:00
|
|
|
foreach($fatherTags as $fatherTag) {
|
|
|
|
echo '<a href="'. sprintf($cat_url, filter($user, 'url'), filter($fatherTag, 'url')) .'" rel="tag">('. filter($fatherTag) .')</a> ';
|
|
|
|
}
|
2008-01-28 14:55:07 +00:00
|
|
|
}
|
2009-01-07 10:30:15 +00:00
|
|
|
/*
|
|
|
|
$displayLinkedTags = displayLinkedTags($explodedTag, '>', $userid, $cat_url, $user, $editingMode, null, 1);
|
|
|
|
echo $displayLinkedTags['output'];
|
|
|
|
if(is_array($displayLinkedTags['stopList'])) {
|
|
|
|
$stopList = array_merge($stopList, $displayLinkedTags['stopList']);
|
|
|
|
}*/
|
2009-02-11 10:25:56 +00:00
|
|
|
echo '<div dojoType="dojo.data.ItemFileReadStore" url="'.ROOT.'ajax/getlinkedtags.php?tag='.filter($explodedTag, 'url').'&uId='.$userid.'" jsid="linkedTagStore" ></div>';
|
2009-01-06 16:39:02 +00:00
|
|
|
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 15:51:35 +00:00
|
|
|
}
|
2009-01-06 16:39:02 +00:00
|
|
|
|
|
|
|
}
|
2009-02-11 10:25:56 +00:00
|
|
|
?> </div>
|
2008-02-20 13:47:33 +00:00
|
|
|
|
|
|
|
<?php endif?>
|