summaryrefslogtreecommitdiff
path: root/timelinejs.module
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2012-07-31 18:37:58 -0300
committerSilvio <silvio@socioambiental.org>2012-07-31 18:37:58 -0300
commit149097510754e175ab93fc9fa8844999713269fb (patch)
tree7bf00f5a64cf1a65c02fe8fcb55ae286781768a6 /timelinejs.module
parent033c3d884c3c26786c83e00c3ff4c348e1f7a3c6 (diff)
downloadtimelinejs-149097510754e175ab93fc9fa8844999713269fb.tar.gz
timelinejs-149097510754e175ab93fc9fa8844999713269fb.tar.bz2
Starting to code a dynamic timeline
Diffstat (limited to 'timelinejs.module')
-rw-r--r--timelinejs.module88
1 files changed, 88 insertions, 0 deletions
diff --git a/timelinejs.module b/timelinejs.module
index 2c7eaca..c42397d 100644
--- a/timelinejs.module
+++ b/timelinejs.module
@@ -5,6 +5,9 @@
* TimelineJS module.
*/
+/**
+ * Implements hook_field_info().
+ */
/*
function timelinejs_field_info() {
return array(
@@ -19,3 +22,88 @@ function timelinejs_field_info() {
);
}
*/
+
+/**
+ * Implements hook_node_view().
+ *
+ * @todo
+ */
+function timelinejs_node_view($node, $view_mode, $langcode) {
+ if ($node->type == 'timeline' && $view_mode == 'full') {
+ }
+}
+
+/**
+ * Implements hook_menu()
+ */
+function timelinejs_menu() {
+ $items['timelinejs/json'] = array(
+ 'page callback' => 'timelinejs_json',
+ 'access arguments' => array('access content'),
+ 'type' => MENU_CALLBACK,
+ );
+
+ $items['timeline'] = array(
+ 'page callback' => 'timelinejs',
+ 'access arguments' => array('access content'),
+ 'type' => MENU_CALLBACK,
+ );
+
+ return $items;
+}
+
+/**
+ * Implements hook_theme()
+ */
+function timelinejs_theme($existing, $type, $theme, $path) {
+ return array(
+ 'timelinejs' => array(
+ 'template' => 'timelinejs',
+ 'variables' => array('timeline'),
+ ),
+ 'timelinejs_json' => array(
+ 'template' => 'timelinejs_json',
+ 'variables' => array('timeline'),
+ ),
+ );
+}
+
+/**
+ * Get a score nid from an issue nid.
+ */
+function timelinejs_load_events($nid) {
+ $query = db_select('field_data_field_timeline', 't');
+
+ // Basic query.
+ $query
+ ->fields('t', array('entity_id'))
+ ->condition('t.bundle', 'evento')
+ ->condition('t.field_timeline_target_id', $nid, '=');
+
+ $result = $query->execute();
+
+ return $result->fetchAll();
+}
+
+/**
+ * Menu callback.
+ *
+ * @todo
+ */
+function timelinejs_json($nid) {
+ // Sanitization and basic data.
+ $nid = (int) $nid;
+ $events = timelinejs_load_events($nid);
+
+ # Avoid themable output.
+ print theme('timelinejs', array('timeline' => array()));
+ exit;
+}
+
+/**
+ * Menu callback.
+ *
+ * @todo
+ */
+function timelinejs($path) {
+}