]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
make event dates federate
authorHannes Mannerheim <h@nnesmannerhe.im>
Fri, 9 Oct 2015 14:00:33 +0000 (16:00 +0200)
committerHannes Mannerheim <h@nnesmannerhe.im>
Fri, 9 Oct 2015 14:00:33 +0000 (16:00 +0200)
plugins/Event/EventPlugin.php
plugins/Event/actions/newevent.php
plugins/Event/classes/Happening.php

index 110f928a4c9914baa8ae7b54f7c1cabe09c99b1a..5f20031693d96287946cb809448149b1ed063cb6 100644 (file)
@@ -145,14 +145,26 @@ class EventPlugin extends MicroAppPlugin
             throw new Exception(_m('Wrong type for object.'));
         }
 
+        $dtstart = $happeningObj->element->getElementsByTagName('dtstart');
+        if($dtstart->length == 0) {
+            // TRANS: Exception thrown when has no start date
+            throw new Exception(_m('No start date for event.'));
+        }
+
+        $dtend = $happeningObj->element->getElementsByTagName('dtend');
+        if($dtend->length == 0) {
+            // TRANS: Exception thrown when has no end date
+            throw new Exception(_m('No end date for event.'));
+        }
+
         $notice = null;
 
         switch ($activity->verb) {
         case ActivityVerb::POST:
                // FIXME: get startTime, endTime, location and URL
             $notice = Happening::saveNew($actor,
-                                         $start_time,
-                                         $end_time,
+                                         $dtstart->item(0)->nodeValue,
+                                         $dtend->item(0)->nodeValue,
                                          $happeningObj->title,
                                          null,
                                          $happeningObj->summary,
@@ -233,7 +245,7 @@ class EventPlugin extends MicroAppPlugin
 
                // FIXME: add location
                // FIXME: add URL
-               
+
         // XXX: probably need other stuff here
 
         return $obj;
index 9483db7b4e55ab5360410560bcbfef389ff407b6..57cd1bb37e1558aaa3fd55a261aa592b69582224 100644 (file)
@@ -220,8 +220,8 @@ class NeweventAction extends Action
             $profile = $this->user->getProfile();
 
             $saved = Happening::saveNew($profile,
-                                        $this->startTime,
-                                        $this->endTime,
+                                        common_sql_date($this->startTime),
+                                        common_sql_date($this->endTime),
                                         $this->title,
                                         $this->location,
                                         $this->description,
index 733235655c28c9faca4f72fe5d6ce138e70f2bd4..8c713bacbd99a848e906cd5898ca303438d27cd6 100644 (file)
@@ -116,8 +116,8 @@ class Happening extends Managed_DataObject
 
         $ev->id          = UUID::gen();
         $ev->profile_id  = $profile->id;
-        $ev->start_time  = common_sql_date($start_time);
-        $ev->end_time    = common_sql_date($end_time);
+        $ev->start_time  = $start_time;
+        $ev->end_time    = $end_time;
         $ev->title       = $title;
         $ev->location    = $location;
         $ev->description = $description;