huge fml update
This commit is contained in:
@ -5,17 +5,17 @@ namespace FML\Controls;
|
||||
use FML\Types\Styleable;
|
||||
|
||||
/**
|
||||
* Gauge Element
|
||||
* Gauge Control
|
||||
* (CMlGauge)
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
// TODO: gauge styles
|
||||
class Gauge extends Control implements Styleable {
|
||||
/**
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $ratio = 1.;
|
||||
// TODO: validate grading
|
||||
protected $ratio = 0.;
|
||||
protected $grading = 1.;
|
||||
protected $color = '';
|
||||
protected $rotation = 0.;
|
||||
@ -25,6 +25,17 @@ class Gauge extends Control implements Styleable {
|
||||
protected $drawBlockBg = 1;
|
||||
protected $style = '';
|
||||
|
||||
/**
|
||||
* Create a new Gauge Control
|
||||
*
|
||||
* @param string $id (optional) Control Id
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public static function create($id = null) {
|
||||
$gauge = new Gauge($id);
|
||||
return $gauge;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Gauge Control
|
||||
*
|
||||
@ -139,9 +150,12 @@ class Gauge extends Control implements Styleable {
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$xmlElement = parent::render($domDocument);
|
||||
// TODO: validate default values
|
||||
$xmlElement->setAttribute('ratio', $this->ratio);
|
||||
$xmlElement->setAttribute('grading', $this->grading);
|
||||
if ($this->ratio) {
|
||||
$xmlElement->setAttribute('ratio', $this->ratio);
|
||||
}
|
||||
if ($this->grading != 1.) {
|
||||
$xmlElement->setAttribute('grading', $this->grading);
|
||||
}
|
||||
if ($this->color) {
|
||||
$xmlElement->setAttribute('color', $this->color);
|
||||
}
|
||||
@ -154,8 +168,12 @@ class Gauge extends Control implements Styleable {
|
||||
if ($this->clan) {
|
||||
$xmlElement->setAttribute('clan', $this->clan);
|
||||
}
|
||||
$xmlElement->setAttribute('drawbg', $this->drawBg);
|
||||
$xmlElement->setAttribute('drawblockbg', $this->drawBlockBg);
|
||||
if (!$this->drawBg) {
|
||||
$xmlElement->setAttribute('drawbg', $this->drawBg);
|
||||
}
|
||||
if (!$this->drawBlockBg) {
|
||||
$xmlElement->setAttribute('drawblockbg', $this->drawBlockBg);
|
||||
}
|
||||
if ($this->style) {
|
||||
$xmlElement->setAttribute('style', $this->style);
|
||||
}
|
||||
|
Reference in New Issue
Block a user