Import/export geolocation to/from iCalendar.
authorJan Schneider <jan@horde.org>
Fri, 28 May 2010 14:16:09 +0000 (16:16 +0200)
committerJan Schneider <jan@horde.org>
Sat, 29 May 2010 09:02:26 +0000 (11:02 +0200)
kronolith/lib/Event.php

index a979ec1..6c9db63 100644 (file)
@@ -580,6 +580,9 @@ abstract class Kronolith_Event
             if (!empty($this->location)) {
                 $vEvent->setAttribute('LOCATION', $v1 ? $this->location : Horde_String::convertCharset($this->location, Horde_Nls::getCharset(), 'utf-8'));
             }
+            if ($this->geoLocation) {
+                $vEvent->setAttribute('GEO', array('latitude' => $this->geoLocation['lat'], 'longitude' => $this->geoLocation['lon']));
+            }
 
             // URL
             if (!empty($this->url)) {
@@ -799,6 +802,12 @@ abstract class Kronolith_Event
         if (!is_array($location) && !($location instanceof PEAR_Error)) {
             $this->location = $location;
         }
+        $geolocation = $vEvent->getAttribute('GEO');
+        if (!($geolocation instanceof PEAR_Error)) {
+            $this->geolocation = array(
+                'lat' => $geolocation['latitude'],
+                'lon' => $geolocation['longitude']);
+        }
 
         // Class
         $class = $vEvent->getAttribute('CLASS');