Grouped the items in the timeline by day.

dev
Loic d'Anterroches 2008-12-01 22:16:28 +01:00
parent da23f2b915
commit ec22b2c8c2
1 changed files with 15 additions and 1 deletions

View File

@ -26,6 +26,8 @@
*/
class IDF_Timeline_Paginator extends Pluf_Paginator
{
public $current_day = null;
/**
* Generate a standard "line" of the body.
*
@ -37,6 +39,18 @@ class IDF_Timeline_Paginator extends Pluf_Paginator
{
$doc = Pluf::factory($item->model_class, $item->model_id);
$doc->public_dtime = $item->public_dtime;
return $doc->timelineFragment($item->request);
$item_day = Pluf_Template_dateFormat($item->creation_dtime,
'%y-%m-%d');
$out = '';
if ($this->current_day == null or
Pluf_Date::dayCompare($this->current_day, $item_day) != 0) {
$day = Pluf_Template_dateFormat($item->creation_dtime);
if ($item_day == Pluf_Template_timeFormat(time(), 'y-m-d')) {
$day = __('Today');
}
$out = '<tr><th colspan="2">'.$day.'</th></tr>'."\n";
$this->current_day = $item_day;
}
return $out.$doc->timelineFragment($item->request);
}
}