diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-08-14 17:03:55 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-08-14 17:03:55 -0400 |
commit | 17a3781bd8c03e6b653104dbcb996a1ff1213959 (patch) | |
tree | 8cf5de301e55f62465d19f270109c6c7c49cc5ce /app/Model/Task.php | |
parent | c6a4fbb3864d63a69a0b42d17f5c3037a73da961 (diff) |
Add Gantt chart for projects
Diffstat (limited to 'app/Model/Task.php')
-rw-r--r-- | app/Model/Task.php | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/app/Model/Task.php b/app/Model/Task.php index 71d973a4..ae8fc7a8 100644 --- a/app/Model/Task.php +++ b/app/Model/Task.php @@ -121,7 +121,7 @@ class Task extends Base */ public function getRecurrenceStatusList() { - return array ( + return array( Task::RECURRING_STATUS_NONE => t('No'), Task::RECURRING_STATUS_PENDING => t('Yes'), ); @@ -135,7 +135,7 @@ class Task extends Base */ public function getRecurrenceTriggerList() { - return array ( + return array( Task::RECURRING_TRIGGER_FIRST_COLUMN => t('When task is moved from first column'), Task::RECURRING_TRIGGER_LAST_COLUMN => t('When task is moved to last column'), Task::RECURRING_TRIGGER_CLOSE => t('When task is closed'), @@ -150,7 +150,7 @@ class Task extends Base */ public function getRecurrenceBasedateList() { - return array ( + return array( Task::RECURRING_BASEDATE_DUEDATE => t('Existing due date'), Task::RECURRING_BASEDATE_TRIGGERDATE => t('Action date'), ); @@ -164,10 +164,37 @@ class Task extends Base */ public function getRecurrenceTimeframeList() { - return array ( + return array( Task::RECURRING_TIMEFRAME_DAYS => t('Day(s)'), Task::RECURRING_TIMEFRAME_MONTHS => t('Month(s)'), Task::RECURRING_TIMEFRAME_YEARS => t('Year(s)'), ); } + + /** + * Get task progress based on the column position + * + * @access public + * @param array $task + * @param array $columns + * @return integer + */ + public function getProgress(array $task, array $columns) + { + if ($task['is_active'] == self::STATUS_CLOSED) { + return 100; + } + + $position = 0; + + foreach ($columns as $column_id => $column_title) { + if ($column_id == $task['column_id']) { + break; + } + + $position++; + } + + return (int) ($position * 100) / count($columns); + } } |