aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-07-28 17:39:26 -0700
committerfriendica <info@friendica.com>2012-07-28 17:39:26 -0700
commiteae7522bc99cc3af0074c189560a66181d2b70a0 (patch)
tree81022ec2be254fff0e57a1f47727e0607761d373
parent2ae0076ae2f08a0f88ad96db4cac0d1b303260ce (diff)
downloadvolse-hubzilla-eae7522bc99cc3af0074c189560a66181d2b70a0.tar.gz
volse-hubzilla-eae7522bc99cc3af0074c189560a66181d2b70a0.tar.bz2
volse-hubzilla-eae7522bc99cc3af0074c189560a66181d2b70a0.zip
also notify count of events today
-rw-r--r--mod/ping.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/mod/ping.php b/mod/ping.php
index 99ff48aa7..d37824645 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -15,6 +15,7 @@ function ping_init(&$a) {
$result['mail'] = 0;
$result['register'] = 0;
$result['events'] = 0;
+ $result['events_today'] = 0;
$result['notice'] = array();
$result['info'] = array();
@@ -154,18 +155,26 @@ function ping_init(&$a) {
$t5 = dba_timer();
-
- $events = q("SELECT count(`event`.`id`) as total FROM `event`
+ $events = q("SELECT count(`event`.`id`) as total, start, convert FROM `event`
WHERE `event`.`uid` = %d AND `start` < '%s' AND `finish` > '%s'
ORDER BY `start` ASC ",
intval(local_user()),
- dbesc(datetime_convert('UTC','UTC','now + 1 days')),
+ dbesc(datetime_convert('UTC','UTC','now + 7 days')),
dbesc(datetime_convert('UTC','UTC','now'))
);
- if($events)
+ if($events && count($events)) {
$result['events'] = intval($events[0]['total']);
+ if($result['events']) {
+ $str_now = datetime_convert('UTC',$a->timezone,'now','Y-m-d');
+ foreach($events as $x) {
+ if(datetime_convert('UTC',((intval($x['convert'])) ? $a->timezone : 'UTC'), $x['start'],'Y-m-d') === $str_now)
+ $result['events_today'] ++;
+ }
+ }
+ }
+
$x = json_encode($result);
$t6 = dba_timer();