From 2d6b6533acc86747425facc9e96303bcccc6daae Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 29 Jul 2015 18:45:26 -0400 Subject: Add new api procedures: getDefaultTaskColor(), getDefaultTaskColors() and getColorList() --- app/Model/Color.php | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'app/Model/Color.php') 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 @@ -122,6 +122,22 @@ class Color extends Base return ''; } + /** + * 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 * @@ -150,6 +166,17 @@ class Color extends Base return $this->config->get('default_color', 'yellow'); } + /** + * Get the default colors + * + * @access public + * @return array + */ + public function getDefaultColors() + { + return $this->default_colors; + } + /** * Get Bordercolor from string * @@ -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']; } /** -- cgit v1.2.3