summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-02-17 13:15:06 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-02-17 13:15:06 +0000
commit3f9a5210f18c5d4418c3c2d8788f9babf1a231c4 (patch)
tree702a2832d83aac4c5df414a3315c937c5e4064ce /services
parent0025ca22a274865fa2a7a045323b3eb418705c4d (diff)
downloadsemanticscuttle-3f9a5210f18c5d4418c3c2d8788f9babf1a231c4.tar.gz
semanticscuttle-3f9a5210f18c5d4418c3c2d8788f9babf1a231c4.tar.bz2
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
Diffstat (limited to 'services')
-rw-r--r--services/bookmark2tagservice.php19
1 files changed, 19 insertions, 0 deletions
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;
}