« Recurring Updates to Drupal Modules | Main | About the UM Biological Station portion of this blog »

December 19, 2012

Add timeline view of datasets

The goal of this to do is to establish a graphical view of the span of various datasets.

1. Add Datetime field to Dataset:
Collection Dates|field_dataset_sample_dates|Datetime|Select List

- This field type is required by timeline. You could also modify the module itself which is probably better.

- Set Permissions for the new field (view Anonymous, edit colleague)

- Must be 1 value only (not unlimited)

2. Install Timeline

$ cd ~/sites/all/modules
$ wget http://ftp.drupal.org/files/projects/timeline-6.x-2.1.tar.gz
$ tar -xzf timeline-6.x-2.1.tar.gz
$ rm timeline-6.x-2.1.tar.gz

- Enable timeline and VBO, run update.php

3. Build VBO view (Unnecessary, Timeline is compatible with field type Date.

Fields
Content: Collected - From date Default
Content: Collected - To date Default
Content: Collection - From date Default
Content: Collection - To date Default
Node: Title Title

Filter
Content: Collected (field_beg_end_date) - From date not empty


Style
Bulk Operations (php execute)
Default sort by node title
Uncheck preserve across pages

Access
Administrator

4. Copy dates to new field (Unnecessary, Timeline is compatible with field type Date.

$object -> field_dataset_sample_dates[0]['value'] = str_replace("T", " ", $object->field_beg_end_date[0]['value']);
$object -> field_dataset_sample_dates[0]['value2'] = str_replace("T", " ", $object->field_beg_end_date[0]['value2']);
node_save($object);

5. Delete VBO view and module

6. Add Timeline view
Type
Node

Style
Timeline


Items to display
Unlimited

Fields
Node: Title
Content: Collection - From date Default
Content: Collection - To date Default

Filters
Node: Type = Data Set
Node: Published Yes

Page Display
Path
datasets/timeline


7. After realizing that Timeline only works with date fields of 1 value (From/To) I am aborting this mission because that is incompatible with our data model.

Posted by kkwaiser at December 19, 2012 09:45 AM

Comments

Login to leave a comment. Create a new account.