aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-30 11:45:12 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-30 11:45:12 +0000
commit942539d2865be193f93dd44c9c0ee44f25fbc70b (patch)
treeb2fce9193e367e181261ab5a047f8311bca70a79 /engine/lib
parent85b94b0c3c9360bd8cf0aa8f9ba69a821d36f14b (diff)
downloadelgg-942539d2865be193f93dd44c9c0ee44f25fbc70b.tar.gz
elgg-942539d2865be193f93dd44c9c0ee44f25fbc70b.tar.bz2
Extender getURL() support (no overide as of yet)
git-svn-id: https://code.elgg.org/elgg/trunk@1591 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/annotations.php61
-rw-r--r--engine/lib/extender.php7
-rw-r--r--engine/lib/metadata.php59
3 files changed, 126 insertions, 1 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index b79a94273..255e8a9b0 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -98,7 +98,14 @@
function delete()
{
return delete_annotation($this->id);
- }
+ }
+
+ /**
+ * Get a url for this annotation.
+ *
+ * @return string
+ */
+ public function getURL() { return get_annotation_url($this->guid); }
// SYSTEM LOG INTERFACE ////////////////////////////////////////////////////////////
@@ -665,6 +672,58 @@
}
return $returnvalue;
+ }
+
+ /**
+ * Get the URL for this item of metadata, by default this links to the export handler in the current view.
+ *
+ * @param int $id
+ */
+ function get_annotation_url($id)
+ {
+ $id = (int)$id;
+
+ global $CONFIG;
+
+ if ($extender = get_annotation($id)) {
+
+ $view = elgg_get_viewtype();
+
+ $guid = $extender->entity_guid;
+ $type = $extender->type;
+
+ $url = "";
+
+ /*if (isset($CONFIG->entity_url_handler[$entity->getType()][$entity->getSubType()])) {
+ $function = $CONFIG->entity_url_handler[$entity->getType()][$entity->getSubType()];
+ if (is_callable($function)) {
+ $url = $function($entity);
+ }
+ }
+ if (isset($CONFIG->entity_url_handler[$entity->getType()]['all'])) {
+ $function = $CONFIG->entity_url_handler[$entity->getType()]['all'];
+ if (is_callable($function)) {
+ $url = $function($entity);
+ }
+ }
+ if (isset($CONFIG->entity_url_handler['all']['all'])) {
+ $function = $CONFIG->entity_url_handler['all']['all'];
+ if (is_callable($function)) {
+ $url = $function($entity);
+ }
+ }*/
+
+
+ if ($url == "") {
+ $nameid = $extender->id;
+ if ($type == 'volatile')
+ $nameid== $extender->name;
+ $url = $CONFIG->wwwroot . "$view/$guid/$type/$nameid/";
+ }
+ return $url;
+
+ }
+ return false;
}
/** Register the hook */
diff --git a/engine/lib/extender.php b/engine/lib/extender.php
index 85908d62a..8af18c38c 100644
--- a/engine/lib/extender.php
+++ b/engine/lib/extender.php
@@ -113,6 +113,13 @@
return can_edit_extender($this->id,$this->type,$user_guid);
}
+ /**
+ * Return a url for this extender.
+ *
+ * @return string
+ */
+ public abstract function getURL();
+
// EXPORTABLE INTERFACE ////////////////////////////////////////////////////////////
/**
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index efa82db01..14e141ec4 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -108,6 +108,13 @@
{
return delete_metadata($this->id);
}
+
+ /**
+ * Get a url for this item of metadata.
+ *
+ * @return string
+ */
+ public function getURL() { return get_metadata_url($this->id); }
// SYSTEM LOG INTERFACE ////////////////////////////////////////////////////////////
@@ -726,6 +733,58 @@
return $valuearray;
+ }
+
+ /**
+ * Get the URL for this item of metadata, by default this links to the export handler in the current view.
+ *
+ * @param int $id
+ */
+ function get_metadata_url($id)
+ {
+ $id = (int)$id;
+
+ global $CONFIG;
+
+ if ($extender = get_metadata($id)) {
+
+ $view = elgg_get_viewtype();
+
+ $guid = $extender->entity_guid;
+ $type = $extender->type;
+
+ $url = "";
+
+ /*if (isset($CONFIG->entity_url_handler[$entity->getType()][$entity->getSubType()])) {
+ $function = $CONFIG->entity_url_handler[$entity->getType()][$entity->getSubType()];
+ if (is_callable($function)) {
+ $url = $function($entity);
+ }
+ }
+ if (isset($CONFIG->entity_url_handler[$entity->getType()]['all'])) {
+ $function = $CONFIG->entity_url_handler[$entity->getType()]['all'];
+ if (is_callable($function)) {
+ $url = $function($entity);
+ }
+ }
+ if (isset($CONFIG->entity_url_handler['all']['all'])) {
+ $function = $CONFIG->entity_url_handler['all']['all'];
+ if (is_callable($function)) {
+ $url = $function($entity);
+ }
+ }*/
+
+
+ if ($url == "") {
+ $nameid = $extender->id;
+ if ($type == 'volatile')
+ $nameid== $extender->name;
+ $url = $CONFIG->wwwroot . "$view/$guid/$type/$nameid/";
+ }
+ return $url;
+
+ }
+ return false;
}
/** Register the hook */