|
|
<?php |
|
|
|
|
|
namespace Kanboard\Export; |
|
|
|
|
|
use Kanboard\Core\Base; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TransitionExport extends Base |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function export($project_id, $from, $to) |
|
|
{ |
|
|
$results = array($this->getColumns()); |
|
|
$transitions = $this->transitionModel->getAllByProjectAndDate($project_id, $from, $to); |
|
|
|
|
|
foreach ($transitions as $transition) { |
|
|
$results[] = $this->format($transition); |
|
|
} |
|
|
|
|
|
return $results; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function getColumns() |
|
|
{ |
|
|
return array( |
|
|
e('Id'), |
|
|
e('Task Title'), |
|
|
e('Source column'), |
|
|
e('Destination column'), |
|
|
e('Executer'), |
|
|
e('Date'), |
|
|
e('Time spent'), |
|
|
); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function format(array $transition) |
|
|
{ |
|
|
$values = array( |
|
|
(int) $transition['id'], |
|
|
$transition['title'], |
|
|
$transition['src_column'], |
|
|
$transition['dst_column'], |
|
|
$transition['name'] ?: $transition['username'], |
|
|
date($this->dateParser->getUserDateTimeFormat(), $transition['date']), |
|
|
round($transition['time_spent'] / 3600, 2) |
|
|
); |
|
|
|
|
|
return $values; |
|
|
} |
|
|
} |
|
|
|