Add subtasks to the dashboard

This commit is contained in:
Frédéric Guillot 2014-11-11 21:52:22 -05:00
parent 7a5b78dbc6
commit 5ca9a12a0a
18 changed files with 99 additions and 0 deletions

View File

@ -3,6 +3,7 @@
namespace Controller;
use Model\Project as ProjectModel;
use Model\SubTask;
/**
* Application controller
@ -27,6 +28,7 @@ class App extends Base
'board_selector' => $this->projectPermission->getAllowedProjects($user_id),
'events' => $this->projectActivity->getProjects($project_ids, 10),
'tasks' => $this->taskFinder->getAllTasksByUser($user_id),
'subtasks' => $this->subTask->getAllByUser($user_id, array(SubTask::STATUS_TODO, SubTask::STATUS_INPROGRESS)),
'projects' => $this->project->getSummary($project_ids),
'title' => t('Dashboard'),
)));

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -571,4 +571,6 @@ return array(
'Reportings' => 'Rapports',
'Task repartition for "%s"' => 'Répartition des tâches pour « %s »',
'Analytics' => 'Analytique',
'Subtask' => 'Sous-tâche',
'My subtasks' => 'Mes sous-tâches',
);

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -571,4 +571,6 @@ return array(
// 'Reportings' => '',
// 'Task repartition for "%s"' => '',
// 'Analytics' => '',
// 'Subtask' => '',
// 'My subtasks' => '',
);

View File

@ -92,6 +92,38 @@ class SubTask extends Base
return $subtasks;
}
/**
* Get all subtasks assigned to a user
*
* @access public
* @param integer $user_id User id
* @param array $status List of status
* @return array
*/
public function getAllByUser($user_id, array $status)
{
$status_list = $this->getStatusList();
$subtasks = $this->db->table(self::TABLE)
->columns(
self::TABLE.'.*',
Task::TABLE.'.project_id',
Task::TABLE.'.color_id',
Project::TABLE.'.name AS project_name'
)
->eq('user_id', $user_id)
->in(self::TABLE.'.status', $status)
->join(Task::TABLE, 'id', 'task_id')
->join(Project::TABLE, 'id', 'project_id', Task::TABLE)
->asc(Task::TABLE.'.id')
->findAll();
foreach ($subtasks as &$subtask) {
$subtask['status_name'] = $status_list[$subtask['status']];
}
return $subtasks;
}
/**
* Get a subtask by the id
*

View File

@ -75,6 +75,37 @@
<?php endforeach ?>
</table>
<?php endif ?>
<h2><?= t('My subtasks') ?></h2>
<?php if (empty($subtasks)): ?>
<p class="alert"><?= t('There is nothing assigned to you.') ?></p>
<?php else: ?>
<table class="table-fixed">
<tr>
<th class="column-8">&nbsp;</th>
<th class="column-20"><?= t('Project') ?></th>
<th class="column-15"><?= t('Status') ?></th>
<th><?= t('Subtask') ?></th>
</tr>
<?php foreach ($subtasks as $subtask): ?>
<tr>
<td class="task-table task-<?= $subtask['color_id'] ?>">
<?= Helper\a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'])) ?>
</td>
<td>
<?= Helper\a(Helper\escape($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?>
</td>
<td>
<?= Helper\escape($subtask['status_name']) ?>
</td>
<td>
<?= Helper\a(Helper\escape($subtask['title']), 'task', 'show', array('task_id' => $subtask['task_id'])) ?>
</td>
</tr>
<?php endforeach ?>
</table>
<?php endif ?>
</div>
<div class="dashboard-right-column">
<h2><?= t('Activity stream') ?></h2>

View File

@ -130,6 +130,10 @@ th a:hover {
width: 10%;
}
.column-15 {
width: 15%;
}
.column-20 {
width: 20%;
}

View File

@ -66,6 +66,10 @@ th a:hover {
width: 10%;
}
.column-15 {
width: 15%;
}
.column-20 {
width: 20%;
}