Add subtask time tracking in the task view

This commit is contained in:
Frederic Guillot 2015-02-10 22:10:32 -05:00
parent 57613d1853
commit efbf679385
19 changed files with 114 additions and 4 deletions

View File

@ -488,4 +488,27 @@ class Task extends Base
'projects_list' => $projects_list,
)));
}
/**
* Display the time tracking details
*
* @access public
*/
public function timesheet()
{
$task = $this->getTask();
$subtask_paginator = $this->paginator
->setUrl('task', 'timesheet', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'pagination' => 'subtasks'))
->setMax(15)
->setOrder('start')
->setDirection('DESC')
->setQuery($this->subtaskTimeTracking->getTaskQuery($task['id']))
->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks');
$this->response->html($this->taskLayout('task/time_tracking', array(
'task' => $task,
'subtask_paginator' => $subtask_paginator,
)));
}
}

View File

@ -681,4 +681,6 @@ return array(
// 'Bitbucket commit received' => '',
// 'Bitbucket webhooks' => '',
// 'Help on Bitbucket webhooks' => '',
// 'Start' => '',
// 'End' => '',
);

View File

@ -681,4 +681,6 @@ return array(
'Bitbucket commit received' => 'Bitbucket commit erhalten',
'Bitbucket webhooks' => 'Bitbucket webhooks',
'Help on Bitbucket webhooks' => 'Hilfe für Bitbucket webhooks',
// 'Start' => '',
// 'End' => '',
);

View File

@ -681,4 +681,6 @@ return array(
// 'Bitbucket commit received' => '',
// 'Bitbucket webhooks' => '',
// 'Help on Bitbucket webhooks' => '',
// 'Start' => '',
// 'End' => '',
);

View File

@ -681,4 +681,6 @@ return array(
// 'Bitbucket commit received' => '',
// 'Bitbucket webhooks' => '',
// 'Help on Bitbucket webhooks' => '',
// 'Start' => '',
// 'End' => '',
);

View File

