Add user dashboard view
This commit is contained in:
parent
24300f828a
commit
2d070627d7
|
|
@ -22,34 +22,44 @@ class App extends Base
|
|||
$this->response->text('OK');
|
||||
}
|
||||
|
||||
/**
|
||||
* User dashboard view for admins
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function dashboard()
|
||||
{
|
||||
$this->index($this->request->getIntegerParam('user_id'), 'dashboard');
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard for the current user
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function index()
|
||||
public function index($user_id = 0, $action = 'index')
|
||||
{
|
||||
$status = array(SubTaskModel::STATUS_TODO, SubTaskModel::STATUS_INPROGRESS);
|
||||
$user_id = $this->userSession->getId();
|
||||
$user_id = $user_id ?: $this->userSession->getId();
|
||||
$projects = $this->projectPermission->getActiveMemberProjects($user_id);
|
||||
$project_ids = array_keys($projects);
|
||||
|
||||
$task_paginator = $this->paginator
|
||||
->setUrl('app', 'index', array('pagination' => 'tasks'))
|
||||
->setUrl('app', $action, array('pagination' => 'tasks'))
|
||||
->setMax(10)
|
||||
->setOrder('tasks.id')
|
||||
->setQuery($this->taskFinder->getUserQuery($user_id))
|
||||
->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks');
|
||||
|
||||
$subtask_paginator = $this->paginator
|
||||
->setUrl('app', 'index', array('pagination' => 'subtasks'))
|
||||
->setUrl('app', $action, array('pagination' => 'subtasks'))
|
||||
->setMax(10)
|
||||
->setOrder('tasks.id')
|
||||
->setQuery($this->subTask->getUserQuery($user_id, $status))
|
||||
->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks');
|
||||
|
||||
$project_paginator = $this->paginator
|
||||
->setUrl('app', 'index', array('pagination' => 'projects'))
|
||||
->setUrl('app', $action, array('pagination' => 'projects'))
|
||||
->setMax(10)
|
||||
->setOrder('name')
|
||||
->setQuery($this->project->getQueryColumnStats($project_ids))
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
// 'Add a comment logging moving the task between columns' => '',
|
||||
// 'Moved to column %s' => '',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
// 'Add a comment logging moving the task between columns' => '',
|
||||
// 'Moved to column %s' => '',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
// 'Add a comment logging moving the task between columns' => '',
|
||||
'Moved to column %s' => 'Movido a columna %s',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
// 'Add a comment logging moving the task between columns' => '',
|
||||
// 'Moved to column %s' => '',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
'Add a comment logging moving the task between columns' => 'Ajouter un commentaire de log lorsqu\'une tâche est déplacée dans une autre colonne',
|
||||
'Moved to column %s' => 'Tâche déplacée à la colonne %s',
|
||||
'Change description' => 'Changer la description',
|
||||
'User dashboard' => 'Tableau de bord de l\'utilisateur',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
// 'Add a comment logging moving the task between columns' => '',
|
||||
// 'Moved to column %s' => '',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
// 'Add a comment logging moving the task between columns' => '',
|
||||
// 'Moved to column %s' => '',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
// 'Add a comment logging moving the task between columns' => '',
|
||||
// 'Moved to column %s' => '',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
'Add a comment logging moving the task between columns' => 'Dodaj komentarz dokumentujący przeniesienie zadania pomiędzy kolumnami',
|
||||
'Moved to column %s' => 'Przeniosiono do kolumny %s',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
'Add a comment logging moving the task between columns' => 'Adicionar un comentário de log ao mover uma tarefa em outra coluna',
|
||||
'Moved to column %s' => 'Mover para a coluna %s',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
// 'Add a comment logging moving the task between columns' => '',
|
||||
// 'Moved to column %s' => '',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
// 'Add a comment logging moving the task between columns' => '',
|
||||
// 'Moved to column %s' => '',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
// 'Add a comment logging moving the task between columns' => '',
|
||||
// 'Moved to column %s' => '',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -700,4 +700,5 @@ return array(
|
|||
// 'Add a comment logging moving the task between columns' => '',
|
||||
// 'Moved to column %s' => '',
|
||||
// 'Change description' => '',
|
||||
// 'User dashboard' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class Acl extends Base
|
|||
* @var array
|
||||
*/
|
||||
private $admin_acl = array(
|
||||
'app' => array('dashboard'),
|
||||
'user' => array('index', 'create', 'save', 'remove'),
|
||||
'config' => '*',
|
||||
'project' => array('remove'),
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@
|
|||
<?= $this->a(t('Persistent connections'), 'user', 'sessions', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($this->userSession->isAdmin()): ?>
|
||||
<li>
|
||||
<?= $this->a(t('User dashboard'), 'app', 'dashboard', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($this->userSession->isAdmin() && ! $this->userSession->isCurrentUser($user['id'])): ?>
|
||||
<li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue