Unification of project header
This commit is contained in:
@@ -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']),
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -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']))
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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')));
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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(),
|
||||
)));
|
||||
|
||||
@@ -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()),
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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']),
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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']),
|
||||
)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user