Interface Fix: add bookmarks counting into admin page
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@273 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
fe83f9ea0e
commit
44915a6e54
3 changed files with 31 additions and 3 deletions
|
@ -71,8 +71,30 @@ class BookmarkService {
|
||||||
return $this->_getbookmark('bHash', $hash, true);
|
return $this->_getbookmark('bHash', $hash, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function countBookmarks($uId) {
|
/* Counts bookmarks for a user. $range = {'public', 'shared', 'private', 'all'}*/
|
||||||
|
function countBookmarks($uId, $range = 'public') {
|
||||||
|
$sql = 'SELECT COUNT(*) FROM '. $GLOBALS['tableprefix'] .'bookmarks';
|
||||||
|
$sql.= ' WHERE uId = '.$uId;
|
||||||
|
switch ($range) {
|
||||||
|
case 'all':
|
||||||
|
//no constraints
|
||||||
|
break;
|
||||||
|
case 'private':
|
||||||
|
$sql.= ' AND bStatus = 2';
|
||||||
|
break;
|
||||||
|
case 'shared':
|
||||||
|
$sql.= ' AND bStatus = 1';
|
||||||
|
break;
|
||||||
|
case 'public':
|
||||||
|
default:
|
||||||
|
$sql.= ' AND bStatus = 0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!($dbresult = & $this->db->sql_query($sql))) {
|
||||||
|
message_die(GENERAL_ERROR, 'Could not get vars', '', __LINE__, __FILE__, $sql, $this->db);
|
||||||
|
}
|
||||||
|
return $this->db->sql_fetchfield(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function editAllowed($bookmark) {
|
function editAllowed($bookmark) {
|
||||||
|
|
|
@ -592,5 +592,10 @@ class User {
|
||||||
}
|
}
|
||||||
return $this->isAdmin;
|
return $this->isAdmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getNbBookmarks($range = 'public') {
|
||||||
|
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
|
||||||
|
return $bookmarkservice->countBookmarks($this->getId(), $range);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -11,6 +11,7 @@ foreach($users as $user) {
|
||||||
|
|
||||||
echo '<div class="link">';
|
echo '<div class="link">';
|
||||||
echo '<a href="'.createURL('profile', $user->getUsername()).'">'.$user->getUsername().'</a>';
|
echo '<a href="'.createURL('profile', $user->getUsername()).'">'.$user->getUsername().'</a>';
|
||||||
|
echo ' - <span title='. T_('Public/Shared/Private') .'>'. $user->getNbBookmarks('public') .' / '. $user->getNbBookmarks('shared') .' / '. $user->getNbBookmarks('private') .' '. T_('bookmark(s)') .'</span>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
if($user->getUsername() != $currentUser->getUsername()) {
|
if($user->getUsername() != $currentUser->getUsername()) {
|
||||||
|
|
Loading…
Reference in a new issue