Simplify dashboard to use new tasks list view

This commit is contained in:
Frederic Guillot
2017-03-12 21:36:52 -04:00
parent f6b42eb802
commit 9b34631135
31 changed files with 380 additions and 650 deletions

View File

@@ -2,8 +2,6 @@
namespace Kanboard\Api\Procedure;
use Kanboard\Model\SubtaskModel;
/**
* Me API controller
*
@@ -19,15 +17,12 @@ class MeProcedure extends BaseProcedure
public function getMyDashboard()
{
$user_id = $this->userSession->getId();
$projects = $this->projectModel->getQueryColumnStats($this->projectPermissionModel->getActiveProjectIds($user_id))->findAll();
$tasks = $this->taskFinderModel->getUserQuery($user_id)->findAll();
$userId = $this->userSession->getId();
return array(
'projects' => $this->formatProjects($projects),
'tasks' => $this->formatTasks($tasks),
'subtasks' => $this->subtaskModel->getUserQuery($user_id, array(SubtaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS))->findAll(),
);
return $this->taskListSubtaskAssigneeFormatter
->withQuery($this->taskFinderModel->getUserQuery($userId))
->withUserId($userId)
->format();
}
public function getMyActivityStream()

View File

@@ -19,7 +19,7 @@ class ActivityController extends BaseController
{
$user = $this->getUser();
$this->response->html($this->helper->layout->dashboard('activity/user', array(
$this->response->html($this->template->render('activity/user', array(
'title' => t('Activity stream for %s', $this->helper->user->getFullname($user)),
'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermissionModel->getActiveProjectIds($user['id']), 100),
'user' => $user,

View File

@@ -19,60 +19,10 @@ class DashboardController extends BaseController
{
$user = $this->getUser();
$this->response->html($this->helper->layout->dashboard('dashboard/show', array(
'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,
)));
}
/**
* My tasks
*
* @access public
*/
public function tasks()
{
$user = $this->getUser();
$this->response->html($this->helper->layout->dashboard('dashboard/tasks', array(
'title' => t('Tasks overview for %s', $this->helper->user->getFullname($user)),
'paginator' => $this->taskPagination->getDashboardPaginator($user['id'], 'tasks', 50),
'user' => $user,
)));
}
/**
* My subtasks
*
* @access public
*/
public function subtasks()
{
$user = $this->getUser();
$this->response->html($this->helper->layout->dashboard('dashboard/subtasks', array(
'title' => t('Subtasks overview for %s', $this->helper->user->getFullname($user)),
'paginator' => $this->subtaskPagination->getDashboardPaginator($user['id'], 'subtasks', 50),
'user' => $user,
)));
}
/**
* My projects
*
* @access public
*/
public function projects()
{
$user = $this->getUser();
$this->response->html($this->helper->layout->dashboard('dashboard/projects', array(
'title' => t('Projects overview for %s', $this->helper->user->getFullname($user)),
'paginator' => $this->projectPagination->getDashboardPaginator($user['id'], 'projects', 25),
'user' => $user,
$this->response->html($this->helper->layout->app('dashboard/show', array(
'title' => t('Dashboard for %s', $this->helper->user->getFullname($user)),
'user' => $user,
'results' => $this->dashboardPagination->getOverview($user['id']),
)));
}
}

View File

@@ -77,6 +77,7 @@ use Pimple\Container;
* @property \Kanboard\Formatter\TaskICalFormatter $taskICalFormatter
* @property \Kanboard\Formatter\TaskListFormatter $taskListFormatter
* @property \Kanboard\Formatter\TaskListSubtaskFormatter $taskListSubtaskFormatter
* @property \Kanboard\Formatter\TaskListSubtaskAssigneeFormatter $taskListSubtaskAssigneeFormatter
* @property \Kanboard\Formatter\TaskSuggestMenuFormatter $taskSuggestMenuFormatter
* @property \Kanboard\Formatter\UserAutoCompleteFormatter $userAutoCompleteFormatter
* @property \Kanboard\Formatter\UserMentionFormatter $userMentionFormatter
@@ -151,9 +152,7 @@ use Pimple\Container;
* @property \Kanboard\Model\UserNotificationFilterModel $userNotificationFilterModel
* @property \Kanboard\Model\UserUnreadNotificationModel $userUnreadNotificationModel
* @property \Kanboard\Model\UserMetadataModel $userMetadataModel
* @property \Kanboard\Pagination\TaskPagination $taskPagination
* @property \Kanboard\Pagination\SubtaskPagination $subtaskPagination
* @property \Kanboard\Pagination\ProjectPagination $projectPagination
* @property \Kanboard\Pagination\DashboardPagination $dashboardPagination
* @property \Kanboard\Pagination\UserPagination $userPagination
* @property \Kanboard\Validator\ActionValidator $actionValidator
* @property \Kanboard\Validator\AuthValidator $authValidator

View File

@@ -0,0 +1,43 @@
<?php
namespace Kanboard\Formatter;
/**
* Class TaskListSubtaskAssigneeFormatter
*
* @package Kanboard\Formatter
* @author Frederic Guillot
*/
class TaskListSubtaskAssigneeFormatter extends TaskListFormatter
{
protected $userId = 0;
/**
* Set assignee
*
* @param integer $userId
* @return $this
*/
public function withUserId($userId)
{
$this->userId = $userId;
return $this;
}
/**
* Apply formatter
*
* @access public
* @return array
*/
public function format()
{
$tasks = parent::format();
$taskIds = array_column($tasks, 'id');
$subtasks = $this->subtaskModel->getAllByTaskIdsAndAssignee($taskIds, $this->userId);
$subtasks = array_column_index($subtasks, 'task_id');
array_merge_relation($tasks, $subtasks, 'subtasks', 'id');
return $tasks;
}
}

View File

@@ -140,19 +140,6 @@ class LayoutHelper extends Base
return $this->subLayout('plugin/layout', 'plugin/sidebar', $template, $params);
}
/**
* Common layout for dashboard views
*
* @access public
* @param string $template
* @param array $params
* @return string
*/
public function dashboard($template, array $params)
{
return $this->subLayout('dashboard/layout', 'dashboard/sidebar', $template, $params);
}
/**
* Common layout for analytic views
*

View File

@@ -296,27 +296,6 @@ class ProjectModel extends Base
return $projects;
}
/**
* Get project summary for a list of project
*
* @access public
* @param array $project_ids List of project id
* @return \PicoDb\Table
*/
public function getQueryColumnStats(array $project_ids)
{
if (empty($project_ids)) {
return $this->db->table(ProjectModel::TABLE)->eq(ProjectModel::TABLE.'.id', 0);
}
return $this->db
->table(ProjectModel::TABLE)
->columns(self::TABLE.'.*', UserModel::TABLE.'.username AS owner_username', UserModel::TABLE.'.name AS owner_name')
->join(UserModel::TABLE, 'id', 'owner_id')
->in(self::TABLE.'.id', $project_ids)
->callback(array($this, 'applyColumnStats'));
}
/**
* Get query for list of project without column statistics
*

View File

@@ -69,35 +69,6 @@ class SubtaskModel extends Base
);
}
/**
* Get the query to fetch subtasks assigned to a user
*
* @access public
* @param integer $userId
* @param array $status
* @return \PicoDb\Table
*/
public function getUserQuery($userId, array $status)
{
return $this->db->table(SubtaskModel::TABLE)
->columns(
SubtaskModel::TABLE.'.*',
TaskModel::TABLE.'.project_id',
TaskModel::TABLE.'.color_id',
TaskModel::TABLE.'.title AS task_name',
ProjectModel::TABLE.'.name AS project_name'
)
->subquery($this->subtaskTimeTrackingModel->getTimerQuery($userId), 'timer_start_date')
->eq('user_id', $userId)
->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE)
->eq(ColumnModel::TABLE.'.hide_in_dashboard', 0)
->in(SubtaskModel::TABLE.'.status', $status)
->join(TaskModel::TABLE, 'id', 'task_id')
->join(ProjectModel::TABLE, 'id', 'project_id', TaskModel::TABLE)
->join(ColumnModel::TABLE, 'id', 'column_id', TaskModel::TABLE)
->callback(array($this, 'addStatusName'));
}
/**
* Get common query
*
@@ -148,6 +119,24 @@ class SubtaskModel extends Base
->format();
}
/**
* Get subtasks for a list of tasks and a given assignee
*
* @param array $taskIds
* @param integer $userId
* @return array
*/
public function getAllByTaskIdsAndAssignee(array $taskIds, $userId)
{
if (empty($taskIds)) {
return array();
}
return $this->subtaskListFormatter
->withQuery($this->getQuery()->in('task_id', $taskIds)->eq(self::TABLE.'.user_id', $userId))
->format();
}
/**
* Get a subtask by the id
*
@@ -310,24 +299,4 @@ class SubtaskModel extends Base
$values['user_id'] = isset($values['user_id']) ? $values['user_id'] : 0;
$this->hook->reference('model:subtask:creation:prepare', $values);
}
/**
* Add subtask status status to the resultset
*
* @access public
* @param array $subtasks Subtasks
* @return array
*/
public function addStatusName(array $subtasks)
{
$status = $this->getStatusList();
foreach ($subtasks as &$subtask) {
$subtask['status_name'] = $status[$subtask['status']];
$subtask['timer_start_date'] = isset($subtask['timer_start_date']) ? $subtask['timer_start_date'] : 0;
$subtask['is_timer_started'] = ! empty($subtask['timer_start_date']);
}
return $subtasks;
}
}

