summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-05-27 17:26:16 -0300
committerSilvio <silvio@socioambiental.org>2013-05-27 17:26:16 -0300
commit94dcb4ebd3fc3d0562c9c75b3182272c3e2cd2a7 (patch)
tree92d6f32b07c4cd1750e1cccb444d77b791e0125d
parent429aecfc183fbb370115868e7d61a78845f461eb (diff)
downloadtimelinejs-94dcb4ebd3fc3d0562c9c75b3182272c3e2cd2a7.tar.gz
timelinejs-94dcb4ebd3fc3d0562c9c75b3182272c3e2cd2a7.tar.bz2
Adding TimelineJS widget
-rw-r--r--timelinejs.module36
1 files changed, 36 insertions, 0 deletions
diff --git a/timelinejs.module b/timelinejs.module
index 2923e5d..0b2397a 100644
--- a/timelinejs.module
+++ b/timelinejs.module
@@ -31,6 +31,12 @@ function timelinejs_menu() {
'type' => MENU_CALLBACK,
);
+ $items['widgets/timeline'] = array(
+ 'page callback' => 'timelinejs_widget',
+ 'access arguments' => array('access content'),
+ 'type' => MENU_CALLBACK,
+ );
+
return $items;
}
@@ -148,6 +154,36 @@ function timelinejs_json($nid) {
/**
* Menu callback.
*/
+function timelinejs_widget($nid = NULL, $width = '960px', $height = '500px') {
+ // Check parameters.
+ if ($nid == NULL) {
+ drupal_not_found();
+ }
+ else {
+ $node = node_load($nid);
+
+ if ($node == FALSE) {
+ drupal_not_found();
+ }
+ }
+
+ // Format output and include timeline.
+ $output = '<!DOCTYPE html>';
+ $output .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
+ $output .= '<html><head>';
+ $output .= '<title>'. t('Timeline: @title', array('@title' => $node->title)) .'</title>';
+ $output .= '</head></body>';
+ $output .= timelinejs($nid, $width, $height);
+ $output .= '</body></html>';
+
+ // Avoid themeable output.
+ print $output;
+ exit;
+}
+
+/**
+ * Menu callback.
+ */
function timelinejs($nid, $width = '960px', $height = '500px') {
global $language;
global $theme;