summaryrefslogtreecommitdiff
path: root/app/Helper/Task.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-01-24 20:38:39 -0500
committerFrederic Guillot <fred@kanboard.net>2016-01-24 20:38:39 -0500
commit051bf1c9dbb5733242c7657d6d507389206b33ee (patch)
tree9f1a61fa8558dd572b7c577f51599586e3c48a7e /app/Helper/Task.php
parent60f3d7f83d23014f9cfb7d8494d6cebd2f8b24a3 (diff)
Add configurable task priority
Diffstat (limited to 'app/Helper/Task.php')
-rw-r--r--app/Helper/Task.php33
1 files changed, 32 insertions, 1 deletions
diff --git a/app/Helper/Task.php b/app/Helper/Task.php
index 1405a167..500b8a89 100644
--- a/app/Helper/Task.php
+++ b/app/Helper/Task.php
@@ -2,13 +2,15 @@
namespace Kanboard\Helper;
+use Kanboard\Core\Base;
+
/**
* Task helpers
*
* @package helper
* @author Frederic Guillot
*/
-class Task extends \Kanboard\Core\Base
+class Task extends Base
{
public function getColors()
{
@@ -34,4 +36,33 @@ class Task extends \Kanboard\Core\Base
{
return $this->taskPermission->canRemoveTask($task);
}
+
+ public function selectPriority(array $project, array $values)
+ {
+ $html = '';
+
+ if ($project['priority_end'] > $project['priority_start']) {
+ $range = range($project['priority_start'], $project['priority_end']);
+ $options = array_combine($range, $range);
+ $values += array('priority' => $project['priority_default']);
+
+ $html .= $this->helper->form->label(t('Priority'), 'priority');
+ $html .= $this->helper->form->select('priority', $options, $values, array(), array('tabindex="7"'));
+ }
+
+ return $html;
+ }
+
+ public function formatPriority(array $project, array $task)
+ {
+ $html = '';
+
+ if ($project['priority_end'] > $project['priority_start']) {
+ $html .= '<span class="task-board-priority" title="'.t('Task priority').'">';
+ $html .= $task['priority'] >= 0 ? 'P'.$task['priority'] : '-P'.abs($task['priority']);
+ $html .= '</span>';
+ }
+
+ return $html;
+ }
}