aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-14 09:18:17 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-14 09:18:17 +0000
commit39780175ff176d11a54c1e4e0dee2ff537790392 (patch)
tree8d35f056200660cbe82cff9e60d31b0b28c0ad4d
parent48af92966e9030431eccd0a30d277e88092e4876 (diff)
downloadelgg-39780175ff176d11a54c1e4e0dee2ff537790392.tar.gz
elgg-39780175ff176d11a54c1e4e0dee2ff537790392.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* ODD Annotation and Metadata export git-svn-id: https://code.elgg.org/elgg/trunk@439 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/annotations.php20
-rw-r--r--engine/lib/entities.php5
-rw-r--r--engine/lib/extender.php19
-rw-r--r--engine/lib/metadata.php24
4 files changed, 38 insertions, 30 deletions
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 <marcus@dushka.co.uk>
*/
- 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;
}
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 7b22424a9..3dee2234c 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -379,8 +379,6 @@
*/
public function export()
{
- global $CONFIG;
-
$tmp = array();
// Generate uuid
@@ -830,7 +828,7 @@
*/
function import_entity_plugin_hook($hook, $entity_type, $returnvalue, $params)
{
- $name = $params['name'];
+/* $name = $params['name'];
$element = $params['element'];
$tmp = NULL;
@@ -849,6 +847,7 @@
return $tmp;
}
+*/
}
/**
diff --git a/engine/lib/extender.php b/engine/lib/extender.php
index e22de5109..fc4655345 100644
--- a/engine/lib/extender.php
+++ b/engine/lib/extender.php
@@ -18,7 +18,7 @@
* @package Elgg
* @subpackage Core
*/
- abstract class ElggExtender implements Exportable, Importable
+ abstract class ElggExtender implements Importable
{
/**
* This contains the site's main properties (id, etc)
@@ -96,24 +96,11 @@
* @param int $user_guid The GUID of the user (defaults to currently logged in user)
* @return true|false
*/
- function canEdit($user_guid = 0) {
+ public function canEdit($user_guid = 0) {
return can_edit_extender($this->id,$this->type,$user_guid);
- }
-
- /**
- * Export this object
- *
- * @return array
- */
- public function export()
- {
- $tmp = new stdClass;
- $tmp->attributes = $this->attributes;
- $tmp->attributes['owner_uuid'] = guid_to_uuid($this->owner_guid);
- $tmp->attributes['entity_uuid'] = guid_to_uuid($this->entity_guid);
- return $tmp;
}
+
/**
* Import an object
*
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index 50bcf2c53..727d68f41 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -19,7 +19,7 @@
* @package Elgg
* @subpackage Core
*/
- class ElggMetadata extends ElggExtender
+ class ElggMetadata extends ElggExtender implements Exportable
{
/**
@@ -94,9 +94,19 @@
{
return delete_metadata($this->id);
}
-
-
-
+
+ /**
+ * Export this object
+ *
+ * @return array
+ */
+ public function export()
+ {
+ $type = "metadata";
+ $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));
+ }
}
/**
@@ -361,7 +371,7 @@
*/
function export_metadata_plugin_hook($hook, $entity_type, $returnvalue, $params)
{
- /* // Sanity check values
+ // Sanity check values
if ((!is_array($params)) && (!isset($params['guid'])))
throw new InvalidParameterException("GUID has not been specified during export, this should never happen.");
@@ -376,9 +386,9 @@
if ($result)
{
foreach ($result as $r)
- $returnvalue[] = $r;
+ $returnvalue[] = $r->export();
}
- */
+
return $returnvalue;
}