summaryrefslogtreecommitdiff
path: root/app/Controller/DashboardController.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller/DashboardController.php')
-rw-r--r--app/Controller/DashboardController.php90
1 files changed, 16 insertions, 74 deletions
diff --git a/app/Controller/DashboardController.php b/app/Controller/DashboardController.php
index 44874546..f32f8552 100644
--- a/app/Controller/DashboardController.php
+++ b/app/Controller/DashboardController.php
@@ -2,9 +2,6 @@
namespace Kanboard\Controller;
-use Kanboard\Model\ProjectModel;
-use Kanboard\Model\SubtaskModel;
-
/**
* Dashboard Controller
*
@@ -14,63 +11,6 @@ use Kanboard\Model\SubtaskModel;
class DashboardController extends BaseController
{
/**
- * Get project pagination
- *
- * @access private
- * @param integer $user_id
- * @param string $action
- * @param integer $max
- * @return \Kanboard\Core\Paginator
- */
- private function getProjectPaginator($user_id, $action, $max)
- {
- return $this->paginator
- ->setUrl('DashboardController', $action, array('pagination' => 'projects', 'user_id' => $user_id))
- ->setMax($max)
- ->setOrder(ProjectModel::TABLE.'.name')
- ->setQuery($this->projectModel->getQueryColumnStats($this->projectPermissionModel->getActiveProjectIds($user_id)))
- ->calculateOnlyIf($this->request->getStringParam('pagination') === 'projects');
- }
-
- /**
- * Get task pagination
- *
- * @access private
- * @param integer $user_id
- * @param string $action
- * @param integer $max
- * @return \Kanboard\Core\Paginator
- */
- private function getTaskPaginator($user_id, $action, $max)
- {
- return $this->paginator
- ->setUrl('DashboardController', $action, array('pagination' => 'tasks', 'user_id' => $user_id))
- ->setMax($max)
- ->setOrder('tasks.id')
- ->setQuery($this->taskFinderModel->getUserQuery($user_id))
- ->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks');
- }
-
- /**
- * Get subtask pagination
- *
- * @access private
- * @param integer $user_id
- * @param string $action
- * @param integer $max
- * @return \Kanboard\Core\Paginator
- */
- private function getSubtaskPaginator($user_id, $action, $max)
- {
- return $this->paginator
- ->setUrl('DashboardController', $action, array('pagination' => 'subtasks', 'user_id' => $user_id))
- ->setMax($max)
- ->setOrder('tasks.id')
- ->setQuery($this->subtaskModel->getUserQuery($user_id, array(SubTaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS)))
- ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks');
- }
-
- /**
* Dashboard overview
*
* @access public
@@ -80,10 +20,10 @@ class DashboardController extends BaseController
$user = $this->getUser();
$this->response->html($this->helper->layout->dashboard('dashboard/show', array(
- 'title' => t('Dashboard'),
- 'project_paginator' => $this->getProjectPaginator($user['id'], 'show', 10),
- 'task_paginator' => $this->getTaskPaginator($user['id'], 'show', 10),
- 'subtask_paginator' => $this->getSubtaskPaginator($user['id'], 'show', 10),
+ 'title' => t('Dashboard for %s', $this->helper->user->getFullname($user)),
+ 'project_paginator' => $this->projectPagination->getDashboardPaginator($user['id'], 'show', 10),
+ 'task_paginator' => $this->taskPagination->getDashboardPaginator($user['id'], 'show', 10),
+ 'subtask_paginator' => $this->subtaskPagination->getDashboardPaginator($user['id'], 'show', 10),
'user' => $user,
)));
}
@@ -98,8 +38,8 @@ class DashboardController extends BaseController
$user = $this->getUser();
$this->response->html($this->helper->layout->dashboard('dashboard/tasks', array(
- 'title' => t('My tasks'),
- 'paginator' => $this->getTaskPaginator($user['id'], 'tasks', 50),
+ 'title' => t('Tasks overview for %s', $this->helper->user->getFullname($user)),
+ 'paginator' => $this->taskPagination->getDashboardPaginator($user['id'], 'tasks', 50),
'user' => $user,
)));
}
@@ -114,8 +54,8 @@ class DashboardController extends BaseController
$user = $this->getUser();
$this->response->html($this->helper->layout->dashboard('dashboard/subtasks', array(
- 'title' => t('My subtasks'),
- 'paginator' => $this->getSubtaskPaginator($user['id'], 'subtasks', 50),
+ 'title' => t('Subtasks overview for %s', $this->helper->user->getFullname($user)),
+ 'paginator' => $this->subtaskPagination->getDashboardPaginator($user['id'], 'subtasks', 50),
'user' => $user,
)));
}
@@ -130,8 +70,8 @@ class DashboardController extends BaseController
$user = $this->getUser();
$this->response->html($this->helper->layout->dashboard('dashboard/projects', array(
- 'title' => t('My projects'),
- 'paginator' => $this->getProjectPaginator($user['id'], 'projects', 25),
+ 'title' => t('Projects overview for %s', $this->helper->user->getFullname($user)),
+ 'paginator' => $this->projectPagination->getDashboardPaginator($user['id'], 'projects', 25),
'user' => $user,
)));
}
@@ -146,7 +86,7 @@ class DashboardController extends BaseController
$user = $this->getUser();
$this->response->html($this->helper->layout->dashboard('dashboard/activity', array(
- 'title' => t('My activity stream'),
+ 'title' => t('Activity stream for %s', $this->helper->user->getFullname($user)),
'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermissionModel->getActiveProjectIds($user['id']), 100),
'user' => $user,
)));
@@ -159,9 +99,11 @@ class DashboardController extends BaseController
*/
public function calendar()
{
+ $user = $this->getUser();
+
$this->response->html($this->helper->layout->dashboard('dashboard/calendar', array(
- 'title' => t('My calendar'),
- 'user' => $this->getUser(),
+ 'title' => t('Calendar for %s', $this->helper->user->getFullname($user)),
+ 'user' => $user,
)));
}
@@ -175,7 +117,7 @@ class DashboardController extends BaseController
$user = $this->getUser();
$this->response->html($this->helper->layout->dashboard('dashboard/notifications', array(
- 'title' => t('My notifications'),
+ 'title' => t('Notifications for %s', $this->helper->user->getFullname($user)),
'notifications' => $this->userUnreadNotificationModel->getAll($user['id']),
'user' => $user,
)));