]> git.mxchange.org Git - friendica.git/commitdiff
notifications - add attendance notifications
authorrabuzarus <>
Mon, 1 Aug 2016 22:01:43 +0000 (00:01 +0200)
committerrabuzarus <>
Mon, 1 Aug 2016 22:01:43 +0000 (00:01 +0200)
include/NotificationsManager.php
mod/notifications.php
view/templates/notifications_attend_item.tpl [new file with mode: 0644]

index b14e76740b4f8e22e7bf135ee383fbb9fd839da0..362e3f53264a39a81eb5beb56d3a29f620dc3bf1 100644 (file)
@@ -246,7 +246,6 @@ class NotificationsManager {
                                switch($it['verb']){
                                        case ACTIVITY_LIKE:
                                                $notif = array(
-                                                       //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        'label' => 'like',
                                                        'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
                                                        '$image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
@@ -258,7 +257,6 @@ class NotificationsManager {
 
                                        case ACTIVITY_DISLIKE:
                                                $notif = array(
-                                                       //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        'label' => 'dislike',
                                                        'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
                                                        'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
@@ -268,13 +266,45 @@ class NotificationsManager {
                                                );
                                                break;
 
+                                       case ACTIVITY_ATTEND:
+                                               $notif = array(
+                                                       'label' => 'attend',
+                                                       'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
+                                                       'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
+                                                       'text' => sprintf( t("%s is attending %s's event"), $it['author-name'], $it['pname']),
+                                                       'when' => relative_date($it['created']),
+                                                       'seen' => $it['seen']
+                                               );
+                                               break;
+
+                                       case ACTIVITY_ATTENDNO:
+                                               $notif = array(
+                                                       'label' => 'attendno',
+                                                       'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
+                                                       'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
+                                                       'text' => sprintf( t("%s is not attending %s's event"), $it['author-name'], $it['pname']),
+                                                       'when' => relative_date($it['created']),
+                                                       'seen' => $it['seen']
+                                               );
+                                               break;
+
+                                       case ACTIVITY_ATTENDMAYBE:
+                                               $notif = array(
+                                                       'label' => 'attendmaybe',
+                                                       'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
+                                                       'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
+                                                       'text' => sprintf( t("%s may attend %s's event"), $it['author-name'], $it['pname']),
+                                                       'when' => relative_date($it['created']),
+                                                       'seen' => $it['seen']
+                                               );
+                                               break;
+
                                        case ACTIVITY_FRIEND:
                                                $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
                                                $obj = parse_xml_string($xmlhead.$it['object']);
                                                $it['fname'] = $obj->title;
 
                                                $notif = array(
-                                                       //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        'label' => 'friend',
                                                        'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
                                                        'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
@@ -286,7 +316,6 @@ class NotificationsManager {
 
                                        default:
                                                $notif = array(
-                                                       //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        'label' => $default_item_label,
                                                        'link' => $default_item_link,
                                                        'image' => $default_item_image,
index cdafe07ee9f3747cf071023bf7f2a31713465f5d..a22703ba95c4cdb7a9bf77e591006ec094317ffe 100644 (file)
@@ -334,6 +334,9 @@ function notifications_content(&$a) {
                // The template files we need in different cases for formatting the content
                $tpl_item_like = 'notifications_likes_item.tpl';
                $tpl_item_dislike = 'notifications_dislikes_item.tpl';
+               $tpl_item_attend = 'notifications_attend_item.tpl';
+               $tpl_item_attendno = 'notifications_attend_item.tpl';
+               $tpl_item_attendmaybe = 'notifications_attend_item.tpl';
                $tpl_item_friend = 'notifications_friends_item.tpl';
                $tpl_item_comment = 'notifications_comments_item.tpl';
                $tpl_item_post = 'notifications_posts_item.tpl';
diff --git a/view/templates/notifications_attend_item.tpl b/view/templates/notifications_attend_item.tpl
new file mode 100644 (file)
index 0000000..6add369
--- /dev/null
@@ -0,0 +1,4 @@
+
+<div class="notif-item {{if !$item_seen}}unseen{{/if}}">
+       <a href="{{$item_link}}" target="friendica-notification"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_when}}</span></a>
+</div>
\ No newline at end of file