summaryrefslogtreecommitdiff
path: root/app/Model/Color.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-07-29 18:45:26 -0400
committerFrederic Guillot <fred@kanboard.net>2015-07-29 18:45:26 -0400
commit2d6b6533acc86747425facc9e96303bcccc6daae (patch)
tree7a17fe198ba916bcaea3fcd73860d2d7610ac1e4 /app/Model/Color.php
parentf595fb2786d884dbaf7ec87d53cee920a0655f0e (diff)
Add new api procedures: getDefaultTaskColor(), getDefaultTaskColors() and getColorList()
Diffstat (limited to 'app/Model/Color.php')
-rw-r--r--app/Model/Color.php41
1 files changed, 31 insertions, 10 deletions
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'];
}
/**