aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-03-06 10:34:04 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-03-06 10:34:04 +0000
commit5e4d72b3e2f3ca473bdaf86038f133e046cec50c (patch)
tree4807e25fc4f088eb0c643e4d9f2f447cadd9085c
parent694d5a9ae4a1a4c21af757b69d0e84e8fc9e451d (diff)
downloadelgg-5e4d72b3e2f3ca473bdaf86038f133e046cec50c.tar.gz
elgg-5e4d72b3e2f3ca473bdaf86038f133e046cec50c.tar.bz2
Improved JSON version of the dashboard
git-svn-id: https://code.elgg.org/elgg/trunk@3107 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--mod/riverdashboard/views/json/riverdashboard/container.php1
-rw-r--r--views/json/river/item/list.php49
2 files changed, 50 insertions, 0 deletions
diff --git a/mod/riverdashboard/views/json/riverdashboard/container.php b/mod/riverdashboard/views/json/riverdashboard/container.php
new file mode 100644
index 000000000..871a6cc7e
--- /dev/null
+++ b/mod/riverdashboard/views/json/riverdashboard/container.php
@@ -0,0 +1 @@
+<?php echo $vars['body']; ?> \ No newline at end of file
diff --git a/views/json/river/item/list.php b/views/json/river/item/list.php
new file mode 100644
index 000000000..8ab836f0a
--- /dev/null
+++ b/views/json/river/item/list.php
@@ -0,0 +1,49 @@
+<?php
+
+ global $jsonexport;
+ if (isset($vars['items']) && is_array($vars['items'])) {
+
+ $i = 0;
+ if (!empty($vars['items']))
+ foreach($vars['items'] as $item) {
+
+ // 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;
+
+ }
+
+ $i++;
+ if ($i >= $vars['limit']) break;
+
+ }
+
+ }
+ echo "!";
+
+
+?> \ No newline at end of file