Constructor can be told to not set default colors.
This commit is contained in:
parent
5c7dd6ba7f
commit
b36c90d35d
1 changed files with 12 additions and 3 deletions
15
Gantt.php
15
Gantt.php
|
@ -40,7 +40,8 @@ class Gantt {
|
||||||
private $colors = array();
|
private $colors = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Track the number of times we've retrieved colors
|
* Track the number of times we've retrieved colors so that we
|
||||||
|
* can always return alternating colors.
|
||||||
* @access private
|
* @access private
|
||||||
* @var integer
|
* @var integer
|
||||||
**/
|
**/
|
||||||
|
@ -49,9 +50,11 @@ class Gantt {
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
**/
|
**/
|
||||||
function __construct() {
|
function __construct($colors = true) {
|
||||||
//add a default set of colors
|
//add a default set of colors
|
||||||
$this->add_color('#FF8080','#99CCFF','#00FF00','#FF9900','#800080');
|
if($colors) {
|
||||||
|
$this->add_color('#FF8080','#99CCFF','#00FF00','#FF9900','#800080');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,6 +93,12 @@ class Gantt {
|
||||||
if($this->html != '') {
|
if($this->html != '') {
|
||||||
return $this->html;
|
return $this->html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//require that there is at least one color set.
|
||||||
|
if(count($this->colors) == 0) {
|
||||||
|
return 'Error! At least one colors must be set: add_colors("#000")';
|
||||||
|
}
|
||||||
|
|
||||||
$columns = $this->find_last();
|
$columns = $this->find_last();
|
||||||
|
|
||||||
// probably should template this html sometime.
|
// probably should template this html sometime.
|
||||||
|
|
Loading…
Reference in a new issue