aboutsummaryrefslogtreecommitdiff
path: root/views/json
diff options
context:
space:
mode:
Diffstat (limited to 'views/json')
-rw-r--r--views/json/canvas/default.php10
-rw-r--r--views/json/export/entity.php11
-rw-r--r--views/json/export/metadata.php6
-rw-r--r--views/json/export/relationship.php4
-rw-r--r--views/json/group/default.php7
-rw-r--r--views/json/messages/exceptions/exception.php5
-rw-r--r--views/json/object/default.php2
-rw-r--r--views/json/pageshells/pageshell.php13
-rw-r--r--views/json/search/entity_list.php10
-rw-r--r--views/json/site/default.php7
-rw-r--r--views/json/user/default.php7
11 files changed, 39 insertions, 43 deletions
diff --git a/views/json/canvas/default.php b/views/json/canvas/default.php
index 6a1355a92..0c7ab191f 100644
--- a/views/json/canvas/default.php
+++ b/views/json/canvas/default.php
@@ -10,12 +10,8 @@
* @copyright Curverider Ltd 2008-2009
* @link http://elgg.org/
*/
-
- for ($i = 1; $i < 8; $i++) {
-
- if (isset($vars["area{$i}"]))
- echo $vars["area{$i}"];
-
- }
+
+
+ global $jsonexport;
?> \ No newline at end of file
diff --git a/views/json/export/entity.php b/views/json/export/entity.php
index 3b0ce8367..c5369eea1 100644
--- a/views/json/export/entity.php
+++ b/views/json/export/entity.php
@@ -11,13 +11,16 @@
* @link http://elgg.org/
*/
- $entity = $vars['entity'];
+ $entity = $vars['entity'];
$export = new stdClass;
$exportable_values = $entity->getExportableValues();
foreach ($exportable_values as $v)
- $export->$v = $entity->$v;
-
- echo json_encode($export);
+ $export->$v = $entity->$v;
+
+ $export->url = $entity->getURL();
+
+ global $jsonexport;
+ $jsonexport[$entity->getType()][$entity->getSubtype()][] = $export;
?> \ No newline at end of file
diff --git a/views/json/export/metadata.php b/views/json/export/metadata.php
index 273051d22..d1a5a44d8 100644
--- a/views/json/export/metadata.php
+++ b/views/json/export/metadata.php
@@ -18,6 +18,8 @@
foreach ($exportable_values as $v)
$export->$v = $m->$v;
-
- echo json_encode($export);
+
+ 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
index 1c255ad4d..4b5006d73 100644
--- a/views/json/export/relationship.php
+++ b/views/json/export/relationship.php
@@ -20,5 +20,7 @@
foreach ($exportable_values as $v)
$export->$v = $r->$v;
- echo json_encode($export);
+ global $jsonexport;
+ $jsonexport['relationships'][] = $export;
+
?> \ No newline at end of file
diff --git a/views/json/group/default.php b/views/json/group/default.php
index 6a1355a92..fd043c6b9 100644
--- a/views/json/group/default.php
+++ b/views/json/group/default.php
@@ -11,11 +11,6 @@
* @link http://elgg.org/
*/
- for ($i = 1; $i < 8; $i++) {
-
- if (isset($vars["area{$i}"]))
- echo $vars["area{$i}"];
-
- }
+ elgg_view('export/entity', $vars);
?> \ No newline at end of file
diff --git a/views/json/messages/exceptions/exception.php b/views/json/messages/exceptions/exception.php
index 76fb3aea3..55a61f0ff 100644
--- a/views/json/messages/exceptions/exception.php
+++ b/views/json/messages/exceptions/exception.php
@@ -15,6 +15,7 @@
$export = $vars['object'];
-
- echo json_encode("$export");
+ global $jsonexport;
+ $jsonexport['exceptions'][] = $export;
+
?> \ No newline at end of file
diff --git a/views/json/object/default.php b/views/json/object/default.php
index ccd9ef497..fd043c6b9 100644
--- a/views/json/object/default.php
+++ b/views/json/object/default.php
@@ -11,6 +11,6 @@
* @link http://elgg.org/
*/
- echo elgg_view('export/entity', $vars);
+ elgg_view('export/entity', $vars);
?> \ No newline at end of file
diff --git a/views/json/pageshells/pageshell.php b/views/json/pageshells/pageshell.php
index d9cb52b9b..ae51b49e5 100644
--- a/views/json/pageshells/pageshell.php
+++ b/views/json/pageshells/pageshell.php
@@ -10,7 +10,14 @@
* @link http://elgg.org/
*
*/
-
- header("Content-Type: application/json");
- echo $vars['body'];
+
+ if(stristr($_SERVER["HTTP_ACCEPT"],"application/json")) {
+ header("Content-Type: application/json");
+ } else {
+ header("Content-Type: application/javascript");
+ }
+ // echo $vars['body'];
+
+ global $jsonexport;
+ echo json_encode($jsonexport);
?> \ No newline at end of file
diff --git a/views/json/search/entity_list.php b/views/json/search/entity_list.php
index 8712f7134..a948f4895 100644
--- a/views/json/search/entity_list.php
+++ b/views/json/search/entity_list.php
@@ -11,10 +11,10 @@
* @link http://elgg.org/
*/
- $entities = $vars['entities'];
- if (is_array($entities) && sizeof($entities) > 0) {
- foreach($entities as $entity)
- echo elgg_view_entity($entity);
- }
+ $entities = $vars['entities'];
+ if (is_array($entities) && sizeof($entities) > 0) {
+ foreach($entities as $entity)
+ echo elgg_view_entity($entity);
+ }
?> \ No newline at end of file
diff --git a/views/json/site/default.php b/views/json/site/default.php
index 6a1355a92..fd043c6b9 100644
--- a/views/json/site/default.php
+++ b/views/json/site/default.php
@@ -11,11 +11,6 @@
* @link http://elgg.org/
*/
- for ($i = 1; $i < 8; $i++) {
-
- if (isset($vars["area{$i}"]))
- echo $vars["area{$i}"];
-
- }
+ elgg_view('export/entity', $vars);
?> \ No newline at end of file
diff --git a/views/json/user/default.php b/views/json/user/default.php
index 6a1355a92..fd043c6b9 100644
--- a/views/json/user/default.php
+++ b/views/json/user/default.php
@@ -11,11 +11,6 @@
* @link http://elgg.org/
*/
- for ($i = 1; $i < 8; $i++) {
-
- if (isset($vars["area{$i}"]))
- echo $vars["area{$i}"];
-
- }
+ elgg_view('export/entity', $vars);
?> \ No newline at end of file