View File

@@ -59,27 +59,11 @@ class TaskFinderModel extends Base
*/
public function getUserQuery($user_id)
{
return $this->db
->table(TaskModel::TABLE)
->columns(
TaskModel::TABLE.'.id',
TaskModel::TABLE.'.title',
TaskModel::TABLE.'.date_due',
TaskModel::TABLE.'.date_creation',
TaskModel::TABLE.'.project_id',
TaskModel::TABLE.'.column_id',
TaskModel::TABLE.'.color_id',
TaskModel::TABLE.'.priority',
TaskModel::TABLE.'.time_spent',
TaskModel::TABLE.'.time_estimated',
TaskModel::TABLE.'.is_active',
TaskModel::TABLE.'.creator_id',
ProjectModel::TABLE.'.name AS project_name',
ColumnModel::TABLE.'.title AS column_title'
)
->join(ProjectModel::TABLE, 'id', 'project_id')
->join(ColumnModel::TABLE, 'id', 'column_id')
return $this->getExtendedQuery()
->beginOr()
->eq(TaskModel::TABLE.'.owner_id', $user_id)
->addCondition(TaskModel::TABLE.".id IN (SELECT task_id FROM ".SubtaskModel::TABLE." WHERE ".SubtaskModel::TABLE.".user_id='$user_id')")
->closeOr()
->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN)
->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE)
->eq(ColumnModel::TABLE.'.hide_in_dashboard', 0);

