summaryrefslogtreecommitdiff
path: root/timelinejs.module
diff options
context:
space:
mode:
Diffstat (limited to 'timelinejs.module')
-rw-r--r--timelinejs.module19
1 files changed, 14 insertions, 5 deletions
diff --git a/timelinejs.module b/timelinejs.module
index a49c04f..9ae7f80 100644
--- a/timelinejs.module
+++ b/timelinejs.module
@@ -79,6 +79,10 @@ function timelinejs_theme($existing, $type, $theme, $path) {
'template' => 'timelinejs_json',
'variables' => array('headline', 'date', 'text', 'media', 'events'),
),
+ 'timelinejs_json_event' => array(
+ 'template' => 'timelinejs_json_event',
+ 'variables' => array('event'),
+ ),
);
}
@@ -106,15 +110,21 @@ function timelinejs_load_events($nid) {
*/
function timelinejs_json($nid) {
// Sanitization and basic data.
- $nid = (int) $nid;
- $events = timelinejs_load_events($nid);
+ $nid = (int) $nid;
+ $nodes = timelinejs_load_events($nid);
+ $items = array();
+
+ foreach ($items as $event) {
+ $events[] = theme('timelinejs_json_event', array('event' => $event));
+ $events = implode(',', $events);
+ }
print theme('timelinejs_json', array(
'headline' => $headline,
'date' => $date,
'text' => $text,
'media' => $media,
- 'events' => array(),
+ 'events' => $events,
));
# Avoid themable output.
@@ -123,14 +133,13 @@ function timelinejs_json($nid) {
/**
* Menu callback.
- *
- * @todo
*/
function timelinejs($nid) {
return theme('timelinejs', array(
'width' => '960px',
'height' => '500px',
'source' => '/sites/boletim/files/timeline-saude-indigena_2.json',
+ //'source' => '/timelinejs/json/'. (int) $nid,
'css' => '/sites/boletim/themes/boletimclean/timeline.css'
));
}