X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FEvent%2FEventPlugin.php;h=0c520ddb7a7a916df87f6c33276ad18112cdae3f;hb=2b4a6c7dd723c404a48b629766279c24b45f54b4;hp=75bdfd2ec38990cd19afc502965e08ca056513b4;hpb=55655ba319d633b19f3fc0c38d57b7d93e9e56b3;p=quix0rs-gnu-social.git diff --git a/plugins/Event/EventPlugin.php b/plugins/Event/EventPlugin.php index 75bdfd2ec3..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'); @@ -164,18 +176,25 @@ class EventPlugin extends MicroAppPlugin $location = $location_object->item(0)->nodeValue; } + // url is optional + $url = null; + $url_object = $happeningObj->element->getElementsByTagName('url'); + if($url_object->length > 0) { + $url = $url_object->item(0)->nodeValue; + } + $notice = null; switch ($activity->verb) { 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, - null, + $url, $options); break; case RSVP::POSITIVE: @@ -251,8 +270,8 @@ class EventPlugin extends MicroAppPlugin common_date_iso8601($happening->end_time)); $obj->extra[] = array('location', false, $happening->location); + $obj->extra[] = array('url', false, $happening->url); - // FIXME: add URL // XXX: probably need other stuff here return $obj; @@ -501,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; + } }