summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-02-08 16:13:05 -0500
committerFrederic Guillot <fred@kanboard.net>2015-02-08 16:13:05 -0500
commit92509c43c452daea115a4f6e99d94bda5538c8f0 (patch)
tree6bfacdbd4ae52ae8be36921605aa5560143fa1fe /app/Controller
parentacf3941b4aa95bff9e80aa03e22dc064036e69cf (diff)
Add user calendar view on the dashboard and in the user management section
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/App.php3
-rw-r--r--app/Controller/Calendar.php30
-rw-r--r--app/Controller/User.php14
3 files changed, 43 insertions, 4 deletions
diff --git a/app/Controller/App.php b/app/Controller/App.php
index c4ed0fb8..ef0a08a9 100644
--- a/app/Controller/App.php
+++ b/app/Controller/App.php
@@ -68,10 +68,11 @@ class App extends Base
$this->response->html($this->template->layout('app/dashboard', array(
'title' => t('Dashboard'),
'board_selector' => $this->projectPermission->getAllowedProjects($user_id),
- 'events' => $this->projectActivity->getProjects($project_ids, 10),
+ 'events' => $this->projectActivity->getProjects($project_ids, 5),
'task_paginator' => $task_paginator,
'subtask_paginator' => $subtask_paginator,
'project_paginator' => $project_paginator,
+ 'user_id' => $user_id,
)));
}
diff --git a/app/Controller/Calendar.php b/app/Controller/Calendar.php
index 6b0c8619..abbcab7f 100644
--- a/app/Controller/Calendar.php
+++ b/app/Controller/Calendar.php
@@ -2,6 +2,8 @@
namespace Controller;
+use Model\Task;
+
/**
* Project Calendar controller
*
@@ -35,7 +37,7 @@ class Calendar extends Base
}
/**
- * Get tasks to display on the calendar
+ * Get tasks to display on the calendar (project view)
*
* @access public
*/
@@ -52,8 +54,30 @@ class Calendar extends Base
->filterByColor($this->request->getStringParam('color_id'))
->filterByStatus($this->request->getIntegerParam('is_active', -1))
->filterByDueDateRange(
- $this->request->getStringParam('start'),
- $this->request->getStringParam('end')
+ $this->request->getStringParam('start'),
+ $this->request->getStringParam('end')
+ )
+ ->toCalendarEvents()
+ );
+ }
+
+ /**
+ * Get tasks to display on the calendar (user view)
+ *
+ * @access public
+ */
+ public function user()
+ {
+ $user_id = $this->request->getIntegerParam('user_id');
+
+ $this->response->json(
+ $this->taskFilter
+ ->create()
+ ->filterByOwner($user_id)
+ ->filterByStatus(Task::STATUS_OPEN)
+ ->filterByDueDateRange(
+ $this->request->getStringParam('start'),
+ $this->request->getStringParam('end')
)
->toCalendarEvents()
);
diff --git a/app/Controller/User.php b/app/Controller/User.php
index 91141241..3736f20e 100644
--- a/app/Controller/User.php
+++ b/app/Controller/User.php
@@ -190,6 +190,20 @@ class User extends Base
}
/**
+ * Display user calendar
+ *
+ * @access public
+ */
+ public function calendar()
+ {
+ $user = $this->getUser();
+
+ $this->response->html($this->layout('user/calendar', array(
+ 'user' => $user,
+ )));
+ }
+
+ /**
* Display timesheet
*
* @access public