summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Api/App.php15
-rw-r--r--app/Api/Base.php4
-rw-r--r--app/Model/Color.php41
3 files changed, 50 insertions, 10 deletions
diff --git a/app/Api/App.php b/app/Api/App.php
index 24da4dd9..9b3ceb94 100644
--- a/app/Api/App.php
+++ b/app/Api/App.php
@@ -19,4 +19,19 @@ class App extends \Core\Base
{
return APP_VERSION;
}
+
+ public function getDefaultTaskColor()
+ {
+ return $this->color->getDefaultColor();
+ }
+
+ public function getDefaultTaskColors()
+ {
+ return $this->color->getDefaultColors();
+ }
+
+ public function getColorList()
+ {
+ return $this->color->getList();
+ }
}
diff --git a/app/Api/Base.php b/app/Api/Base.php
index 723b60b7..17c7f79f 100644
--- a/app/Api/Base.php
+++ b/app/Api/Base.php
@@ -24,6 +24,9 @@ abstract class Base extends \Core\Base
private $both_allowed_procedures = array(
'getTimezone',
'getVersion',
+ 'getDefaultTaskColor',
+ 'getDefaultTaskColors',
+ 'getColorList',
'getProjectById',
'getTask',
'getTaskByReference',
@@ -67,6 +70,7 @@ abstract class Base extends \Core\Base
{
if (! empty($task)) {
$task['url'] = $this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), '', true);
+ $task['color'] = $this->color->getColorProperties($task['color_id']);
}
return $task;
diff --git a/app/Model/Color.php b/app/Model/Color.php
index 73e5d629..6df7beb8 100644
--- a/app/Model/Color.php
+++ b/app/Model/Color.php
@@ -123,6 +123,22 @@ class Color extends Base
}
/**
+ * Get color properties
+ *
+ * @access public
+ * @param string $color_id
+ * @return array
+ */
+ public function getColorProperties($color_id)
+ {
+ if (isset($this->default_colors[$color_id])) {
+ return $this->default_colors[$color_id];
+ }
+
+ return $this->default_colors[$this->getDefaultColor()];
+ }
+
+ /**
* Get available colors
*
* @access public
@@ -151,6 +167,17 @@ class Color extends Base
}
/**
+ * Get the default colors
+ *
+ * @access public
+ * @return array
+ */
+ public function getDefaultColors()
+ {
+ return $this->default_colors;
+ }
+
+ /**
* Get Bordercolor from string
*
* @access public
@@ -159,11 +186,8 @@ class Color extends Base
*/
public function getBorderColor($color_id)
{
- if (isset($this->default_colors[$color_id])) {
- return $this->default_colors[$color_id]['border'];
- }
-
- return $this->default_colors[$this->getDefaultColor()]['border'];
+ $color = $this->getColorProperties($color_id);
+ return $color['border'];
}
/**
@@ -175,11 +199,8 @@ class Color extends Base
*/
public function getBackgroundColor($color_id)
{
- if (isset($this->default_colors[$color_id])) {
- return $this->default_colors[$color_id]['background'];
- }
-
- return $this->default_colors[$this->getDefaultColor()]['background'];
+ $color = $this->getColorProperties($color_id);
+ return $color['background'];
}
/**