summaryrefslogtreecommitdiff
path: root/app/Template/dashboard
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-15 18:31:47 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-15 18:31:47 -0400
commit67b836164997527b91452b19adbcb8aa3c5decf1 (patch)
treeb5876d311912e97b0592c7e208639f7b52813a75 /app/Template/dashboard
parent108e867605dbc7ece4cbcbecc89a674e9c154a9b (diff)
Refactoring: added controlled middleware and changed response class
Diffstat (limited to 'app/Template/dashboard')
-rw-r--r--app/Template/dashboard/activity.php4
-rw-r--r--app/Template/dashboard/calendar.php5
-rw-r--r--app/Template/dashboard/layout.php32
-rw-r--r--app/Template/dashboard/notifications.php61
-rw-r--r--app/Template/dashboard/projects.php50
-rw-r--r--app/Template/dashboard/show.php12
-rw-r--r--app/Template/dashboard/sidebar.php27
-rw-r--r--app/Template/dashboard/subtasks.php43
-rw-r--r--app/Template/dashboard/tasks.php49
9 files changed, 283 insertions, 0 deletions
diff --git a/app/Template/dashboard/activity.php b/app/Template/dashboard/activity.php
new file mode 100644
index 00000000..71a67fb2
--- /dev/null
+++ b/app/Template/dashboard/activity.php
@@ -0,0 +1,4 @@
+<div class="page-header">
+ <h2><?= t('My activity stream') ?></h2>
+</div>
+<?= $this->render('event/events', array('events' => $events)) ?> \ No newline at end of file
diff --git a/app/Template/dashboard/calendar.php b/app/Template/dashboard/calendar.php
new file mode 100644
index 00000000..a154203b
--- /dev/null
+++ b/app/Template/dashboard/calendar.php
@@ -0,0 +1,5 @@
+<div id="calendar"
+ data-check-url="<?= $this->url->href('calendar', 'user', array('user_id' => $user['id'])) ?>"
+ data-save-url="<?= $this->url->href('calendar', 'save') ?>"
+>
+</div>
diff --git a/app/Template/dashboard/layout.php b/app/Template/dashboard/layout.php
new file mode 100644
index 00000000..2a32ac02
--- /dev/null
+++ b/app/Template/dashboard/layout.php
@@ -0,0 +1,32 @@
+<section id="main">
+ <div class="page-header">
+ <ul>
+ <?php if ($this->user->hasAccess('ProjectCreation', 'create')): ?>
+ <li>
+ <i class="fa fa-plus fa-fw"></i>
+ <?= $this->url->link(t('New project'), 'ProjectCreation', 'create', array(), false, 'popover') ?>
+ </li>
+ <?php endif ?>
+ <?php if ($this->app->config('disable_private_project', 0) == 0): ?>
+ <li>
+ <i class="fa fa-lock fa-fw"></i>
+ <?= $this->url->link(t('New private project'), 'ProjectCreation', 'createPrivate', array(), false, 'popover') ?>
+ </li>
+ <?php endif ?>
+ <li>
+ <i class="fa fa-search fa-fw"></i>
+ <?= $this->url->link(t('Search'), 'search', 'index') ?>
+ </li>
+ <li>
+ <i class="fa fa-folder fa-fw"></i>
+ <?= $this->url->link(t('Project management'), 'project', 'index') ?>
+ </li>
+ </ul>
+ </div>
+ <section class="sidebar-container" id="dashboard">
+ <?= $this->render($sidebar_template, array('user' => $user)) ?>
+ <div class="sidebar-content">
+ <?= $content_for_sublayout ?>
+ </div>
+ </section>
+</section> \ No newline at end of file
diff --git a/app/Template/dashboard/notifications.php b/app/Template/dashboard/notifications.php
new file mode 100644
index 00000000..b64eb0b7
--- /dev/null
+++ b/app/Template/dashboard/notifications.php
@@ -0,0 +1,61 @@
+<div class="page-header">
+ <h2><?= t('My notifications') ?></h2>
+
+<?php if (empty($notifications)): ?>
+</div>
+<p class="alert"><?= t('No new notifications.') ?></p>
+<?php else: ?>
+ <ul>
+ <li>
+ <i class="fa fa-check-square-o fa-fw"></i>
+ <?= $this->url->link(t('Mark all as read'), 'webNotification', 'flush', array('user_id' => $user['id'])) ?>
+ </li>
+ </ul>
+</div>
+
+ <table class="table-fixed table-small">
+ <tr>
+ <th><?= t('Notification') ?></th>
+ <th class="column-20"><?= t('Date') ?></th>
+ <th class="column-15"><?= t('Action') ?></th>
+ </tr>
+ <?php foreach ($notifications as $notification): ?>
+ <tr>
+ <td>
+ <?php if ($this->text->contains($notification['event_name'], 'subtask')): ?>
+ <i class="fa fa-tasks fa-fw"></i>
+ <?php elseif ($this->text->contains($notification['event_name'], 'task.move')): ?>
+ <i class="fa fa-arrows-alt fa-fw"></i>
+ <?php elseif ($this->text->contains($notification['event_name'], 'task.overdue')): ?>
+ <i class="fa fa-calendar-times-o fa-fw"></i>
+ <?php elseif ($this->text->contains($notification['event_name'], 'task')): ?>
+ <i class="fa fa-newspaper-o fa-fw"></i>
+ <?php elseif ($this->text->contains($notification['event_name'], 'comment')): ?>
+ <i class="fa fa-comments-o fa-fw"></i>
+ <?php elseif ($this->text->contains($notification['event_name'], 'file')): ?>
+ <i class="fa fa-file-o fa-fw"></i>
+ <?php endif ?>
+
+ <?php if ($this->text->contains($notification['event_name'], 'comment')): ?>
+ <?= $this->url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id']), false, '', '', false, 'comment-'.$notification['event_data']['comment']['id']) ?>
+ <?php elseif ($this->text->contains($notification['event_name'], 'task.overdue')): ?>
+ <?php if (count($notification['event_data']['tasks']) > 1): ?>
+ <?= $notification['title'] ?>
+ <?php else: ?>
+ <?= $this->url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['tasks'][0]['id'], 'project_id' => $notification['event_data']['tasks'][0]['project_id'])) ?>
+ <?php endif ?>
+ <?php else: ?>
+ <?= $this->url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id'])) ?>
+ <?php endif ?>
+ </td>
+ <td>
+ <?= $this->dt->datetime($notification['date_creation']) ?>
+ </td>
+ <td>
+ <i class="fa fa-check fa-fw"></i>
+ <?= $this->url->link(t('Mark as read'), 'webNotification', 'remove', array('user_id' => $user['id'], 'notification_id' => $notification['id'])) ?>
+ </td>
+ </tr>
+ <?php endforeach ?>
+ </table>
+<?php endif ?> \ No newline at end of file
diff --git a/app/Template/dashboard/projects.php b/app/Template/dashboard/projects.php
new file mode 100644
index 00000000..cdf19bdf
--- /dev/null
+++ b/app/Template/dashboard/projects.php
@@ -0,0 +1,50 @@
+<div class="page-header">
+ <h2><?= $this->url->link(t('My projects'), 'DashboardController', 'projects', array('user_id' => $user['id'])) ?> (<?= $paginator->getTotal() ?>)</h2>
+</div>
+<?php if ($paginator->isEmpty()): ?>
+ <p class="alert"><?= t('Your are not member of any project.') ?></p>
+<?php else: ?>
+ <table class="table-fixed table-small">
+ <tr>
+ <th class="column-5"><?= $paginator->order('Id', 'id') ?></th>
+ <th class="column-3"><?= $paginator->order('<i class="fa fa-lock fa-fw" title="'.t('Private project').'"></i>', 'is_private') ?></th>
+ <th class="column-25"><?= $paginator->order(t('Project'), \Kanboard\Model\Project::TABLE.'.name') ?></th>
+ <th><?= t('Columns') ?></th>
+ </tr>
+ <?php foreach ($paginator->getCollection() as $project): ?>
+ <tr>
+ <td>
+ <?= $this->render('project/dropdown', array('project' => $project)) ?>
+ </td>
+ <td>
+ <?php if ($project['is_private']): ?>
+ <i class="fa fa-lock fa-fw" title="<?= t('Private project') ?>"></i>
+ <?php endif ?>
+ </td>
+ <td>
+ <?php if ($this->user->hasProjectAccess('gantt', 'project', $project['id'])): ?>
+ <?= $this->url->link('<i class="fa fa-sliders fa-fw"></i>', 'gantt', 'project', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Gantt chart')) ?>
+ <?php endif ?>
+
+ <?= $this->url->link('<i class="fa fa-list"></i>', 'listing', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('List')) ?>&nbsp;
+ <?= $this->url->link('<i class="fa fa-calendar"></i>', 'calendar', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Calendar')) ?>&nbsp;
+
+ <?= $this->url->link($this->text->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?>
+ <?php if (! empty($project['description'])): ?>
+ <span class="tooltip" title="<?= $this->text->markdownAttribute($project['description']) ?>">
+ <i class="fa fa-info-circle"></i>
+ </span>
+ <?php endif ?>
+ </td>
+ <td class="dashboard-project-stats">
+ <?php foreach ($project['columns'] as $column): ?>
+ <strong title="<?= t('Task count') ?>"><?= $column['nb_tasks'] ?></strong>
+ <span><?= $this->text->e($column['title']) ?></span>
+ <?php endforeach ?>
+ </td>
+ </tr>
+ <?php endforeach ?>
+ </table>
+
+ <?= $paginator ?>
+<?php endif ?>
diff --git a/app/Template/dashboard/show.php b/app/Template/dashboard/show.php
new file mode 100644
index 00000000..bc4e2952
--- /dev/null
+++ b/app/Template/dashboard/show.php
@@ -0,0 +1,12 @@
+<div class="filter-box">
+ <form method="get" action="<?= $this->url->dir() ?>" class="search">
+ <?= $this->form->hidden('controller', array('controller' => 'search')) ?>
+ <?= $this->form->hidden('action', array('action' => 'index')) ?>
+ <?= $this->form->text('search', array(), array(), array('placeholder="'.t('Search').'"'), 'form-input-large') ?>
+ <?= $this->render('app/filters_helper') ?>
+ </form>
+</div>
+
+<?= $this->render('dashboard/projects', array('paginator' => $project_paginator, 'user' => $user)) ?>
+<?= $this->render('dashboard/tasks', array('paginator' => $task_paginator, 'user' => $user)) ?>
+<?= $this->render('dashboard/subtasks', array('paginator' => $subtask_paginator, 'user' => $user)) ?>
diff --git a/app/Template/dashboard/sidebar.php b/app/Template/dashboard/sidebar.php
new file mode 100644
index 00000000..86cc20f8
--- /dev/null
+++ b/app/Template/dashboard/sidebar.php
@@ -0,0 +1,27 @@
+<div class="sidebar">
+ <h2><?= $this->text->e($user['name'] ?: $user['username']) ?></h2>
+ <ul>
+ <li <?= $this->app->checkMenuSelection('DashboardController', 'show') ?>>
+ <?= $this->url->link(t('Overview'), 'DashboardController', 'show', array('user_id' => $user['id'])) ?>
+ </li>
+ <li <?= $this->app->checkMenuSelection('DashboardController', 'projects') ?>>
+ <?= $this->url->link(t('My projects'), 'DashboardController', 'projects', array('user_id' => $user['id'])) ?>
+ </li>
+ <li <?= $this->app->checkMenuSelection('DashboardController', 'tasks') ?>>
+ <?= $this->url->link(t('My tasks'), 'DashboardController', 'tasks', array('user_id' => $user['id'])) ?>
+ </li>
+ <li <?= $this->app->checkMenuSelection('DashboardController', 'subtasks') ?>>
+ <?= $this->url->link(t('My subtasks'), 'DashboardController', 'subtasks', array('user_id' => $user['id'])) ?>
+ </li>
+ <li <?= $this->app->checkMenuSelection('DashboardController', 'calendar') ?>>
+ <?= $this->url->link(t('My calendar'), 'DashboardController', 'calendar', array('user_id' => $user['id'])) ?>
+ </li>
+ <li <?= $this->app->checkMenuSelection('DashboardController', 'activity') ?>>
+ <?= $this->url->link(t('My activity stream'), 'DashboardController', 'activity', array('user_id' => $user['id'])) ?>
+ </li>
+ <li <?= $this->app->checkMenuSelection('DashboardController', 'notifications') ?>>
+ <?= $this->url->link(t('My notifications'), 'DashboardController', 'notifications', array('user_id' => $user['id'])) ?>
+ </li>
+ <?= $this->hook->render('template:dashboard:sidebar') ?>
+ </ul>
+</div>
diff --git a/app/Template/dashboard/subtasks.php b/app/Template/dashboard/subtasks.php
new file mode 100644
index 00000000..ee6caf02
--- /dev/null
+++ b/app/Template/dashboard/subtasks.php
@@ -0,0 +1,43 @@
+<div class="page-header">
+ <h2><?= $this->url->link(t('My subtasks'), 'DashboardController', 'subtasks', array('user_id' => $user['id'])) ?> (<?= $paginator->getTotal() ?>)</h2>
+</div>
+<?php if ($paginator->isEmpty()): ?>
+ <p class="alert"><?= t('There is nothing assigned to you.') ?></p>
+<?php else: ?>
+ <table class="table-fixed table-small">
+ <tr>
+ <th class="column-5"><?= $paginator->order('Id', 'tasks.id') ?></th>
+ <th class="column-20"><?= $paginator->order(t('Project'), 'project_name') ?></th>
+ <th><?= $paginator->order(t('Task'), 'task_name') ?></th>
+ <th><?= $paginator->order(t('Subtask'), 'title') ?></th>
+ <th class="column-20"><?= t('Time tracking') ?></th>
+ </tr>
+ <?php foreach ($paginator->getCollection() as $subtask): ?>
+ <tr>
+ <td class="task-table color-<?= $subtask['color_id'] ?>">
+ <?= $this->render('task/dropdown', array('task' => array('id' => $subtask['task_id'], 'project_id' => $subtask['project_id']))) ?>
+ </td>
+ <td>
+ <?= $this->url->link($this->text->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?>
+ </td>
+ <td>
+ <?= $this->url->link($this->text->e($subtask['task_name']), 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?>
+ </td>
+ <td>
+ <?= $this->subtask->toggleStatus($subtask, $subtask['project_id']) ?>
+ </td>
+ <td>
+ <?php if (! empty($subtask['time_spent'])): ?>
+ <strong><?= $this->text->e($subtask['time_spent']).'h' ?></strong> <?= t('spent') ?>
+ <?php endif ?>
+
+ <?php if (! empty($subtask['time_estimated'])): ?>
+ <strong><?= $this->text->e($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?>
+ <?php endif ?>
+ </td>
+ </tr>
+ <?php endforeach ?>
+ </table>
+
+ <?= $paginator ?>
+<?php endif ?>
diff --git a/app/Template/dashboard/tasks.php b/app/Template/dashboard/tasks.php
new file mode 100644
index 00000000..71b62572
--- /dev/null
+++ b/app/Template/dashboard/tasks.php
@@ -0,0 +1,49 @@
+<div class="page-header">
+ <h2><?= $this->url->link(t('My tasks'), 'DashboardController', 'tasks', array('user_id' => $user['id'])) ?> (<?= $paginator->getTotal() ?>)</h2>
+</div>
+<?php if ($paginator->isEmpty()): ?>
+ <p class="alert"><?= t('There is nothing assigned to you.') ?></p>
+<?php else: ?>
+ <table class="table-fixed table-small">
+ <tr>
+ <th class="column-5"><?= $paginator->order('Id', 'tasks.id') ?></th>
+ <th class="column-20"><?= $paginator->order(t('Project'), 'project_name') ?></th>
+ <th><?= $paginator->order(t('Task'), 'title') ?></th>
+ <th class="column-5"><?= $paginator->order('Priority', 'tasks.priority') ?></th>
+ <th class="column-20"><?= t('Time tracking') ?></th>
+ <th class="column-20"><?= $paginator->order(t('Due date'), 'date_due') ?></th>
+ </tr>
+ <?php foreach ($paginator->getCollection() as $task): ?>
+ <tr>
+ <td class="task-table color-<?= $task['color_id'] ?>">
+ <?= $this->render('task/dropdown', array('task' => $task)) ?>
+ </td>
+ <td>
+ <?= $this->url->link($this->text->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?>
+ </td>
+ <td>
+ <?= $this->url->link($this->text->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ </td>
+ <td>
+ <?php if ($task['priority'] >= 0): ?>
+ P<?= $this->text->e($task['priority'])?>
+ <?php endif?>
+ </td>
+ <td>
+ <?php if (! empty($task['time_spent'])): ?>
+ <strong><?= $this->text->e($task['time_spent']).'h' ?></strong> <?= t('spent') ?>
+ <?php endif ?>
+
+ <?php if (! empty($task['time_estimated'])): ?>
+ <strong><?= $this->text->e($task['time_estimated']).'h' ?></strong> <?= t('estimated') ?>
+ <?php endif ?>
+ </td>
+ <td>
+ <?= $this->dt->date($task['date_due']) ?>
+ </td>
+ </tr>
+ <?php endforeach ?>
+ </table>
+
+ <?= $paginator ?>
+<?php endif ?>