summaryrefslogtreecommitdiff
path: root/app/Helper/Task.php
diff options
context:
space:
mode:
author85pando <85pando@googlemail.com>2016-02-05 10:28:40 +0100
committer85pando <85pando@googlemail.com>2016-02-05 10:28:40 +0100
commit791d13c87bf510d913973b77a5f6d152311a1d87 (patch)
tree81412e8dbd3ac4fa0047030a6068afafd975687e /app/Helper/Task.php
parent2074aaaa9a75455097e4e77ca09f4fba3e567052 (diff)
parent12aaec03b19a07635f59b00f532c92c37ac1df5f (diff)
Merge remote-tracking branch 'refs/remotes/upstream/master'
Conflicts: app/Locale/de_DE/translations.php
Diffstat (limited to 'app/Helper/Task.php')
-rw-r--r--app/Helper/Task.php119
1 files changed, 119 insertions, 0 deletions
diff --git a/app/Helper/Task.php b/app/Helper/Task.php
index 500b8a89..1cb36b86 100644
--- a/app/Helper/Task.php
+++ b/app/Helper/Task.php
@@ -12,6 +12,14 @@ use Kanboard\Core\Base;
*/
class Task extends Base
{
+ /**
+ * Local cache for project columns
+ *
+ * @access private
+ * @var array
+ */
+ private $columns = array();
+
public function getColors()
{
return $this->color->getList();
@@ -37,6 +45,53 @@ class Task extends Base
return $this->taskPermission->canRemoveTask($task);
}
+ public function selectAssignee(array $users, array $values, array $errors = array(), array $attributes = array())
+ {
+ $attributes = array_merge(array('tabindex="3"'), $attributes);
+
+ $html = $this->helper->form->label(t('Assignee'), 'owner_id');
+ $html .= $this->helper->form->select('owner_id', $users, $values, $errors, $attributes);
+ $html .= '&nbsp;<a href="#" class="assign-me" data-target-id="form-owner_id" data-current-id="'.$this->userSession->getId().'" title="'.t('Assign to me').'">'.t('Me').'</a>';
+
+ return $html;
+ }
+
+ public function selectCategory(array $categories, array $values, array $errors = array(), array $attributes = array(), $allow_one_item = false)
+ {
+ $attributes = array_merge(array('tabindex="4"'), $attributes);
+ $html = '';
+
+ if (! (! $allow_one_item && count($categories) === 1 && key($categories) == 0)) {
+ $html .= $this->helper->form->label(t('Category'), 'category_id');
+ $html .= $this->helper->form->select('category_id', $categories, $values, $errors, $attributes);
+ }
+
+ return $html;
+ }
+
+ public function selectSwimlane(array $swimlanes, array $values, array $errors = array(), array $attributes = array())
+ {
+ $attributes = array_merge(array('tabindex="5"'), $attributes);
+ $html = '';
+
+ if (! (count($swimlanes) === 1 && key($swimlanes) == 0)) {
+ $html .= $this->helper->form->label(t('Swimlane'), 'swimlane_id');
+ $html .= $this->helper->form->select('swimlane_id', $swimlanes, $values, $errors, $attributes);
+ }
+
+ return $html;
+ }
+
+ public function selectColumn(array $columns, array $values, array $errors = array(), array $attributes = array())
+ {
+ $attributes = array_merge(array('tabindex="6"'), $attributes);
+
+ $html = $this->helper->form->label(t('Column'), 'column_id');
+ $html .= $this->helper->form->select('column_id', $columns, $values, $errors, $attributes);
+
+ return $html;
+ }
+
public function selectPriority(array $project, array $values)
{
$html = '';
@@ -53,6 +108,61 @@ class Task extends Base
return $html;
}
+ public function selectScore(array $values, array $errors = array(), array $attributes = array())
+ {
+ $attributes = array_merge(array('tabindex="8"'), $attributes);
+
+ $html = $this->helper->form->label(t('Complexity'), 'score');
+ $html .= $this->helper->form->number('score', $values, $errors, $attributes);
+
+ return $html;
+ }
+
+ public function selectTimeEstimated(array $values, array $errors = array(), array $attributes = array())
+ {
+ $attributes = array_merge(array('tabindex="9"'), $attributes);
+
+ $html = $this->helper->form->label(t('Original estimate'), 'time_estimated');
+ $html .= $this->helper->form->numeric('time_estimated', $values, $errors, $attributes);
+ $html .= ' '.t('hours');
+
+ return $html;
+ }
+
+ public function selectTimeSpent(array $values, array $errors = array(), array $attributes = array())
+ {
+ $attributes = array_merge(array('tabindex="10"'), $attributes);
+
+ $html = $this->helper->form->label(t('Time spent'), 'time_spent');
+ $html .= $this->helper->form->numeric('time_spent', $values, $errors, $attributes);
+ $html .= ' '.t('hours');
+
+ return $html;
+ }
+
+ public function selectStartDate(array $values, array $errors = array(), array $attributes = array())
+ {
+ $placeholder = $this->helper->text->in($this->config->get('application_date_format'), $this->dateParser->getAvailableFormats());
+ $attributes = array_merge(array('tabindex="11"', 'placeholder="'.$placeholder.'"'), $attributes);
+
+ $html = $this->helper->form->label(t('Start Date'), 'date_started');
+ $html .= $this->helper->form->text('date_started', $values, $errors, $attributes, 'form-date');
+
+ return $html;
+ }
+
+ public function selectDueDate(array $values, array $errors = array(), array $attributes = array())
+ {
+ $placeholder = $this->helper->text->in($this->config->get('application_date_format'), $this->dateParser->getAvailableFormats());
+ $attributes = array_merge(array('tabindex="12"', 'placeholder="'.$placeholder.'"'), $attributes);
+
+ $html = $this->helper->form->label(t('Due Date'), 'date_due');
+ $html .= $this->helper->form->text('date_due', $values, $errors, $attributes, 'form-date');
+ $html .= '<div class="form-help">'.t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')).'</div>';
+
+ return $html;
+ }
+
public function formatPriority(array $project, array $task)
{
$html = '';
@@ -65,4 +175,13 @@ class Task extends Base
return $html;
}
+
+ public function getProgress($task)
+ {
+ if (! isset($this->columns[$task['project_id']])) {
+ $this->columns[$task['project_id']] = $this->board->getColumnsList($task['project_id']);
+ }
+
+ return $this->task->getProgress($task, $this->columns[$task['project_id']]);
+ }
}