From 3e2854611b5d73687a701b24dc58fd56d79be09d Mon Sep 17 00:00:00 2001 From: mensonge Date: Thu, 17 Apr 2008 08:02:09 +0000 Subject: New feature: menu box which displays tags included into the special tag menu [Config modified] git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@105 b3834d28-1941-0410-a4f8-b48e95affb8f --- services/tag2tagservice.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'services') diff --git a/services/tag2tagservice.php b/services/tag2tagservice.php index ee26a11..8b2b731 100644 --- a/services/tag2tagservice.php +++ b/services/tag2tagservice.php @@ -188,6 +188,31 @@ class Tag2TagService { return $this->db->sql_fetchrowset($dbresult); } + function getMenuTags($uId) { + if(strlen($GLOBALS['menuTag']) < 1) { + return array(); + } else { + // we don't use the getAllLinkedTags function in order to improve performance + $query = "SELECT tag2 as 'tag', COUNT(tag2) as 'count'"; + $query.= " FROM `". $this->getTableName() ."`"; + $query.= " WHERE tag1 = '".$GLOBALS['menuTag']."'"; + $query.= " AND relationType = '>'"; + if($uId > 0) { + $query.= " AND uId = '".$uId."'"; + } + $query.= " GROUP BY tag2"; + $query.= " ORDER BY count DESC"; + $query.= " LIMIT 0, ".$GLOBALS['maxSizeMenuBlock']; + + if (! ($dbresult =& $this->db->sql_query($query)) ){ + message_die(GENERAL_ERROR, 'Could not get linked tags', '', __LINE__, __FILE__, $query, $this->db); + return false; + } + return $this->db->sql_fetchrowset($dbresult); + } + } + + function existsLinkedTags($tag1, $tag2, $relationType, $uId) { $query = "SELECT tag1, tag2, relationType, uId FROM `". $this->getTableName() ."`"; $query.= " WHERE tag1 = '" .$tag1 ."'"; -- cgit v1.2.3-54-g00ecf