Example #1
0
 /**
  * Generate a standard "line" of the body.
  *
  * It is important to note that the table has only 2 columns, so
  * the timelineFragment() method of each item must take that into
  * account.
  */
 function bodyLine($item)
 {
     $doc = Pluf::factory($item->model_class, $item->model_id);
     $doc->public_dtime = $item->public_dtime;
     $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);
 }
Example #2
0
/**
 * Display the date in a "6 days, 23 hours ago" style.
 */
function Pluf_Template_dateAgo($date, $f = 'withal')
{
    Pluf::loadFunction('Pluf_Date_Easy');
    $date = Pluf_Template_dateFormat($date, '%Y-%m-%d %H:%M:%S');
    if ($f == 'withal') {
        return Pluf_Date_Easy($date, null, 2, __('now'));
    } else {
        return Pluf_Date_Easy($date, null, 2, __('now'), false);
    }
}
Example #3
0
function Pluf_Paginator_DateAgo($field, $item)
{
    Pluf::loadFunction('Pluf_Date_Easy');
    Pluf::loadFunction('Pluf_Template_dateFormat');
    $date = Pluf_Template_dateFormat($item->{$field}, '%Y-%m-%d %H:%M:%S');
    return Pluf_Date_Easy($date, null, 2, __('now'));
}