FML 1.2
This commit is contained in:
@ -2,41 +2,43 @@
|
||||
|
||||
namespace FML\Controls;
|
||||
|
||||
use FML\Types\Renderable;
|
||||
use FML\Script\Builder;
|
||||
use FML\Script\Features\ActionTrigger;
|
||||
use FML\Script\ScriptLabel;
|
||||
use FML\Types\ScriptFeatureable;
|
||||
use FML\Script\Features\ControlScript;
|
||||
use FML\Script\Features\MapInfo;
|
||||
use FML\Script\Features\PlayerProfile;
|
||||
use FML\Script\Features\UISound;
|
||||
use FML\Script\Builder;
|
||||
use FML\Script\Features\ScriptFeature;
|
||||
use FML\Script\Features\Toggle;
|
||||
use FML\Script\Features\Tooltip;
|
||||
use FML\Script\Features\UISound;
|
||||
use FML\Script\ScriptLabel;
|
||||
use FML\Types\Renderable;
|
||||
use FML\Types\ScriptFeatureable;
|
||||
|
||||
/**
|
||||
* Base Control
|
||||
* (CMlControl)
|
||||
*
|
||||
* @author steeffeen
|
||||
* @author steeffeen
|
||||
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
abstract class Control implements Renderable, ScriptFeatureable {
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
const CENTER = 'center';
|
||||
const CENTER = 'center';
|
||||
const CENTER2 = 'center2';
|
||||
const TOP = 'top';
|
||||
const RIGHT = 'right';
|
||||
const BOTTOM = 'bottom';
|
||||
const LEFT = 'left';
|
||||
|
||||
const TOP = 'top';
|
||||
const RIGHT = 'right';
|
||||
const BOTTOM = 'bottom';
|
||||
const LEFT = 'left';
|
||||
|
||||
/*
|
||||
* Static Properties
|
||||
*/
|
||||
protected static $currentIndex = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Protected Properties
|
||||
*/
|
||||
@ -85,26 +87,29 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setId($id) {
|
||||
$this->id = (string) $id;
|
||||
$this->id = (string)$id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Id for dangerous Characters and assign a unique Id if necessary
|
||||
*
|
||||
* @param bool $forceNewId Whether to force setting a newly generated Id
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function checkId() {
|
||||
if (!$this->getId()) {
|
||||
public function checkId($forceNewId = false) {
|
||||
if ($forceNewId || !$this->getId()) {
|
||||
$this->setId('FML_ID_' . self::$currentIndex);
|
||||
self::$currentIndex++;
|
||||
return $this;
|
||||
}
|
||||
$dangerousCharacters = array(' ', ' ', '.', '|', '-', PHP_EOL);
|
||||
$idCharacters = str_split($this->getId());
|
||||
$danger = false;
|
||||
$idCharacters = str_split($this->getId());
|
||||
$danger = false;
|
||||
foreach ($idCharacters as $character) {
|
||||
if (!in_array($character, $dangerousCharacters)) continue;
|
||||
if (!in_array($character, $dangerousCharacters)) {
|
||||
continue;
|
||||
}
|
||||
$danger = true;
|
||||
break;
|
||||
}
|
||||
@ -123,7 +128,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setX($x) {
|
||||
$this->x = (float) $x;
|
||||
$this->x = (float)$x;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -134,7 +139,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setY($y) {
|
||||
$this->y = (float) $y;
|
||||
$this->y = (float)$y;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -145,7 +150,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setZ($z) {
|
||||
$this->z = (float) $z;
|
||||
$this->z = (float)$z;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -173,7 +178,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setWidth($width) {
|
||||
$this->width = (float) $width;
|
||||
$this->width = (float)$width;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -184,14 +189,14 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setHeight($height) {
|
||||
$this->height = (float) $height;
|
||||
$this->height = (float)$height;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Control Size
|
||||
*
|
||||
* @param float $width Control Width
|
||||
* @param float $width Control Width
|
||||
* @param float $height Control Height
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
@ -208,7 +213,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setHAlign($hAlign) {
|
||||
$this->hAlign = (string) $hAlign;
|
||||
$this->hAlign = (string)$hAlign;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -219,7 +224,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setVAlign($vAlign) {
|
||||
$this->vAlign = (string) $vAlign;
|
||||
$this->vAlign = (string)$vAlign;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -236,6 +241,26 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Center Alignment
|
||||
*
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function centerAlign() {
|
||||
$this->setAlign(self::CENTER, self::CENTER2);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset Alignment
|
||||
*
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function resetAlign() {
|
||||
$this->setAlign(null, null);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Control Scale
|
||||
*
|
||||
@ -243,7 +268,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setScale($scale) {
|
||||
$this->scale = (float) $scale;
|
||||
$this->scale = (float)$scale;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -253,7 +278,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* @param bool $visible Whether Control should be visible
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setVisible($visible) {
|
||||
public function setVisible($visible = true) {
|
||||
$this->hidden = ($visible ? 0 : 1);
|
||||
return $this;
|
||||
}
|
||||
@ -265,7 +290,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addClass($class) {
|
||||
$class = (string) $class;
|
||||
$class = (string)$class;
|
||||
if (!in_array($class, $this->classes)) {
|
||||
array_push($this->classes, $class);
|
||||
}
|
||||
@ -281,7 +306,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
*/
|
||||
public function addActionTriggerFeature($actionName, $eventLabel = ScriptLabel::MOUSECLICK) {
|
||||
$actionTrigger = new ActionTrigger($actionName, $this, $eventLabel);
|
||||
array_push($this->scriptFeatures, $actionTrigger);
|
||||
$this->addScriptFeature($actionTrigger);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -293,34 +318,34 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
*/
|
||||
public function addMapInfoFeature($eventLabel = ScriptLabel::MOUSECLICK) {
|
||||
$mapInfo = new MapInfo($this, $eventLabel);
|
||||
array_push($this->scriptFeatures, $mapInfo);
|
||||
$this->addScriptFeature($mapInfo);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a dynamic Feature to open a specific Player Profile
|
||||
*
|
||||
* @param string $login The Login of the Player
|
||||
* @param string $login The Login of the Player
|
||||
* @param string $eventLabel (optional) Event on which the Player Profile will be opened
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addPlayerProfileFeature($login, $eventLabel = ScriptLabel::MOUSECLICK) {
|
||||
$playerProfile = new PlayerProfile($login, $this, $eventLabel);
|
||||
array_push($this->scriptFeatures, $playerProfile);
|
||||
$this->addScriptFeature($playerProfile);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a dynamic Feature playing an UISound
|
||||
*
|
||||
* @param string $soundName UISound Name
|
||||
* @param int $variant (optional) Sound Variant
|
||||
* @param string $soundName UISound Name
|
||||
* @param int $variant (optional) Sound Variant
|
||||
* @param string $eventLabel (optional) Event on which the Sound will be played
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addUISoundFeature($soundName, $variant = 0, $eventLabel = ScriptLabel::MOUSECLICK) {
|
||||
$uiSound = new UISound($soundName, $this, $variant, $eventLabel);
|
||||
array_push($this->scriptFeatures, $uiSound);
|
||||
$this->addScriptFeature($uiSound);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -328,14 +353,14 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* Add a dynamic Feature toggling another Control
|
||||
*
|
||||
* @param Control $toggledControl Toggled Control
|
||||
* @param string $labelName (optional) Script Label Name
|
||||
* @param bool $onlyShow (optional) Whether it should only Show the Control but not toggle
|
||||
* @param bool $onlyHide (optional) Whether it should only Hide the Control but not toggle
|
||||
* @param string $labelName (optional) Script Label Name
|
||||
* @param bool $onlyShow (optional) Whether it should only Show the Control but not toggle
|
||||
* @param bool $onlyHide (optional) Whether it should only Hide the Control but not toggle
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addToggleFeature(Control $toggledControl, $labelName = Scriptlabel::MOUSECLICK, $onlyShow = false, $onlyHide = false) {
|
||||
$toggle = new Toggle($this, $toggledControl, $labelName, $onlyShow, $onlyHide);
|
||||
array_push($this->scriptFeatures, $toggle);
|
||||
$this->addScriptFeature($toggle);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -343,43 +368,67 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
* Add a dynamic Feature showing a Tooltip on hovering
|
||||
*
|
||||
* @param Control $tooltipControl Tooltip Control
|
||||
* @param bool $stayOnClick (optional) Whether the Tooltip should stay on Click
|
||||
* @param bool $invert (optional) Whether the Visibility Toggling should be inverted
|
||||
* @param bool $stayOnClick (optional) Whether the Tooltip should stay on Click
|
||||
* @param bool $invert (optional) Whether the Visibility Toggling should be inverted
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addTooltipFeature(Control $tooltipControl, $stayOnClick = false, $invert = false) {
|
||||
$tooltip = new Tooltip($this, $tooltipControl, $stayOnClick, $invert);
|
||||
array_push($this->scriptFeatures, $tooltip);
|
||||
$this->addScriptFeature($tooltip);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a dynamic Feature showing a Tooltip on hovering
|
||||
*
|
||||
* @param Label $tooltipControl Tooltip Control
|
||||
* @param string $text The Text to display on the Tooltip Label
|
||||
* @param bool $stayOnClick (optional) Whether the Tooltip should stay on Click
|
||||
* @param bool $invert (optional) Whether the Visibility Toggling should be inverted
|
||||
* @param Label $tooltipControl Tooltip Control
|
||||
* @param string $text The Text to display on the Tooltip Label
|
||||
* @param bool $stayOnClick (optional) Whether the Tooltip should stay on Click
|
||||
* @param bool $invert (optional) Whether the Visibility Toggling should be inverted
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addTooltipLabelFeature(Label $tooltipControl, $text, $stayOnClick = false, $invert = false) {
|
||||
$tooltip = new Tooltip($this, $tooltipControl, $stayOnClick, $invert, $text);
|
||||
array_push($this->scriptFeatures, $tooltip);
|
||||
$this->addScriptFeature($tooltip);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Custom Control Script Text Part
|
||||
*
|
||||
* @param string $scriptText Script Text
|
||||
* @param string $label (optional) Script Label Name
|
||||
* @param bool $isolated (optional) Whether to isolate the Script Text
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addScriptText($scriptText, $label = ScriptLabel::MOUSECLICK, $isolated = true) {
|
||||
$customText = new ControlScript($this, $scriptText, $label, $isolated);
|
||||
$this->addScriptFeature($customText);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Script Feature
|
||||
*
|
||||
* @param ScriptFeature $scriptFeature Script Feature
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addScriptFeature(ScriptFeature $scriptFeature) {
|
||||
array_push($this->scriptFeatures, $scriptFeature);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all Script Features
|
||||
*
|
||||
*
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function removeScriptFeatures() {
|
||||
$this->scriptFeatures = array();
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\ScriptFeatureable::getScriptFeatures()
|
||||
*/
|
||||
public function getScriptFeatures() {
|
||||
@ -387,7 +436,6 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Renderable::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
|
@ -1,20 +1,21 @@
|
||||
<?php
|
||||
// TODO: add entry styles
|
||||
|
||||
namespace FML\Controls;
|
||||
|
||||
use FML\Script\Features\EntrySubmit;
|
||||
use FML\Types\NewLineable;
|
||||
use FML\Types\Scriptable;
|
||||
use FML\Types\Styleable;
|
||||
use FML\Types\TextFormatable;
|
||||
use FML\Script\Features\EntrySubmit;
|
||||
|
||||
/**
|
||||
* Entry Control
|
||||
* (CMlEntry)
|
||||
*
|
||||
* @author steeffeen
|
||||
* @author steeffeen
|
||||
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class Entry extends Control implements NewLineable, Scriptable, Styleable, TextFormatable {
|
||||
/*
|
||||
@ -59,7 +60,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
* @return \FML\Controls\Entry
|
||||
*/
|
||||
public function setName($name) {
|
||||
$this->name = (string) $name;
|
||||
$this->name = (string)$name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -84,7 +85,15 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Default Value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDefault() {
|
||||
return $this->default;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \FML\Types\NewLineable::setAutoNewLine()
|
||||
*/
|
||||
public function setAutoNewLine($autoNewLine) {
|
||||
@ -93,7 +102,6 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
||||
*/
|
||||
public function setScriptEvents($scriptEvents) {
|
||||
@ -102,47 +110,42 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Styleable::setStyle()
|
||||
*/
|
||||
public function setStyle($style) {
|
||||
$this->style = (string) $style;
|
||||
$this->style = (string)$style;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\TextFormatable::setTextColor()
|
||||
*/
|
||||
public function setTextColor($textColor) {
|
||||
$this->textColor = (string) $textColor;
|
||||
$this->textColor = (string)$textColor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\TextFormatable::setTextSize()
|
||||
*/
|
||||
public function setTextSize($textSize) {
|
||||
$this->textSize = (int) $textSize;
|
||||
$this->textSize = (int)$textSize;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\TextFormatable::setAreaColor()
|
||||
*/
|
||||
public function setAreaColor($areaColor) {
|
||||
$this->focusAreaColor1 = (string) $areaColor;
|
||||
$this->focusAreaColor1 = (string)$areaColor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\TextFormatable::setAreaFocusColor()
|
||||
*/
|
||||
public function setAreaFocusColor($areaFocusColor) {
|
||||
$this->focusAreaColor2 = (string) $areaFocusColor;
|
||||
$this->focusAreaColor2 = (string)$areaFocusColor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -153,7 +156,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
* @return \FML\Controls\Entry
|
||||
*/
|
||||
public function setAutoComplete($autoComplete) {
|
||||
$this->autoComplete = (bool) $autoComplete;
|
||||
$this->autoComplete = (bool)$autoComplete;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -165,12 +168,11 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
*/
|
||||
public function addSubmitFeature($url) {
|
||||
$entrySubmit = new EntrySubmit($this, $url);
|
||||
array_push($this->scriptFeatures, $entrySubmit);
|
||||
$this->addScriptFeature($entrySubmit);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Control::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
@ -180,13 +182,11 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
}
|
||||
if ($this->default !== null) {
|
||||
$xmlElement->setAttribute('default', $this->default);
|
||||
}
|
||||
else if ($this->autoComplete) {
|
||||
} else if ($this->autoComplete) {
|
||||
$value = null;
|
||||
if (array_key_exists($this->name, $_GET)) {
|
||||
$value = $_GET[$this->name];
|
||||
}
|
||||
else if (array_key_exists($this->name, $_POST)) {
|
||||
} else if (array_key_exists($this->name, $_POST)) {
|
||||
$value = $_POST[$this->name];
|
||||
}
|
||||
if ($value) {
|
||||
|
@ -2,25 +2,25 @@
|
||||
|
||||
namespace FML\Controls;
|
||||
|
||||
use FML\Types\Container;
|
||||
|
||||
use FML\Elements\Format;
|
||||
|
||||
use FML\Types\Container;
|
||||
use FML\Types\Renderable;
|
||||
use FML\Types\ScriptFeatureable;
|
||||
|
||||
/**
|
||||
* Frame Control
|
||||
* (CMlFrame)
|
||||
*
|
||||
* @author steeffeen
|
||||
* @author steeffeen
|
||||
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class Frame extends Control implements Container {
|
||||
/*
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $children = array();
|
||||
/** @var Format $format */
|
||||
protected $format = null;
|
||||
|
||||
/**
|
||||
@ -45,10 +45,9 @@ class Frame extends Control implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Container::add()
|
||||
*/
|
||||
public function add(Control $child) {
|
||||
public function add(Renderable $child) {
|
||||
if (!in_array($child, $this->children, true)) {
|
||||
array_push($this->children, $child);
|
||||
}
|
||||
@ -56,7 +55,6 @@ class Frame extends Control implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Container::removeChildren()
|
||||
*/
|
||||
public function removeChildren() {
|
||||
@ -65,7 +63,6 @@ class Frame extends Control implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Container::setFormat()
|
||||
*/
|
||||
public function setFormat(Format $format) {
|
||||
@ -74,7 +71,6 @@ class Frame extends Control implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Container::getFormat()
|
||||
*/
|
||||
public function getFormat($createIfEmpty = true) {
|
||||
@ -85,7 +81,6 @@ class Frame extends Control implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Controls\Control::getScriptFeatures()
|
||||
*/
|
||||
public function getScriptFeatures() {
|
||||
@ -99,7 +94,6 @@ class Frame extends Control implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Renderable::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
@ -109,6 +103,7 @@ class Frame extends Control implements Container {
|
||||
$xmlElement->appendChild($formatXml);
|
||||
}
|
||||
foreach ($this->children as $child) {
|
||||
/** @var Renderable $child */
|
||||
$childXmlElement = $child->render($domDocument);
|
||||
$xmlElement->appendChild($childXmlElement);
|
||||
}
|
||||
|
@ -2,22 +2,37 @@
|
||||
|
||||
namespace FML\Controls;
|
||||
|
||||
use FML\Types\Scriptable;
|
||||
use FML\Stylesheet\Style3d;
|
||||
use FML\Types\Scriptable;
|
||||
|
||||
/**
|
||||
* Frame3d Control
|
||||
* (CMlFrame)
|
||||
*
|
||||
* @author steeffeen
|
||||
* @author steeffeen
|
||||
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class Frame3d extends Frame implements Scriptable {
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
const STYLE_BaseStation = 'BaseStation';
|
||||
const STYLE_BaseBoxCase = 'BaseBoxCase';
|
||||
const STYLE_Titlelogo = 'Titlelogo';
|
||||
const STYLE_ButtonBack = 'ButtonBack';
|
||||
const STYLE_ButtonNav = 'ButtonNav';
|
||||
const STYLE_ButtonH = 'ButtonH';
|
||||
const STYLE_Station3x3 = 'Station3x3';
|
||||
const STYLE_Title = 'Title';
|
||||
const STYLE_TitleEditor = 'TitleEditor';
|
||||
const STYLE_Window = 'Window';
|
||||
|
||||
/*
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $style3dId = '';
|
||||
/** @var Style3d $style3d */
|
||||
protected $style3d = null;
|
||||
protected $scriptEvents = 0;
|
||||
|
||||
@ -49,8 +64,8 @@ class Frame3d extends Frame implements Scriptable {
|
||||
* @return \FML\Controls\Frame3d
|
||||
*/
|
||||
public function setStyle3dId($style3dId) {
|
||||
$this->style3dId = (string) $style3dId;
|
||||
$this->style3d = null;
|
||||
$this->style3dId = (string)$style3dId;
|
||||
$this->style3d = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -66,7 +81,6 @@ class Frame3d extends Frame implements Scriptable {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
||||
*/
|
||||
public function setScriptEvents($scriptEvents) {
|
||||
@ -75,7 +89,6 @@ class Frame3d extends Frame implements Scriptable {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Controls\Frame::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
@ -83,8 +96,7 @@ class Frame3d extends Frame implements Scriptable {
|
||||
if ($this->style3d) {
|
||||
$this->style3d->checkId();
|
||||
$xmlElement->setAttribute('style3d', $this->style3d->getId());
|
||||
}
|
||||
else if ($this->style3dId) {
|
||||
} else if ($this->style3dId) {
|
||||
$xmlElement->setAttribute('style3d', $this->style3dId);
|
||||
}
|
||||
if ($this->scriptEvents) {
|
||||
|
@ -4,26 +4,26 @@ namespace FML\Controls;
|
||||
|
||||
use FML\Elements\FrameModel;
|
||||
|
||||
|
||||
/**
|
||||
* Class representing an Instance of a Frame Model
|
||||
* (CMlFrame)
|
||||
*
|
||||
* @author steeffeen
|
||||
* @author steeffeen
|
||||
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class FrameInstance extends Control {
|
||||
/*
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $modelId = '';
|
||||
/** @var FrameModel $model */
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* Create a new Frame Instance
|
||||
*
|
||||
* @param string $modelId (optional) Frame Model Id
|
||||
* @param string $modelId (optional) Frame Model Id
|
||||
* @param string $controlId (optional) Control Id
|
||||
* @return \FML\Controls\Frame
|
||||
*/
|
||||
@ -35,7 +35,7 @@ class FrameInstance extends Control {
|
||||
/**
|
||||
* Construct a new Frame Instance
|
||||
*
|
||||
* @param string $modelId (optional) Frame Model Id
|
||||
* @param string $modelId (optional) Frame Model Id
|
||||
* @param string $controlId (optional) Control Id
|
||||
*/
|
||||
public function __construct($modelId = null, $controlId = null) {
|
||||
@ -53,8 +53,8 @@ class FrameInstance extends Control {
|
||||
* @return \FML\Controls\FrameInstance
|
||||
*/
|
||||
public function setModelId($modelId) {
|
||||
$this->modelId = (string) $modelId;
|
||||
$this->model = null;
|
||||
$this->modelId = (string)$modelId;
|
||||
$this->model = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -65,13 +65,12 @@ class FrameInstance extends Control {
|
||||
* @return \FML\Controls\FrameInstance
|
||||
*/
|
||||
public function setModel(FrameModel $frameModel) {
|
||||
$this->model = $frameModel;
|
||||
$this->model = $frameModel;
|
||||
$this->modelId = '';
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Renderable::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
@ -79,8 +78,7 @@ class FrameInstance extends Control {
|
||||
if ($this->model) {
|
||||
$this->model->checkId();
|
||||
$xmlElement->setAttribute('modelid', $this->model->getId());
|
||||
}
|
||||
else if ($this->modelId) {
|
||||
} else if ($this->modelId) {
|
||||
$xmlElement->setAttribute('modelid', $this->modelId);
|
||||
}
|
||||
return $xmlElement;
|
||||
|
@ -264,7 +264,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
|
||||
*/
|
||||
public function addClockFeature($showSeconds = true, $showFullDate = false) {
|
||||
$clock = new Clock($this, $showSeconds, $showFullDate);
|
||||
array_push($this->scriptFeatures, $clock);
|
||||
$this->addScriptFeature($clock);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace FML\Controls;
|
||||
|
||||
use FML\Models\CheckBoxDesign;
|
||||
use FML\Types\Actionable;
|
||||
use FML\Types\BgColorable;
|
||||
use FML\Types\Linkable;
|
||||
@ -13,9 +14,9 @@ use FML\Types\SubStyleable;
|
||||
* Quad Control
|
||||
* (CMlQuad)
|
||||
*
|
||||
* @author steeffeen
|
||||
* @author steeffeen
|
||||
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class Quad extends Control implements Actionable, BgColorable, Linkable, Scriptable, Styleable, SubStyleable {
|
||||
/*
|
||||
@ -68,7 +69,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
* @return \FML\Controls\Quad
|
||||
*/
|
||||
public function setImage($image) {
|
||||
$this->image = (string) $image;
|
||||
$this->image = (string)$image;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -79,7 +80,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
* @return \FML\Controls\Quad
|
||||
*/
|
||||
public function setImageId($imageId) {
|
||||
$this->imageId = (string) $imageId;
|
||||
$this->imageId = (string)$imageId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -90,7 +91,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
* @return \FML\Controls\Quad
|
||||
*/
|
||||
public function setImageFocus($imageFocus) {
|
||||
$this->imageFocus = (string) $imageFocus;
|
||||
$this->imageFocus = (string)$imageFocus;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -101,7 +102,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
* @return \FML\Controls\Quad
|
||||
*/
|
||||
public function setImageFocusId($imageFocusId) {
|
||||
$this->imageFocusId = (string) $imageFocusId;
|
||||
$this->imageFocusId = (string)$imageFocusId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -112,7 +113,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
* @return \FML\Controls\Quad
|
||||
*/
|
||||
public function setColorize($colorize) {
|
||||
$this->colorize = (string) $colorize;
|
||||
$this->colorize = (string)$colorize;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -123,7 +124,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
* @return \FML\Controls\Quad
|
||||
*/
|
||||
public function setModulizeColor($modulizeColor) {
|
||||
$this->modulizeColor = (string) $modulizeColor;
|
||||
$this->modulizeColor = (string)$modulizeColor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -139,16 +140,14 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Actionable::setAction()
|
||||
*/
|
||||
public function setAction($action) {
|
||||
$this->action = (string) $action;
|
||||
$this->action = (string)$action;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Actionable::getAction()
|
||||
*/
|
||||
public function getAction() {
|
||||
@ -156,61 +155,54 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Actionable::setActionKey()
|
||||
*/
|
||||
public function setActionKey($actionKey) {
|
||||
$this->actionKey = (int) $actionKey;
|
||||
$this->actionKey = (int)$actionKey;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\BgColorable::setBgColor()
|
||||
*/
|
||||
public function setBgColor($bgColor) {
|
||||
$this->bgColor = (string) $bgColor;
|
||||
$this->bgColor = (string)$bgColor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Linkable::setUrl()
|
||||
*/
|
||||
public function setUrl($url) {
|
||||
$this->url = (string) $url;
|
||||
$this->url = (string)$url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Linkable::setUrlId()
|
||||
*/
|
||||
public function setUrlId($urlId) {
|
||||
$this->urlId = (string) $urlId;
|
||||
$this->urlId = (string)$urlId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Linkable::setManialink()
|
||||
*/
|
||||
public function setManialink($manialink) {
|
||||
$this->manialink = (string) $manialink;
|
||||
$this->manialink = (string)$manialink;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Linkable::setManialinkId()
|
||||
*/
|
||||
public function setManialinkId($manialinkId) {
|
||||
$this->manialinkId = (string) $manialinkId;
|
||||
$this->manialinkId = (string)$manialinkId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
||||
*/
|
||||
public function setScriptEvents($scriptEvents) {
|
||||
@ -219,25 +211,22 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Styleable::setStyle()
|
||||
*/
|
||||
public function setStyle($style) {
|
||||
$this->style = (string) $style;
|
||||
$this->style = (string)$style;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\SubStyleable::setSubStyle()
|
||||
*/
|
||||
public function setSubStyle($subStyle) {
|
||||
$this->subStyle = (string) $subStyle;
|
||||
$this->subStyle = (string)$subStyle;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\SubStyleable::setStyles()
|
||||
*/
|
||||
public function setStyles($style, $subStyle) {
|
||||
@ -247,7 +236,17 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the given CheckBox Design
|
||||
*
|
||||
* @param CheckBoxDesign $checkBoxDesign CheckBox Design
|
||||
* @return \FML\Controls\Quad
|
||||
*/
|
||||
public function applyCheckBoxDesign(CheckBoxDesign $checkBoxDesign) {
|
||||
$checkBoxDesign->applyToQuad($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \FML\Control::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
|
Reference in New Issue
Block a user