diff options
| author | Frederic Guillot <fred@kanboard.net> | 2015-01-18 17:59:41 -0500 |
|---|---|---|
| committer | Frederic Guillot <fred@kanboard.net> | 2015-01-18 17:59:41 -0500 |
| commit | 7c1c14cf64b59f211b9d505112797cb855e5b604 (patch) | |
| tree | 79622c17096b386ca599c3f804a9d6d5513a8d7d /app/Model/SubtaskPaginator.php | |
| parent | 74e4a7b0642b18d9aaa71dd72359495c5dc99107 (diff) | |
Pagination refactoring
Diffstat (limited to 'app/Model/SubtaskPaginator.php')
| -rw-r--r-- | app/Model/SubtaskPaginator.php | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/app/Model/SubtaskPaginator.php b/app/Model/SubtaskPaginator.php deleted file mode 100644 index 8ccbd696..00000000 --- a/app/Model/SubtaskPaginator.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php - -namespace Model; - -/** - * Subtask Paginator - * - * @package model - * @author Frederic Guillot - */ -class SubtaskPaginator extends Base -{ - /** - * Get all subtasks assigned to a user - * - * @access public - * @param integer $user_id User id - * @param array $status List of status - * @param integer $offset Offset - * @param integer $limit Limit - * @param string $column Sorting column - * @param string $direction Sorting direction - * @return array - */ - public function userSubtasks($user_id, array $status, $offset = 0, $limit = 25, $column = 'tasks.id', $direction = 'asc') - { - $status_list = $this->subTask->getStatusList(); - - $subtasks = $this->db->table(SubTask::TABLE) - ->columns( - SubTask::TABLE.'.*', - Task::TABLE.'.project_id', - Task::TABLE.'.color_id', - Project::TABLE.'.name AS project_name' - ) - ->eq('user_id', $user_id) - ->in(SubTask::TABLE.'.status', $status) - ->join(Task::TABLE, 'id', 'task_id') - ->join(Project::TABLE, 'id', 'project_id', Task::TABLE) - ->offset($offset) - ->limit($limit) - ->orderBy($column, $direction) - ->findAll(); - - foreach ($subtasks as &$subtask) { - $subtask['status_name'] = $status_list[$subtask['status']]; - } - - return $subtasks; - } - - /** - * Count all subtasks assigned to the user - * - * @access public - * @param integer $user_id User id - * @param array $status List of status - * @return integer - */ - public function countUserSubtasks($user_id, array $status) - { - return $this->db - ->table(SubTask::TABLE) - ->eq('user_id', $user_id) - ->in('status', $status) - ->count(); - } -} |
