aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-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 */