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
13
Gantt.php
13
Gantt.php
|
@ -40,7 +40,8 @@ class Gantt {
|
|||
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
|
||||
* @var integer
|
||||
**/
|
||||
|
@ -49,10 +50,12 @@ class Gantt {
|
|||
/**
|
||||
* Constructor
|
||||
**/
|
||||
function __construct() {
|
||||
function __construct($colors = true) {
|
||||
//add a default set of colors
|
||||
if($colors) {
|
||||
$this->add_color('#FF8080','#99CCFF','#00FF00','#FF9900','#800080');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an event to be processed
|
||||
|
@ -90,6 +93,12 @@ class Gantt {
|
|||
if($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();
|
||||
|
||||
// probably should template this html sometime.
|
||||
|
|
Loading…
Reference in a new issue