@ -341,7 +341,7 @@ return array(
'Add a comment' => 'Ajouter un commentaire',
'Edit a comment' => 'Modifier un commentaire',
'Summary' => 'Résumé',
'Time tracking' => 'Gestion du temps',
'Time tracking' => 'Suivi du temps',
'Estimate:' => 'Estimation :',
'Spent:' => 'Passé :',
'Do you really want to remove this sub-task?' => 'Voulez-vous vraiment supprimer cette sous-tâche ?',
@ -668,7 +668,7 @@ return array(
'Enable time tracking for subtasks' => 'Activer la feuille de temps pour les sous-tâches',
'Select the new status of the subtask: "%s"' => 'Selectionnez le nouveau statut de la sous-tâche : « %s »',
'Subtask timesheet' => 'Feuille de temps des sous-tâches',
'There is nothing to show.' => 'Il n\'y a rien à montrer',
'There is nothing to show.' => 'Il n\'y a rien à montrer.',
'Time Tracking' => 'Feuille de temps',
'You already have one subtask in progress' => 'Vous avez déjà une sous-tâche en progrès',
'Which parts of the project do you want to duplicate?' => 'Quelles parties du projet voulez-vous dupliquer ?',
@ -683,4 +683,6 @@ return array(
'Bitbucket commit received' => '« Commit » reçu via Bitbucket',
'Bitbucket webhooks' => 'Webhook Bitbucket',
'Help on Bitbucket webhooks' => 'Aide sur les webhooks Bitbucket',
'Start' => 'Début',
'End' => 'Fin',
);

View File

@ -681,4 +681,6 @@ return array(
// 'Bitbucket commit received' => '',
// 'Bitbucket webhooks' => '',
// 'Help on Bitbucket webhooks' => '',
// 'Start' => '',
// 'End' => '',
);

View File

@ -681,4 +681,6 @@ return array(
// 'Bitbucket commit received' => '',
// 'Bitbucket webhooks' => '',
// 'Help on Bitbucket webhooks' => '',
// 'Start' => '',
// 'End' => '',
);

View File

@ -681,4 +681,6 @@ return array(
// 'Bitbucket commit received' => '',
// 'Bitbucket webhooks' => '',
// 'Help on Bitbucket webhooks' => '',
// 'Start' => '',
// 'End' => '',
);

View File

@ -681,4 +681,6 @@ return array(
// 'Bitbucket commit received' => '',
// 'Bitbucket webhooks' => '',
// 'Help on Bitbucket webhooks' => '',
// 'Start' => '',
// 'End' => '',
);

View File

@ -681,4 +681,6 @@ return array(
'Bitbucket commit received' => '"Commit" recebido via Bitbucket',
'Bitbucket webhooks' => 'Webhook Bitbucket',
'Help on Bitbucket webhooks' => 'Ajuda sobre os webhooks Bitbucket',
// 'Start' => '',
// 'End' => '',
);

View File

@ -681,4 +681,6 @@ return array(
// 'Bitbucket commit received' => '',
// 'Bitbucket webhooks' => '',
// 'Help on Bitbucket webhooks' => '',
// 'Start' => '',
// 'End' => '',
);

View File

@ -681,4 +681,6 @@ return array(
// 'Bitbucket commit received' => '',
// 'Bitbucket webhooks' => '',
// 'Help on Bitbucket webhooks' => '',
// 'Start' => '',
// 'End' => '',
);

View File

@ -681,4 +681,6 @@ return array(
// 'Bitbucket commit received' => '',
// 'Bitbucket webhooks' => '',
// 'Help on Bitbucket webhooks' => '',
// 'Start' => '',
// 'End' => '',
);

View File

@ -681,4 +681,6 @@ return array(
// 'Bitbucket commit received' => '',
// 'Bitbucket webhooks' => '',
// 'Help on Bitbucket webhooks' => '',
// 'Start' => '',
// 'End' => '',
);

View File

@ -43,6 +43,35 @@ class SubtaskTimeTracking extends Base
->eq(self::TABLE.'.user_id', $user_id);
}
/**
* Get query for task (pagination)
*
* @access public
* @param integer $task_id Task id
* @return \PicoDb\Table
*/
public function getTaskQuery($task_id)
{
return $this->db
->table(self::TABLE)
->columns(
self::TABLE.'.id',
self::TABLE.'.subtask_id',
self::TABLE.'.end',
self::TABLE.'.start',
self::TABLE.'.user_id',
Subtask::TABLE.'.task_id',
Subtask::TABLE.'.title AS subtask_title',
Task::TABLE.'.project_id',
User::TABLE.'.username',
User::TABLE.'.name AS user_fullname'
)
->join(Subtask::TABLE, 'id', 'subtask_id')
->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE)
->join(User::TABLE, 'id', 'user_id', self::TABLE)
->eq(Task::TABLE.'.id', $task_id);
}
/**
* Get all recorded time slots for a given user
*

View File

@ -4,6 +4,11 @@
<li>
<?= $this->a(t('Summary'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
<?php if ($task['time_estimated'] > 0 || $task['time_spent'] > 0): ?>
<li>
<?= $this->a(t('Time tracking'), 'task', 'timesheet', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
<?php endif ?>
<li>
<?= $this->a(t('Edit the task'), 'task', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>

View File

@ -0,0 +1,25 @@
<?= $this->render('task/timesheet', array('task' => $task)) ?>
<h3><?= t('Subtask timesheet') ?></h3>
<?php if ($subtask_paginator->isEmpty()): ?>
<p class="alert"><?= t('There is nothing to show.') ?></p>
<?php else: ?>
<table class="table-fixed">
<tr>
<th class="column-20"><?= $subtask_paginator->order(t('User'), 'username') ?></th>
<th class="column-40"><?= $subtask_paginator->order(t('Subtask'), 'subtask_title') ?></th>
<th><?= $subtask_paginator->order(t('Start'), 'start') ?></th>
<th><?= $subtask_paginator->order(t('End'), 'end') ?></th>
</tr>
<?php foreach ($subtask_paginator->getCollection() as $record): ?>
<tr>
<td><?= $this->a($this->e($record['user_fullname'] ?: $record['username']), 'user', 'show', array('user_id' => $record['user_id'])) ?></td>
<td><?= t($record['subtask_title']) ?></td>
<td><?= dt('%B %e, %Y at %k:%M %p', $record['start']) ?></td>
<td><?= dt('%B %e, %Y at %k:%M %p', $record['end']) ?></td>
</tr>
<?php endforeach ?>
</table>
<?= $subtask_paginator ?>
<?php endif ?>

View File

@ -8,8 +8,8 @@
<?php else: ?>
<table class="table-fixed">
<tr>
<th class="column-20"><?= $subtask_paginator->order('Task', 'task_title') ?></th>
<th class="column-20"><?= $subtask_paginator->order('Subtask', 'subtask_title') ?></th>
<th class="column-20"><?= $subtask_paginator->order(t('Task'), 'task_title') ?></th>
<th class="column-20"><?= $subtask_paginator->order(t('Subtask'), 'subtask_title') ?></th>
<th><?= $subtask_paginator->order(t('Start'), 'start') ?></th>
<th><?= $subtask_paginator->order(t('End'), 'end') ?></th>
</tr>