summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Activity.php1
-rw-r--r--app/Controller/Analytic.php3
-rw-r--r--app/Controller/Base.php56
-rw-r--r--app/Controller/Board.php13
-rw-r--r--app/Controller/Calendar.php7
-rw-r--r--app/Controller/Gantt.php11
-rw-r--r--app/Controller/Listing.php15
-rw-r--r--app/Controller/ProjectOverview.php21
-rw-r--r--app/Controller/Task.php8
9 files changed, 47 insertions, 88 deletions
diff --git a/app/Controller/Activity.php b/app/Controller/Activity.php
index db520ebe..e455b1da 100644
--- a/app/Controller/Activity.php
+++ b/app/Controller/Activity.php
@@ -38,6 +38,7 @@ class Activity extends Base
$this->response->html($this->helper->layout->task('activity/task', array(
'title' => $task['title'],
'task' => $task,
+ 'project' => $this->project->getById($task['project_id']),
'events' => $this->projectActivity->getTask($task['id']),
)));
}
diff --git a/app/Controller/Analytic.php b/app/Controller/Analytic.php
index 6ce062c4..6b0730b0 100644
--- a/app/Controller/Analytic.php
+++ b/app/Controller/Analytic.php
@@ -44,8 +44,7 @@ class Analytic extends Base
public function compareHours()
{
$project = $this->getProject();
- $params = $this->getProjectFilters('analytic', 'compareHours');
- $query = $this->taskFilter->create()->filterByProject($params['project']['id'])->getQuery();
+ $query = $this->taskFilter->create()->filterByProject($project['id'])->getQuery();
$paginator = $this->paginator
->setUrl('analytic', 'compareHours', array('project_id' => $project['id']))
diff --git a/app/Controller/Base.php b/app/Controller/Base.php
index 2453be18..beb56909 100644
--- a/app/Controller/Base.php
+++ b/app/Controller/Base.php
@@ -287,60 +287,4 @@ abstract class Base extends \Kanboard\Core\Base
return $subtask;
}
-
- /**
- * Common method to get project filters
- *
- * @access protected
- * @param string $controller
- * @param string $action
- * @return array
- */
- protected function getProjectFilters($controller, $action)
- {
- $project = $this->getProject();
- $search = $this->request->getStringParam('search', $this->userSession->getFilters($project['id']));
- $board_selector = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
- unset($board_selector[$project['id']]);
-
- $filters = array(
- 'controller' => $controller,
- 'action' => $action,
- 'project_id' => $project['id'],
- 'search' => urldecode($search),
- );
-
- $this->userSession->setFilters($project['id'], $filters['search']);
-
- return array(
- 'project' => $project,
- 'board_selector' => $board_selector,
- 'filters' => $filters,
- 'title' => $project['name'],
- 'description' => $this->getProjectDescription($project),
- );
- }
-
- /**
- * Get project description
- *
- * @access protected
- * @param array &$project
- * @return string
- */
- protected function getProjectDescription(array &$project)
- {
- if ($project['owner_id'] > 0) {
- $description = t('Project owner: ').'**'.$this->helper->text->e($project['owner_name'] ?: $project['owner_username']).'**'.PHP_EOL.PHP_EOL;
-
- if (! empty($project['description'])) {
- $description .= '***'.PHP_EOL.PHP_EOL;
- $description .= $project['description'];
- }
- } else {
- $description = $project['description'];
- }
-
- return $description;
- }
}
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index 199f1703..51344bd3 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -47,16 +47,17 @@ class Board extends Base
*/
public function show()
{
- $params = $this->getProjectFilters('board', 'show');
+ $project = $this->getProject();
+ $search = $this->helper->projectHeader->getSearchQuery($project);
$this->response->html($this->helper->layout->app('board/view_private', array(
- 'categories_list' => $this->category->getList($params['project']['id'], false),
- 'users_list' => $this->projectUserRole->getAssignableUsersList($params['project']['id'], false),
- 'custom_filters_list' => $this->customFilter->getAll($params['project']['id'], $this->userSession->getId()),
- 'swimlanes' => $this->taskFilter->search($params['filters']['search'])->getBoard($params['project']['id']),
+ 'swimlanes' => $this->taskFilter->search($search)->getBoard($project['id']),
+ 'project' => $project,
+ 'title' => $project['name'],
+ 'description' => $this->helper->projectHeader->getDescription($project),
'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
'board_highlight_period' => $this->config->get('board_highlight_period'),
- ) + $params));
+ )));
}
/**
diff --git a/app/Controller/Calendar.php b/app/Controller/Calendar.php
index a0a25e41..af31ae47 100644
--- a/app/Controller/Calendar.php
+++ b/app/Controller/Calendar.php
@@ -20,9 +20,14 @@ class Calendar extends Base
*/
public function show()
{
+ $project = $this->getProject();
+
$this->response->html($this->helper->layout->app('calendar/show', array(
+ 'project' => $project,
+ 'title' => $project['name'],
+ 'description' => $this->helper->projectHeader->getDescription($project),
'check_interval' => $this->config->get('board_private_refresh_interval'),
- ) + $this->getProjectFilters('calendar', 'show')));
+ )));
}
/**
diff --git a/app/Controller/Gantt.php b/app/Controller/Gantt.php
index 9ffa277f..02ee946c 100644
--- a/app/Controller/Gantt.php
+++ b/app/Controller/Gantt.php
@@ -54,8 +54,9 @@ class Gantt extends Base
*/
public function project()
{
- $params = $this->getProjectFilters('gantt', 'project');
- $filter = $this->taskFilterGanttFormatter->search($params['filters']['search'])->filterByProject($params['project']['id']);
+ $project = $this->getProject();
+ $search = $this->helper->projectHeader->getSearchQuery($project);
+ $filter = $this->taskFilterGanttFormatter->search($search)->filterByProject($project['id']);
$sorting = $this->request->getStringParam('sorting', 'board');
if ($sorting === 'date') {
@@ -64,8 +65,10 @@ class Gantt extends Base
$filter->getQuery()->asc('column_position')->asc(TaskModel::TABLE.'.position');
}
- $this->response->html($this->helper->layout->app('gantt/project', $params + array(
- 'users_list' => $this->projectUserRole->getAssignableUsersList($params['project']['id'], false),
+ $this->response->html($this->helper->layout->app('gantt/project', array(
+ 'project' => $project,
+ 'title' => $project['name'],
+ 'description' => $this->helper->projectHeader->getDescription($project),
'sorting' => $sorting,
'tasks' => $filter->format(),
)));
diff --git a/app/Controller/Listing.php b/app/Controller/Listing.php
index c784dd50..9931c346 100644
--- a/app/Controller/Listing.php
+++ b/app/Controller/Listing.php
@@ -19,22 +19,23 @@ class Listing extends Base
*/
public function show()
{
- $params = $this->getProjectFilters('listing', 'show');
- $query = $this->taskFilter->search($params['filters']['search'])->filterByProject($params['project']['id'])->getQuery();
+ $project = $this->getProject();
+ $search = $this->helper->projectHeader->getSearchQuery($project);
+ $query = $this->taskFilter->search($search)->filterByProject($project['id'])->getQuery();
$paginator = $this->paginator
- ->setUrl('listing', 'show', array('project_id' => $params['project']['id']))
+ ->setUrl('listing', 'show', array('project_id' => $project['id']))
->setMax(30)
->setOrder(TaskModel::TABLE.'.id')
->setDirection('DESC')
->setQuery($query)
->calculate();
- $this->response->html($this->helper->layout->app('listing/show', $params + array(
+ $this->response->html($this->helper->layout->app('listing/show', array(
+ 'project' => $project,
+ 'title' => $project['name'],
+ 'description' => $this->helper->projectHeader->getDescription($project),
'paginator' => $paginator,
- 'categories_list' => $this->category->getList($params['project']['id'], false),
- 'users_list' => $this->projectUserRole->getAssignableUsersList($params['project']['id'], false),
- 'custom_filters_list' => $this->customFilter->getAll($params['project']['id'], $this->userSession->getId()),
)));
}
}
diff --git a/app/Controller/ProjectOverview.php b/app/Controller/ProjectOverview.php
index b0687ed3..04645804 100644
--- a/app/Controller/ProjectOverview.php
+++ b/app/Controller/ProjectOverview.php
@@ -15,15 +15,18 @@ class ProjectOverview extends Base
*/
public function show()
{
- $params = $this->getProjectFilters('ProjectOverview', 'show');
- $params['users'] = $this->projectUserRole->getAllUsersGroupedByRole($params['project']['id']);
- $params['roles'] = $this->role->getProjectRoles();
- $params['events'] = $this->projectActivity->getProject($params['project']['id'], 10);
- $params['images'] = $this->projectFile->getAllImages($params['project']['id']);
- $params['files'] = $this->projectFile->getAllDocuments($params['project']['id']);
+ $project = $this->getProject();
+ $this->project->getColumnStats($project);
- $this->project->getColumnStats($params['project']);
-
- $this->response->html($this->helper->layout->app('project_overview/show', $params));
+ $this->response->html($this->helper->layout->app('project_overview/show', array(
+ 'project' => $project,
+ 'title' => $project['name'],
+ 'description' => $this->helper->projectHeader->getDescription($project),
+ 'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']),
+ 'roles' => $this->role->getProjectRoles(),
+ 'events' => $this->projectActivity->getProject($project['id'], 10),
+ 'images' => $this->projectFile->getAllImages($project['id']),
+ 'files' => $this->projectFile->getAllDocuments($project['id']),
+ )));
}
}
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index dc10604e..902a32d6 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -71,17 +71,16 @@ class Task extends Base
$values = $this->dateParser->format($values, array('date_started'), $this->config->get('application_datetime_format', DateParser::DATE_TIME_FORMAT));
$this->response->html($this->helper->layout->task('task/show', array(
+ 'task' => $task,
'project' => $this->project->getById($task['project_id']),
+ 'values' => $values,
'files' => $this->taskFile->getAllDocuments($task['id']),
'images' => $this->taskFile->getAllImages($task['id']),
'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting()),
'subtasks' => $subtasks,
'internal_links' => $this->taskLink->getAllGroupedByLabel($task['id']),
'external_links' => $this->taskExternalLink->getAll($task['id']),
- 'task' => $task,
- 'values' => $values,
'link_label_list' => $this->link->getList(0, false),
- 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id'], true, false, false),
)));
}
@@ -96,6 +95,7 @@ class Task extends Base
$this->response->html($this->helper->layout->task('task/analytics', array(
'task' => $task,
+ 'project' => $this->project->getById($task['project_id']),
'lead_time' => $this->taskAnalytic->getLeadTime($task),
'cycle_time' => $this->taskAnalytic->getCycleTime($task),
'time_spent_columns' => $this->taskAnalytic->getTimeSpentByColumn($task),
@@ -121,6 +121,7 @@ class Task extends Base
$this->response->html($this->helper->layout->task('task/time_tracking_details', array(
'task' => $task,
+ 'project' => $this->project->getById($task['project_id']),
'subtask_paginator' => $subtask_paginator,
)));
}
@@ -136,6 +137,7 @@ class Task extends Base
$this->response->html($this->helper->layout->task('task/transitions', array(
'task' => $task,
+ 'project' => $this->project->getById($task['project_id']),
'transitions' => $this->transition->getAllByTask($task['id']),
)));
}