Index: views_views_plugin_style_timeline.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/timeline/views_views_plugin_style_timeline.inc,v retrieving revision 1.3 diff -u -p -r1.3 views_views_plugin_style_timeline.inc --- views_views_plugin_style_timeline.inc 25 Jul 2009 02:14:49 -0000 1.3 +++ views_views_plugin_style_timeline.inc 22 Sep 2009 09:51:03 -0000 @@ -220,7 +220,7 @@ class views_views_plugin_style_timeline $form['bands']['focus'] = array( '#type' => 'select', '#title' => t('Initial date focus'), - '#options' => array('today' => t('The current date'), 'first' => t('First event in timeline'), 'last' => t('Last event in timeline'), 'custom' => t('Custom')), + '#options' => array('today' => t('The current date'), 'first' => t('First event in timeline'), 'last' => t('Last event in timeline'), 'middle' => t('Middle Event'), 'median' => t('Median'), 'custom' => t('Custom')), '#default_value' => $this->options['bands']['focus'], '#description' => t('Determines which event or date the timeline view should initially be centered on after it has loaded. Leave blank to use default value.'), ); @@ -311,4 +311,4 @@ class views_views_plugin_style_timeline ); return theme($this->theme_functions(), $this->view, $this->options); } -} \ No newline at end of file +} Index: classes/Timeline.class.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/timeline/classes/Timeline.class.inc,v retrieving revision 1.3 diff -u -p -r1.3 Timeline.class.inc --- classes/Timeline.class.inc 25 Jul 2009 02:14:49 -0000 1.3 +++ classes/Timeline.class.inc 22 Sep 2009 09:51:03 -0000 @@ -123,7 +123,18 @@ class Timeline { case 'first': return $this->data['events']['events'][0]['start']; case 'last': - return $this->data['events']['events'][count($this->data - 1)]['start']; + return timeline_date_conversion($this->data['events']['events'][count($this->data['events']['events']) - 1]['start'], 'iso8601', 'gregorian'); + case 'middle': + $end=timeline_date_conversion($this->data['events']['events'][count($this->data['events']['events']) - 1]['start'], 'iso8601', 'timestamp'); + $start=timeline_date_conversion($this->data['events']['events'][0]['start'], 'iso8601', 'timestamp'); + $middle=($start+$end)/2; + return timeline_date_conversion($middle, 'timestamp', 'gregorian'); + case 'median': + foreach($this->data['events']['events'] as $date){ + $t[]=timeline_date_conversion($date['start'], 'iso8601', 'timestamp'); + } + sort($t); + return timeline_date_conversion($t[round(count($t)/2)], 'timestamp', 'gregorian'); case 'custom': if ($options_field != '') { return timeline_date_conversion(strtotime($options_field), 'timestamp');