aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Notifications.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-10-22 19:32:08 -0700
committerzotlabs <mike@macgirvin.com>2017-10-22 19:32:08 -0700
commitc49eec71f0995cd75be99a64a4dde398f9f0241b (patch)
tree06e29769c32460299d9c73794028e657e362b6e2 /Zotlabs/Module/Notifications.php
parentcdb1bc9be6fbc09caff62c0153386cc58a2bfbd9 (diff)
parentb58bf75f21d15ac440bb3a90edb29afac9eb64ba (diff)
downloadvolse-hubzilla-c49eec71f0995cd75be99a64a4dde398f9f0241b.tar.gz
volse-hubzilla-c49eec71f0995cd75be99a64a4dde398f9f0241b.tar.bz2
volse-hubzilla-c49eec71f0995cd75be99a64a4dde398f9f0241b.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'Zotlabs/Module/Notifications.php')
-rw-r--r--Zotlabs/Module/Notifications.php35
1 files changed, 27 insertions, 8 deletions
diff --git a/Zotlabs/Module/Notifications.php b/Zotlabs/Module/Notifications.php
index 652648701..dfa007548 100644
--- a/Zotlabs/Module/Notifications.php
+++ b/Zotlabs/Module/Notifications.php
@@ -12,25 +12,44 @@ class Notifications extends \Zotlabs\Web\Controller {
return;
}
- nav_set_selected('notifications');
+ nav_set_selected('Notifications');
$o = '';
-
- $r = q("SELECT * from notify where uid = %d and seen = 0 order by created desc",
+
+ $r = q("select count(*) as total from notify where uid = %d and seen = 0",
intval(local_channel())
);
+ if($r && intval($t[0]['total']) > 49) {
+ $r = q("select * from notify where uid = %d
+ and seen = 0 order by created desc limit 50",
+ intval(local_channel())
+ );
+ } else {
+ $r1 = q("select * from notify where uid = %d
+ and seen = 0 order by created desc limit 50",
+ intval(local_channel())
+ );
+ $r2 = q("select * from notify where uid = %d
+ and seen = 1 order by created desc limit %d",
+ intval(local_channel()),
+ intval(50 - intval($t[0]['total']))
+ );
+ $r = array_merge($r1,$r2);
+ }
if($r) {
$notifications_available = 1;
- foreach ($r as $it) {
- $x = strip_tags(bbcode($it['msg']));
+ foreach ($r as $rr) {
+ $x = strip_tags(bbcode($rr['msg']));
if(strpos($x,','))
$x = substr($x,strpos($x,',')+1);
$notif_content .= replace_macros(get_markup_template('notify.tpl'),array(
- '$item_link' => z_root().'/notify/view/'. $it['id'],
- '$item_image' => $it['photo'],
+ '$item_link' => z_root().'/notify/view/'. $rr['id'],
+ '$item_image' => $rr['photo'],
'$item_text' => $x,
- '$item_when' => relative_date($it['created'])
+ '$item_when' => relative_date($rr['created']),
+ '$item_seen' => (($rr['seen']) ? true : false),
+ '$new' => t('New')
));
}
}