From 3f9a5210f18c5d4418c3c2d8788f9babf1a231c4 Mon Sep 17 00:00:00 2001 From: mensonge Date: Tue, 17 Feb 2009 13:15:06 +0000 Subject: Interface fix: option to allow admins to see easily tags from other admins when adding/editing a bookmark. [Config file modified: ] git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@289 b3834d28-1941-0410-a4f8-b48e95affb8f --- services/bookmark2tagservice.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'services') diff --git a/services/bookmark2tagservice.php b/services/bookmark2tagservice.php index 257db15..86cb88a 100644 --- a/services/bookmark2tagservice.php +++ b/services/bookmark2tagservice.php @@ -326,7 +326,20 @@ class Bookmark2TagService { $this->db->sql_freeresult($dbresult); return $output; } + + function &getAdminTags($limit = 30, $logged_on_user = NULL, $days = NULL) { + // look for admin ids + $userservice = & ServiceFactory :: getServiceInstance('UserService'); + $admins = array(); + foreach($GLOBALS['admin_users'] as $adminName) { + $admins[] = $userservice->getIdFromUser($adminName); + } + + // ask for their tags + return $this->getPopularTags($admins, $limit, $logged_on_user, $days); + } + // $users can be {NULL, an id, an array of id} function &getPopularTags($user = NULL, $limit = 30, $logged_on_user = NULL, $days = NULL) { // Only count the tags that are visible to the current user. if (($user != $logged_on_user) || is_null($user) || ($user === false)) @@ -342,6 +355,12 @@ class Bookmark2TagService { $query = 'SELECT T.tag, COUNT(T.bId) AS bCount FROM '. $this->getTableName() .' AS T, '. $GLOBALS['tableprefix'] .'bookmarks AS B WHERE '; if (is_null($user) || ($user === false)) { $query .= 'B.bId = T.bId AND B.bStatus = 0'; + } elseif(is_array($user)) { + $query .= ' (1 = 0'; //tricks + foreach($user as $u) { + $query .= ' OR B.uId = '. $this->db->sql_escape($u) .' AND B.bId = T.bId'; + } + $query .= ' )'; } else { $query .= 'B.uId = '. $this->db->sql_escape($user) .' AND B.bId = T.bId'. $privacy; } -- cgit v1.2.3-54-g00ecf