public function renderContent() { $timespan = new TimespanSelector(); $content = $timespan; $list = ''; $records = $this->splitRecords($this->controller->getRecords($timespan->getStart(), $timespan->getEnd())); $totalLength = 0; foreach ($records as $day => $dayRecords) { $totalDayLength = 0; foreach ($dayRecords as $dayRecord) { $length = $dayRecord->getLength(); if (is_null($length)) { $length = abs(time() - $dayRecord->getStart()->getTimestamp()); } $totalDayLength += $length; } $totalLength += $totalDayLength; $lengthString = RecordList::formatLength($totalDayLength); $list .= HTML::div(['.title'], HTML::div(['.date'], $day) . HTML::div(['.length'], $lengthString)); $list .= new RecordList($dayRecords, 'record', false, false); } $content .= HTML::div(['.title', '.total'], HTML::div('total') . HTML::div(['.length'], RecordList::formatLength($totalLength))); $content .= $list; return HTML::div($content); }
public function renderContent() { $timespan = new TimespanSelector(); $content = $timespan; $start = $timespan->getStart(); $end = $timespan->getEnd(); if ($this->controller->getCurrentUser()) { $content .= $this->attributeList('categories', $this->controller->getCategoriesLengths($start, $end)); $content .= $this->attributeList('activities', $this->controller->getActivitiesLengths($start, $end)); $content .= $this->attributeList('tags', $this->controller->getTagsLengths($start, $end)); } return $content; }