summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2012-08-02 16:41:37 -0300
committerSilvio <silvio@socioambiental.org>2012-08-02 16:41:37 -0300
commitd6d6b670401e28caff59f330d3d2843d65b85de9 (patch)
treebb83b20c977bee5f7c5f7cde13e5ca747de7992c
parent0984f3d81efe59a3028b3f00a1f9afb8926da885 (diff)
downloadtimelinejs-d6d6b670401e28caff59f330d3d2843d65b85de9.tar.gz
timelinejs-d6d6b670401e28caff59f330d3d2843d65b85de9.tar.bz2
More changes in the timelinejs_json
-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":""
}