X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FEvent%2FEventPlugin.php;h=0c520ddb7a7a916df87f6c33276ad18112cdae3f;hb=2b4a6c7dd723c404a48b629766279c24b45f54b4;hp=4e9d153b1616c3e7ddfafe8d8cdfb5b84c419b4b;hpb=89d3d9b2cef52efe054128f7f1f457ee260cee61;p=quix0rs-gnu-social.git diff --git a/plugins/Event/EventPlugin.php b/plugins/Event/EventPlugin.php index 4e9d153b16..0c520ddb7a 100644 --- a/plugins/Event/EventPlugin.php +++ b/plugins/Event/EventPlugin.php @@ -90,6 +90,10 @@ class EventPlugin extends MicroAppPlugin array('id' => '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')); $m->connect('main/event/updatetimes', array('action' => 'timelist')); + + $m->connect(':nickname/events', + array('action' => 'events'), + array('nickname' => Nickname::DISPLAY_FMT)); return true; } @@ -157,6 +161,14 @@ class EventPlugin extends MicroAppPlugin throw new Exception(_m('No end date for event.')); } + // convert RFC3339 dates delivered in Activity Stream to MySQL DATETIME date format + $start_time = new DateTime($dtstart->item(0)->nodeValue); + $start_time->setTimezone(new DateTimeZone('UTC')); + $start_time = $start_time->format('Y-m-d H:i:s'); + $end_time = new DateTime($dtend->item(0)->nodeValue); + $end_time->setTimezone(new DateTimeZone('UTC')); + $end_time = $end_time->format('Y-m-d H:i:s'); + // location is optional $location = null; $location_object = $happeningObj->element->getElementsByTagName('location'); @@ -177,8 +189,8 @@ class EventPlugin extends MicroAppPlugin case ActivityVerb::POST: // FIXME: get startTime, endTime, location and URL $notice = Happening::saveNew($actor, - $dtstart->item(0)->nodeValue, - $dtend->item(0)->nodeValue, + $start_time, + $end_time, $happeningObj->title, $location, $happeningObj->summary, @@ -508,4 +520,14 @@ class EventPlugin extends MicroAppPlugin $out->raw($rsvp->asHTML()); $out->elementEnd('div'); } + + function onEndPersonalGroupNav(Menu $menu, Profile $target, Profile $scoped=null) + { + $menu->menuItem(common_local_url('events', array('nickname' => $target->getNickname())), + // TRANS: Menu item in sample plugin. + _m('Happenings'), + // TRANS: Menu item title in sample plugin. + _m('A list of your events'), false, 'nav_timeline_events'); + return true; + } }