]> git.mxchange.org Git - friendica.git/commitdiff
bug #166
authorFriendika <info@friendika.com>
Tue, 25 Oct 2011 05:07:42 +0000 (22:07 -0700)
committerFriendika <info@friendika.com>
Tue, 25 Oct 2011 05:07:42 +0000 (22:07 -0700)
boot.php
mod/network.php
mod/profile.php

index 86a37ce90b80c3c41eb7d7f885585be017b138ea..636062136cc12d4220bb9e7536b9e1b12cdae12f 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1031,6 +1031,57 @@ function get_birthdays() {
 }}
 
 
+if(! function_exists('get_events')) {
+function get_events() {
+
+       require_once('include/bbcode.php');
+
+       $a = get_app();
+       $o = '';
+
+       if(! local_user())
+               return $o;
+
+       $bd_format = t('g A l F d') ; // 8 AM Friday January 18
+       $bd_short = t('F d');
+
+       $r = q("SELECT `event`.* FROM `event` 
+               WHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' AND `finish` > '%s' 
+               ORDER BY `start` DESC ",
+               intval(local_user()),
+               dbesc(datetime_convert('UTC','UTC','now + 6 days')),
+               dbesc(datetime_convert('UTC','UTC','now'))
+       );
+
+       if($r && count($r)) {
+               $o .= '<div id="event-notice" class="birthday-notice fakelink" onclick=openClose(\'event-wrapper\'); >' . t('Event Reminders') . ' ' . '(' . count($r) . ')' . '</div>'; 
+               $o .= '<div id="event-wrapper" style="display: none;" ><div id="event-title">' . t('Events this week:') . '</div>'; 
+               $o .= '<div id="event-title-end"></div>';
+
+               foreach($r as $rr) {
+
+                       if($rr['adjust'])
+                               $md = datetime_convert('UTC',$a->timezone,$rr['start'],'Y/m\#\l\i\n\k\-j');
+                       else
+                               $md = datetime_convert('UTC','UTC',$rr['start'],'Y/m\#\l\i\n\k\-j');
+
+                       $title = substr(strip_tags(bbcode($rr['desc'])),0,32) . '... ';
+                       if(! $title)
+                               $title = t('[No description]');
+                       $now = strtotime('now');
+                       $today = (((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now)) ? true : false); 
+
+                       $o .= '<div class="event-list" id="event-' . $rr['eid'] . '"></a> <a href="events/' . $md . '">' . $title . '</a>' 
+                       . day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ?  ' ' . t('[today]') : '')
+                       . '</div>' ;
+               }
+               $o .= '</div></div>';
+       }
+
+       return $o;
+}}
+
+
 /**
  * 
  * Wrap calls to proc_close(proc_open()) and call hook
index 491603f354f2ef8b7e67f77f55cebbb48864fac9..9fed8592ec34b3a59491af9b7a76da2a511f292a 100644 (file)
@@ -328,8 +328,10 @@ function network_content(&$a, $update = 0) {
                }
        }
 
-       if((! $group) && (! $cid) && (! $update))
+       if((! $group) && (! $cid) && (! $update)) {
                $o .= get_birthdays();
+               $o .= get_events();
+       }
 
        $sql_extra2 = (($nouveau) ? '' : " AND `item`.`parent` = `item`.`id` ");
 
index a453f72f1f94124c1bcb649fb4d9e9eb81cbcde0..6d67ab74b2e651e5d1b68945e90e6a3434dfc54d 100644 (file)
@@ -223,8 +223,10 @@ function profile_content(&$a, $update = 0) {
                );
        }
 
-       if($is_owner && ! $update)
+       if($is_owner && ! $update) {
                $o .= get_birthdays();
+               $o .= get_events();
+       }
 
        $o .= conversation($a,$r,'profile',$update);