From 0984f3d81efe59a3028b3f00a1f9afb8926da885 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 1 Aug 2012 16:40:48 -0300 Subject: Loading event nodes --- timelinejs.module | 7 ++++--- timelinejs_json.tpl.php | 29 ++++++++++++++++++----------- timelinejs_json_event.tpl.php | 29 +++++++++++------------------ 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/timelinejs.module b/timelinejs.module index 9ae7f80..33020ed 100644 --- a/timelinejs.module +++ b/timelinejs.module @@ -105,14 +105,15 @@ function timelinejs_load_events($nid) { /** * Menu callback. - * - * @todo */ function timelinejs_json($nid) { // Sanitization and basic data. $nid = (int) $nid; $nodes = timelinejs_load_events($nid); - $items = array(); + + foreach ($nodes as $node) { + $items[] = node_load($node->entity_id); + } foreach ($items as $event) { $events[] = theme('timelinejs_json_event', array('event' => $event)); diff --git a/timelinejs_json.tpl.php b/timelinejs_json.tpl.php index 2e69e8d..92ac391 100644 --- a/timelinejs_json.tpl.php +++ b/timelinejs_json.tpl.php @@ -1,11 +1,18 @@ - { - "startDate":"", - "headline":"", - "text":"", - "asset": - { - "media":"", - "credit":"", - "caption":"" - } - } +{ + "timeline": + { + "headline":"", + "type":"default", + "startDate":"", + "text":"", + "asset": + { + "media":"", + "credit":"", + "caption":"" + }, + "date": [ + + ] + } +} diff --git a/timelinejs_json_event.tpl.php b/timelinejs_json_event.tpl.php index 92ac391..2e69e8d 100644 --- a/timelinejs_json_event.tpl.php +++ b/timelinejs_json_event.tpl.php @@ -1,18 +1,11 @@ -{ - "timeline": - { - "headline":"", - "type":"default", - "startDate":"", - "text":"", - "asset": - { - "media":"", - "credit":"", - "caption":"" - }, - "date": [ - - ] - } -} + { + "startDate":"", + "headline":"", + "text":"", + "asset": + { + "media":"", + "credit":"", + "caption":"" + } + } -- cgit v1.2.3