aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-25 20:09:14 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-25 20:09:14 +0000
commit53d085f513d5e29af160991739e7ad1b515090a7 (patch)
treead7ca627fbf2656653edbc40f05e2c192da31078 /engine/lib/entities.php
parentbf9e9feefa7e1f3af12a534999817eae9bca24ca (diff)
downloadelgg-53d085f513d5e29af160991739e7ad1b515090a7.tar.gz
elgg-53d085f513d5e29af160991739e7ad1b515090a7.tar.bz2
Hook for future geocoding library added.
git-svn-id: https://code.elgg.org/elgg/trunk@2488 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 99c8bdca6..b645fc372 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -17,6 +17,9 @@
/// Cache subtype searches
$SUBTYPE_CACHE = NULL;
+ /// Require the locatable interface TODO: Move this into start.php?
+ require_once('location.php');
+
/**
* ElggEntity The elgg entity superclass
* This class holds methods for accessing the main entities table.
@@ -27,6 +30,7 @@
*/
abstract class ElggEntity implements
Notable, // Calendar interface
+ Locatable, // Geocoding interface
Exportable, // Allow export of data
Importable, // Allow import of data
Loggable, // Can events related to this object class be logged
@@ -711,6 +715,53 @@
return $res;
}
+ // LOCATABLE INTERFACE /////////////////////////////////////////////////////////////
+
+ /** Interface to set the location */
+ public function setLocation($location)
+ {
+ $location = sanitise_string($location);
+
+ $this->location = $location;
+
+ return true;
+ }
+
+ /**
+ * Set latitude and longitude tags for a given entity.
+ *
+ * @param float $lat
+ * @param float $long
+ */
+ public function setLatLong($lat, $long)
+ {
+ $lat = sanitise_string($lat);
+ $long = sanitise_string($long);
+
+ $this->set('geo:lat', $lat);
+ $this->set('geo:long', $long);
+
+ return true;
+ }
+
+ /**
+ * Get the contents of the ->geo:lat field.
+ *
+ */
+ public function getLatitude() { return $this->get('geo:lat'); }
+
+ /**
+ * Get the contents of the ->geo:lat field.
+ *
+ */
+ public function getLongitude() { return $this->get('geo:long'); }
+
+ /**
+ * Get the ->location metadata.
+ *
+ */
+ public function getLocation() { return $this->get('location'); }
+
// NOTABLE INTERFACE ///////////////////////////////////////////////////////////////
/**