Huge FML Update

This commit is contained in:
Steffen Schröder
2014-01-12 00:51:46 +01:00
parent 6a6fa56596
commit 345368df39
69 changed files with 2068 additions and 429 deletions

View File

@ -10,7 +10,8 @@ use FML\Types\Styleable;
use FML\Types\SubStyleable;
/**
* Class representing CMlQuad
* Quad Element
* (CMlQuad)
*
* @author steeffeen
*/
@ -22,7 +23,9 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
protected $imageFocus = '';
protected $colorize = '';
protected $modulizeColor = '';
protected $autoScale = 1;
protected $action = '';
protected $actionKey = -1;
protected $bgColor = '';
protected $url = '';
protected $manialink = '';
@ -33,8 +36,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
/**
* Construct a new Quad Control
*
* @param string $id
* Control Id
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
parent::__construct($id);
@ -45,48 +47,55 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
/**
* Set Image Url
*
* @param string $image
* Image Url
* @param string $image Image Url
* @return \FML\Controls\Quad
*/
public function setImage($image) {
$this->image = $image;
$this->image = (string) $image;
return $this;
}
/**
* Set Focus Image Url
*
* @param string $imageFocus
* Focus Image Url
* @param string $imageFocus Focus Image Url
* @return \FML\Controls\Quad
*/
public function setImageFocus($imageFocus) {
$this->imageFocus = $imageFocus;
$this->imageFocus = (string) $imageFocus;
return $this;
}
/**
* Set Colorization
*
* @param string $colorize
* Colorize Value
* @param string $colorize Colorize Value
* @return \FML\Controls\Quad
*/
public function setColorize($colorize) {
$this->colorize = $colorize;
$this->colorize = (string) $colorize;
return $this;
}
/**
* Set Modulization
*
* @param string $modulizeColor
* Modulize Value
* @param string $modulizeColor Modulize Value
* @return \FML\Controls\Quad
*/
public function setModulizeColor($modulizeColor) {
$this->modulizeColor = $modulizeColor;
$this->modulizeColor = (string) $modulizeColor;
return $this;
}
/**
* Disable the automatic Image Scaling
*
* @param bool $autoScale Whether the Image should scale automatically
* @return \FML\Controls\Quad
*/
public function setAutoScale($autoScale) {
$this->autoScale = ($autoScale ? 1 : 0);
return $this;
}
@ -96,7 +105,17 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setAction($action) {
$this->action = $action;
$this->action = (string) $action;
return $this;
}
/**
*
* @see \FML\Types\Actionable::setActionKey()
* @return \FML\Controls\Quad
*/
public function setActionKey($actionKey) {
$this->actionKey = (int) $actionKey;
return $this;
}
@ -106,7 +125,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setBgColor($bgColor) {
$this->bgColor = $bgColor;
$this->bgColor = (string) $bgColor;
return $this;
}
@ -116,7 +135,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setUrl($url) {
$this->url = $url;
$this->url = (string) $url;
return $this;
}
@ -126,7 +145,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setManialink($manialink) {
$this->manialink = $manialink;
$this->manialink = (string) $manialink;
return $this;
}
@ -146,7 +165,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setStyle($style) {
$this->style = $style;
$this->style = (string) $style;
return $this;
}
@ -156,7 +175,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @return \FML\Controls\Quad
*/
public function setSubStyle($subStyle) {
$this->subStyle = $subStyle;
$this->subStyle = (string) $subStyle;
return $this;
}
@ -176,40 +195,46 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
* @see \FML\Control::render()
*/
public function render(\DOMDocument $domDocument) {
$xml = parent::render($domDocument);
$xmlElement = parent::render($domDocument);
if ($this->image) {
$xml->setAttribute('image', $this->image);
$xmlElement->setAttribute('image', $this->image);
}
if ($this->imageFocus) {
$xml->setAttribute('imagefocus', $this->imageFocus);
$xmlElement->setAttribute('imagefocus', $this->imageFocus);
}
if ($this->colorize) {
$xml->setAttribute('colorize', $this->colorize);
$xmlElement->setAttribute('colorize', $this->colorize);
}
if ($this->modulizeColor) {
$xml->setAttribute('modulizecolor', $this->modulizeColor);
$xmlElement->setAttribute('modulizecolor', $this->modulizeColor);
}
if (!$this->autoScale) {
$xmlElement->setAttribute('autoscale', $this->autoScale);
}
if ($this->action) {
$xml->setAttribute('action', $this->action);
$xmlElement->setAttribute('action', $this->action);
}
if ($this->actionKey >= 0) {
$xmlElement->setAttribute('actionkey', $this->actionKey);
}
if ($this->bgColor) {
$xml->setAttribute('bgcolor', $this->bgColor);
$xmlElement->setAttribute('bgcolor', $this->bgColor);
}
if ($this->url) {
$xml->setAttribute('url', $this->url);
$xmlElement->setAttribute('url', $this->url);
}
if ($this->manialink) {
$xml->setAttribute('manialink', $this->manialink);
$xmlElement->setAttribute('manialink', $this->manialink);
}
if ($this->scriptEvents) {
$xml->setAttribute('scriptevents', $this->scriptEvents);
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
if ($this->style) {
$xml->setAttribute('style', $this->style);
$xmlElement->setAttribute('style', $this->style);
}
if ($this->subStyle) {
$xml->setAttribute('substyle', $this->subStyle);
$xmlElement->setAttribute('substyle', $this->subStyle);
}
return $xml;
return $xmlElement;
}
}