ping: further work
This commit is contained in:
parent
c0406918ec
commit
4b7f080c46
2 changed files with 17 additions and 5 deletions
|
@ -340,18 +340,30 @@ function groups_containing($uid,$c) {
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @brief count unread group items
|
||||||
|
*
|
||||||
|
* Count unread items of each groups
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* 'id' => contact id
|
||||||
|
* 'name' => group name
|
||||||
|
* 'count' => counted unseen group items
|
||||||
|
*
|
||||||
|
*/
|
||||||
function groups_count_unseen() {
|
function groups_count_unseen() {
|
||||||
|
|
||||||
$r = q("SELECT `group`.`id`, `group`.`name`, COUNT(`item`.id`) AS `count` FROM `group`, `group_member`, `item`
|
$r = q("SELECT `group`.`id`, `group`.`name`, COUNT(`item`.`id`) AS `count` FROM `group`, `group_member`, `item`
|
||||||
WHERE `group`.`uid` = %d
|
WHERE `group`.`uid` = %d
|
||||||
AND `item`.`uid` = %d
|
AND `item`.`uid` = %d
|
||||||
AND `item`.`unseen` AND `item`.`visible`
|
AND `item`.`unseen` AND `item`.`visible`
|
||||||
AND NOT `item`.`deleted`
|
AND NOT `item`.`deleted`
|
||||||
AND `item`.`contact-id` = `group_member`.`contact-id`
|
AND `item`.`contact-id` = `group_member`.`contact-id`
|
||||||
AND `group_member`.`gid` = `group`.`id`
|
AND `group_member`.`gid` = `group`.`id`
|
||||||
GROUP BY `group.id` ",
|
GROUP BY `group`.`id` ",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return $r;
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
require_once("include/datetime.php");
|
require_once("include/datetime.php");
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
require_once('include/forums.php');
|
require_once('include/forums.php');
|
||||||
require_once('include/groupo.php');
|
require_once('include/group.php');
|
||||||
require_once("mod/proxy.php");
|
require_once("mod/proxy.php");
|
||||||
|
|
||||||
function ping_init(&$a) {
|
function ping_init(&$a) {
|
||||||
|
|
Loading…
Reference in a new issue