summaryrefslogtreecommitdiff
path: root/app/Model/BoardModel.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-06-24 08:50:57 -0400
committerFrederic Guillot <fred@kanboard.net>2016-06-24 08:50:57 -0400
commit9e278a9370e3b651a4a545c0c0c0c256088ed187 (patch)
tree2738835d2410d183a02f29cf80f96215371cfd11 /app/Model/BoardModel.php
parentd560f84b374fa1b3345dc582eddd6bb7b9138674 (diff)
Use BoardFormatter to generate the board
Diffstat (limited to 'app/Model/BoardModel.php')
-rw-r--r--app/Model/BoardModel.php60
1 files changed, 0 insertions, 60 deletions
diff --git a/app/Model/BoardModel.php b/app/Model/BoardModel.php
index d2718b47..4d559936 100644
--- a/app/Model/BoardModel.php
+++ b/app/Model/BoardModel.php
@@ -94,66 +94,6 @@ class BoardModel extends Base
}
/**
- * Get all tasks sorted by columns and swimlanes
- *
- * @access public
- * @param integer $project_id
- * @param callable $callback
- * @return array
- */
- public function getBoard($project_id, $callback = null)
- {
- $swimlanes = $this->swimlaneModel->getSwimlanes($project_id);
- $columns = $this->columnModel->getAll($project_id);
- $nb_columns = count($columns);
-
- for ($i = 0, $ilen = count($swimlanes); $i < $ilen; $i++) {
- $swimlanes[$i]['columns'] = $columns;
- $swimlanes[$i]['nb_columns'] = $nb_columns;
- $swimlanes[$i]['nb_tasks'] = 0;
- $swimlanes[$i]['nb_swimlanes'] = $ilen;
-
- for ($j = 0; $j < $nb_columns; $j++) {
- $column_id = $columns[$j]['id'];
- $swimlane_id = $swimlanes[$i]['id'];
-
- if (! isset($swimlanes[0]['columns'][$j]['nb_column_tasks'])) {
- $swimlanes[0]['columns'][$j]['nb_column_tasks'] = 0;
- $swimlanes[0]['columns'][$j]['total_score'] = 0;
- }
-
- $swimlanes[$i]['columns'][$j]['tasks'] = $callback === null ? $this->taskFinderModel->getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id) : $callback($project_id, $column_id, $swimlane_id);
- $swimlanes[$i]['columns'][$j]['nb_tasks'] = count($swimlanes[$i]['columns'][$j]['tasks']);
- $swimlanes[$i]['columns'][$j]['score'] = $this->getColumnSum($swimlanes[$i]['columns'][$j]['tasks'], 'score');
- $swimlanes[$i]['nb_tasks'] += $swimlanes[$i]['columns'][$j]['nb_tasks'];
- $swimlanes[0]['columns'][$j]['nb_column_tasks'] += $swimlanes[$i]['columns'][$j]['nb_tasks'];
- $swimlanes[0]['columns'][$j]['total_score'] += $swimlanes[$i]['columns'][$j]['score'];
- }
- }
-
- return $swimlanes;
- }
-
- /**
- * Calculate the sum of the defined field for a list of tasks
- *
- * @access public
- * @param array $tasks
- * @param string $field
- * @return integer
- */
- public function getColumnSum(array &$tasks, $field)
- {
- $sum = 0;
-
- foreach ($tasks as $task) {
- $sum += $task[$field];
- }
-
- return $sum;
- }
-
- /**
* Get the total of tasks per column
*
* @access public