Active
Project:
Timeline
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Sep 2009 at 00:42 UTC
Updated:
6 Nov 2010 at 01:03 UTC
Jump to comment: Most recent file
Hello,
I have added two start points : median and middle.
The code is :
Change the line 252 in views_views_plugin_style_timeline.inc
'#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 Event'), 'custom' => t('Custom')),
Add the following lines after the line 137 :
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');
I have found one bug in use Last Event and i must change the line 132 by this :
return timeline_date_conversion($this->data['events']['events'][count($this->data['events']['events']) - 1]['start'], 'iso8601', 'gregorian');
Regards,
Nicolas
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | timeline.patch | 2.89 KB | ndm |
Comments
Comment #1
xamanu commentedThanks for your work on that. I'd appreciate if you could make a patch. This would be a lot easier to handle. Check out ttp://drupal.org/patch for information on how to create patches. Please use the DRUPAL-6--2 cvs branch.
Thanks!
Comment #2
ndm commentedThe patch with the modifications explain before.
Comment #3
xamanu commentedThank you for the patch. I applied it to the 6.x-2.0-dev version. The whole logic would need some more love. I'd like to track these improvements within this post. There was a related ticket to that (#566734: Initial time placement when first loaded syntax error).
Everybody who wants is invited to write a patch and help with that.
Comment #4
xamanu commentedInformation on how this initial date logic is not good enough: #607338: Initial Date Focus not Working
Comment #5
xamanu commentedAnd another one who found this bug: #610006: Band - Interval Settings Not Working for Initial Date Focus
Comment #6
walwyn commentedThe issue here is that the code is converting iso8601 and gregorian dates to timestamp. Timestamp is the number of seconds since midnight Jan 1st 1970 and is why some are getting the Initial focus to be 1970. I've not looked at the SIMILE code but I suspect that if they get an error or null value as the initial focus then they are defaulting to 1900.
Suffice to say that all the date manipulations have to be done in either iso8601 or gregorian. I'll see if I can cobble up a fix but it may take me a while to a) get the time (probably not this weekend), and b) I don't really have a PHP development system.
Comment #7
xamanu commentedposting some input from walwyn (thanks!). Just to avoiding to loose it.
I've had a quick whack at this and fixed the start, last, and median settings. TODO are the middle and custom but I'm off to get some sleep basically I think one will have to use the PHP DATE class to fix those. Anyway here is the updated function do with what you will.