mirror of https://github.com/xfarrow/phpxpress.git
Update table.php
This commit is contained in:
parent
a7e5672d65
commit
4bacdff0de
|
@ -5,10 +5,10 @@
|
||||||
private $dataSource;
|
private $dataSource;
|
||||||
private $columnCaptions;
|
private $columnCaptions;
|
||||||
|
|
||||||
private $darkTheme = false; // boolean
|
private $darkTheme = false;
|
||||||
private $stripedRows = false; // boolean
|
private $stripedRows = false;
|
||||||
private $bordered = false; //boolean
|
private $bordered = false;
|
||||||
private $hoverAnimation = false; //boolean
|
private $hoverAnimation = false;
|
||||||
private $small = false;
|
private $small = false;
|
||||||
|
|
||||||
function draw(){
|
function draw(){
|
||||||
|
@ -47,56 +47,57 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDataSource($dataSource){
|
function setDataSource(Array $dataSource){
|
||||||
if(!is_array($dataSource)){
|
if(empty($dataSource))
|
||||||
throw new BadFunctionCallException('DataSource must be an array.');
|
throw new InvalidArgumentException('Parameter cannot be empty.');
|
||||||
}
|
|
||||||
|
|
||||||
$this->dataSource = $dataSource;
|
$this->dataSource = $dataSource;
|
||||||
$this->columnCaptions = array_keys(get_object_vars($this->dataSource[0]));
|
$this->columnCaptions = array_keys(get_object_vars($this->dataSource[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCustomCaptions($captions){
|
function setCustomCaptions(Array $captions){
|
||||||
if(!is_array($captions)){
|
if(empty($this->dataSource))
|
||||||
throw new BadFunctionCallException('Captions must be an array.');
|
throw new BadFunctionCallException('Before setting Custom captions, a datasource must be provided first.');
|
||||||
}
|
|
||||||
$this->columnCaptions = $captions;
|
if(count($this->columnCaptions) == count($captions))
|
||||||
|
$this->columnCaptions = $captions;
|
||||||
|
else
|
||||||
|
throw new LengthException('Number of provided captions not matching the datasource ones.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDarkTheme($bool){
|
function setDarkTheme($bool){
|
||||||
if(!is_bool($bool)){
|
if(!is_bool($bool)){
|
||||||
throw new BadFunctionCallException('Parameter must be a boolean.');
|
throw new InvalidArgumentException('Parameter must be a boolean.');
|
||||||
}
|
}
|
||||||
$this->darkTheme = $bool;
|
$this->darkTheme = $bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setStripedRows($bool){
|
function setStripedRows($bool){
|
||||||
if(!is_bool($bool)){
|
if(!is_bool($bool)){
|
||||||
throw new BadFunctionCallException('Parameter must be a boolean.');
|
throw new InvalidArgumentException('Parameter must be a boolean.');
|
||||||
}
|
}
|
||||||
$this->stripedRows = $bool;
|
$this->stripedRows = $bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setBordered($bool){
|
function setBordered($bool){
|
||||||
if(!is_bool($bool)){
|
if(!is_bool($bool)){
|
||||||
throw new BadFunctionCallException('Parameter must be a boolean.');
|
throw new InvalidArgumentException('Parameter must be a boolean.');
|
||||||
}
|
}
|
||||||
$this->bordered = $bool;
|
$this->bordered = $bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setHoverAnimation($bool){
|
function setHoverAnimation($bool){
|
||||||
if(!is_bool($bool)){
|
if(!is_bool($bool)){
|
||||||
throw new BadFunctionCallException('Parameter must be a boolean.');
|
throw new InvalidArgumentException('Parameter must be a boolean.');
|
||||||
}
|
}
|
||||||
$this->hoverAnimation = $bool;
|
$this->hoverAnimation = $bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSmall($bool){
|
function setSmall($bool){
|
||||||
if(!is_bool($bool)){
|
if(!is_bool($bool)){
|
||||||
throw new BadFunctionCallException('Parameter must be a boolean.');
|
throw new InvalidArgumentException('Parameter must be a boolean.');
|
||||||
}
|
}
|
||||||
$this->small = $bool;
|
$this->small = $bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue