FML 1.2
This commit is contained in:
parent
e61c6f4c11
commit
d3e4fd309f
169
application/core/Libs/FML/Components/CheckBox.php
Normal file
169
application/core/Libs/FML/Components/CheckBox.php
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace FML\Components;
|
||||||
|
|
||||||
|
use FML\Controls\Entry;
|
||||||
|
use FML\Controls\Frame;
|
||||||
|
use FML\Controls\Quad;
|
||||||
|
use FML\Models\CheckBoxDesign;
|
||||||
|
use FML\Script\Features\CheckBoxFeature;
|
||||||
|
use FML\Types\Renderable;
|
||||||
|
use FML\Types\ScriptFeatureable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CheckBox Component
|
||||||
|
*
|
||||||
|
* @author steeffeen
|
||||||
|
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||||
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||||
|
*/
|
||||||
|
class CheckBox implements Renderable, ScriptFeatureable {
|
||||||
|
/*
|
||||||
|
* Protected Properties
|
||||||
|
*/
|
||||||
|
protected $name = null;
|
||||||
|
protected $default = null;
|
||||||
|
protected $hiddenEntryDisabled = null;
|
||||||
|
protected $feature = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new CheckBox Component
|
||||||
|
*
|
||||||
|
* @param string $name (optional) CheckBox Name
|
||||||
|
* @param bool $default (optional) Default Value
|
||||||
|
* @param Quad $quad (optional) CheckBox Quad
|
||||||
|
*/
|
||||||
|
public function __construct($name = null, $default = null, Quad $quad = null) {
|
||||||
|
$this->setName($name);
|
||||||
|
$this->setDefault($default);
|
||||||
|
$this->feature = new CheckBoxFeature();
|
||||||
|
$this->feature->setQuad($quad);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Name
|
||||||
|
*
|
||||||
|
* @param string $name CheckBox Name
|
||||||
|
* @return \FML\Components\CheckBox
|
||||||
|
*/
|
||||||
|
public function setName($name) {
|
||||||
|
$this->name = (string)$name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Default Value
|
||||||
|
*
|
||||||
|
* @param bool $default Default Value
|
||||||
|
* @return \FML\Components\CheckBox
|
||||||
|
*/
|
||||||
|
public function setDefault($default) {
|
||||||
|
$this->default = ($default ? 1 : 0);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the hidden Entry that's sending the Value on Page Actions
|
||||||
|
*
|
||||||
|
* @param bool $disable (optional) Whether to disable or not
|
||||||
|
* @return \FML\Components\CheckBox
|
||||||
|
*/
|
||||||
|
public function disableHiddenEntry($disable = true) {
|
||||||
|
$this->hiddenEntryDisabled = (bool)$disable;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Enabled Design
|
||||||
|
*
|
||||||
|
* @param string $style Style Name or Image Url
|
||||||
|
* @param string $subStyle SubStyle Name
|
||||||
|
* @return \FML\Components\CheckBox
|
||||||
|
*/
|
||||||
|
public function setEnabledDesign($style, $subStyle = null) {
|
||||||
|
$checkBoxDesign = new CheckBoxDesign($style, $subStyle);
|
||||||
|
$this->feature->setEnabledDesign($checkBoxDesign);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Disabled Design
|
||||||
|
*
|
||||||
|
* @param string $style Style Name or Image Url
|
||||||
|
* @param string $subStyle SubStyle Name
|
||||||
|
* @return \FML\Components\CheckBox
|
||||||
|
*/
|
||||||
|
public function setDisabledDesign($style, $subStyle = null) {
|
||||||
|
$checkBoxDesign = new CheckBoxDesign($style, $subStyle);
|
||||||
|
$this->feature->setDisabledDesign($checkBoxDesign);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the CheckBox Quad
|
||||||
|
*
|
||||||
|
* @param bool $createIfEmpty (optional) Create the Quad if it's not set
|
||||||
|
* @return \FML\Controls\Quad
|
||||||
|
*/
|
||||||
|
public function getQuad($createIfEmpty = true) {
|
||||||
|
if (!$this->feature->getQuad() && $createIfEmpty) {
|
||||||
|
$quad = new Quad();
|
||||||
|
$quad->setSize(10, 10);
|
||||||
|
$quad->setScriptEvents(true);
|
||||||
|
$this->feature->setQuad($quad);
|
||||||
|
}
|
||||||
|
return $this->feature->getQuad();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the CheckBox Quad
|
||||||
|
*
|
||||||
|
* @param Quad $quad CheckBox Quad
|
||||||
|
* @return \FML\Components\CheckBox
|
||||||
|
*/
|
||||||
|
public function setQuad(Quad $quad) {
|
||||||
|
$this->feature->setQuad($quad);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \FML\Types\ScriptFeatureable::getScriptFeatures()
|
||||||
|
*/
|
||||||
|
public function getScriptFeatures() {
|
||||||
|
return array($this->feature);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \ManiaControl\Types\Renderable::render()
|
||||||
|
*/
|
||||||
|
public function render(\DOMDocument $domDocument) {
|
||||||
|
$frame = new Frame();
|
||||||
|
$frame->addScriptFeature($this->feature);
|
||||||
|
|
||||||
|
$quad = $this->getQuad();
|
||||||
|
$frame->add($quad);
|
||||||
|
|
||||||
|
if (!$this->hiddenEntryDisabled) {
|
||||||
|
$entry = $this->buildEntry();
|
||||||
|
$frame->add($entry);
|
||||||
|
$this->feature->setEntry($entry);
|
||||||
|
} else {
|
||||||
|
$this->feature->setEntry(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $frame->render($domDocument);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the hidden Entry
|
||||||
|
*
|
||||||
|
* @return Entry
|
||||||
|
*/
|
||||||
|
protected function buildEntry() {
|
||||||
|
$entry = new Entry();
|
||||||
|
$entry->setVisible(false);
|
||||||
|
$entry->setName($this->name);
|
||||||
|
$entry->setDefault($this->default);
|
||||||
|
return $entry;
|
||||||
|
}
|
||||||
|
}
|
@ -2,16 +2,18 @@
|
|||||||
|
|
||||||
namespace FML\Controls;
|
namespace FML\Controls;
|
||||||
|
|
||||||
use FML\Types\Renderable;
|
use FML\Script\Builder;
|
||||||
use FML\Script\Features\ActionTrigger;
|
use FML\Script\Features\ActionTrigger;
|
||||||
use FML\Script\ScriptLabel;
|
use FML\Script\Features\ControlScript;
|
||||||
use FML\Types\ScriptFeatureable;
|
|
||||||
use FML\Script\Features\MapInfo;
|
use FML\Script\Features\MapInfo;
|
||||||
use FML\Script\Features\PlayerProfile;
|
use FML\Script\Features\PlayerProfile;
|
||||||
use FML\Script\Features\UISound;
|
use FML\Script\Features\ScriptFeature;
|
||||||
use FML\Script\Builder;
|
|
||||||
use FML\Script\Features\Toggle;
|
use FML\Script\Features\Toggle;
|
||||||
use FML\Script\Features\Tooltip;
|
use FML\Script\Features\Tooltip;
|
||||||
|
use FML\Script\Features\UISound;
|
||||||
|
use FML\Script\ScriptLabel;
|
||||||
|
use FML\Types\Renderable;
|
||||||
|
use FML\Types\ScriptFeatureable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base Control
|
* Base Control
|
||||||
@ -85,17 +87,18 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
* @return \FML\Controls\Control
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = (string) $id;
|
$this->id = (string)$id;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Id for dangerous Characters and assign a unique Id if necessary
|
* 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
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function checkId() {
|
public function checkId($forceNewId = false) {
|
||||||
if (!$this->getId()) {
|
if ($forceNewId || !$this->getId()) {
|
||||||
$this->setId('FML_ID_' . self::$currentIndex);
|
$this->setId('FML_ID_' . self::$currentIndex);
|
||||||
self::$currentIndex++;
|
self::$currentIndex++;
|
||||||
return $this;
|
return $this;
|
||||||
@ -104,7 +107,9 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
$idCharacters = str_split($this->getId());
|
$idCharacters = str_split($this->getId());
|
||||||
$danger = false;
|
$danger = false;
|
||||||
foreach ($idCharacters as $character) {
|
foreach ($idCharacters as $character) {
|
||||||
if (!in_array($character, $dangerousCharacters)) continue;
|
if (!in_array($character, $dangerousCharacters)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$danger = true;
|
$danger = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -123,7 +128,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
* @return \FML\Controls\Control
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function setX($x) {
|
public function setX($x) {
|
||||||
$this->x = (float) $x;
|
$this->x = (float)$x;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +139,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
* @return \FML\Controls\Control
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function setY($y) {
|
public function setY($y) {
|
||||||
$this->y = (float) $y;
|
$this->y = (float)$y;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +150,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
* @return \FML\Controls\Control
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function setZ($z) {
|
public function setZ($z) {
|
||||||
$this->z = (float) $z;
|
$this->z = (float)$z;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +178,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
* @return \FML\Controls\Control
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function setWidth($width) {
|
public function setWidth($width) {
|
||||||
$this->width = (float) $width;
|
$this->width = (float)$width;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +189,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
* @return \FML\Controls\Control
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function setHeight($height) {
|
public function setHeight($height) {
|
||||||
$this->height = (float) $height;
|
$this->height = (float)$height;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +213,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
* @return \FML\Controls\Control
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function setHAlign($hAlign) {
|
public function setHAlign($hAlign) {
|
||||||
$this->hAlign = (string) $hAlign;
|
$this->hAlign = (string)$hAlign;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +224,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
* @return \FML\Controls\Control
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function setVAlign($vAlign) {
|
public function setVAlign($vAlign) {
|
||||||
$this->vAlign = (string) $vAlign;
|
$this->vAlign = (string)$vAlign;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,6 +241,26 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
return $this;
|
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
|
* Set Control Scale
|
||||||
*
|
*
|
||||||
@ -243,7 +268,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
* @return \FML\Controls\Control
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function setScale($scale) {
|
public function setScale($scale) {
|
||||||
$this->scale = (float) $scale;
|
$this->scale = (float)$scale;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +278,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
* @param bool $visible Whether Control should be visible
|
* @param bool $visible Whether Control should be visible
|
||||||
* @return \FML\Controls\Control
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function setVisible($visible) {
|
public function setVisible($visible = true) {
|
||||||
$this->hidden = ($visible ? 0 : 1);
|
$this->hidden = ($visible ? 0 : 1);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -265,7 +290,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
* @return \FML\Controls\Control
|
* @return \FML\Controls\Control
|
||||||
*/
|
*/
|
||||||
public function addClass($class) {
|
public function addClass($class) {
|
||||||
$class = (string) $class;
|
$class = (string)$class;
|
||||||
if (!in_array($class, $this->classes)) {
|
if (!in_array($class, $this->classes)) {
|
||||||
array_push($this->classes, $class);
|
array_push($this->classes, $class);
|
||||||
}
|
}
|
||||||
@ -281,7 +306,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
*/
|
*/
|
||||||
public function addActionTriggerFeature($actionName, $eventLabel = ScriptLabel::MOUSECLICK) {
|
public function addActionTriggerFeature($actionName, $eventLabel = ScriptLabel::MOUSECLICK) {
|
||||||
$actionTrigger = new ActionTrigger($actionName, $this, $eventLabel);
|
$actionTrigger = new ActionTrigger($actionName, $this, $eventLabel);
|
||||||
array_push($this->scriptFeatures, $actionTrigger);
|
$this->addScriptFeature($actionTrigger);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +318,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
*/
|
*/
|
||||||
public function addMapInfoFeature($eventLabel = ScriptLabel::MOUSECLICK) {
|
public function addMapInfoFeature($eventLabel = ScriptLabel::MOUSECLICK) {
|
||||||
$mapInfo = new MapInfo($this, $eventLabel);
|
$mapInfo = new MapInfo($this, $eventLabel);
|
||||||
array_push($this->scriptFeatures, $mapInfo);
|
$this->addScriptFeature($mapInfo);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +331,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
*/
|
*/
|
||||||
public function addPlayerProfileFeature($login, $eventLabel = ScriptLabel::MOUSECLICK) {
|
public function addPlayerProfileFeature($login, $eventLabel = ScriptLabel::MOUSECLICK) {
|
||||||
$playerProfile = new PlayerProfile($login, $this, $eventLabel);
|
$playerProfile = new PlayerProfile($login, $this, $eventLabel);
|
||||||
array_push($this->scriptFeatures, $playerProfile);
|
$this->addScriptFeature($playerProfile);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +345,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
*/
|
*/
|
||||||
public function addUISoundFeature($soundName, $variant = 0, $eventLabel = ScriptLabel::MOUSECLICK) {
|
public function addUISoundFeature($soundName, $variant = 0, $eventLabel = ScriptLabel::MOUSECLICK) {
|
||||||
$uiSound = new UISound($soundName, $this, $variant, $eventLabel);
|
$uiSound = new UISound($soundName, $this, $variant, $eventLabel);
|
||||||
array_push($this->scriptFeatures, $uiSound);
|
$this->addScriptFeature($uiSound);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +360,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
*/
|
*/
|
||||||
public function addToggleFeature(Control $toggledControl, $labelName = Scriptlabel::MOUSECLICK, $onlyShow = false, $onlyHide = false) {
|
public function addToggleFeature(Control $toggledControl, $labelName = Scriptlabel::MOUSECLICK, $onlyShow = false, $onlyHide = false) {
|
||||||
$toggle = new Toggle($this, $toggledControl, $labelName, $onlyShow, $onlyHide);
|
$toggle = new Toggle($this, $toggledControl, $labelName, $onlyShow, $onlyHide);
|
||||||
array_push($this->scriptFeatures, $toggle);
|
$this->addScriptFeature($toggle);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,7 +374,7 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
*/
|
*/
|
||||||
public function addTooltipFeature(Control $tooltipControl, $stayOnClick = false, $invert = false) {
|
public function addTooltipFeature(Control $tooltipControl, $stayOnClick = false, $invert = false) {
|
||||||
$tooltip = new Tooltip($this, $tooltipControl, $stayOnClick, $invert);
|
$tooltip = new Tooltip($this, $tooltipControl, $stayOnClick, $invert);
|
||||||
array_push($this->scriptFeatures, $tooltip);
|
$this->addScriptFeature($tooltip);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,7 +389,32 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
*/
|
*/
|
||||||
public function addTooltipLabelFeature(Label $tooltipControl, $text, $stayOnClick = false, $invert = false) {
|
public function addTooltipLabelFeature(Label $tooltipControl, $text, $stayOnClick = false, $invert = false) {
|
||||||
$tooltip = new Tooltip($this, $tooltipControl, $stayOnClick, $invert, $text);
|
$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;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +429,6 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\ScriptFeatureable::getScriptFeatures()
|
* @see \FML\Types\ScriptFeatureable::getScriptFeatures()
|
||||||
*/
|
*/
|
||||||
public function getScriptFeatures() {
|
public function getScriptFeatures() {
|
||||||
@ -387,7 +436,6 @@ abstract class Control implements Renderable, ScriptFeatureable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see \FML\Types\Renderable::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument) {
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// TODO: add entry styles
|
||||||
|
|
||||||
namespace FML\Controls;
|
namespace FML\Controls;
|
||||||
|
|
||||||
|
use FML\Script\Features\EntrySubmit;
|
||||||
use FML\Types\NewLineable;
|
use FML\Types\NewLineable;
|
||||||
use FML\Types\Scriptable;
|
use FML\Types\Scriptable;
|
||||||
use FML\Types\Styleable;
|
use FML\Types\Styleable;
|
||||||
use FML\Types\TextFormatable;
|
use FML\Types\TextFormatable;
|
||||||
use FML\Script\Features\EntrySubmit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry Control
|
* Entry Control
|
||||||
@ -59,7 +60,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
|||||||
* @return \FML\Controls\Entry
|
* @return \FML\Controls\Entry
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name) {
|
||||||
$this->name = (string) $name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
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()
|
* @see \FML\Types\NewLineable::setAutoNewLine()
|
||||||
*/
|
*/
|
||||||
public function setAutoNewLine($autoNewLine) {
|
public function setAutoNewLine($autoNewLine) {
|
||||||
@ -93,7 +102,6 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
* @see \FML\Types\Scriptable::setScriptEvents()
|
||||||
*/
|
*/
|
||||||
public function setScriptEvents($scriptEvents) {
|
public function setScriptEvents($scriptEvents) {
|
||||||
@ -102,47 +110,42 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Styleable::setStyle()
|
* @see \FML\Types\Styleable::setStyle()
|
||||||
*/
|
*/
|
||||||
public function setStyle($style) {
|
public function setStyle($style) {
|
||||||
$this->style = (string) $style;
|
$this->style = (string)$style;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\TextFormatable::setTextColor()
|
* @see \FML\Types\TextFormatable::setTextColor()
|
||||||
*/
|
*/
|
||||||
public function setTextColor($textColor) {
|
public function setTextColor($textColor) {
|
||||||
$this->textColor = (string) $textColor;
|
$this->textColor = (string)$textColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\TextFormatable::setTextSize()
|
* @see \FML\Types\TextFormatable::setTextSize()
|
||||||
*/
|
*/
|
||||||
public function setTextSize($textSize) {
|
public function setTextSize($textSize) {
|
||||||
$this->textSize = (int) $textSize;
|
$this->textSize = (int)$textSize;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\TextFormatable::setAreaColor()
|
* @see \FML\Types\TextFormatable::setAreaColor()
|
||||||
*/
|
*/
|
||||||
public function setAreaColor($areaColor) {
|
public function setAreaColor($areaColor) {
|
||||||
$this->focusAreaColor1 = (string) $areaColor;
|
$this->focusAreaColor1 = (string)$areaColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\TextFormatable::setAreaFocusColor()
|
* @see \FML\Types\TextFormatable::setAreaFocusColor()
|
||||||
*/
|
*/
|
||||||
public function setAreaFocusColor($areaFocusColor) {
|
public function setAreaFocusColor($areaFocusColor) {
|
||||||
$this->focusAreaColor2 = (string) $areaFocusColor;
|
$this->focusAreaColor2 = (string)$areaFocusColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +156,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
|||||||
* @return \FML\Controls\Entry
|
* @return \FML\Controls\Entry
|
||||||
*/
|
*/
|
||||||
public function setAutoComplete($autoComplete) {
|
public function setAutoComplete($autoComplete) {
|
||||||
$this->autoComplete = (bool) $autoComplete;
|
$this->autoComplete = (bool)$autoComplete;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,12 +168,11 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
|||||||
*/
|
*/
|
||||||
public function addSubmitFeature($url) {
|
public function addSubmitFeature($url) {
|
||||||
$entrySubmit = new EntrySubmit($this, $url);
|
$entrySubmit = new EntrySubmit($this, $url);
|
||||||
array_push($this->scriptFeatures, $entrySubmit);
|
$this->addScriptFeature($entrySubmit);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Control::render()
|
* @see \FML\Control::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument) {
|
||||||
@ -180,13 +182,11 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
|||||||
}
|
}
|
||||||
if ($this->default !== null) {
|
if ($this->default !== null) {
|
||||||
$xmlElement->setAttribute('default', $this->default);
|
$xmlElement->setAttribute('default', $this->default);
|
||||||
}
|
} else if ($this->autoComplete) {
|
||||||
else if ($this->autoComplete) {
|
|
||||||
$value = null;
|
$value = null;
|
||||||
if (array_key_exists($this->name, $_GET)) {
|
if (array_key_exists($this->name, $_GET)) {
|
||||||
$value = $_GET[$this->name];
|
$value = $_GET[$this->name];
|
||||||
}
|
} else if (array_key_exists($this->name, $_POST)) {
|
||||||
else if (array_key_exists($this->name, $_POST)) {
|
|
||||||
$value = $_POST[$this->name];
|
$value = $_POST[$this->name];
|
||||||
}
|
}
|
||||||
if ($value) {
|
if ($value) {
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace FML\Controls;
|
namespace FML\Controls;
|
||||||
|
|
||||||
use FML\Types\Container;
|
|
||||||
|
|
||||||
use FML\Elements\Format;
|
use FML\Elements\Format;
|
||||||
|
use FML\Types\Container;
|
||||||
|
use FML\Types\Renderable;
|
||||||
use FML\Types\ScriptFeatureable;
|
use FML\Types\ScriptFeatureable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,6 +20,7 @@ class Frame extends Control implements Container {
|
|||||||
* Protected Properties
|
* Protected Properties
|
||||||
*/
|
*/
|
||||||
protected $children = array();
|
protected $children = array();
|
||||||
|
/** @var Format $format */
|
||||||
protected $format = null;
|
protected $format = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,10 +45,9 @@ class Frame extends Control implements Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Container::add()
|
* @see \FML\Types\Container::add()
|
||||||
*/
|
*/
|
||||||
public function add(Control $child) {
|
public function add(Renderable $child) {
|
||||||
if (!in_array($child, $this->children, true)) {
|
if (!in_array($child, $this->children, true)) {
|
||||||
array_push($this->children, $child);
|
array_push($this->children, $child);
|
||||||
}
|
}
|
||||||
@ -56,7 +55,6 @@ class Frame extends Control implements Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Container::removeChildren()
|
* @see \FML\Types\Container::removeChildren()
|
||||||
*/
|
*/
|
||||||
public function removeChildren() {
|
public function removeChildren() {
|
||||||
@ -65,7 +63,6 @@ class Frame extends Control implements Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Container::setFormat()
|
* @see \FML\Types\Container::setFormat()
|
||||||
*/
|
*/
|
||||||
public function setFormat(Format $format) {
|
public function setFormat(Format $format) {
|
||||||
@ -74,7 +71,6 @@ class Frame extends Control implements Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Container::getFormat()
|
* @see \FML\Types\Container::getFormat()
|
||||||
*/
|
*/
|
||||||
public function getFormat($createIfEmpty = true) {
|
public function getFormat($createIfEmpty = true) {
|
||||||
@ -85,7 +81,6 @@ class Frame extends Control implements Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Controls\Control::getScriptFeatures()
|
* @see \FML\Controls\Control::getScriptFeatures()
|
||||||
*/
|
*/
|
||||||
public function getScriptFeatures() {
|
public function getScriptFeatures() {
|
||||||
@ -99,7 +94,6 @@ class Frame extends Control implements Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Renderable::render()
|
* @see \FML\Renderable::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument) {
|
||||||
@ -109,6 +103,7 @@ class Frame extends Control implements Container {
|
|||||||
$xmlElement->appendChild($formatXml);
|
$xmlElement->appendChild($formatXml);
|
||||||
}
|
}
|
||||||
foreach ($this->children as $child) {
|
foreach ($this->children as $child) {
|
||||||
|
/** @var Renderable $child */
|
||||||
$childXmlElement = $child->render($domDocument);
|
$childXmlElement = $child->render($domDocument);
|
||||||
$xmlElement->appendChild($childXmlElement);
|
$xmlElement->appendChild($childXmlElement);
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace FML\Controls;
|
namespace FML\Controls;
|
||||||
|
|
||||||
use FML\Types\Scriptable;
|
|
||||||
use FML\Stylesheet\Style3d;
|
use FML\Stylesheet\Style3d;
|
||||||
|
use FML\Types\Scriptable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Frame3d Control
|
* Frame3d Control
|
||||||
@ -14,10 +14,25 @@ use FML\Stylesheet\Style3d;
|
|||||||
* @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 {
|
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 Properties
|
||||||
*/
|
*/
|
||||||
protected $style3dId = '';
|
protected $style3dId = '';
|
||||||
|
/** @var Style3d $style3d */
|
||||||
protected $style3d = null;
|
protected $style3d = null;
|
||||||
protected $scriptEvents = 0;
|
protected $scriptEvents = 0;
|
||||||
|
|
||||||
@ -49,7 +64,7 @@ class Frame3d extends Frame implements Scriptable {
|
|||||||
* @return \FML\Controls\Frame3d
|
* @return \FML\Controls\Frame3d
|
||||||
*/
|
*/
|
||||||
public function setStyle3dId($style3dId) {
|
public function setStyle3dId($style3dId) {
|
||||||
$this->style3dId = (string) $style3dId;
|
$this->style3dId = (string)$style3dId;
|
||||||
$this->style3d = null;
|
$this->style3d = null;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -66,7 +81,6 @@ class Frame3d extends Frame implements Scriptable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
* @see \FML\Types\Scriptable::setScriptEvents()
|
||||||
*/
|
*/
|
||||||
public function setScriptEvents($scriptEvents) {
|
public function setScriptEvents($scriptEvents) {
|
||||||
@ -75,7 +89,6 @@ class Frame3d extends Frame implements Scriptable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Controls\Frame::render()
|
* @see \FML\Controls\Frame::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument) {
|
||||||
@ -83,8 +96,7 @@ class Frame3d extends Frame implements Scriptable {
|
|||||||
if ($this->style3d) {
|
if ($this->style3d) {
|
||||||
$this->style3d->checkId();
|
$this->style3d->checkId();
|
||||||
$xmlElement->setAttribute('style3d', $this->style3d->getId());
|
$xmlElement->setAttribute('style3d', $this->style3d->getId());
|
||||||
}
|
} else if ($this->style3dId) {
|
||||||
else if ($this->style3dId) {
|
|
||||||
$xmlElement->setAttribute('style3d', $this->style3dId);
|
$xmlElement->setAttribute('style3d', $this->style3dId);
|
||||||
}
|
}
|
||||||
if ($this->scriptEvents) {
|
if ($this->scriptEvents) {
|
||||||
|
@ -4,7 +4,6 @@ namespace FML\Controls;
|
|||||||
|
|
||||||
use FML\Elements\FrameModel;
|
use FML\Elements\FrameModel;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing an Instance of a Frame Model
|
* Class representing an Instance of a Frame Model
|
||||||
* (CMlFrame)
|
* (CMlFrame)
|
||||||
@ -18,6 +17,7 @@ class FrameInstance extends Control {
|
|||||||
* Protected Properties
|
* Protected Properties
|
||||||
*/
|
*/
|
||||||
protected $modelId = '';
|
protected $modelId = '';
|
||||||
|
/** @var FrameModel $model */
|
||||||
protected $model = null;
|
protected $model = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,7 +53,7 @@ class FrameInstance extends Control {
|
|||||||
* @return \FML\Controls\FrameInstance
|
* @return \FML\Controls\FrameInstance
|
||||||
*/
|
*/
|
||||||
public function setModelId($modelId) {
|
public function setModelId($modelId) {
|
||||||
$this->modelId = (string) $modelId;
|
$this->modelId = (string)$modelId;
|
||||||
$this->model = null;
|
$this->model = null;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -71,7 +71,6 @@ class FrameInstance extends Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Renderable::render()
|
* @see \FML\Renderable::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument) {
|
||||||
@ -79,8 +78,7 @@ class FrameInstance extends Control {
|
|||||||
if ($this->model) {
|
if ($this->model) {
|
||||||
$this->model->checkId();
|
$this->model->checkId();
|
||||||
$xmlElement->setAttribute('modelid', $this->model->getId());
|
$xmlElement->setAttribute('modelid', $this->model->getId());
|
||||||
}
|
} else if ($this->modelId) {
|
||||||
else if ($this->modelId) {
|
|
||||||
$xmlElement->setAttribute('modelid', $this->modelId);
|
$xmlElement->setAttribute('modelid', $this->modelId);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
return $xmlElement;
|
||||||
|
@ -264,7 +264,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
|
|||||||
*/
|
*/
|
||||||
public function addClockFeature($showSeconds = true, $showFullDate = false) {
|
public function addClockFeature($showSeconds = true, $showFullDate = false) {
|
||||||
$clock = new Clock($this, $showSeconds, $showFullDate);
|
$clock = new Clock($this, $showSeconds, $showFullDate);
|
||||||
array_push($this->scriptFeatures, $clock);
|
$this->addScriptFeature($clock);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace FML\Controls;
|
namespace FML\Controls;
|
||||||
|
|
||||||
|
use FML\Models\CheckBoxDesign;
|
||||||
use FML\Types\Actionable;
|
use FML\Types\Actionable;
|
||||||
use FML\Types\BgColorable;
|
use FML\Types\BgColorable;
|
||||||
use FML\Types\Linkable;
|
use FML\Types\Linkable;
|
||||||
@ -68,7 +69,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
|||||||
* @return \FML\Controls\Quad
|
* @return \FML\Controls\Quad
|
||||||
*/
|
*/
|
||||||
public function setImage($image) {
|
public function setImage($image) {
|
||||||
$this->image = (string) $image;
|
$this->image = (string)$image;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +80,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
|||||||
* @return \FML\Controls\Quad
|
* @return \FML\Controls\Quad
|
||||||
*/
|
*/
|
||||||
public function setImageId($imageId) {
|
public function setImageId($imageId) {
|
||||||
$this->imageId = (string) $imageId;
|
$this->imageId = (string)$imageId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +91,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
|||||||
* @return \FML\Controls\Quad
|
* @return \FML\Controls\Quad
|
||||||
*/
|
*/
|
||||||
public function setImageFocus($imageFocus) {
|
public function setImageFocus($imageFocus) {
|
||||||
$this->imageFocus = (string) $imageFocus;
|
$this->imageFocus = (string)$imageFocus;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
|||||||
* @return \FML\Controls\Quad
|
* @return \FML\Controls\Quad
|
||||||
*/
|
*/
|
||||||
public function setImageFocusId($imageFocusId) {
|
public function setImageFocusId($imageFocusId) {
|
||||||
$this->imageFocusId = (string) $imageFocusId;
|
$this->imageFocusId = (string)$imageFocusId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +113,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
|||||||
* @return \FML\Controls\Quad
|
* @return \FML\Controls\Quad
|
||||||
*/
|
*/
|
||||||
public function setColorize($colorize) {
|
public function setColorize($colorize) {
|
||||||
$this->colorize = (string) $colorize;
|
$this->colorize = (string)$colorize;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
|||||||
* @return \FML\Controls\Quad
|
* @return \FML\Controls\Quad
|
||||||
*/
|
*/
|
||||||
public function setModulizeColor($modulizeColor) {
|
public function setModulizeColor($modulizeColor) {
|
||||||
$this->modulizeColor = (string) $modulizeColor;
|
$this->modulizeColor = (string)$modulizeColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,16 +140,14 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Actionable::setAction()
|
* @see \FML\Types\Actionable::setAction()
|
||||||
*/
|
*/
|
||||||
public function setAction($action) {
|
public function setAction($action) {
|
||||||
$this->action = (string) $action;
|
$this->action = (string)$action;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Actionable::getAction()
|
* @see \FML\Types\Actionable::getAction()
|
||||||
*/
|
*/
|
||||||
public function getAction() {
|
public function getAction() {
|
||||||
@ -156,61 +155,54 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Actionable::setActionKey()
|
* @see \FML\Types\Actionable::setActionKey()
|
||||||
*/
|
*/
|
||||||
public function setActionKey($actionKey) {
|
public function setActionKey($actionKey) {
|
||||||
$this->actionKey = (int) $actionKey;
|
$this->actionKey = (int)$actionKey;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\BgColorable::setBgColor()
|
* @see \FML\Types\BgColorable::setBgColor()
|
||||||
*/
|
*/
|
||||||
public function setBgColor($bgColor) {
|
public function setBgColor($bgColor) {
|
||||||
$this->bgColor = (string) $bgColor;
|
$this->bgColor = (string)$bgColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Linkable::setUrl()
|
* @see \FML\Types\Linkable::setUrl()
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url) {
|
||||||
$this->url = (string) $url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Linkable::setUrlId()
|
* @see \FML\Types\Linkable::setUrlId()
|
||||||
*/
|
*/
|
||||||
public function setUrlId($urlId) {
|
public function setUrlId($urlId) {
|
||||||
$this->urlId = (string) $urlId;
|
$this->urlId = (string)$urlId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Linkable::setManialink()
|
* @see \FML\Types\Linkable::setManialink()
|
||||||
*/
|
*/
|
||||||
public function setManialink($manialink) {
|
public function setManialink($manialink) {
|
||||||
$this->manialink = (string) $manialink;
|
$this->manialink = (string)$manialink;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Linkable::setManialinkId()
|
* @see \FML\Types\Linkable::setManialinkId()
|
||||||
*/
|
*/
|
||||||
public function setManialinkId($manialinkId) {
|
public function setManialinkId($manialinkId) {
|
||||||
$this->manialinkId = (string) $manialinkId;
|
$this->manialinkId = (string)$manialinkId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
* @see \FML\Types\Scriptable::setScriptEvents()
|
||||||
*/
|
*/
|
||||||
public function setScriptEvents($scriptEvents) {
|
public function setScriptEvents($scriptEvents) {
|
||||||
@ -219,25 +211,22 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Styleable::setStyle()
|
* @see \FML\Types\Styleable::setStyle()
|
||||||
*/
|
*/
|
||||||
public function setStyle($style) {
|
public function setStyle($style) {
|
||||||
$this->style = (string) $style;
|
$this->style = (string)$style;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\SubStyleable::setSubStyle()
|
* @see \FML\Types\SubStyleable::setSubStyle()
|
||||||
*/
|
*/
|
||||||
public function setSubStyle($subStyle) {
|
public function setSubStyle($subStyle) {
|
||||||
$this->subStyle = (string) $subStyle;
|
$this->subStyle = (string)$subStyle;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\SubStyleable::setStyles()
|
* @see \FML\Types\SubStyleable::setStyles()
|
||||||
*/
|
*/
|
||||||
public function setStyles($style, $subStyle) {
|
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()
|
* @see \FML\Control::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument) {
|
||||||
|
@ -47,7 +47,7 @@ class CustomUI {
|
|||||||
* @return \FML\CustomUI
|
* @return \FML\CustomUI
|
||||||
*/
|
*/
|
||||||
public function setXMLEncoding($encoding) {
|
public function setXMLEncoding($encoding) {
|
||||||
$this->encoding = (string) $encoding;
|
$this->encoding = (string)$encoding;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class CustomUI {
|
|||||||
/**
|
/**
|
||||||
* Set Global Showing
|
* Set Global Showing
|
||||||
*
|
*
|
||||||
* @param bool $visible Wether the UI should be disabled completely
|
* @param bool $visible Whether the UI should be disabled completely
|
||||||
* @return \FML\CustomUI
|
* @return \FML\CustomUI
|
||||||
*/
|
*/
|
||||||
public function setGlobalVisible($visible) {
|
public function setGlobalVisible($visible) {
|
||||||
@ -146,7 +146,7 @@ class CustomUI {
|
|||||||
* @return \DOMDocument
|
* @return \DOMDocument
|
||||||
*/
|
*/
|
||||||
public function render($domDocument = null) {
|
public function render($domDocument = null) {
|
||||||
$isChild = (bool) $domDocument;
|
$isChild = (bool)$domDocument;
|
||||||
if (!$isChild) {
|
if (!$isChild) {
|
||||||
$domDocument = new \DOMDocument('1.0', $this->encoding);
|
$domDocument = new \DOMDocument('1.0', $this->encoding);
|
||||||
$domDocument->xmlStandalone = true;
|
$domDocument->xmlStandalone = true;
|
||||||
@ -157,7 +157,9 @@ class CustomUI {
|
|||||||
}
|
}
|
||||||
$settings = $this->getSettings();
|
$settings = $this->getSettings();
|
||||||
foreach ($settings as $setting => $value) {
|
foreach ($settings as $setting => $value) {
|
||||||
if ($value === null) continue;
|
if ($value === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$xmlSubElement = $domDocument->createElement($setting);
|
$xmlSubElement = $domDocument->createElement($setting);
|
||||||
$xmlSubElement->setAttribute('visible', ($value ? 1 : 0));
|
$xmlSubElement->setAttribute('visible', ($value ? 1 : 0));
|
||||||
$xmlElement->appendChild($xmlSubElement);
|
$xmlElement->appendChild($xmlSubElement);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace FML\Elements;
|
namespace FML\Elements;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
|
||||||
use FML\Types\Container;
|
use FML\Types\Container;
|
||||||
use FML\Types\Renderable;
|
use FML\Types\Renderable;
|
||||||
|
|
||||||
@ -20,6 +19,7 @@ class FrameModel implements Container, Renderable {
|
|||||||
protected $tagName = 'framemodel';
|
protected $tagName = 'framemodel';
|
||||||
protected $id = '';
|
protected $id = '';
|
||||||
protected $children = array();
|
protected $children = array();
|
||||||
|
/** @var Format $format */
|
||||||
protected $format = null;
|
protected $format = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,7 +29,7 @@ class FrameModel implements Container, Renderable {
|
|||||||
* @return \FML\Elements\FrameModel
|
* @return \FML\Elements\FrameModel
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = (string) $id;
|
$this->id = (string)$id;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,18 +55,16 @@ class FrameModel implements Container, Renderable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Container::add()
|
* @see \FML\Types\Container::add()
|
||||||
*/
|
*/
|
||||||
public function add(Control $childControl) {
|
public function add(Renderable $childElement) {
|
||||||
if (!in_array($childControl, $this->children, true)) {
|
if (!in_array($childElement, $this->children, true)) {
|
||||||
array_push($this->children, $childControl);
|
array_push($this->children, $childElement);
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Container::removeChildren()
|
* @see \FML\Types\Container::removeChildren()
|
||||||
*/
|
*/
|
||||||
public function removeChildren() {
|
public function removeChildren() {
|
||||||
@ -75,7 +73,6 @@ class FrameModel implements Container, Renderable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Container::setFormat()
|
* @see \FML\Types\Container::setFormat()
|
||||||
*/
|
*/
|
||||||
public function setFormat(Format $format) {
|
public function setFormat(Format $format) {
|
||||||
@ -84,7 +81,6 @@ class FrameModel implements Container, Renderable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Container::getFormat()
|
* @see \FML\Types\Container::getFormat()
|
||||||
*/
|
*/
|
||||||
public function getFormat($createIfEmpty = true) {
|
public function getFormat($createIfEmpty = true) {
|
||||||
@ -95,7 +91,6 @@ class FrameModel implements Container, Renderable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see \FML\Types\Renderable::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument) {
|
||||||
@ -107,6 +102,7 @@ class FrameModel implements Container, Renderable {
|
|||||||
$xmlElement->appendChild($formatXml);
|
$xmlElement->appendChild($formatXml);
|
||||||
}
|
}
|
||||||
foreach ($this->children as $child) {
|
foreach ($this->children as $child) {
|
||||||
|
/** @var Renderable $child */
|
||||||
$childElement = $child->render($domDocument);
|
$childElement = $child->render($domDocument);
|
||||||
$xmlElement->appendChild($childElement);
|
$xmlElement->appendChild($childElement);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ use FML\ManiaCode\AddFavorite;
|
|||||||
use FML\ManiaCode\Element;
|
use FML\ManiaCode\Element;
|
||||||
use FML\ManiaCode\GetSkin;
|
use FML\ManiaCode\GetSkin;
|
||||||
use FML\ManiaCode\Go_To;
|
use FML\ManiaCode\Go_To;
|
||||||
|
use FML\ManiaCode\InstallMacroblock;
|
||||||
use FML\ManiaCode\InstallMap;
|
use FML\ManiaCode\InstallMap;
|
||||||
use FML\ManiaCode\InstallPack;
|
use FML\ManiaCode\InstallPack;
|
||||||
use FML\ManiaCode\InstallReplay;
|
use FML\ManiaCode\InstallReplay;
|
||||||
@ -17,7 +18,6 @@ use FML\ManiaCode\PlayMap;
|
|||||||
use FML\ManiaCode\PlayReplay;
|
use FML\ManiaCode\PlayReplay;
|
||||||
use FML\ManiaCode\ShowMessage;
|
use FML\ManiaCode\ShowMessage;
|
||||||
use FML\ManiaCode\ViewReplay;
|
use FML\ManiaCode\ViewReplay;
|
||||||
use FML\ManiaCode\InstallMacroblock;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing a ManiaCode
|
* Class representing a ManiaCode
|
||||||
@ -58,7 +58,7 @@ class ManiaCode {
|
|||||||
* @return \FML\ManiaCode
|
* @return \FML\ManiaCode
|
||||||
*/
|
*/
|
||||||
public function setXmlEncoding($encoding) {
|
public function setXmlEncoding($encoding) {
|
||||||
$this->encoding = (string) $encoding;
|
$this->encoding = (string)$encoding;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,6 +304,7 @@ class ManiaCode {
|
|||||||
$maniaCode->setAttribute('noconfirmation', $this->noConfirmation);
|
$maniaCode->setAttribute('noconfirmation', $this->noConfirmation);
|
||||||
}
|
}
|
||||||
foreach ($this->elements as $element) {
|
foreach ($this->elements as $element) {
|
||||||
|
/** @var Element $element */
|
||||||
$xmlElement = $element->render($domDocument);
|
$xmlElement = $element->render($domDocument);
|
||||||
$maniaCode->appendChild($xmlElement);
|
$maniaCode->appendChild($xmlElement);
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,11 @@ class ManiaLink {
|
|||||||
protected $navigable3d = 1;
|
protected $navigable3d = 1;
|
||||||
protected $timeout = 0;
|
protected $timeout = 0;
|
||||||
protected $children = array();
|
protected $children = array();
|
||||||
|
/** @var Dico $dico */
|
||||||
protected $dico = null;
|
protected $dico = null;
|
||||||
|
/** @var Stylesheet $stylesheet */
|
||||||
protected $stylesheet = null;
|
protected $stylesheet = null;
|
||||||
|
/** @var Script $script */
|
||||||
protected $script = null;
|
protected $script = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,7 +72,7 @@ class ManiaLink {
|
|||||||
* @return \FML\ManiaLink
|
* @return \FML\ManiaLink
|
||||||
*/
|
*/
|
||||||
public function setXmlEncoding($encoding) {
|
public function setXmlEncoding($encoding) {
|
||||||
$this->encoding = (string) $encoding;
|
$this->encoding = (string)$encoding;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +83,7 @@ class ManiaLink {
|
|||||||
* @return \FML\ManiaLink
|
* @return \FML\ManiaLink
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = (string) $id;
|
$this->id = (string)$id;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +103,7 @@ class ManiaLink {
|
|||||||
* @return \FML\ManiaLink
|
* @return \FML\ManiaLink
|
||||||
*/
|
*/
|
||||||
public function setBackground($background) {
|
public function setBackground($background) {
|
||||||
$this->background = (string) $background;
|
$this->background = (string)$background;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +125,7 @@ class ManiaLink {
|
|||||||
* @return \FML\ManiaLink
|
* @return \FML\ManiaLink
|
||||||
*/
|
*/
|
||||||
public function setTimeout($timeout) {
|
public function setTimeout($timeout) {
|
||||||
$this->timeout = (int) $timeout;
|
$this->timeout = (int)$timeout;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +232,7 @@ class ManiaLink {
|
|||||||
* @return \DOMDocument
|
* @return \DOMDocument
|
||||||
*/
|
*/
|
||||||
public function render($echo = false, $domDocument = null) {
|
public function render($echo = false, $domDocument = null) {
|
||||||
$isChild = (bool) $domDocument;
|
$isChild = (bool)$domDocument;
|
||||||
if (!$isChild) {
|
if (!$isChild) {
|
||||||
$domDocument = new \DOMDocument('1.0', $this->encoding);
|
$domDocument = new \DOMDocument('1.0', $this->encoding);
|
||||||
$domDocument->xmlStandalone = true;
|
$domDocument->xmlStandalone = true;
|
||||||
@ -260,6 +263,7 @@ class ManiaLink {
|
|||||||
}
|
}
|
||||||
$scriptFeatures = array();
|
$scriptFeatures = array();
|
||||||
foreach ($this->children as $child) {
|
foreach ($this->children as $child) {
|
||||||
|
/** @var Renderable $child */
|
||||||
$childXml = $child->render($domDocument, $this->getScript());
|
$childXml = $child->render($domDocument, $this->getScript());
|
||||||
$maniaLink->appendChild($childXml);
|
$maniaLink->appendChild($childXml);
|
||||||
if ($child instanceof ScriptFeatureable) {
|
if ($child instanceof ScriptFeatureable) {
|
||||||
|
@ -16,6 +16,7 @@ class ManiaLinks {
|
|||||||
protected $encoding = 'utf-8';
|
protected $encoding = 'utf-8';
|
||||||
protected $tagName = 'manialinks';
|
protected $tagName = 'manialinks';
|
||||||
protected $children = array();
|
protected $children = array();
|
||||||
|
/** @var CustomUI $customUI */
|
||||||
protected $customUI = null;
|
protected $customUI = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,7 +42,7 @@ class ManiaLinks {
|
|||||||
* @return \FML\ManiaLinks
|
* @return \FML\ManiaLinks
|
||||||
*/
|
*/
|
||||||
public function setXmlEncoding($encoding) {
|
public function setXmlEncoding($encoding) {
|
||||||
$this->encoding = (string) $encoding;
|
$this->encoding = (string)$encoding;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,6 +105,7 @@ class ManiaLinks {
|
|||||||
$maniaLinks = $domDocument->createElement($this->tagName);
|
$maniaLinks = $domDocument->createElement($this->tagName);
|
||||||
$domDocument->appendChild($maniaLinks);
|
$domDocument->appendChild($maniaLinks);
|
||||||
foreach ($this->children as $child) {
|
foreach ($this->children as $child) {
|
||||||
|
/** @var ManiaLink $child */
|
||||||
$childXml = $child->render(false, $domDocument);
|
$childXml = $child->render(false, $domDocument);
|
||||||
$maniaLinks->appendChild($childXml);
|
$maniaLinks->appendChild($childXml);
|
||||||
}
|
}
|
||||||
|
127
application/core/Libs/FML/Models/CheckBoxDesign.php
Normal file
127
application/core/Libs/FML/Models/CheckBoxDesign.php
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace FML\Models;
|
||||||
|
|
||||||
|
use FML\Controls\Quad;
|
||||||
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||||
|
use FML\Script\Builder;
|
||||||
|
use FML\Types\Styleable;
|
||||||
|
use FML\Types\SubStyleable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class representing CheckBox Design
|
||||||
|
*
|
||||||
|
* @author steeffeen
|
||||||
|
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||||
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||||
|
*/
|
||||||
|
class CheckBoxDesign implements Styleable, SubStyleable {
|
||||||
|
/*
|
||||||
|
* Protected Properties
|
||||||
|
*/
|
||||||
|
protected $url = null;
|
||||||
|
protected $style = null;
|
||||||
|
protected $subStyle = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the Default Enabled Design
|
||||||
|
*
|
||||||
|
* @return \FML\Models\CheckBoxDesign
|
||||||
|
*/
|
||||||
|
public static function defaultEnabledDesign() {
|
||||||
|
$checkBoxDesign = new CheckBoxDesign(Quad_Icons64x64_1::STYLE, Quad_Icons64x64_1::SUBSTYLE_LvlGreen);
|
||||||
|
return $checkBoxDesign;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the Default Disabled Design
|
||||||
|
*
|
||||||
|
* @return \FML\Models\CheckBoxDesign
|
||||||
|
*/
|
||||||
|
public static function defaultDisabledDesign() {
|
||||||
|
$checkBoxDesign = new CheckBoxDesign(Quad_Icons64x64_1::STYLE, Quad_Icons64x64_1::SUBSTYLE_LvlRed);
|
||||||
|
return $checkBoxDesign;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new CheckBox Design
|
||||||
|
*
|
||||||
|
* @param string $style Style Name or Image Url
|
||||||
|
* @param string $subStyle SubStyle Name
|
||||||
|
*/
|
||||||
|
public function __construct($style, $subStyle = null) {
|
||||||
|
if ($subStyle === null) {
|
||||||
|
$this->setImageUrl($style);
|
||||||
|
} else {
|
||||||
|
$this->setStyle($style);
|
||||||
|
$this->setSubStyle($subStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Image Url
|
||||||
|
*
|
||||||
|
* @param string $url Image Url
|
||||||
|
* @return \FML\Models\CheckBoxDesign
|
||||||
|
*/
|
||||||
|
public function setImageUrl($url) {
|
||||||
|
$this->url = (string)$url;
|
||||||
|
$this->style = null;
|
||||||
|
$this->subStyle = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \FML\Types\Styleable::setStyle()
|
||||||
|
*/
|
||||||
|
public function setStyle($style) {
|
||||||
|
$this->style = (string)$style;
|
||||||
|
$this->url = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \FML\Types\SubStyleable::setSubStyle()
|
||||||
|
*/
|
||||||
|
public function setSubStyle($subStyle) {
|
||||||
|
$this->subStyle = (string)$subStyle;
|
||||||
|
$this->url = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \FML\Types\SubStyleable::setStyles()
|
||||||
|
*/
|
||||||
|
public function setStyles($style, $subStyle) {
|
||||||
|
$this->setStyle($style);
|
||||||
|
$this->setSubStyle($subStyle);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the Design to the given Quad
|
||||||
|
*
|
||||||
|
* @param Quad $quad CheckBox Quad
|
||||||
|
* @return \FML\Models\CheckBoxDesign
|
||||||
|
*/
|
||||||
|
public function applyToQuad(Quad $quad) {
|
||||||
|
$quad->setImage($this->url);
|
||||||
|
$quad->setStyles($this->style, $this->subStyle);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the CheckBox Design String
|
||||||
|
*
|
||||||
|
* @param bool $escaped (optional) Whether the String should be escaped for the Script
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDesignString($escaped = true) {
|
||||||
|
if ($this->url !== null) {
|
||||||
|
$string = $this->url;
|
||||||
|
} else {
|
||||||
|
$string = $this->style . '|' . $this->subStyle;;
|
||||||
|
}
|
||||||
|
return Builder::escapeText($string);
|
||||||
|
}
|
||||||
|
}
|
@ -3,10 +3,10 @@
|
|||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
|
use FML\Script\Builder;
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use FML\Script\ScriptLabel;
|
use FML\Script\ScriptLabel;
|
||||||
use FML\Script\Builder;
|
use FML\Types\Scriptable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script Feature for triggering a Page Action
|
* Script Feature for triggering a Page Action
|
||||||
@ -20,6 +20,7 @@ class ActionTrigger extends ScriptFeature {
|
|||||||
* Protected Properties
|
* Protected Properties
|
||||||
*/
|
*/
|
||||||
protected $actionName = null;
|
protected $actionName = null;
|
||||||
|
/** @var Control $control */
|
||||||
protected $control = null;
|
protected $control = null;
|
||||||
protected $labelName = null;
|
protected $labelName = null;
|
||||||
|
|
||||||
@ -55,7 +56,9 @@ class ActionTrigger extends ScriptFeature {
|
|||||||
*/
|
*/
|
||||||
public function setControl(Control $control) {
|
public function setControl(Control $control) {
|
||||||
$control->checkId();
|
$control->checkId();
|
||||||
|
if ($control instanceof Scriptable) {
|
||||||
$control->setScriptEvents(true);
|
$control->setScriptEvents(true);
|
||||||
|
}
|
||||||
$this->control = $control;
|
$this->control = $control;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -72,7 +75,6 @@ class ActionTrigger extends ScriptFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script) {
|
||||||
@ -94,8 +96,7 @@ class ActionTrigger extends ScriptFeature {
|
|||||||
if (Event.Control.ControlId == \"{$controlId}\") {
|
if (Event.Control.ControlId == \"{$controlId}\") {
|
||||||
TriggerPageAction(\"{$actionName}\");
|
TriggerPageAction(\"{$actionName}\");
|
||||||
}";
|
}";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Other
|
// Other
|
||||||
$scriptText = "
|
$scriptText = "
|
||||||
TriggerPageAction(\"{$actionName}\");";
|
TriggerPageAction(\"{$actionName}\");";
|
||||||
|
203
application/core/Libs/FML/Script/Features/CheckBoxFeature.php
Normal file
203
application/core/Libs/FML/Script/Features/CheckBoxFeature.php
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
|
use FML\Controls\Entry;
|
||||||
|
use FML\Controls\Quad;
|
||||||
|
use FML\Models\CheckBoxDesign;
|
||||||
|
use FML\Script\Builder;
|
||||||
|
use FML\Script\Script;
|
||||||
|
use FML\Script\ScriptInclude;
|
||||||
|
use FML\Script\ScriptLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script Feature for creating a CheckBox Behavior
|
||||||
|
*
|
||||||
|
* @author steeffeen
|
||||||
|
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||||
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||||
|
*/
|
||||||
|
class CheckBoxFeature extends ScriptFeature {
|
||||||
|
/*
|
||||||
|
* Constants
|
||||||
|
*/
|
||||||
|
const FUNCTION_UPDATE_QUAD_DESIGN = 'FML_UpdateQuadDesign';
|
||||||
|
const VAR_CHECKBOX_ENABLED = 'FML_CheckBox_Enabled';
|
||||||
|
const VAR_CHECKBOX_DESIGNS = 'FML_CheckBox_Designs';
|
||||||
|
const VAR_CHECKBOX_ENTRY_ID = 'FML_CheckBox_EntryId';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Protected Properties
|
||||||
|
*/
|
||||||
|
/** @var Quad $quad */
|
||||||
|
protected $quad = null;
|
||||||
|
/** @var Entry $entry */
|
||||||
|
protected $entry = null;
|
||||||
|
/** @var CheckBoxDesign $enabledDesign */
|
||||||
|
protected $enabledDesign = null;
|
||||||
|
/** @var CheckBoxDesign $disabledDesign */
|
||||||
|
protected $disabledDesign = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new CheckBox Feature
|
||||||
|
*
|
||||||
|
* @param Quad $quad (optional) CheckBox Quad
|
||||||
|
* @param Entry $entry (optional) Hidden Entry
|
||||||
|
*/
|
||||||
|
public function __construct(Quad $quad = null, Entry $entry = null) {
|
||||||
|
$this->setQuad($quad);
|
||||||
|
$this->setEntry($entry);
|
||||||
|
$this->setEnabledDesign(CheckBoxDesign::defaultEnabledDesign());
|
||||||
|
$this->setDisabledDesign(CheckBoxDesign::defaultDisabledDesign());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the CheckBox Quad
|
||||||
|
*
|
||||||
|
* @param Quad $quad CheckBox Quad
|
||||||
|
* @return \FML\Script\Features\CheckBoxFeature
|
||||||
|
*/
|
||||||
|
public function setQuad(Quad $quad = null) {
|
||||||
|
if ($quad) {
|
||||||
|
$quad->checkId();
|
||||||
|
$quad->setScriptEvents(true);
|
||||||
|
}
|
||||||
|
$this->quad = $quad;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the CheckBox Quad
|
||||||
|
*
|
||||||
|
* @return \FML\Controls\Quad
|
||||||
|
*/
|
||||||
|
public function getQuad() {
|
||||||
|
return $this->quad;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the CheckBox Entry
|
||||||
|
*
|
||||||
|
* @param Entry $entry CheckBox Entry
|
||||||
|
* @return \FML\Script\Features\CheckBoxFeature
|
||||||
|
*/
|
||||||
|
public function setEntry(Entry $entry = null) {
|
||||||
|
if ($entry) {
|
||||||
|
$entry->checkId();
|
||||||
|
}
|
||||||
|
$this->entry = $entry;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Enabled Design
|
||||||
|
*
|
||||||
|
* @param CheckBoxDesign $checkBoxDesign CheckBox Design
|
||||||
|
* @return \FML\Script\Features\CheckBoxFeature
|
||||||
|
*/
|
||||||
|
public function setEnabledDesign(CheckBoxDesign $checkBoxDesign) {
|
||||||
|
$this->enabledDesign = $checkBoxDesign;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Disabled Design
|
||||||
|
*
|
||||||
|
* @param CheckBoxDesign $checkBoxDesign CheckBox Design
|
||||||
|
* @return \FML\Script\Features\CheckBoxFeature
|
||||||
|
*/
|
||||||
|
public function setDisabledDesign(CheckBoxDesign $checkBoxDesign) {
|
||||||
|
$this->disabledDesign = $checkBoxDesign;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
|
*/
|
||||||
|
public function prepare(Script $script) {
|
||||||
|
if ($this->getQuad()) {
|
||||||
|
$script->setScriptInclude(ScriptInclude::TEXTLIB);
|
||||||
|
$script->addScriptFunction(self::FUNCTION_UPDATE_QUAD_DESIGN, $this->buildSetQuadDesignFunction());
|
||||||
|
$script->appendGenericScriptLabel(ScriptLabel::ONINIT, $this->buildInitScriptText(), true);
|
||||||
|
$script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK, $this->buildClickScriptText());
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the Function Text
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function buildSetQuadDesignFunction() {
|
||||||
|
$functionText = "
|
||||||
|
Void " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(CMlQuad _Quad) {
|
||||||
|
declare " . self::VAR_CHECKBOX_ENABLED . " as Enabled for _Quad = True;
|
||||||
|
Enabled = !Enabled;
|
||||||
|
declare " . self::VAR_CHECKBOX_DESIGNS . " as Designs for _Quad = Text[Boolean];
|
||||||
|
declare Design = Designs[Enabled];
|
||||||
|
declare DesignParts = TextLib::Split(\"|\", Design);
|
||||||
|
if (DesignParts.count > 1) {
|
||||||
|
_Quad.Style = DesignParts[0];
|
||||||
|
_Quad.Substyle = DesignParts[1];
|
||||||
|
} else {
|
||||||
|
_Quad.ImageUrl = Design;
|
||||||
|
}
|
||||||
|
declare " . self::VAR_CHECKBOX_ENTRY_ID . " as EntryId for _Quad = \"\";
|
||||||
|
if (EntryId != \"\") {
|
||||||
|
declare Value = \"0\";
|
||||||
|
if (Enabled) {
|
||||||
|
Value = \"1\";
|
||||||
|
}
|
||||||
|
declare Entry <=> (Page.GetFirstChild(EntryId) as CMlEntry);
|
||||||
|
Entry.Value = Value;
|
||||||
|
}
|
||||||
|
}";
|
||||||
|
return $functionText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the Init Script Text
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function buildInitScriptText() {
|
||||||
|
$quadId = $this->getQuad()->getId(true);
|
||||||
|
$default = true;
|
||||||
|
$entryId = '';
|
||||||
|
if ($this->entry) {
|
||||||
|
$default = $this->entry->getDefault();
|
||||||
|
$entryId = $this->entry->getId(true);
|
||||||
|
}
|
||||||
|
$default = Builder::getBoolean($default);
|
||||||
|
$enabledDesignString = $this->enabledDesign->getDesignString();
|
||||||
|
$disabledDesignString = $this->disabledDesign->getDesignString();
|
||||||
|
$scriptText = "
|
||||||
|
declare Quad_CheckBox <=> (Page.GetFirstChild(\"{$quadId}\") as CMlQuad);
|
||||||
|
declare Text[Boolean] " . self::VAR_CHECKBOX_DESIGNS . " as Designs for Quad_CheckBox;
|
||||||
|
Designs[True] = \"{$enabledDesignString}\";
|
||||||
|
Designs[False] = \"{$disabledDesignString}\";
|
||||||
|
declare Boolean " . self::VAR_CHECKBOX_ENABLED . " as Enabled for Quad_CheckBox;
|
||||||
|
Enabled = {$default};
|
||||||
|
declare Text " . self::VAR_CHECKBOX_ENTRY_ID . " as EntryId for Quad_CheckBox;
|
||||||
|
EntryId = \"{$entryId}\";
|
||||||
|
" . self::FUNCTION_UPDATE_QUAD_DESIGN . "(Quad_CheckBox);
|
||||||
|
";
|
||||||
|
return $scriptText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the Script Text for Quad Clicks
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function buildClickScriptText() {
|
||||||
|
$quadId = $this->getQuad()->getId(true);
|
||||||
|
$scriptText = "
|
||||||
|
if (Event.ControlId == \"{$quadId}\") {
|
||||||
|
declare Quad_CheckBox <=> (Event.Control as CMlQuad);
|
||||||
|
" . self::FUNCTION_UPDATE_QUAD_DESIGN . "(Quad_CheckBox);
|
||||||
|
}";
|
||||||
|
return $scriptText;
|
||||||
|
}
|
||||||
|
}
|
@ -2,13 +2,10 @@
|
|||||||
|
|
||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
|
|
||||||
use FML\Script\Script;
|
|
||||||
use FML\Script\ScriptLabel;
|
|
||||||
|
|
||||||
|
|
||||||
use FML\Controls\Label;
|
use FML\Controls\Label;
|
||||||
|
use FML\Script\Script;
|
||||||
use FML\Script\ScriptInclude;
|
use FML\Script\ScriptInclude;
|
||||||
|
use FML\Script\ScriptLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script Feature showing the current Time on a Label
|
* Script Feature showing the current Time on a Label
|
||||||
@ -21,6 +18,7 @@ class Clock extends ScriptFeature {
|
|||||||
/*
|
/*
|
||||||
* Protected Properties
|
* Protected Properties
|
||||||
*/
|
*/
|
||||||
|
/** @var Label $label */
|
||||||
protected $label = null;
|
protected $label = null;
|
||||||
protected $showSeconds = null;
|
protected $showSeconds = null;
|
||||||
protected $showFullDate = null;
|
protected $showFullDate = null;
|
||||||
@ -57,7 +55,7 @@ class Clock extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\Clock
|
* @return \FML\Script\Features\Clock
|
||||||
*/
|
*/
|
||||||
public function setShowSeconds($showSeconds) {
|
public function setShowSeconds($showSeconds) {
|
||||||
$this->showSeconds = (bool) $showSeconds;
|
$this->showSeconds = (bool)$showSeconds;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,12 +66,11 @@ class Clock extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\Clock
|
* @return \FML\Script\Features\Clock
|
||||||
*/
|
*/
|
||||||
public function setShowFullDate($showFullDate) {
|
public function setShowFullDate($showFullDate) {
|
||||||
$this->showFullDate = (bool) $showFullDate;
|
$this->showFullDate = (bool)$showFullDate;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script) {
|
||||||
|
111
application/core/Libs/FML/Script/Features/ControlScript.php
Normal file
111
application/core/Libs/FML/Script/Features/ControlScript.php
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
|
use FML\Controls\Control;
|
||||||
|
use FML\Script\Script;
|
||||||
|
use FML\Script\ScriptLabel;
|
||||||
|
use FML\Types\Scriptable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script Feature for a Control-related Script
|
||||||
|
*
|
||||||
|
* @author steeffeen
|
||||||
|
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||||
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||||
|
*/
|
||||||
|
class ControlScript extends ScriptFeature {
|
||||||
|
/*
|
||||||
|
* Protected Properties
|
||||||
|
*/
|
||||||
|
/** @var Control $control */
|
||||||
|
protected $control = null;
|
||||||
|
protected $labelName = null;
|
||||||
|
protected $text = null;
|
||||||
|
protected $isolated = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new Custom Script Text
|
||||||
|
*
|
||||||
|
* @param Control $control Event Control
|
||||||
|
* @param string $text Script Text
|
||||||
|
* @param string $labelName (optional) Script Label Name
|
||||||
|
* @param bool $isolated (optional) Whether to isolate the Script Text
|
||||||
|
*/
|
||||||
|
public function __construct(Control $control, $text, $labelName = ScriptLabel::MOUSECLICK, $isolated = true) {
|
||||||
|
$this->setControl($control);
|
||||||
|
$this->setText($text);
|
||||||
|
$this->setLabelName($labelName);
|
||||||
|
$this->setIsolated($isolated);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Control
|
||||||
|
*
|
||||||
|
* @param Control $control Custom Control
|
||||||
|
* @return \FML\Script\Features\ControlScript
|
||||||
|
*/
|
||||||
|
public function setControl(Control $control) {
|
||||||
|
$control->checkId();
|
||||||
|
if ($control instanceof Scriptable) {
|
||||||
|
$control->setScriptEvents(true);
|
||||||
|
}
|
||||||
|
$this->control = $control;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Script Text
|
||||||
|
*
|
||||||
|
* @param string $text Script Text
|
||||||
|
* @return \FML\Script\Features\ControlScript
|
||||||
|
*/
|
||||||
|
public function setText($text) {
|
||||||
|
$this->text = (string)$text;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Label Name
|
||||||
|
*
|
||||||
|
* @param string $labelName Script Label Name
|
||||||
|
* @return \FML\Script\Features\ControlScript
|
||||||
|
*/
|
||||||
|
public function setLabelName($labelName) {
|
||||||
|
$this->labelName = $labelName;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether the Script should be isolated
|
||||||
|
*
|
||||||
|
* @param bool $isolated Whether to isolate the Script Text
|
||||||
|
* @return \FML\Script\Features\ControlScript
|
||||||
|
*/
|
||||||
|
public function setIsolated($isolated = true) {
|
||||||
|
$this->isolated = (bool)$isolated;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
|
*/
|
||||||
|
public function prepare(Script $script) {
|
||||||
|
$script->appendGenericScriptLabel($this->labelName, $this->getEncapsulatedText(), $this->isolated);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Script Text encapsulated for the Control Event
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getEncapsulatedText() {
|
||||||
|
$controlId = $this->control->getId(true);
|
||||||
|
$scriptText = "
|
||||||
|
if (Event.ControlId == \"{$controlId}\") {
|
||||||
|
{$this->text}
|
||||||
|
}";
|
||||||
|
return $scriptText;
|
||||||
|
}
|
||||||
|
}
|
@ -2,14 +2,11 @@
|
|||||||
|
|
||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
|
|
||||||
use FML\Script\Script;
|
|
||||||
use FML\Script\ScriptLabel;
|
|
||||||
use FML\Script\Builder;
|
|
||||||
|
|
||||||
|
|
||||||
use FML\Controls\Entry;
|
use FML\Controls\Entry;
|
||||||
|
use FML\Script\Builder;
|
||||||
|
use FML\Script\Script;
|
||||||
use FML\Script\ScriptInclude;
|
use FML\Script\ScriptInclude;
|
||||||
|
use FML\Script\ScriptLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script Feature for submitting an Entry
|
* Script Feature for submitting an Entry
|
||||||
@ -22,6 +19,7 @@ class EntrySubmit extends ScriptFeature {
|
|||||||
/*
|
/*
|
||||||
* Protected Properties
|
* Protected Properties
|
||||||
*/
|
*/
|
||||||
|
/** @var Entry $entry */
|
||||||
protected $entry = null;
|
protected $entry = null;
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
@ -56,12 +54,11 @@ class EntrySubmit extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\EntrySubmit
|
* @return \FML\Script\Features\EntrySubmit
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url) {
|
||||||
$this->url = (string) $url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script) {
|
||||||
@ -98,8 +95,7 @@ if (Event.Control.ControlId == \"{$controlId}\") {
|
|||||||
$paramsBegin = stripos($url, '?');
|
$paramsBegin = stripos($url, '?');
|
||||||
if (!is_int($paramsBegin) || $paramsBegin < 0) {
|
if (!is_int($paramsBegin) || $paramsBegin < 0) {
|
||||||
$url .= '?';
|
$url .= '?';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$url .= '&';
|
$url .= '&';
|
||||||
}
|
}
|
||||||
return $url;
|
return $url;
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Script\Builder;
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use FML\Script\ScriptLabel;
|
use FML\Script\ScriptLabel;
|
||||||
use FML\Script\Builder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script Feature for triggering a Page Action on Key Press
|
* Script Feature for triggering a Page Action on Key Press
|
||||||
@ -46,7 +45,7 @@ class KeyAction extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\KeyAction
|
* @return \FML\Script\Features\KeyAction
|
||||||
*/
|
*/
|
||||||
public function setActionName($actionName) {
|
public function setActionName($actionName) {
|
||||||
$this->actionName = (string) $actionName;
|
$this->actionName = (string)$actionName;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ class KeyAction extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\KeyAction
|
* @return \FML\Script\Features\KeyAction
|
||||||
*/
|
*/
|
||||||
public function setKeyName($keyName) {
|
public function setKeyName($keyName) {
|
||||||
$this->keyName = (string) $keyName;
|
$this->keyName = (string)$keyName;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +83,6 @@ class KeyAction extends ScriptFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script) {
|
||||||
@ -103,11 +101,10 @@ class KeyAction extends ScriptFeature {
|
|||||||
$value = $this->keyName;
|
$value = $this->keyName;
|
||||||
if ($this->keyCode !== null) {
|
if ($this->keyCode !== null) {
|
||||||
$key = 'KeyCode';
|
$key = 'KeyCode';
|
||||||
$value = (int) $this->keyCode;
|
$value = (int)$this->keyCode;
|
||||||
}
|
} else if ($this->charPressed !== null) {
|
||||||
else if ($this->charPressed !== null) {
|
|
||||||
$key = 'CharPressed';
|
$key = 'CharPressed';
|
||||||
$value = (string) $this->charPressed;
|
$value = (string)$this->charPressed;
|
||||||
}
|
}
|
||||||
$scriptText = "
|
$scriptText = "
|
||||||
if (Event.{$key} == \"{$value}\") {
|
if (Event.{$key} == \"{$value}\") {
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
|
use FML\Script\Builder;
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use FML\Script\ScriptLabel;
|
use FML\Script\ScriptLabel;
|
||||||
use FML\Script\Builder;
|
use FML\Types\Scriptable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script Feature for opening the Map Info
|
* Script Feature for opening the Map Info
|
||||||
@ -19,6 +19,7 @@ class MapInfo extends ScriptFeature {
|
|||||||
/*
|
/*
|
||||||
* Protected Properties
|
* Protected Properties
|
||||||
*/
|
*/
|
||||||
|
/** @var Control $control */
|
||||||
protected $control = null;
|
protected $control = null;
|
||||||
protected $labelName = null;
|
protected $labelName = null;
|
||||||
|
|
||||||
@ -36,12 +37,14 @@ class MapInfo extends ScriptFeature {
|
|||||||
/**
|
/**
|
||||||
* Set the Control
|
* Set the Control
|
||||||
*
|
*
|
||||||
* @param Control $control Action Control
|
* @param Control $control Map Info Control
|
||||||
* @return \FML\Script\Features\ActionTrigger
|
* @return \FML\Script\Features\MapInfo
|
||||||
*/
|
*/
|
||||||
public function setControl(Control $control) {
|
public function setControl(Control $control) {
|
||||||
$control->checkId();
|
$control->checkId();
|
||||||
|
if ($control instanceof Scriptable) {
|
||||||
$control->setScriptEvents(true);
|
$control->setScriptEvents(true);
|
||||||
|
}
|
||||||
$this->control = $control;
|
$this->control = $control;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -50,7 +53,7 @@ class MapInfo extends ScriptFeature {
|
|||||||
* Set the Label Name
|
* Set the Label Name
|
||||||
*
|
*
|
||||||
* @param string $labelName Script Label Name
|
* @param string $labelName Script Label Name
|
||||||
* @return \FML\Script\Features\ActionTrigger
|
* @return \FML\Script\Features\MapInfo
|
||||||
*/
|
*/
|
||||||
public function setLabelName($labelName) {
|
public function setLabelName($labelName) {
|
||||||
$this->labelName = $labelName;
|
$this->labelName = $labelName;
|
||||||
@ -58,7 +61,6 @@ class MapInfo extends ScriptFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script) {
|
||||||
@ -79,8 +81,7 @@ class MapInfo extends ScriptFeature {
|
|||||||
if (Event.Control.ControlId == \"{$controlId}\") {
|
if (Event.Control.ControlId == \"{$controlId}\") {
|
||||||
ShowCurChallengeCard();
|
ShowCurChallengeCard();
|
||||||
}";
|
}";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Other
|
// Other
|
||||||
$scriptText = "
|
$scriptText = "
|
||||||
ShowCurChallengeCard();";
|
ShowCurChallengeCard();";
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
|
use FML\Script\Builder;
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use FML\Script\ScriptLabel;
|
use FML\Script\ScriptLabel;
|
||||||
use FML\Script\Builder;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script Feature realising a Menu showing specific Controls for the different Item Controls
|
* Script Feature realising a Menu showing specific Controls for the different Item Controls
|
||||||
@ -25,6 +24,7 @@ class Menu extends ScriptFeature {
|
|||||||
* Protected Properties
|
* Protected Properties
|
||||||
*/
|
*/
|
||||||
protected $elements = array();
|
protected $elements = array();
|
||||||
|
/** @var MenuElement $startElement */
|
||||||
protected $startElement = null;
|
protected $startElement = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +35,7 @@ class Menu extends ScriptFeature {
|
|||||||
*/
|
*/
|
||||||
public function __construct(Control $item = null, Control $control = null) {
|
public function __construct(Control $item = null, Control $control = null) {
|
||||||
if ($item && $control) {
|
if ($item && $control) {
|
||||||
$this->addNewElement($item, $control);
|
$this->addElement($item, $control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,8 +64,7 @@ class Menu extends ScriptFeature {
|
|||||||
array_push($this->elements, $menuElement);
|
array_push($this->elements, $menuElement);
|
||||||
if ($isStartElement) {
|
if ($isStartElement) {
|
||||||
$this->setStartElement($menuElement);
|
$this->setStartElement($menuElement);
|
||||||
}
|
} else if (count($this->elements) > 1) {
|
||||||
else if (count($this->elements) > 1) {
|
|
||||||
$menuElement->getControl()->setVisible(false);
|
$menuElement->getControl()->setVisible(false);
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
@ -86,7 +85,6 @@ class Menu extends ScriptFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script) {
|
||||||
@ -131,7 +129,9 @@ Void {$updateFunctionName}(Text[Text] _Elements, Text _ShownControlId) {
|
|||||||
protected function getElementsArrayText() {
|
protected function getElementsArrayText() {
|
||||||
$elements = array();
|
$elements = array();
|
||||||
foreach ($this->elements as $element) {
|
foreach ($this->elements as $element) {
|
||||||
$elements[$element->getItem()->getId()] = $element->getControl()->getId();
|
/** @var MenuElement $element */
|
||||||
|
$elementId = $element->getItem()->getId();
|
||||||
|
$elements[$elementId] = $element->getControl()->getId();
|
||||||
}
|
}
|
||||||
return Builder::getArray($elements, true);
|
return Builder::getArray($elements, true);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
|
use FML\Types\Scriptable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An Element for the Menu Feature
|
* An Element for the Menu Feature
|
||||||
@ -37,7 +38,9 @@ class MenuElement {
|
|||||||
*/
|
*/
|
||||||
public function setItem(Control $item) {
|
public function setItem(Control $item) {
|
||||||
$item->checkId();
|
$item->checkId();
|
||||||
|
if ($item instanceof Scriptable) {
|
||||||
$item->setScriptEvents(true);
|
$item->setScriptEvents(true);
|
||||||
|
}
|
||||||
$this->item = $item;
|
$this->item = $item;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
use FML\Script\Script;
|
|
||||||
use FML\Script\ScriptLabel;
|
|
||||||
use FML\Script\Builder;
|
|
||||||
use FML\Controls\Label;
|
use FML\Controls\Label;
|
||||||
|
use FML\Script\Builder;
|
||||||
|
use FML\Script\Script;
|
||||||
use FML\Script\ScriptInclude;
|
use FML\Script\ScriptInclude;
|
||||||
|
use FML\Script\ScriptLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script Feature realising a Mechanism for browsing through Pages
|
* Script Feature realising a Mechanism for browsing through Pages
|
||||||
@ -28,6 +28,7 @@ class Paging extends ScriptFeature {
|
|||||||
*/
|
*/
|
||||||
protected $pages = array();
|
protected $pages = array();
|
||||||
protected $buttons = array();
|
protected $buttons = array();
|
||||||
|
/** @var Label $label */
|
||||||
protected $label = null;
|
protected $label = null;
|
||||||
protected $startPageNumber = null;
|
protected $startPageNumber = null;
|
||||||
protected $customMaxPageNumber = null;
|
protected $customMaxPageNumber = null;
|
||||||
@ -85,8 +86,7 @@ class Paging extends ScriptFeature {
|
|||||||
$buttonCount = count($this->buttons);
|
$buttonCount = count($this->buttons);
|
||||||
if ($buttonCount % 2 === 0) {
|
if ($buttonCount % 2 === 0) {
|
||||||
$browseAction = $buttonCount / 2 + 1;
|
$browseAction = $buttonCount / 2 + 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$browseAction = $buttonCount / -2 - 1;
|
$browseAction = $buttonCount / -2 - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ class Paging extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\Paging
|
* @return \FML\Script\Features\Paging
|
||||||
*/
|
*/
|
||||||
public function setStartPageNumber($startPageNumber) {
|
public function setStartPageNumber($startPageNumber) {
|
||||||
$this->startPageNumber = (int) $startPageNumber;
|
$this->startPageNumber = (int)$startPageNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -135,7 +135,7 @@ class Paging extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\Paging
|
* @return \FML\Script\Features\Paging
|
||||||
*/
|
*/
|
||||||
public function setCustomMaxPageNumber($maxPageNumber) {
|
public function setCustomMaxPageNumber($maxPageNumber) {
|
||||||
$this->customMaxPageNumber = (int) $maxPageNumber;
|
$this->customMaxPageNumber = (int)$maxPageNumber;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ class Paging extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\Paging
|
* @return \FML\Script\Features\Paging
|
||||||
*/
|
*/
|
||||||
public function setPreviousChunkAction($previousChunkAction) {
|
public function setPreviousChunkAction($previousChunkAction) {
|
||||||
$this->previousChunkAction = (string) $previousChunkAction;
|
$this->previousChunkAction = (string)$previousChunkAction;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ class Paging extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\Paging
|
* @return \FML\Script\Features\Paging
|
||||||
*/
|
*/
|
||||||
public function setNextChunkAction($nextChunkAction) {
|
public function setNextChunkAction($nextChunkAction) {
|
||||||
$this->nextChunkAction = (string) $nextChunkAction;
|
$this->nextChunkAction = (string)$nextChunkAction;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,15 +178,13 @@ class Paging extends ScriptFeature {
|
|||||||
*
|
*
|
||||||
* @param bool $appendPageNumber Whether to append the needed Page Number
|
* @param bool $appendPageNumber Whether to append the needed Page Number
|
||||||
* @return \FML\Script\Features\Paging
|
* @return \FML\Script\Features\Paging
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function setChunkActionAppendsPageNumber($appendPageNumber) {
|
public function setChunkActionAppendsPageNumber($appendPageNumber) {
|
||||||
$this->chunkActionAppendsPageNumber = (bool) $appendPageNumber;
|
$this->chunkActionAppendsPageNumber = (bool)$appendPageNumber;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script) {
|
||||||
@ -284,6 +282,7 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct
|
|||||||
$minPageNumber = null;
|
$minPageNumber = null;
|
||||||
$minPage = null;
|
$minPage = null;
|
||||||
foreach ($this->pages as $page) {
|
foreach ($this->pages as $page) {
|
||||||
|
/** @var PagingPage $page */
|
||||||
$pageNumber = $page->getPageNumber();
|
$pageNumber = $page->getPageNumber();
|
||||||
if ($minPageNumber === null || $pageNumber < $minPageNumber) {
|
if ($minPageNumber === null || $pageNumber < $minPageNumber) {
|
||||||
$minPageNumber = $pageNumber;
|
$minPageNumber = $pageNumber;
|
||||||
@ -302,6 +301,7 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct
|
|||||||
$maxPageNumber = null;
|
$maxPageNumber = null;
|
||||||
$maxPage = null;
|
$maxPage = null;
|
||||||
foreach ($this->pages as $page) {
|
foreach ($this->pages as $page) {
|
||||||
|
/** @var PagingPage $page */
|
||||||
$pageNumber = $page->getPageNumber();
|
$pageNumber = $page->getPageNumber();
|
||||||
if ($maxPageNumber === null || $pageNumber > $maxPageNumber) {
|
if ($maxPageNumber === null || $pageNumber > $maxPageNumber) {
|
||||||
$maxPageNumber = $pageNumber;
|
$maxPageNumber = $pageNumber;
|
||||||
@ -319,7 +319,9 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct
|
|||||||
protected function getPagesArrayText() {
|
protected function getPagesArrayText() {
|
||||||
$pages = array();
|
$pages = array();
|
||||||
foreach ($this->pages as $page) {
|
foreach ($this->pages as $page) {
|
||||||
$pages[$page->getPageNumber()] = $page->getControl()->getId();
|
/** @var PagingPage $page */
|
||||||
|
$pageNumber = $page->getPageNumber();
|
||||||
|
$pages[$pageNumber] = $page->getControl()->getId();
|
||||||
}
|
}
|
||||||
return Builder::getArray($pages, true);
|
return Builder::getArray($pages, true);
|
||||||
}
|
}
|
||||||
@ -335,7 +337,9 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct
|
|||||||
}
|
}
|
||||||
$pageButtons = array();
|
$pageButtons = array();
|
||||||
foreach ($this->buttons as $pageButton) {
|
foreach ($this->buttons as $pageButton) {
|
||||||
$pageButtons[$pageButton->getControl()->getId()] = $pageButton->getBrowseAction();
|
/** @var PagingButton $pageButton */
|
||||||
|
$pageButtonId = $pageButton->getControl()->getId();
|
||||||
|
$pageButtons[$pageButtonId] = $pageButton->getBrowseAction();
|
||||||
}
|
}
|
||||||
return Builder::getArray($pageButtons, true);
|
return Builder::getArray($pageButtons, true);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
|
use FML\Types\Scriptable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Button for browsing through Pages
|
* A Button for browsing through Pages
|
||||||
@ -37,7 +38,9 @@ class PagingButton {
|
|||||||
*/
|
*/
|
||||||
public function setControl(Control $control) {
|
public function setControl(Control $control) {
|
||||||
$control->checkId();
|
$control->checkId();
|
||||||
|
if ($control instanceof Scriptable) {
|
||||||
$control->setScriptEvents(true);
|
$control->setScriptEvents(true);
|
||||||
|
}
|
||||||
$this->control = $control;
|
$this->control = $control;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -58,7 +61,7 @@ class PagingButton {
|
|||||||
* @return \FML\Script\Features\PagingButton
|
* @return \FML\Script\Features\PagingButton
|
||||||
*/
|
*/
|
||||||
public function setBrowseAction($browseAction) {
|
public function setBrowseAction($browseAction) {
|
||||||
$this->browseAction = (int) $browseAction;
|
$this->browseAction = (int)$browseAction;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,9 +3,10 @@
|
|||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
|
use FML\Script\Builder;
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use FML\Script\ScriptLabel;
|
use FML\Script\ScriptLabel;
|
||||||
use FML\Script\Builder;
|
use FML\Types\Scriptable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script Feature for opening a Player Profile
|
* Script Feature for opening a Player Profile
|
||||||
@ -19,6 +20,7 @@ class PlayerProfile extends ScriptFeature {
|
|||||||
* Protected Properties
|
* Protected Properties
|
||||||
*/
|
*/
|
||||||
protected $login = null;
|
protected $login = null;
|
||||||
|
/** @var Control $control */
|
||||||
protected $control = null;
|
protected $control = null;
|
||||||
protected $labelName = null;
|
protected $labelName = null;
|
||||||
|
|
||||||
@ -54,7 +56,9 @@ class PlayerProfile extends ScriptFeature {
|
|||||||
*/
|
*/
|
||||||
public function setControl(Control $control) {
|
public function setControl(Control $control) {
|
||||||
$control->checkId();
|
$control->checkId();
|
||||||
|
if ($control instanceof Scriptable) {
|
||||||
$control->setScriptEvents(true);
|
$control->setScriptEvents(true);
|
||||||
|
}
|
||||||
$this->control = $control;
|
$this->control = $control;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -71,7 +75,6 @@ class PlayerProfile extends ScriptFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script) {
|
||||||
@ -93,8 +96,7 @@ class PlayerProfile extends ScriptFeature {
|
|||||||
if (Event.Control.ControlId == \"{$controlId}\") {
|
if (Event.Control.ControlId == \"{$controlId}\") {
|
||||||
ShowProfile(\"{$login}\");
|
ShowProfile(\"{$login}\");
|
||||||
}";
|
}";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Other
|
// Other
|
||||||
$scriptText = "
|
$scriptText = "
|
||||||
ShowProfile(\"{$login}\");";
|
ShowProfile(\"{$login}\");";
|
||||||
|
@ -5,7 +5,7 @@ namespace FML\Script\Features;
|
|||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use FML\Script\ScriptLabel;
|
use FML\Script\ScriptLabel;
|
||||||
|
use FML\Types\Scriptable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script Feature for toggling Controls
|
* Script Feature for toggling Controls
|
||||||
@ -18,7 +18,9 @@ class Toggle extends ScriptFeature {
|
|||||||
/*
|
/*
|
||||||
* Protected Properties
|
* Protected Properties
|
||||||
*/
|
*/
|
||||||
|
/** @var Control $togglingControl */
|
||||||
protected $togglingControl = null;
|
protected $togglingControl = null;
|
||||||
|
/** @var Control $toggledControl */
|
||||||
protected $toggledControl = null;
|
protected $toggledControl = null;
|
||||||
protected $labelName = null;
|
protected $labelName = null;
|
||||||
protected $onlyShow = null;
|
protected $onlyShow = null;
|
||||||
@ -49,7 +51,9 @@ class Toggle extends ScriptFeature {
|
|||||||
*/
|
*/
|
||||||
public function setTogglingControl(Control $control) {
|
public function setTogglingControl(Control $control) {
|
||||||
$control->checkId();
|
$control->checkId();
|
||||||
|
if ($control instanceof Scriptable) {
|
||||||
$control->setScriptEvents(true);
|
$control->setScriptEvents(true);
|
||||||
|
}
|
||||||
$this->togglingControl = $control;
|
$this->togglingControl = $control;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -73,7 +77,7 @@ class Toggle extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\Toggle
|
* @return \FML\Script\Features\Toggle
|
||||||
*/
|
*/
|
||||||
public function setLabelName($labelName) {
|
public function setLabelName($labelName) {
|
||||||
$this->labelName = (string) $labelName;
|
$this->labelName = (string)$labelName;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +88,7 @@ class Toggle extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\Toggle
|
* @return \FML\Script\Features\Toggle
|
||||||
*/
|
*/
|
||||||
public function setOnlyShow($onlyShow) {
|
public function setOnlyShow($onlyShow) {
|
||||||
$this->onlyShow = (bool) $onlyShow;
|
$this->onlyShow = (bool)$onlyShow;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,12 +99,11 @@ class Toggle extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\Toggle
|
* @return \FML\Script\Features\Toggle
|
||||||
*/
|
*/
|
||||||
public function setOnlyHide($onlyHide) {
|
public function setOnlyHide($onlyHide) {
|
||||||
$this->onlyHide = (bool) $onlyHide;
|
$this->onlyHide = (bool)$onlyHide;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script) {
|
||||||
@ -119,8 +122,7 @@ class Toggle extends ScriptFeature {
|
|||||||
$visibility = '!ToggleControl.Visible';
|
$visibility = '!ToggleControl.Visible';
|
||||||
if ($this->onlyShow) {
|
if ($this->onlyShow) {
|
||||||
$visibility = 'True';
|
$visibility = 'True';
|
||||||
}
|
} else if ($this->onlyHide) {
|
||||||
else if ($this->onlyHide) {
|
|
||||||
$visibility = 'False';
|
$visibility = 'False';
|
||||||
}
|
}
|
||||||
$scriptText = "
|
$scriptText = "
|
||||||
|
@ -3,12 +3,11 @@
|
|||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
|
use FML\Controls\Label;
|
||||||
|
use FML\Script\Builder;
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use FML\Script\ScriptLabel;
|
use FML\Script\ScriptLabel;
|
||||||
use FML\Script\Builder;
|
use FML\Types\Scriptable;
|
||||||
|
|
||||||
|
|
||||||
use FML\Controls\Label;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script Feature for Showing Tooltips
|
* Script Feature for Showing Tooltips
|
||||||
@ -21,7 +20,9 @@ class Tooltip extends ScriptFeature {
|
|||||||
/*
|
/*
|
||||||
* Protected Properties
|
* Protected Properties
|
||||||
*/
|
*/
|
||||||
|
/** @var Control $hoverControl */
|
||||||
protected $hoverControl = null;
|
protected $hoverControl = null;
|
||||||
|
/** @var Control $tooltipControl */
|
||||||
protected $tooltipControl = null;
|
protected $tooltipControl = null;
|
||||||
protected $stayOnClick = null;
|
protected $stayOnClick = null;
|
||||||
protected $invert = null;
|
protected $invert = null;
|
||||||
@ -52,7 +53,9 @@ class Tooltip extends ScriptFeature {
|
|||||||
*/
|
*/
|
||||||
public function setHoverControl(Control $hoverControl) {
|
public function setHoverControl(Control $hoverControl) {
|
||||||
$hoverControl->checkId();
|
$hoverControl->checkId();
|
||||||
|
if ($hoverControl instanceof Scriptable) {
|
||||||
$hoverControl->setScriptEvents(true);
|
$hoverControl->setScriptEvents(true);
|
||||||
|
}
|
||||||
$this->hoverControl = $hoverControl;
|
$this->hoverControl = $hoverControl;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -77,7 +80,7 @@ class Tooltip extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\Tooltip
|
* @return \FML\Script\Features\Tooltip
|
||||||
*/
|
*/
|
||||||
public function setStayOnClick($stayOnClick) {
|
public function setStayOnClick($stayOnClick) {
|
||||||
$this->stayOnClick = (bool) $stayOnClick;
|
$this->stayOnClick = (bool)$stayOnClick;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +91,7 @@ class Tooltip extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\Tooltip
|
* @return \FML\Script\Features\Tooltip
|
||||||
*/
|
*/
|
||||||
public function setInvert($invert) {
|
public function setInvert($invert) {
|
||||||
$this->invert = (bool) $invert;
|
$this->invert = (bool)$invert;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +107,6 @@ class Tooltip extends ScriptFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script) {
|
||||||
|
@ -3,9 +3,10 @@
|
|||||||
namespace FML\Script\Features;
|
namespace FML\Script\Features;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
|
use FML\Script\Builder;
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use FML\Script\ScriptLabel;
|
use FML\Script\ScriptLabel;
|
||||||
use FML\Script\Builder;
|
use FML\Types\Scriptable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Script Feature for playing an UI Sound
|
* Script Feature for playing an UI Sound
|
||||||
@ -52,6 +53,7 @@ class UISound extends ScriptFeature {
|
|||||||
* Protected Properties
|
* Protected Properties
|
||||||
*/
|
*/
|
||||||
protected $soundName = null;
|
protected $soundName = null;
|
||||||
|
/** @var Control $control */
|
||||||
protected $control = null;
|
protected $control = null;
|
||||||
protected $variant = 0;
|
protected $variant = 0;
|
||||||
protected $volume = 1.;
|
protected $volume = 1.;
|
||||||
@ -79,7 +81,7 @@ class UISound extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\UISound
|
* @return \FML\Script\Features\UISound
|
||||||
*/
|
*/
|
||||||
public function setSoundName($soundName) {
|
public function setSoundName($soundName) {
|
||||||
$this->soundName = (string) $soundName;
|
$this->soundName = (string)$soundName;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +93,9 @@ class UISound extends ScriptFeature {
|
|||||||
*/
|
*/
|
||||||
public function setControl(Control $control) {
|
public function setControl(Control $control) {
|
||||||
$control->checkId();
|
$control->checkId();
|
||||||
|
if ($control instanceof Scriptable) {
|
||||||
$control->setScriptEvents(true);
|
$control->setScriptEvents(true);
|
||||||
|
}
|
||||||
$this->control = $control;
|
$this->control = $control;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -103,7 +107,7 @@ class UISound extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\UISound
|
* @return \FML\Script\Features\UISound
|
||||||
*/
|
*/
|
||||||
public function setVariant($variant) {
|
public function setVariant($variant) {
|
||||||
$this->variant = (int) $variant;
|
$this->variant = (int)$variant;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +118,7 @@ class UISound extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\UISound
|
* @return \FML\Script\Features\UISound
|
||||||
*/
|
*/
|
||||||
public function setVolume($volume) {
|
public function setVolume($volume) {
|
||||||
$this->volume = (float) $volume;
|
$this->volume = (float)$volume;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,12 +129,11 @@ class UISound extends ScriptFeature {
|
|||||||
* @return \FML\Script\Features\UISound
|
* @return \FML\Script\Features\UISound
|
||||||
*/
|
*/
|
||||||
public function setLabelName($labelName) {
|
public function setLabelName($labelName) {
|
||||||
$this->labelName = (string) $labelName;
|
$this->labelName = (string)$labelName;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see \FML\Script\Features\ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script) {
|
||||||
@ -151,8 +154,7 @@ class UISound extends ScriptFeature {
|
|||||||
if (Event.Control.ControlId == \"{$controlId}\") {
|
if (Event.Control.ControlId == \"{$controlId}\") {
|
||||||
PlayUiSound(CMlScriptIngame::EUISound::{$this->soundName}, {$this->variant}, {$this->volume});
|
PlayUiSound(CMlScriptIngame::EUISound::{$this->soundName}, {$this->variant}, {$this->volume});
|
||||||
}";
|
}";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Other
|
// Other
|
||||||
$scriptText = "
|
$scriptText = "
|
||||||
PlayUiSound(CMlScriptIngame::EUISound::{$this->soundName}, {$this->variant}, {$this->volume});";
|
PlayUiSound(CMlScriptIngame::EUISound::{$this->soundName}, {$this->variant}, {$this->volume});";
|
||||||
|
@ -41,11 +41,11 @@ class Script {
|
|||||||
public function setScriptInclude($file, $namespace = null) {
|
public function setScriptInclude($file, $namespace = null) {
|
||||||
if (is_object($file) && ($file instanceof ScriptInclude)) {
|
if (is_object($file) && ($file instanceof ScriptInclude)) {
|
||||||
$scriptInclude = $file;
|
$scriptInclude = $file;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scriptInclude = new ScriptInclude($file, $namespace);
|
$scriptInclude = new ScriptInclude($file, $namespace);
|
||||||
}
|
}
|
||||||
$this->includes[$scriptInclude->getNamespace()] = $scriptInclude;
|
$namespace = $scriptInclude->getNamespace();
|
||||||
|
$this->includes[$namespace] = $scriptInclude;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,8 +59,7 @@ class Script {
|
|||||||
public function addScriptConstant($name, $value = null) {
|
public function addScriptConstant($name, $value = null) {
|
||||||
if (is_object($name) && ($name instanceof ScriptConstant)) {
|
if (is_object($name) && ($name instanceof ScriptConstant)) {
|
||||||
$scriptConstant = $name;
|
$scriptConstant = $name;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scriptConstant = new ScriptConstant($name, $value);
|
$scriptConstant = new ScriptConstant($name, $value);
|
||||||
}
|
}
|
||||||
array_push($this->constants, $scriptConstant);
|
array_push($this->constants, $scriptConstant);
|
||||||
@ -77,8 +76,7 @@ class Script {
|
|||||||
public function addScriptFunction($name, $text = null) {
|
public function addScriptFunction($name, $text = null) {
|
||||||
if (is_object($name) && ($name instanceof ScriptFunction)) {
|
if (is_object($name) && ($name instanceof ScriptFunction)) {
|
||||||
$scriptFunction = $name;
|
$scriptFunction = $name;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scriptFunction = new ScriptFunction($name, $text);
|
$scriptFunction = new ScriptFunction($name, $text);
|
||||||
}
|
}
|
||||||
if (!in_array($scriptFunction, $this->functions)) {
|
if (!in_array($scriptFunction, $this->functions)) {
|
||||||
@ -97,8 +95,7 @@ class Script {
|
|||||||
public function addCustomScriptLabel($name, $text = null) {
|
public function addCustomScriptLabel($name, $text = null) {
|
||||||
if (is_object($name) && ($name instanceof ScriptLabel)) {
|
if (is_object($name) && ($name instanceof ScriptLabel)) {
|
||||||
$scriptLabel = $name;
|
$scriptLabel = $name;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scriptLabel = new ScriptLabel($name, $text);
|
$scriptLabel = new ScriptLabel($name, $text);
|
||||||
}
|
}
|
||||||
array_push($this->customLabels, $scriptLabel);
|
array_push($this->customLabels, $scriptLabel);
|
||||||
@ -116,8 +113,7 @@ class Script {
|
|||||||
public function appendGenericScriptLabel($name, $text = null, $isolated = false) {
|
public function appendGenericScriptLabel($name, $text = null, $isolated = false) {
|
||||||
if (is_object($name) && ($name instanceof ScriptLabel)) {
|
if (is_object($name) && ($name instanceof ScriptLabel)) {
|
||||||
$scriptLabel = $name;
|
$scriptLabel = $name;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scriptLabel = new ScriptLabel($name, $text, $isolated);
|
$scriptLabel = new ScriptLabel($name, $text, $isolated);
|
||||||
}
|
}
|
||||||
array_push($this->genericLabels, $scriptLabel);
|
array_push($this->genericLabels, $scriptLabel);
|
||||||
@ -222,6 +218,7 @@ class Script {
|
|||||||
* FancyManiaLinks v' . FML_VERSION . ' by steeffeen *
|
* FancyManiaLinks v' . FML_VERSION . ' by steeffeen *
|
||||||
* http://github.com/steeffeen/FancyManiaLinks *
|
* http://github.com/steeffeen/FancyManiaLinks *
|
||||||
****************************************************/
|
****************************************************/
|
||||||
|
|
||||||
';
|
';
|
||||||
return $headerComment;
|
return $headerComment;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ class ScriptLabel {
|
|||||||
* @return \FML\Script\ScriptLabel
|
* @return \FML\Script\ScriptLabel
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name) {
|
||||||
$this->name = (string) $name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ class ScriptLabel {
|
|||||||
* @return \FML\Script\ScriptLabel
|
* @return \FML\Script\ScriptLabel
|
||||||
*/
|
*/
|
||||||
public function setText($text) {
|
public function setText($text) {
|
||||||
$this->text = (string) $text;
|
$this->text = (string)$text;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class ScriptLabel {
|
|||||||
* @return \FML\Script\ScriptLabel
|
* @return \FML\Script\ScriptLabel
|
||||||
*/
|
*/
|
||||||
public function setIsolated($isolated) {
|
public function setIsolated($isolated) {
|
||||||
$this->isolated = (bool) $isolated;
|
$this->isolated = (bool)$isolated;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace FML\Stylesheet;
|
namespace FML\Stylesheet;
|
||||||
|
|
||||||
// Warning: The mood class isn't fully supported yet!
|
// Warning: The mood class isn't fully supported yet!
|
||||||
// Missing attributes: LDir1..
|
// Missing attributes: LDir1..
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing a Stylesheets Mood
|
* Class representing a Stylesheets Mood
|
||||||
@ -57,9 +57,9 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setLightAmbientColor($red, $green, $blue) {
|
public function setLightAmbientColor($red, $green, $blue) {
|
||||||
$red = (float) $red;
|
$red = (float)$red;
|
||||||
$green = (float) $green;
|
$green = (float)$green;
|
||||||
$blue = (float) $blue;
|
$blue = (float)$blue;
|
||||||
$this->lAmbient_LinearRgb = "{$red} {$green} {$blue}";
|
$this->lAmbient_LinearRgb = "{$red} {$green} {$blue}";
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -73,9 +73,9 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setCloudsColorMin($red, $green, $blue) {
|
public function setCloudsColorMin($red, $green, $blue) {
|
||||||
$red = (float) $red;
|
$red = (float)$red;
|
||||||
$green = (float) $green;
|
$green = (float)$green;
|
||||||
$blue = (float) $blue;
|
$blue = (float)$blue;
|
||||||
$this->cloudsRgbMinLinear = "{$red} {$green} {$blue}";
|
$this->cloudsRgbMinLinear = "{$red} {$green} {$blue}";
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -89,9 +89,9 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setCloudsColorMax($red, $green, $blue) {
|
public function setCloudsColorMax($red, $green, $blue) {
|
||||||
$red = (float) $red;
|
$red = (float)$red;
|
||||||
$green = (float) $green;
|
$green = (float)$green;
|
||||||
$blue = (float) $blue;
|
$blue = (float)$blue;
|
||||||
$this->cloudsRgbMaxLinear = "{$red} {$green} {$blue}";
|
$this->cloudsRgbMaxLinear = "{$red} {$green} {$blue}";
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -105,9 +105,9 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setLight0Color($red, $green, $blue) {
|
public function setLight0Color($red, $green, $blue) {
|
||||||
$red = (float) $red;
|
$red = (float)$red;
|
||||||
$green = (float) $green;
|
$green = (float)$green;
|
||||||
$blue = (float) $blue;
|
$blue = (float)$blue;
|
||||||
$this->lDir0_LinearRgb = "{$red} {$green} {$blue}";
|
$this->lDir0_LinearRgb = "{$red} {$green} {$blue}";
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setLight0Intensity($intensity) {
|
public function setLight0Intensity($intensity) {
|
||||||
$this->lDir0_Intens = (float) $intensity;
|
$this->lDir0_Intens = (float)$intensity;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setLight0PhiAngle($phiAngle) {
|
public function setLight0PhiAngle($phiAngle) {
|
||||||
$this->lDir0_DirPhi = (float) $phiAngle;
|
$this->lDir0_DirPhi = (float)$phiAngle;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setLight0ThetaAngle($thetaAngle) {
|
public function setLight0ThetaAngle($thetaAngle) {
|
||||||
$this->lDir0_DirTheta = (float) $thetaAngle;
|
$this->lDir0_DirTheta = (float)$thetaAngle;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,9 +154,9 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setLightBallColor($red, $green, $blue) {
|
public function setLightBallColor($red, $green, $blue) {
|
||||||
$red = (float) $red;
|
$red = (float)$red;
|
||||||
$green = (float) $green;
|
$green = (float)$green;
|
||||||
$blue = (float) $blue;
|
$blue = (float)$blue;
|
||||||
$this->lBall_LinearRgb = "{$red} {$green} {$blue}";
|
$this->lBall_LinearRgb = "{$red} {$green} {$blue}";
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setLightBallIntensity($intensity) {
|
public function setLightBallIntensity($intensity) {
|
||||||
$this->lBall_Intensity = (float) $intensity;
|
$this->lBall_Intensity = (float)$intensity;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setLightBallRadius($radius) {
|
public function setLightBallRadius($radius) {
|
||||||
$this->lBall_Radius = (float) $radius;
|
$this->lBall_Radius = (float)$radius;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,9 +192,9 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setFogColor($red, $green, $blue) {
|
public function setFogColor($red, $green, $blue) {
|
||||||
$red = (float) $red;
|
$red = (float)$red;
|
||||||
$green = (float) $green;
|
$green = (float)$green;
|
||||||
$blue = (float) $blue;
|
$blue = (float)$blue;
|
||||||
$this->fogColorSrgb = "{$red} {$green} {$blue}";
|
$this->fogColorSrgb = "{$red} {$green} {$blue}";
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -208,9 +208,9 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setSelfIllumColor($red, $green, $blue) {
|
public function setSelfIllumColor($red, $green, $blue) {
|
||||||
$red = (float) $red;
|
$red = (float)$red;
|
||||||
$green = (float) $green;
|
$green = (float)$green;
|
||||||
$blue = (float) $blue;
|
$blue = (float)$blue;
|
||||||
$this->selfIllumColor = "{$red} {$green} {$blue}";
|
$this->selfIllumColor = "{$red} {$green} {$blue}";
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function setSkyGradientScale($scale) {
|
public function setSkyGradientScale($scale) {
|
||||||
$this->skyGradientV_Scale = (float) $scale;
|
$this->skyGradientV_Scale = (float)$scale;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,8 +234,8 @@ class Mood {
|
|||||||
* @return \FML\Stylesheet\Mood
|
* @return \FML\Stylesheet\Mood
|
||||||
*/
|
*/
|
||||||
public function addSkyGradientKey($x, $color) {
|
public function addSkyGradientKey($x, $color) {
|
||||||
$x = (float) $x;
|
$x = (float)$x;
|
||||||
$color = (string) $color;
|
$color = (string)$color;
|
||||||
$gradientKey = array('x' => $x, 'color' => $color);
|
$gradientKey = array('x' => $x, 'color' => $color);
|
||||||
array_push($this->skyGradientKeys, $gradientKey);
|
array_push($this->skyGradientKeys, $gradientKey);
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -64,7 +64,7 @@ class Style3d {
|
|||||||
* @return \FML\Stylesheet\Style3d
|
* @return \FML\Stylesheet\Style3d
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = (string) $id;
|
$this->id = (string)$id;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ class Style3d {
|
|||||||
* @return \FML\Stylesheet\Style3d
|
* @return \FML\Stylesheet\Style3d
|
||||||
*/
|
*/
|
||||||
public function setModel($model) {
|
public function setModel($model) {
|
||||||
$this->model = (string) $model;
|
$this->model = (string)$model;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ class Style3d {
|
|||||||
* @return \FML\Stylesheet\Style3d
|
* @return \FML\Stylesheet\Style3d
|
||||||
*/
|
*/
|
||||||
public function setThickness($thickness) {
|
public function setThickness($thickness) {
|
||||||
$this->thickness = (float) $thickness;
|
$this->thickness = (float)$thickness;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ class Style3d {
|
|||||||
* @return \FML\Stylesheet\Style3d
|
* @return \FML\Stylesheet\Style3d
|
||||||
*/
|
*/
|
||||||
public function setColor($color) {
|
public function setColor($color) {
|
||||||
$this->color = (string) $color;
|
$this->color = (string)$color;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ class Style3d {
|
|||||||
* @return \FML\Stylesheet\Style3d
|
* @return \FML\Stylesheet\Style3d
|
||||||
*/
|
*/
|
||||||
public function setFocusColor($focusColor) {
|
public function setFocusColor($focusColor) {
|
||||||
$this->focusColor = (string) $focusColor;
|
$this->focusColor = (string)$focusColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ class Style3d {
|
|||||||
* @return \FML\Stylesheet\Style3d
|
* @return \FML\Stylesheet\Style3d
|
||||||
*/
|
*/
|
||||||
public function setLightColor($lightColor) {
|
public function setLightColor($lightColor) {
|
||||||
$this->lightColor = (string) $lightColor;
|
$this->lightColor = (string)$lightColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ class Style3d {
|
|||||||
* @return \FML\Stylesheet\Style3d
|
* @return \FML\Stylesheet\Style3d
|
||||||
*/
|
*/
|
||||||
public function setFocusLightColor($focusLightColor) {
|
public function setFocusLightColor($focusLightColor) {
|
||||||
$this->focusLightColor = (string) $focusLightColor;
|
$this->focusLightColor = (string)$focusLightColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ class Style3d {
|
|||||||
* @return \FML\Stylesheet\Style3d
|
* @return \FML\Stylesheet\Style3d
|
||||||
*/
|
*/
|
||||||
public function setYOffset($yOffset) {
|
public function setYOffset($yOffset) {
|
||||||
$this->yOffset = (float) $yOffset;
|
$this->yOffset = (float)$yOffset;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ class Style3d {
|
|||||||
* @return \FML\Stylesheet\Style3d
|
* @return \FML\Stylesheet\Style3d
|
||||||
*/
|
*/
|
||||||
public function setFocusYOffset($focusYOffset) {
|
public function setFocusYOffset($focusYOffset) {
|
||||||
$this->focusYOffset = (float) $focusYOffset;
|
$this->focusYOffset = (float)$focusYOffset;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ class Style3d {
|
|||||||
* @return \FML\Stylesheet\Style3d
|
* @return \FML\Stylesheet\Style3d
|
||||||
*/
|
*/
|
||||||
public function setZOffset($zOffset) {
|
public function setZOffset($zOffset) {
|
||||||
$this->zOffset = (float) $zOffset;
|
$this->zOffset = (float)$zOffset;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ class Style3d {
|
|||||||
* @return \FML\Stylesheet\Style3d
|
* @return \FML\Stylesheet\Style3d
|
||||||
*/
|
*/
|
||||||
public function setFocusZOffset($focusZOffset) {
|
public function setFocusZOffset($focusZOffset) {
|
||||||
$this->focusZOffset = (float) $focusZOffset;
|
$this->focusZOffset = (float)$focusZOffset;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ class Stylesheet {
|
|||||||
*/
|
*/
|
||||||
protected $tagName = 'stylesheet';
|
protected $tagName = 'stylesheet';
|
||||||
protected $styles3d = array();
|
protected $styles3d = array();
|
||||||
|
/** @var Mood $mood */
|
||||||
protected $mood = null;
|
protected $mood = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,6 +93,7 @@ class Stylesheet {
|
|||||||
$stylesXml = $domDocument->createElement('frame3dstyles');
|
$stylesXml = $domDocument->createElement('frame3dstyles');
|
||||||
$stylesheetXml->appendChild($stylesXml);
|
$stylesheetXml->appendChild($stylesXml);
|
||||||
foreach ($this->styles3d as $style3d) {
|
foreach ($this->styles3d as $style3d) {
|
||||||
|
/** @var Style3d $style3d */
|
||||||
$style3dXml = $style3d->render($domDocument);
|
$style3dXml = $style3d->render($domDocument);
|
||||||
$stylesXml->appendChild($style3dXml);
|
$stylesXml->appendChild($style3dXml);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace FML\Types;
|
namespace FML\Types;
|
||||||
|
|
||||||
use FML\Controls\Control;
|
|
||||||
use FML\Elements\Format;
|
use FML\Elements\Format;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,12 +14,12 @@ use FML\Elements\Format;
|
|||||||
interface Container {
|
interface Container {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new Child Control
|
* Add a new Child Element
|
||||||
*
|
*
|
||||||
* @param Control $child The Child Control to add
|
* @param Renderable $child The Child Control to add
|
||||||
* @return \FML\Types\Container
|
* @return \FML\Types\Container
|
||||||
*/
|
*/
|
||||||
public function add(Control $child);
|
public function add(Renderable $child);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all Children
|
* Remove all Children
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* FancyManiaLinks - Automatic ManiaLink Generator Framework
|
* FancyManiaLinks - Automatic ManiaLink Generator Framework
|
||||||
*
|
*
|
||||||
* @author steeffeen
|
* @author steeffeen
|
||||||
* @version 1.1
|
* @version 1.2
|
||||||
* @link http://github.com/steeffeen/FancyManiaLinks
|
* @link http://github.com/steeffeen/FancyManiaLinks
|
||||||
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
* @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
|
||||||
@ -13,7 +13,7 @@ if (!defined('FML_PATH')) {
|
|||||||
define('FML_PATH', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
|
define('FML_PATH', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
|
||||||
}
|
}
|
||||||
if (!defined('FML_VERSION')) {
|
if (!defined('FML_VERSION')) {
|
||||||
define('FML_VERSION', 1.1);
|
define('FML_VERSION', '1.2');
|
||||||
}
|
}
|
||||||
if (!defined('FML_SIMPLE_CLASSES')) {
|
if (!defined('FML_SIMPLE_CLASSES')) {
|
||||||
define('FML_SIMPLE_CLASSES', false);
|
define('FML_SIMPLE_CLASSES', false);
|
||||||
@ -30,8 +30,7 @@ if (!defined('FML_AUTOLOAD_DEFINED')) {
|
|||||||
if (file_exists($filePath)) {
|
if (file_exists($filePath)) {
|
||||||
// Load with FML namespace
|
// Load with FML namespace
|
||||||
require_once $filePath;
|
require_once $filePath;
|
||||||
}
|
} else if (FML_SIMPLE_CLASSES) {
|
||||||
else if (FML_SIMPLE_CLASSES) {
|
|
||||||
// Load as simple class name
|
// Load as simple class name
|
||||||
if (!function_exists('loadSimpleClass')) {
|
if (!function_exists('loadSimpleClass')) {
|
||||||
|
|
||||||
@ -58,7 +57,9 @@ if (!defined('FML_AUTOLOAD_DEFINED')) {
|
|||||||
$subDirectory = $filePath . DIRECTORY_SEPARATOR;
|
$subDirectory = $filePath . DIRECTORY_SEPARATOR;
|
||||||
$namespace = $baseNamespace . $fileName . '\\';
|
$namespace = $baseNamespace . $fileName . '\\';
|
||||||
$success = loadSimpleClass($className, $subDirectory, $excludes, $namespace);
|
$success = loadSimpleClass($className, $subDirectory, $excludes, $namespace);
|
||||||
if ($success) return true;
|
if ($success) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (is_file($filePath)) {
|
if (is_file($filePath)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user