Show only active projects in board selector
This commit is contained in:
parent
d0af39170c
commit
c83f589b22
|
|
@ -20,7 +20,7 @@ class Activity extends Base
|
|||
$project = $this->getProject();
|
||||
|
||||
$this->response->html($this->template->layout('activity/project', array(
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
'events' => $this->projectActivity->getProject($project['id']),
|
||||
'project' => $project,
|
||||
'title' => t('%s\'s activity', $project['name'])
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class Analytic extends Base
|
|||
*/
|
||||
private function layout($template, array $params)
|
||||
{
|
||||
$params['board_selector'] = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
|
||||
$params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
|
||||
$params['content_for_sublayout'] = $this->template->render($template, $params);
|
||||
|
||||
return $this->template->layout('analytic/layout', $params);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class App extends Base
|
|||
*/
|
||||
private function layout($template, array $params)
|
||||
{
|
||||
$params['board_selector'] = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
|
||||
$params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
|
||||
$params['content_for_sublayout'] = $this->template->render($template, $params);
|
||||
|
||||
return $this->template->layout('app/layout', $params);
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ abstract class Base extends \Kanboard\Core\Base
|
|||
$content = $this->template->render($template, $params);
|
||||
$params['task_content_for_layout'] = $content;
|
||||
$params['title'] = $params['task']['project_name'].' > '.$params['task']['title'];
|
||||
$params['board_selector'] = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
|
||||
$params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
|
||||
|
||||
return $this->template->layout('task/layout', $params);
|
||||
}
|
||||
|
|
@ -208,7 +208,7 @@ abstract class Base extends \Kanboard\Core\Base
|
|||
$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->projectUserRole->getProjectsByUser($this->userSession->getId());
|
||||
$params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
|
||||
$params['sidebar_template'] = $sidebar_template;
|
||||
|
||||
return $this->template->layout('project/layout', $params);
|
||||
|
|
@ -289,7 +289,7 @@ abstract class Base extends \Kanboard\Core\Base
|
|||
{
|
||||
$project = $this->getProject();
|
||||
$search = $this->request->getStringParam('search', $this->userSession->getFilters($project['id']));
|
||||
$board_selector = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
|
||||
$board_selector = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
|
||||
unset($board_selector[$project['id']]);
|
||||
|
||||
$filters = array(
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class Config extends Base
|
|||
*/
|
||||
private function layout($template, array $params)
|
||||
{
|
||||
$params['board_selector'] = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
|
||||
$params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
|
||||
$params['values'] = $this->config->getAll();
|
||||
$params['errors'] = array();
|
||||
$params['config_content_for_layout'] = $this->template->render($template, $params);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class Currency extends Base
|
|||
*/
|
||||
private function layout($template, array $params)
|
||||
{
|
||||
$params['board_selector'] = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
|
||||
$params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
|
||||
$params['config_content_for_layout'] = $this->template->render($template, $params);
|
||||
|
||||
return $this->template->layout('config/layout', $params);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class Doc extends Base
|
|||
}
|
||||
|
||||
$this->response->html($this->template->layout('doc/show', $this->readFile($filename) + array(
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Gantt extends Base
|
|||
$this->response->html($this->template->layout('gantt/projects', array(
|
||||
'projects' => $this->projectGanttFormatter->filter($project_ids)->format(),
|
||||
'title' => t('Gantt chart for all projects'),
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Group extends Base
|
|||
->calculate();
|
||||
|
||||
$this->response->html($this->template->layout('group/index', array(
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
'title' => t('Groups').' ('.$paginator->getTotal().')',
|
||||
'paginator' => $paginator,
|
||||
)));
|
||||
|
|
@ -49,7 +49,7 @@ class Group extends Base
|
|||
->calculate();
|
||||
|
||||
$this->response->html($this->template->layout('group/users', array(
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
'title' => t('Members of %s', $group['name']).' ('.$paginator->getTotal().')',
|
||||
'paginator' => $paginator,
|
||||
'group' => $group,
|
||||
|
|
@ -64,7 +64,7 @@ class Group extends Base
|
|||
public function create(array $values = array(), array $errors = array())
|
||||
{
|
||||
$this->response->html($this->template->layout('group/create', array(
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
'errors' => $errors,
|
||||
'values' => $values,
|
||||
'title' => t('New group')
|
||||
|
|
@ -105,7 +105,7 @@ class Group extends Base
|
|||
}
|
||||
|
||||
$this->response->html($this->template->layout('group/edit', array(
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
'errors' => $errors,
|
||||
'values' => $values,
|
||||
'title' => t('Edit group')
|
||||
|
|
@ -149,7 +149,7 @@ class Group extends Base
|
|||
}
|
||||
|
||||
$this->response->html($this->template->layout('group/associate', array(
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
'users' => $this->user->prepareList($this->groupMember->getNotMembers($group_id)),
|
||||
'group' => $group,
|
||||
'errors' => $errors,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class Link extends Base
|
|||
*/
|
||||
private function layout($template, array $params)
|
||||
{
|
||||
$params['board_selector'] = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
|
||||
$params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
|
||||
$params['config_content_for_layout'] = $this->template->render($template, $params);
|
||||
|
||||
return $this->template->layout('config/layout', $params);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Project extends Base
|
|||
->calculate();
|
||||
|
||||
$this->response->html($this->template->layout('project/index', array(
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
'paginator' => $paginator,
|
||||
'nb_projects' => $nb_projects,
|
||||
'title' => t('Projects').' ('.$nb_projects.')'
|
||||
|
|
@ -302,7 +302,7 @@ class Project extends Base
|
|||
$is_private = isset($values['is_private']) && $values['is_private'] == 1;
|
||||
|
||||
$this->response->html($this->template->layout('project/new', array(
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
'values' => $values,
|
||||
'errors' => $errors,
|
||||
'is_private' => $is_private,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Projectuser extends Base
|
|||
*/
|
||||
private function layout($template, array $params)
|
||||
{
|
||||
$params['board_selector'] = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
|
||||
$params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
|
||||
$params['content_for_sublayout'] = $this->template->render($template, $params);
|
||||
$params['filter'] = array('user_id' => $params['user_id']);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class User extends Base
|
|||
{
|
||||
$content = $this->template->render($template, $params);
|
||||
$params['user_content_for_layout'] = $content;
|
||||
$params['board_selector'] = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
|
||||
$params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
|
||||
|
||||
if (isset($params['user'])) {
|
||||
$params['title'] = ($params['user']['name'] ?: $params['user']['username']).' (#'.$params['user']['id'].')';
|
||||
|
|
@ -51,7 +51,7 @@ class User extends Base
|
|||
|
||||
$this->response->html(
|
||||
$this->template->layout('user/index', array(
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
'title' => t('Users').' ('.$paginator->getTotal().')',
|
||||
'paginator' => $paginator,
|
||||
)));
|
||||
|
|
@ -72,7 +72,7 @@ class User extends Base
|
|||
|
||||
$this->response->html(
|
||||
$this->template->layout('user/profile', array(
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
'title' => $user['name'] ?: $user['username'],
|
||||
'user' => $user,
|
||||
)
|
||||
|
|
@ -92,7 +92,7 @@ class User extends Base
|
|||
'timezones' => $this->config->getTimezones(true),
|
||||
'languages' => $this->config->getLanguages(true),
|
||||
'roles' => $this->role->getApplicationRoles(),
|
||||
'board_selector' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()),
|
||||
'board_selector' => $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId()),
|
||||
'projects' => $this->project->getList(),
|
||||
'errors' => $errors,
|
||||
'values' => $values + array('role' => Role::APP_USER),
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class ProjectPermission extends Base
|
|||
*/
|
||||
public function getActiveProjectIds($user_id)
|
||||
{
|
||||
return array_keys($this->projectUserRole->getProjectsByUser($user_id, array(Project::ACTIVE)));
|
||||
return array_keys($this->projectUserRole->getActiveProjectsByUser($user_id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,7 +20,19 @@ class ProjectUserRole extends Base
|
|||
const TABLE = 'project_has_users';
|
||||
|
||||
/**
|
||||
* Get the list of project visible by the given user
|
||||
* Get the list of active project for the given user
|
||||
*
|
||||
* @access public
|
||||
* @param integer $user_id
|
||||
* @return array
|
||||
*/
|
||||
public function getActiveProjectsByUser($user_id)
|
||||
{
|
||||
return $this->getProjectsByUser($user_id, $status = array(Project::ACTIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of project visible for the given user
|
||||
*
|
||||
* @access public
|
||||
* @param integer $user_id
|
||||
|
|
|
|||
Loading…
Reference in New Issue