summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--timelinejs.module39
-rw-r--r--timelinejs.tpl.php16
2 files changed, 41 insertions, 14 deletions
diff --git a/timelinejs.module b/timelinejs.module
index c42397d..a49c04f 100644
--- a/timelinejs.module
+++ b/timelinejs.module
@@ -25,15 +25,20 @@ function timelinejs_field_info() {
/**
* Implements hook_node_view().
- *
- * @todo
*/
function timelinejs_node_view($node, $view_mode, $langcode) {
if ($node->type == 'timeline' && $view_mode == 'full') {
+ $node->content['timeline']['#markup'] = timelinejs($node->nid);
}
}
/**
+ * Implements hook_node_view_alter.
+ */
+function timelinejs_node_view_alter(&$build) {
+}
+
+/**
* Implements hook_menu()
*/
function timelinejs_menu() {
@@ -59,11 +64,20 @@ function timelinejs_theme($existing, $type, $theme, $path) {
return array(
'timelinejs' => array(
'template' => 'timelinejs',
- 'variables' => array('timeline'),
+ 'variables' => array(
+ 'width' => NULL,
+ 'height' => NULL,
+ 'source' => NULL,
+ 'start_at_end' => 'false',
+ 'hash_bookmark' => 'true',
+ 'css' => NULL,
+ 'js' => '/sites/all/libraries/timelinejs/compiled/js/timeline.js',
+ 'lang' => '/sites/all/libraries/timelinejs/compiled/js/locale/pt-br.js',
+ ),
),
'timelinejs_json' => array(
'template' => 'timelinejs_json',
- 'variables' => array('timeline'),
+ 'variables' => array('headline', 'date', 'text', 'media', 'events'),
),
);
}
@@ -95,8 +109,15 @@ function timelinejs_json($nid) {
$nid = (int) $nid;
$events = timelinejs_load_events($nid);
+ print theme('timelinejs_json', array(
+ 'headline' => $headline,
+ 'date' => $date,
+ 'text' => $text,
+ 'media' => $media,
+ 'events' => array(),
+ ));
+
# Avoid themable output.
- print theme('timelinejs', array('timeline' => array()));
exit;
}
@@ -105,5 +126,11 @@ function timelinejs_json($nid) {
*
* @todo
*/
-function timelinejs($path) {
+function timelinejs($nid) {
+ return theme('timelinejs', array(
+ 'width' => '960px',
+ 'height' => '500px',
+ 'source' => '/sites/boletim/files/timeline-saude-indigena_2.json',
+ 'css' => '/sites/boletim/themes/boletimclean/timeline.css'
+ ));
}
diff --git a/timelinejs.tpl.php b/timelinejs.tpl.php
index 0c1004a..1dc3aed 100644
--- a/timelinejs.tpl.php
+++ b/timelinejs.tpl.php
@@ -2,14 +2,14 @@
<div id="timeline-embed" style="width:960px; height: 500px;"></div>
<script type="text/javascript">
var timeline_config = {
- width: "960px",
- height: "500px",
- source: '/sites/boletim/files/timeline-saude-indigena_2.json',
- start_at_end: false,
- hash_bookmark: true,
- css: '/sites/boletim/themes/boletimclean/timeline.css',
- js: '/sites/all/libraries/timelinejs/compiled/js/timeline.js',
- lang: '/sites/all/libraries/timelinejs/compiled/js/locale/pt-br.js'
+ width: "<?php print $width; ?>",
+ height: "<?php print $height; ?>",
+ source: '<?php print $source; ?>',
+ start_at_end: <?php print $start_at_end; ?>,
+ hash_bookmark: <?php print $hash_bookmark; ?>,
+ css: '<?php print $css; ?>',
+ js: '<?php print $js; ?>',
+ lang: '<?php print $lang; ?>'
}
</script>
<script type="text/javascript" src="/sites/all/libraries/timelinejs/compiled/js/timeline-embed.js"></script>