From f58d8f410885bb1895821cd0767bdf981629f0cd Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 27 Feb 2018 20:47:18 -0500 Subject: [PATCH] Add attendance check to event reminder --- mod/network.php | 4 ++-- mod/profile.php | 2 +- src/Model/Profile.php | 20 ++++++++++++++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/mod/network.php b/mod/network.php index 2d9a829ce4..5b9e2a6fb9 100644 --- a/mod/network.php +++ b/mod/network.php @@ -439,7 +439,7 @@ function networkFlatView(App $a, $update = 0) if (!Config::get('theme', 'hide_eventlist')) { $o .= Profile::getBirthdays(); - $o .= Profile::getEvents(); + $o .= Profile::getEventsReminderHTML(); } } @@ -677,7 +677,7 @@ function networkThreadedView(App $a, $update = 0) if (!$gid && !$cid && !$update && !Config::get('theme', 'hide_eventlist')) { $o .= Profile::getBirthdays(); - $o .= Profile::getEvents(); + $o .= Profile::getEventsReminderHTML(); } if ($datequery) { diff --git a/mod/profile.php b/mod/profile.php index 74ca06aad9..5e5988994c 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -352,7 +352,7 @@ function profile_content(App $a, $update = 0) if ($is_owner && !$update && !Config::get('theme', 'hide_eventlist')) { $o .= Profile::getBirthdays(); - $o .= Profile::getEvents(); + $o .= Profile::getEventsReminderHTML(); } diff --git a/src/Model/Profile.php b/src/Model/Profile.php index 81f9963099..c91fdc1a9e 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -622,7 +622,7 @@ class Profile ]); } - public static function getEvents() + public static function getEventsReminderHTML() { $a = get_app(); $o = ''; @@ -642,9 +642,21 @@ class Profile $classtoday = ''; $s = dba::p( - "SELECT `event`.* FROM `event` - WHERE `event`.`uid` = ? AND `type` != 'birthday' AND `start` < ? AND `start` >= ? - ORDER BY `start` ASC ", + "SELECT `event`.*, `item`.`id`, `item`.`thr-parent`, `item`.`parent-uri` + FROM `event` + LEFT JOIN `item` + ON `item`.`uid` = `event`.`uid` + AND `item`.`parent-uri` = `event`.`uri` + AND `item`.`verb` = ? + AND `item`.`visible` + AND NOT `item`.`deleted` + WHERE `event`.`uid` = ? + AND `event`.`type` != 'birthday' + AND `event`.`start` < ? + AND `event`.`start` >= ? + AND `item`.`id` IS NULL + ORDER BY `event`.`start` ASC", + ACTIVITY_ATTENDNO, local_user(), DateTimeFormat::utc('now + 7 days'), DateTimeFormat::utc('now - 1 days')