summaryrefslogtreecommitdiff
path: root/app/Formatter/ProjectGanttFormatter.php
diff options
context:
space:
mode:
authorImbasaur <yarrusg@gmail.com>2016-04-13 17:05:59 +0200
committerImbasaur <yarrusg@gmail.com>2016-04-13 17:05:59 +0200
commit99f275e5bb033cca33eee87b0e914645730f13d1 (patch)
treead845419d56304f2bf014744f0878186f7155a3c /app/Formatter/ProjectGanttFormatter.php
parent13d5bd8e48bd6c0109d1272da58a8879bf9a6737 (diff)
parentcd5bf9d4d214ec9282b706c26bb27cabf150ee63 (diff)
Merge pull request #1 from fguillot/master
Diffstat (limited to 'app/Formatter/ProjectGanttFormatter.php')
-rw-r--r--app/Formatter/ProjectGanttFormatter.php39
1 files changed, 4 insertions, 35 deletions
diff --git a/app/Formatter/ProjectGanttFormatter.php b/app/Formatter/ProjectGanttFormatter.php
index 4f73e217..aee1f27f 100644
--- a/app/Formatter/ProjectGanttFormatter.php
+++ b/app/Formatter/ProjectGanttFormatter.php
@@ -2,7 +2,7 @@
namespace Kanboard\Formatter;
-use Kanboard\Model\Project;
+use Kanboard\Core\Filter\FormatterInterface;
/**
* Gantt chart formatter for projects
@@ -10,41 +10,9 @@ use Kanboard\Model\Project;
* @package formatter
* @author Frederic Guillot
*/
-class ProjectGanttFormatter extends Project implements FormatterInterface
+class ProjectGanttFormatter extends BaseFormatter implements FormatterInterface
{
/**
- * List of projects
- *
- * @access private
- * @var array
- */
- private $projects = array();
-
- /**
- * Filter projects to generate the Gantt chart
- *
- * @access public
- * @param int[] $project_ids
- * @return ProjectGanttFormatter
- */
- public function filter(array $project_ids)
- {
- if (empty($project_ids)) {
- $this->projects = array();
- } else {
- $this->projects = $this->db
- ->table(self::TABLE)
- ->asc('start_date')
- ->in('id', $project_ids)
- ->eq('is_active', self::ACTIVE)
- ->eq('is_private', 0)
- ->findAll();
- }
-
- return $this;
- }
-
- /**
* Format projects to be displayed in the Gantt chart
*
* @access public
@@ -52,10 +20,11 @@ class ProjectGanttFormatter extends Project implements FormatterInterface
*/
public function format()
{
+ $projects = $this->query->findAll();
$colors = $this->color->getDefaultColors();
$bars = array();
- foreach ($this->projects as $project) {
+ foreach ($projects as $project) {
$start = empty($project['start_date']) ? time() : strtotime($project['start_date']);
$end = empty($project['end_date']) ? $start : strtotime($project['end_date']);
$color = next($colors) ?: reset($colors);