]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #4515 from MrPetovan/task/4513-hide-attendno-events
authorMichael Vogel <icarus@dabo.de>
Wed, 28 Feb 2018 14:29:16 +0000 (15:29 +0100)
committerGitHub <noreply@github.com>
Wed, 28 Feb 2018 14:29:16 +0000 (15:29 +0100)
Add attendance check to event reminder

mod/network.php
mod/profile.php
src/Model/Profile.php

index 8cd2e279397ac4c43ae928cdcff5a74a3c0c6412..5ec97dbe99657995b78bfea9aa6e9d883821a2eb 100644 (file)
@@ -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, $parent)
 
        if (!$gid && !$cid && !$update && !Config::get('theme', 'hide_eventlist')) {
                $o .= Profile::getBirthdays();
-               $o .= Profile::getEvents();
+               $o .= Profile::getEventsReminderHTML();
        }
 
        if ($datequery) {
index 74ca06aad9fb9e4e7b5155c73f2df8b830072c09..5e5988994cbe0965c58060bb1a0f87239d74f908 100644 (file)
@@ -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();
        }
 
 
index 81f99630994173c0a5867446d58f39ff56b05af8..e493d82d53cfb36c4be9234bd093113211860909 100644 (file)
@@ -622,7 +622,7 @@ class Profile
                ]);
        }
 
-       public static function getEvents()
+       public static function getEventsReminderHTML()
        {
                $a = get_app();
                $o = '';
@@ -642,12 +642,26 @@ 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 *
+                       FROM `event`
+                       WHERE `event`.`uid` = ?
+                       AND  `event`.`type` != 'birthday'
+                       AND  `event`.`start` < ?
+                       AND  `event`.`start` >= ?
+                       AND NOT EXISTS (
+                               SELECT `id`
+                               FROM `item`
+                               WHERE `item`.`uid` = `event`.`uid`
+                               AND `item`.`parent-uri` = `event`.`uri`
+                               AND `item`.`verb` = ?
+                               AND `item`.`visible`
+                               AND NOT `item`.`deleted`
+                       )
+                       ORDER BY  `event`.`start` ASC",
                        local_user(),
                        DateTimeFormat::utc('now + 7 days'),
-                       DateTimeFormat::utc('now - 1 days')
+                       DateTimeFormat::utc('now - 1 days'),
+                       ACTIVITY_ATTENDNO
                );
 
                $r = [];