summaryrefslogtreecommitdiff
path: root/app/Controller/App.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-02-04 22:05:41 -0500
committerFrederic Guillot <fred@kanboard.net>2015-02-04 22:05:41 -0500
commit2d070627d751bf5728ec98a5efaf163532594cd9 (patch)
tree2f1781baea559e40230bb10dc394b56e8a7d6f22 /app/Controller/App.php
parent24300f828a684eedf71d63374effb2be95c13b1a (diff)
Add user dashboard view
Diffstat (limited to 'app/Controller/App.php')
-rw-r--r--app/Controller/App.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/app/Controller/App.php b/app/Controller/App.php
index 6eab2bcd..11e3915c 100644
--- a/app/Controller/App.php
+++ b/app/Controller/App.php
@@ -23,33 +23,43 @@ class App extends Base
}
/**
+ * 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))