aboutsummaryrefslogtreecommitdiff
path: root/views/json/export
diff options
context:
space:
mode:
Diffstat (limited to 'views/json/export')
-rw-r--r--views/json/export/entity.php25
-rw-r--r--views/json/export/metadata.php21
-rw-r--r--views/json/export/relationship.php21
3 files changed, 67 insertions, 0 deletions
diff --git a/views/json/export/entity.php b/views/json/export/entity.php
new file mode 100644
index 000000000..36af5eaef
--- /dev/null
+++ b/views/json/export/entity.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Elgg Entity export.
+ * Displays an entity as JSON
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+$entity = $vars['entity'];
+
+$export = new stdClass;
+$exportable_values = $entity->getExportableValues();
+
+foreach ($exportable_values as $v) {
+ $export->$v = $entity->$v;
+}
+
+$export->url = $entity->getURL();
+
+global $jsonexport;
+$jsonexport[$entity->getType()][$entity->getSubtype()][] = $export;
+
+// @todo hack to fix #4504
+echo "Fix for bug #4504";
diff --git a/views/json/export/metadata.php b/views/json/export/metadata.php
new file mode 100644
index 000000000..e1e6ceb26
--- /dev/null
+++ b/views/json/export/metadata.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Elgg metadata export.
+ * Displays a metadata item using json
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+$m = $vars['metadata'];
+
+$export = new stdClass;
+$exportable_values = $entity->getExportableValues();
+
+foreach ($exportable_values as $v) {
+ $export->$v = $m->$v;
+}
+
+global $jsonexport;
+$jsonexport['metadata'][] = $entity;
+// echo json_encode($export); \ No newline at end of file
diff --git a/views/json/export/relationship.php b/views/json/export/relationship.php
new file mode 100644
index 000000000..47b3a390d
--- /dev/null
+++ b/views/json/export/relationship.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Elgg relationship export.
+ * Displays a relationship using JSON.
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+$r = $vars['relationship'];
+
+$export = new stdClass;
+
+$exportable_values = $entity->getExportableValues();
+
+foreach ($exportable_values as $v) {
+ $export->$v = $r->$v;
+}
+
+global $jsonexport;
+$jsonexport['relationships'][] = $export; \ No newline at end of file