Add user calendar view on the dashboard and in the user management section
This commit is contained in:
@@ -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,
|
||||
)));
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
|
||||
@@ -189,6 +189,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
|
||||
*
|
||||
|
||||
@@ -12,6 +12,7 @@ use Pimple\Container;
|
||||
*
|
||||
* @property \Core\Session $session
|
||||
* @property \Model\Acl $acl
|
||||
* @property \Model\Config $config
|
||||
* @property \Model\User $user
|
||||
* @property \Model\UserSession $userSession
|
||||
*/
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -678,4 +678,6 @@ return array(
|
||||
'Show/hide subtasks' => 'Afficher/cacher les sous-tâches',
|
||||
'Show/hide tasks' => 'Afficher/cacher les tâches',
|
||||
'Disable login form' => 'Désactiver le formulaire d\'authentification',
|
||||
'Show/hide calendar' => 'Afficher/cacher le calendrier',
|
||||
'User calendar' => 'Calendrier de l\'utilisateur',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -676,4 +676,6 @@ return array(
|
||||
// 'Show/hide subtasks' => '',
|
||||
// 'Show/hide tasks' => '',
|
||||
// 'Disable login form' => '',
|
||||
// 'Show/hide calendar' => '',
|
||||
// 'User calendar' => '',
|
||||
);
|
||||
|
||||
@@ -38,7 +38,7 @@ class Acl extends Base
|
||||
'project' => array('show', 'tasks', 'search', 'activity'),
|
||||
'subtask' => '*',
|
||||
'task' => '*',
|
||||
'calendar' => '*',
|
||||
'calendar' => array('show', 'events', 'save'),
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
<li>
|
||||
<a href="#" class="dashboard-toggle" data-toggle="subtasks"><?= t('Show/hide subtasks') ?></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="dashboard-toggle" data-toggle="calendar"><?= t('Show/hide calendar') ?></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="dashboard-toggle" data-toggle="activities"><?= t('Show/hide activities') ?></a>
|
||||
</li>
|
||||
@@ -40,6 +43,13 @@
|
||||
<div id="dashboard-subtasks"><?= $this->render('app/subtasks', array('paginator' => $subtask_paginator)) ?></div>
|
||||
</div>
|
||||
<div class="dashboard-right-column">
|
||||
<div id="dashboard-calendar">
|
||||
<div id="user-calendar"
|
||||
data-check-url="<?= $this->u('calendar', 'user') ?>"
|
||||
data-user-id="<?= $user_id ?>"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dashboard-activities">
|
||||
<h2><?= t('Activity stream') ?></h2>
|
||||
<?= $this->render('project/events', array('events' => $events)) ?>
|
||||
|
||||
5
app/Template/user/calendar.php
Normal file
5
app/Template/user/calendar.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<div id="user-calendar"
|
||||
data-check-url="<?= $this->u('calendar', 'user') ?>"
|
||||
data-user-id="<?= $user['id'] ?>"
|
||||
>
|
||||
</div>
|
||||
@@ -37,6 +37,9 @@
|
||||
<li>
|
||||
<?= $this->a(t('User dashboard'), 'app', 'dashboard', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= $this->a(t('User calendar'), 'user', 'calendar', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($this->userSession->isAdmin() && ! $this->userSession->isCurrentUser($user['id'])): ?>
|
||||
|
||||
Reference in New Issue
Block a user