diff --git a/Controller/PrintTaskController.php b/Controller/PrintTaskController.php index 087e663..7b6757b 100644 --- a/Controller/PrintTaskController.php +++ b/Controller/PrintTaskController.php @@ -15,7 +15,8 @@ use Kanboard\Model\ColorModel; use Kanboard\Model\TaskTagModel; use Kanboard\Model\TaskFileModel; - +use Kanboard\Model\TaskModel; +use Kanboard\Filter\TaskProjectFilter; class PrintTaskController extends BaseController { @@ -86,9 +87,110 @@ public function printTask() } } + public function printProjectAll() + { + $status = array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED); + + $project = $this->getProject(); + $task_ids = $this->db + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project['id']) + ->in(TaskModel::TABLE.'.is_active', $status) + ->asc(TaskModel::TABLE.'.id') + ->findAllByColumn(TaskModel::TABLE.'.id'); + self::printProject($task_ids, $project); + } + + public function printProjectOpen() + { + $status = array(TaskModel::STATUS_OPEN); + + $project = $this->getProject(); + $task_ids = $this->db + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project['id']) + ->in(TaskModel::TABLE.'.is_active', $status) + ->asc(TaskModel::TABLE.'.id') + ->findAllByColumn(TaskModel::TABLE.'.id'); + self::printProject($task_ids, $project); + } + public function printProjectClosed() + { + $status = array(TaskModel::STATUS_CLOSED); + + $project = $this->getProject(); + $task_ids = $this->db + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project['id']) + ->in(TaskModel::TABLE.'.is_active', $status) + ->asc(TaskModel::TABLE.'.id') + ->findAllByColumn(TaskModel::TABLE.'.id'); + self::printProject($task_ids, $project); + } + + public function printProjectPerUser() + { + $status = array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED); + + $project = $this->getProject(); + $user = $this->getUser(); + $task_ids = $this->db + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project['id']) + ->eq(TaskModel::TABLE.'.owner_id', $user['id']) + ->in(TaskModel::TABLE.'.is_active', $status) + ->asc(TaskModel::TABLE.'.id') + ->findAllByColumn(TaskModel::TABLE.'.id'); + self::printProject($task_ids, $project); + } - public function printProject() + public function printProjectPerUserOpen() + { + $status = array(TaskModel::STATUS_OPEN); + + $project = $this->getProject(); + $user = $this->getUser(); + $task_ids = $this->db + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project['id']) + ->eq(TaskModel::TABLE.'.owner_id', $user['id']) + ->in(TaskModel::TABLE.'.is_active', $status) + ->asc(TaskModel::TABLE.'.id') + ->findAllByColumn(TaskModel::TABLE.'.id'); + self::printProject($task_ids, $project); + } + + public function printProjectPerUserClosed() + { + $status = array(TaskModel::STATUS_CLOSED); + + $project = $this->getProject(); + $user = $this->getUser(); + $task_ids = $this->db + ->table(TaskModel::TABLE) + ->eq(TaskModel::TABLE.'.project_id', $project['id']) + ->eq(TaskModel::TABLE.'.owner_id', $user['id']) + ->in(TaskModel::TABLE.'.is_active', $status) + ->asc(TaskModel::TABLE.'.id') + ->findAllByColumn(TaskModel::TABLE.'.id'); + self::printProject($task_ids, $project); + } + + public function printProjectByFilter() + { + $project = $this->getProject(); + $search = $this->helper->projectHeader->getSearchQuery($project); + $tasks = $this->taskLexer->build($search)->withFilter(new TaskProjectFilter($project['id']))->format($this->taskListFormatter); + $task_ids = array(); + foreach ($tasks as $task) + { + array_push($task_ids,$task['id']); + } + self::printProject($task_ids, $project); + } + + function printProject($task_ids, $project) { // instantiate and use t$options = new Options(); $options = new Options(); @@ -105,9 +207,7 @@ public function printProject() } else { $html_all = '
'; } - - $project = $this->getProject(); - $task_ids = $this->taskFinderModel->getAllIds($project['id']); + $files_to_embed = array(); foreach ($task_ids as $task_id) { diff --git a/Template/project_header/print_project.php b/Template/project_header/print_project.php index 9e0b6aa..baa0f0e 100644 --- a/Template/project_header/print_project.php +++ b/Template/project_header/print_project.php @@ -1,5 +1,38 @@ - user->hasProjectAccess('ExportController', 'tasks', $project['id'])): ?> + user->hasProjectAccess('AnalyticController', 'taskDistribution', $project['id'])): ?>