diff options
Diffstat (limited to 'engine/lib/annotations.php')
-rw-r--r-- | engine/lib/annotations.php | 61 |
1 files changed, 60 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 */
|