View File

@@ -0,0 +1,50 @@
<?php
namespace Kanboard\Pagination;
use Kanboard\Core\Base;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\TaskModel;
/**
* Class DashboardPagination
*
* @package Kanboard\Pagination
* @author Frederic Guillot
*/
class DashboardPagination extends Base
{
/**
* Get user listing pagination
*
* @access public
* @param integer $userId
* @return array
*/
public function getOverview($userId)
{
$paginators = array();
$projects = $this->projectUserRoleModel->getActiveProjectsByUser($userId);
foreach ($projects as $projectId => $projectName) {
$paginator = $this->paginator
->setUrl('DashboardController', 'show', array('user_id' => $userId))
->setMax(50)
->setOrder(TaskModel::TABLE.'.priority')
->setDirection('DESC')
->setFormatter($this->taskListSubtaskAssigneeFormatter->withUserId($userId))
->setQuery($this->taskFinderModel->getUserQuery($userId)->eq(ProjectModel::TABLE.'.id', $projectId))
->calculate();
if ($paginator->getTotal() > 0) {
$paginators[] = array(
'project_id' => $projectId,
'project_name' => $projectName,
'paginator' => $paginator,
);
}
}
return $paginators;
}
}

View File

@@ -1,35 +0,0 @@
<?php
namespace Kanboard\Pagination;
use Kanboard\Core\Base;
use Kanboard\Core\Paginator;
use Kanboard\Model\ProjectModel;
/**
* Class ProjectPagination
*
* @package Kanboard\Pagination
* @author Frederic Guillot
*/
class ProjectPagination extends Base
{
/**
* Get dashboard pagination
*
* @access public
* @param integer $user_id
* @param string $method
* @param integer $max
* @return Paginator
*/
public function getDashboardPaginator($user_id, $method, $max)
{
return $this->paginator
->setUrl('DashboardController', $method, 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');
}
}

View File

@@ -1,39 +0,0 @@
<?php
namespace Kanboard\Pagination;
use Kanboard\Core\Base;
use Kanboard\Core\Paginator;
use Kanboard\Model\SubtaskModel;
use Kanboard\Model\TaskModel;
/**
* Class SubtaskPagination
*
* @package Kanboard\Pagination
* @author Frederic Guillot
*/
class SubtaskPagination extends Base
{
/**
* Get dashboard pagination
*
* @access public
* @param integer $user_id
* @param string $method
* @param integer $max
* @return Paginator
*/
public function getDashboardPaginator($user_id, $method, $max)
{
$query = $this->subtaskModel->getUserQuery($user_id, array(SubtaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS));
$this->hook->reference('pagination:dashboard:subtask:query', $query);
return $this->paginator
->setUrl('DashboardController', $method, array('pagination' => 'subtasks', 'user_id' => $user_id))
->setMax($max)
->setOrder(TaskModel::TABLE.'.id')
->setQuery($query)
->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks');
}
}

View File

@@ -1,38 +0,0 @@
<?php
namespace Kanboard\Pagination;
use Kanboard\Core\Base;
use Kanboard\Core\Paginator;
use Kanboard\Model\TaskModel;
/**
* Class TaskPagination
*
* @package Kanboard\Pagination
* @author Frederic Guillot
*/
class TaskPagination extends Base
{
/**
* Get dashboard pagination
*
* @access public
* @param integer $user_id
* @param string $method
* @param integer $max
* @return Paginator
*/
public function getDashboardPaginator($user_id, $method, $max)
{
$query = $this->taskFinderModel->getUserQuery($user_id);
$this->hook->reference('pagination:dashboard:task:query', $query);
return $this->paginator
->setUrl('DashboardController', $method, array('pagination' => 'tasks', 'user_id' => $user_id))
->setMax($max)
->setOrder(TaskModel::TABLE.'.id')
->setQuery($query)
->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks');
}
}

View File

@@ -15,7 +15,7 @@ use Kanboard\Model\UserModel;
class UserPagination extends Base
{
/**
* Get user listing paginator
* Get user listing pagination
*
* @access public
* @return Paginator

View File

@@ -129,9 +129,7 @@ class ClassProvider implements ServiceProviderInterface
'TransitionExport',
),
'Pagination' => array(
'TaskPagination',
'SubtaskPagination',
'ProjectPagination',
'DashboardPagination',
'UserPagination',
),
'Core' => array(

View File

@@ -31,6 +31,7 @@ class FormatterProvider implements ServiceProviderInterface
'TaskICalFormatter',
'TaskListFormatter',
'TaskListSubtaskFormatter',
'TaskListSubtaskAssigneeFormatter',
'TaskSuggestMenuFormatter',
'UserAutoCompleteFormatter',
'UserMentionFormatter',

View File

@@ -1,31 +0,0 @@
<section id="main">
<div class="page-header">
<ul>
<?php if ($this->user->hasAccess('ProjectCreationController', 'create')): ?>
<li>
<?= $this->modal->medium('plus', t('New project'), 'ProjectCreationController', 'create') ?>
</li>
<?php endif ?>
<?php if ($this->app->config('disable_private_project', 0) == 0): ?>
<li>
<?= $this->modal->medium('lock', t('New private project'), 'ProjectCreationController', 'createPrivate') ?>
</li>
<?php endif ?>
<li>
<?= $this->url->icon('folder', t('Project management'), 'ProjectListController', 'show') ?>
</li>
<li>
<?= $this->modal->medium('dashboard', t('My activity stream'), 'ActivityController', 'user') ?>
</li>
<li>
<?= $this->modal->medium('calendar', t('My calendar'), 'CalendarController', 'user') ?>
</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>

View File

@@ -1,55 +0,0 @@
<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-striped table-small table-scrolling">
<tr>
<th class="column-5"><?= $paginator->order('Id', \Kanboard\Model\ProjectModel::TABLE.'.id') ?></th>
<th class="column-3"><?= $paginator->order('<i class="fa fa-lock fa-fw" title="'.t('Private project').'"></i>', \Kanboard\Model\ProjectModel::TABLE.'.is_private') ?></th>
<th class="column-25"><?= $paginator->order(t('Project'), \Kanboard\Model\ProjectModel::TABLE.'.name') ?></th>
<th class="column-10"><?= t('Tasks') ?></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('TaskGanttController', 'show', $project['id'])): ?>
<?= $this->url->link('<i class="fa fa-sliders fa-fw"></i>', 'TaskGanttController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Gantt chart')) ?>
<?php endif ?>
<?= $this->url->link('<i class="fa fa-list"></i>', 'TaskListController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('List')) ?>&nbsp;
<?= $this->url->link('<i class="fa fa-calendar"></i>', 'CalendarController', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Calendar')) ?>&nbsp;
<?= $this->url->link($this->text->e($project['name']), 'BoardViewController', '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>
<?= $project['nb_active_tasks'] ?>
</td>
<td class="dashboard-project-stats">
<?php foreach ($project['columns'] as $column): ?>
<strong title="<?= t('Task count') ?>"><?= $column['nb_open_tasks'] ?></strong>
<small><?= $this->text->e($column['title']) ?></small>
<?php endforeach ?>
</td>
</tr>
<?php endforeach ?>
</table>
<?= $paginator ?>
<?php endif ?>

View File

@@ -1,3 +1,27 @@
<div class="page-header">
<ul>
<?php if ($this->user->hasAccess('ProjectCreationController', 'create')): ?>
<li>
<?= $this->modal->medium('plus', t('New project'), 'ProjectCreationController', 'create') ?>
</li>
<?php endif ?>
<?php if ($this->app->config('disable_private_project', 0) == 0): ?>
<li>
<?= $this->modal->medium('lock', t('New private project'), 'ProjectCreationController', 'createPrivate') ?>
</li>
<?php endif ?>
<li>
<?= $this->url->icon('folder', t('Project management'), 'ProjectListController', 'show') ?>
</li>
<li>
<?= $this->modal->medium('dashboard', t('My activity stream'), 'ActivityController', 'user') ?>
</li>
<li>
<?= $this->modal->medium('calendar', t('My calendar'), 'CalendarController', 'user') ?>
</li>
</ul>
</div>
<div class="filter-box margin-bottom">
<form method="get" action="<?= $this->url->dir() ?>" class="search">
<?= $this->form->hidden('controller', array('controller' => 'SearchController')) ?>
@@ -12,8 +36,48 @@
</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)) ?>
<?php if (empty($results)): ?>
<p class="alert"><?= t('There is nothing assigned to you.') ?></p>
<?php else: ?>
<?php foreach ($results as $result): ?>
<?php if (! $result['paginator']->isEmpty()): ?>
<div class="page-header">
<h2><?= $this->url->link($this->text->e($result['project_name']), 'BoardViewController', 'show', array('project_id' => $result['project_id'])) ?></h2>
</div>
<div class="table-list">
<?= $this->render('task_list/header', array(
'paginator' => $result['paginator'],
)) ?>
<?php foreach ($result['paginator']->getCollection() as $task): ?>
<div class="table-list-row color-<?= $task['color_id'] ?>">
<?= $this->render('task_list/task_title', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_details', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_avatars', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_icons', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_subtasks', array(
'task' => $task,
)) ?>
</div>
<?php endforeach ?>
</div>
<?= $result['paginator'] ?>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
<?= $this->hook->render('template:dashboard:show', array('user' => $user)) ?>

View File

@@ -1,17 +0,0 @@
<div class="sidebar">
<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>
<?= $this->hook->render('template:dashboard:sidebar', array('user' => $user)) ?>
</ul>
</div>

View File

@@ -1,45 +0,0 @@
<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-striped table-small table-scrolling">
<tr>
<th class="column-5"><?= $paginator->order('Id', \Kanboard\Model\TaskModel::TABLE.'.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'), \Kanboard\Model\SubtaskModel::TABLE.'.title') ?></th>
<?= $this->hook->render('template:dashboard:subtasks:header:before-timetracking', array('paginator' => $paginator)) ?>
<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']), 'BoardViewController', 'show', array('project_id' => $subtask['project_id'])) ?>
</td>
<td>
<?= $this->url->link($this->text->e($subtask['task_name']), 'TaskViewController', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?>
</td>
<td>
<?= $this->subtask->renderToggleStatus(array('project_id' => $subtask['project_id']), $subtask) ?>
</td>
<?= $this->hook->render('template:dashboard:subtasks:rows', array('subtask' => $subtask)) ?>
<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 ?>

View File

@@ -1,53 +0,0 @@
<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-striped table-small table-scrolling">
<tr>
<th class="column-5"><?= $paginator->order('Id', \Kanboard\Model\TaskModel::TABLE.'.id') ?></th>
<th class="column-20"><?= $paginator->order(t('Project'), 'project_name') ?></th>
<th><?= $paginator->order(t('Task'), \Kanboard\Model\TaskModel::TABLE.'.title') ?></th>
<th class="column-8"><?= $paginator->order(t('Priority'), \Kanboard\Model\TaskModel::TABLE.'.priority') ?></th>
<th class="column-20"><?= t('Time tracking') ?></th>
<th class="column-10"><?= $paginator->order(t('Due date'), \Kanboard\Model\TaskModel::TABLE.'.date_due') ?></th>
<th class="column-10"><?= $paginator->order(t('Column'), 'column_title') ?></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']), 'BoardViewController', 'show', array('project_id' => $task['project_id'])) ?>
</td>
<td>
<?= $this->url->link($this->text->e($task['title']), 'TaskViewController', '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>
<td>
<?= $this->text->e($task['column_title']) ?>
</td>
</tr>
<?php endforeach ?>
</table>
<?= $paginator ?>
<?php endif ?>

View File

@@ -1,40 +1,38 @@
<section id="main">
<?= $this->projectHeader->render($project, 'TaskListController', 'show') ?>
<?= $this->projectHeader->render($project, 'TaskListController', 'show') ?>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('No tasks found.') ?></p>
<?php elseif (! $paginator->isEmpty()): ?>
<div class="table-list">
<?= $this->render('task_list/header', array(
'paginator' => $paginator,
'project' => $project,
)) ?>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('No tasks found.') ?></p>
<?php elseif (! $paginator->isEmpty()): ?>
<div class="table-list">
<?= $this->render('task_list/header', array(
'paginator' => $paginator,
'project' => $project,
)) ?>
<?php foreach ($paginator->getCollection() as $task): ?>
<div class="table-list-row color-<?= $task['color_id'] ?>">
<?= $this->render('task_list/task_title', array(
'task' => $task,
)) ?>
<?php foreach ($paginator->getCollection() as $task): ?>
<div class="table-list-row color-<?= $task['color_id'] ?>">
<?= $this->render('task_list/task_title', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_details', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_details', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_avatars', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_avatars', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_icons', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_icons', array(
'task' => $task,
)) ?>
<?= $this->render('task_list/task_subtasks', array(
'task' => $task,
)) ?>
</div>
<?php endforeach ?>
</div>
<?= $this->render('task_list/task_subtasks', array(
'task' => $task,
)) ?>
</div>
<?php endforeach ?>
</div>
<?= $paginator ?>
<?php endif ?>
</section>
<?= $paginator ?>
<?php endif ?>