Remove setGeoLocation()/getGeoLocation().
authorJan Schneider <jan@horde.org>
Mon, 1 Nov 2010 18:45:02 +0000 (19:45 +0100)
committerJan Schneider <jan@horde.org>
Tue, 2 Nov 2010 15:14:20 +0000 (16:14 +0100)
kronolith/lib/Event.php
kronolith/lib/Resource/Single.php

index 46bca8a..f057f2e 100644 (file)
@@ -365,7 +365,13 @@ abstract class Kronolith_Event
             }
             return $this->_tags;
         case 'geoLocation':
-            return $this->getGeolocation();
+            if (!isset($this->_geoLocation) &&
+                ($gDriver = Kronolith::getGeoDriver())) {
+                try {
+                    $this->_geoLocation = $gDriver->getLocation($this->id);
+                } catch (Exception $e) {}
+            }
+            return $this->_geoLocation;
         }
 
         $trace = debug_backtrace();
@@ -2341,13 +2347,13 @@ abstract class Kronolith_Event
         }
 
         // Tags.
-        $this->_tags = Horde_Util::getFormData('tags', $this->tags);
+        $this->tags = Horde_Util::getFormData('tags', $this->tags);
 
         // Geolocation
         if (Horde_Util::getFormData('lat') && Horde_Util::getFormData('lon')) {
-            $this->setGeoLocation(array('lat' => Horde_Util::getFormData('lat'),
-                                        'lon' => Horde_Util::getFormData('lon'),
-                                        'zoom' => Horde_Util::getFormData('zoom')));
+            $this->geoLocation = array('lat' => Horde_Util::getFormData('lat'),
+                                       'lon' => Horde_Util::getFormData('lon'),
+                                       'zoom' => Horde_Util::getFormData('zoom'));
         }
 
         $this->initialized = true;
@@ -2771,34 +2777,6 @@ abstract class Kronolith_Event
         return 'kronolithEvent';
     }
 
-    /**
-     * Setter for geo data
-     *
-     * @param array $data  An array of lat/lng data.
-     */
-    public function setGeoLocation($data)
-    {
-        $this->_geoLocation = $data;
-    }
-
-    /**
-     * Getter for geo data
-     *
-     * @return array  An array of lat/lng data.
-     */
-    public function getGeolocation()
-    {
-        /* Get geolocation data */
-        if (!isset($this->_geoLocation) &&
-            ($gDriver = Kronolith::getGeoDriver())) {
-            try {
-                $this->_geoLocation = $gDriver->getLocation($this->id);
-            } catch (Exception $e) {}
-        }
-
-        return $this->_geoLocation;
-    }
-
     private function _formIDEncode($id)
     {
         return str_replace(array('[', ']'),
index 8fe8263..2ac8f04 100644 (file)
@@ -157,7 +157,7 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base
         $to->description = $from->description;
         $to->url = $from->url;
         $to->tags = $from->tags;
-        $to->setGeoLocation($from->geoLocation);
+        $to->geoLocation = $from->geoLocation;
         $to->first = $from ->first;
         $to->last = $from->last;
         $to->start = $from->start;