aboutsummaryrefslogtreecommitdiff
path: root/views/json
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-22 22:37:30 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-22 22:37:30 +0000
commitca08eb6d170d375ef4fca53604956f3474c7db19 (patch)
treea1e96c6b0ae322fab93373a66e1951e2b3b9be48 /views/json
parentbe37104ac63cd25f2eac831ca03d6d2b19976e1c (diff)
downloadelgg-ca08eb6d170d375ef4fca53604956f3474c7db19.tar.gz
elgg-ca08eb6d170d375ef4fca53604956f3474c7db19.tar.bz2
Merged r6701:6756 from 1.7 branch into trunk
git-svn-id: http://code.elgg.org/elgg/trunk@6849 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/json')
-rw-r--r--views/json/river/item/list.php52
1 files changed, 24 insertions, 28 deletions
diff --git a/views/json/river/item/list.php b/views/json/river/item/list.php
index 908ea7a90..4f3f37d92 100644
--- a/views/json/river/item/list.php
+++ b/views/json/river/item/list.php
@@ -1,6 +1,6 @@
<?php
/**
- * Elgg default layout
+ * JSON river view
*
* @package Elgg
* @subpackage Core
@@ -8,39 +8,34 @@
* @link http://elgg.org/
*/
global $jsonexport;
-if (isset($vars['items']) && is_array($vars['items'])) {
+$json_items = array();
+
+if (isset($vars['items']) && is_array($vars['items'])) {
$i = 0;
+
if (!empty($vars['items'])) {
foreach($vars['items'] as $item) {
+
+ $json_entry = array(
+ 'subject' => NULL,
+ 'object' => NULL,
+ 'type' => NULL,
+ 'subtype' => NULL,
+ 'action_type' => NULL,
+ 'view' => NULL,
+ 'annotation' => NULL,
+ 'timestamp' => NULL,
+ 'string' => NULL
+ );
- // echo elgg_view_river_item($item);
- if (elgg_view_exists($item->view,'default')) {
- $body = elgg_view($item->view,array('item' => $item), false, false, 'default');
- $time = date("r",$item->posted);
- if ($entity = get_entity($item->object_guid)) {
- $url = htmlspecialchars($entity->getURL());
- } else {
- $url = $vars['url'];
- }
- $title = strip_tags($body);
-
- $jsonitem = $item;
- $jsonitem->url = $url;
- $jsonitem->description = autop($body);
- $jsonitem->title = $title;
- unset($jsonitem->view);
-
- if ($subject = get_entity($item->subject_guid)) {
- elgg_view_entity($subject);
- }
- if ($object = get_entity($item->object_guid)) {
- elgg_view_entity($object);
- }
-
- $jsonexport['activity'][] = $jsonitem;
+ if (elgg_view_exists($item->view, 'default')) {
+ $json_entry['string'] = elgg_view($item->view, array('item' => $item), FALSE, FALSE, 'default');
+ $json_entry['timestamp'] = (int)$item->posted;
}
+ $json_items[] = $json_entry;
+
$i++;
if ($i >= $vars['limit']) {
break;
@@ -48,4 +43,5 @@ if (isset($vars['items']) && is_array($vars['items'])) {
}
}
}
-echo "!"; \ No newline at end of file
+
+$jsonexport['activity'] = $json_items;