From 39780175ff176d11a54c1e4e0dee2ff537790392 Mon Sep 17 00:00:00 2001 From: icewing Date: Mon, 14 Apr 2008 09:18:17 +0000 Subject: Marcus Povey * ODD Annotation and Metadata export git-svn-id: https://code.elgg.org/elgg/trunk@439 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/annotations.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'engine/lib/annotations.php') diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 4983dcacf..1e974cc71 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -26,7 +26,7 @@ * @subpackage Core * @author Marcus Povey */ - class ElggAnnotation extends ElggExtender + class ElggAnnotation extends ElggExtender implements Exportable { /** @@ -100,6 +100,18 @@ return delete_annotation($this->id); } + /** + * Export this object + * + * @return array + */ + public function export() + { + $type = "annotation"; + $uuid = guid_to_uuid($this->entity_guid). $type . "/{$this->id}/"; + + return new ODDMetadata($uuid, guid_to_uuid($this->entity_guid), $this->attributes[$name], $this->attributes['value'], $type, guid_to_uuid($this->owner_guid)); + } } /** @@ -427,7 +439,7 @@ function export_annotation_plugin_hook($hook, $entity_type, $returnvalue, $params) { // Sanity check values -/* if ((!is_array($params)) && (!isset($params['guid']))) + if ((!is_array($params)) && (!isset($params['guid']))) throw new InvalidParameterException("GUID has not been specified during export, this should never happen."); if (!is_array($returnvalue)) @@ -441,8 +453,8 @@ if ($result) { foreach ($result as $r) - $returnvalue[] = $r; - }*/ + $returnvalue[] = $r->export(); + } return $returnvalue; } -- cgit v1.2.3