summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--timelinejs.module13
-rw-r--r--timelinejs_json_event.tpl.php8
2 files changed, 13 insertions, 8 deletions
diff --git a/timelinejs.module b/timelinejs.module
index 33020ed..5f948fe 100644
--- a/timelinejs.module
+++ b/timelinejs.module
@@ -109,6 +109,7 @@ function timelinejs_load_events($nid) {
function timelinejs_json($nid) {
// Sanitization and basic data.
$nid = (int) $nid;
+ $node = node_load($nid);
$nodes = timelinejs_load_events($nid);
foreach ($nodes as $node) {
@@ -116,10 +117,15 @@ function timelinejs_json($nid) {
}
foreach ($items as $event) {
- $events[] = theme('timelinejs_json_event', array('event' => $event));
- $events = implode(',', $events);
+ $output[] = theme('timelinejs_json_event', array('event' => $event));
+ $events = implode(',', $output);
}
+ // TODO
+ $text = $media = NULL;
+ $headline = $node->title;
+ $date = $node->field_data['und']['0']['value'];
+
print theme('timelinejs_json', array(
'headline' => $headline,
'date' => $date,
@@ -139,8 +145,7 @@ 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,
+ 'source' => '/timelinejs/json/'. (int) $nid,
'css' => '/sites/boletim/themes/boletimclean/timeline.css'
));
}
diff --git a/timelinejs_json_event.tpl.php b/timelinejs_json_event.tpl.php
index 2e69e8d..a76f806 100644
--- a/timelinejs_json_event.tpl.php
+++ b/timelinejs_json_event.tpl.php
@@ -1,10 +1,10 @@
{
- "startDate":"<?php print $event['date']; ?>",
- "headline":"<?php print $event['headline']; ?>",
- "text":"<?php print $event['text']; ?>",
+ "startDate":"<?php print strftime('%Y,%m,%d,', strtotime($event->field_data['und']['0']['value'])); ?>",
+ "headline":"<?php print $event->title; ?>",
+ "text":"<?php print $event->body['und']['0']['value']; ?>",
"asset":
{
- "media":"<?php print $event['media']; ?>",
+ "media":"<?php // TODO: print $event->media; ?>",
"credit":"",
"caption":""
}