Improve project navigation
This commit is contained in:
@@ -21,7 +21,7 @@ class Analytic extends Base
|
||||
private function layout($template, array $params)
|
||||
{
|
||||
$params['board_selector'] = $this->projectPermission->getAllowedProjects($this->userSession->getId());
|
||||
$params['analytic_content_for_layout'] = $this->template->render($template, $params);
|
||||
$params['content_for_sublayout'] = $this->template->render($template, $params);
|
||||
|
||||
return $this->template->layout('analytic/layout', $params);
|
||||
}
|
||||
|
||||
@@ -247,12 +247,13 @@ abstract class Base extends \Core\Base
|
||||
* @param array $params Template parameters
|
||||
* @return string
|
||||
*/
|
||||
protected function projectLayout($template, array $params)
|
||||
protected function projectLayout($template, array $params, $sidebar_template = 'project/sidebar')
|
||||
{
|
||||
$content = $this->template->render($template, $params);
|
||||
$params['project_content_for_layout'] = $content;
|
||||
$params['title'] = $params['project']['name'] === $params['title'] ? $params['title'] : $params['project']['name'].' > '.$params['title'];
|
||||
$params['board_selector'] = $this->projectPermission->getAllowedProjects($this->userSession->getId());
|
||||
$params['sidebar_template'] = $sidebar_template;
|
||||
|
||||
return $this->template->layout('project/layout', $params);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class Budget extends Base
|
||||
'daily_budget' => $this->budget->getDailyBudgetBreakdown($project['id']),
|
||||
'project' => $project,
|
||||
'title' => t('Budget')
|
||||
)));
|
||||
), 'budget/sidebar'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ class Budget extends Base
|
||||
'paginator' => $paginator,
|
||||
'project' => $project,
|
||||
'title' => t('Budget')
|
||||
)));
|
||||
), 'budget/sidebar'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,8 +68,8 @@ class Budget extends Base
|
||||
'values' => $values + array('project_id' => $project['id']),
|
||||
'errors' => $errors,
|
||||
'project' => $project,
|
||||
'title' => t('Budget')
|
||||
)));
|
||||
'title' => t('Budget lines')
|
||||
), 'budget/sidebar'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +111,7 @@ class Budget extends Base
|
||||
'project' => $project,
|
||||
'budget_id' => $this->request->getIntegerParam('budget_id'),
|
||||
'title' => t('Remove a budget line'),
|
||||
)));
|
||||
), 'budget/sidebar'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ class Export extends Base
|
||||
'date_formats' => $this->dateParser->getAvailableFormats(),
|
||||
'project' => $project,
|
||||
'title' => $page_title,
|
||||
)));
|
||||
), 'export/sidebar'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Controller;
|
||||
|
||||
/**
|
||||
* Project controller
|
||||
* Project controller (Settings + creation/edition)
|
||||
*
|
||||
* @package controller
|
||||
* @author Frederic Guillot
|
||||
@@ -415,91 +415,6 @@ class Project extends Base
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Activity page for a project
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function activity()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
|
||||
$this->response->html($this->template->layout('project/activity', array(
|
||||
'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()),
|
||||
'events' => $this->projectActivity->getProject($project['id']),
|
||||
'project' => $project,
|
||||
'title' => t('%s\'s activity', $project['name'])
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Task search for a given project
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$search = $this->request->getStringParam('search');
|
||||
$nb_tasks = 0;
|
||||
|
||||
$paginator = $this->paginator
|
||||
->setUrl('project', 'search', array('search' => $search, 'project_id' => $project['id']))
|
||||
->setMax(30)
|
||||
->setOrder('tasks.id')
|
||||
->setDirection('DESC');
|
||||
|
||||
if ($search !== '') {
|
||||
|
||||
$paginator
|
||||
->setQuery($this->taskFinder->getSearchQuery($project['id'], $search))
|
||||
->calculate();
|
||||
|
||||
$nb_tasks = $paginator->getTotal();
|
||||
}
|
||||
|
||||
$this->response->html($this->template->layout('project/search', array(
|
||||
'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()),
|
||||
'values' => array(
|
||||
'search' => $search,
|
||||
'controller' => 'project',
|
||||
'action' => 'search',
|
||||
'project_id' => $project['id'],
|
||||
),
|
||||
'paginator' => $paginator,
|
||||
'project' => $project,
|
||||
'columns' => $this->board->getColumnsList($project['id']),
|
||||
'categories' => $this->category->getList($project['id'], false),
|
||||
'title' => t('Search in the project "%s"', $project['name']).($nb_tasks > 0 ? ' ('.$nb_tasks.')' : '')
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* List of completed tasks for a given project
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function tasks()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$paginator = $this->paginator
|
||||
->setUrl('project', 'tasks', array('project_id' => $project['id']))
|
||||
->setMax(30)
|
||||
->setOrder('tasks.id')
|
||||
->setDirection('DESC')
|
||||
->setQuery($this->taskFinder->getClosedTaskQuery($project['id']))
|
||||
->calculate();
|
||||
|
||||
$this->response->html($this->template->layout('project/tasks', array(
|
||||
'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()),
|
||||
'project' => $project,
|
||||
'columns' => $this->board->getColumnsList($project['id']),
|
||||
'categories' => $this->category->getList($project['id'], false),
|
||||
'paginator' => $paginator,
|
||||
'title' => t('Completed tasks for "%s"', $project['name']).' ('.$paginator->getTotal().')'
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a form to create a new project
|
||||
*
|
||||
|
||||
97
app/Controller/Projectinfo.php
Normal file
97
app/Controller/Projectinfo.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace Controller;
|
||||
|
||||
/**
|
||||
* Project Info controller (ActivityStream + completed tasks)
|
||||
*
|
||||
* @package controller
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class Projectinfo extends Base
|
||||
{
|
||||
/**
|
||||
* Activity page for a project
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function activity()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
|
||||
$this->response->html($this->template->layout('projectinfo/activity', array(
|
||||
'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()),
|
||||
'events' => $this->projectActivity->getProject($project['id']),
|
||||
'project' => $project,
|
||||
'title' => t('%s\'s activity', $project['name'])
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Task search for a given project
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$search = $this->request->getStringParam('search');
|
||||
$nb_tasks = 0;
|
||||
|
||||
$paginator = $this->paginator
|
||||
->setUrl('projectinfo', 'search', array('search' => $search, 'project_id' => $project['id']))
|
||||
->setMax(30)
|
||||
->setOrder('tasks.id')
|
||||
->setDirection('DESC');
|
||||
|
||||
if ($search !== '') {
|
||||
|
||||
$paginator
|
||||
->setQuery($this->taskFinder->getSearchQuery($project['id'], $search))
|
||||
->calculate();
|
||||
|
||||
$nb_tasks = $paginator->getTotal();
|
||||
}
|
||||
|
||||
$this->response->html($this->template->layout('projectinfo/search', array(
|
||||
'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()),
|
||||
'values' => array(
|
||||
'search' => $search,
|
||||
'controller' => 'projectinfo',
|
||||
'action' => 'search',
|
||||
'project_id' => $project['id'],
|
||||
),
|
||||
'paginator' => $paginator,
|
||||
'project' => $project,
|
||||
'columns' => $this->board->getColumnsList($project['id']),
|
||||
'categories' => $this->category->getList($project['id'], false),
|
||||
'title' => t('Search in the project "%s"', $project['name']).($nb_tasks > 0 ? ' ('.$nb_tasks.')' : '')
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* List of completed tasks for a given project
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function tasks()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$paginator = $this->paginator
|
||||
->setUrl('projectinfo', 'tasks', array('project_id' => $project['id']))
|
||||
->setMax(30)
|
||||
->setOrder('tasks.id')
|
||||
->setDirection('DESC')
|
||||
->setQuery($this->taskFinder->getClosedTaskQuery($project['id']))
|
||||
->calculate();
|
||||
|
||||
$this->response->html($this->template->layout('projectinfo/tasks', array(
|
||||
'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()),
|
||||
'project' => $project,
|
||||
'columns' => $this->board->getColumnsList($project['id']),
|
||||
'categories' => $this->category->getList($project['id'], false),
|
||||
'paginator' => $paginator,
|
||||
'title' => t('Completed tasks for "%s"', $project['name']).' ('.$paginator->getTotal().')'
|
||||
)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user