Updated to ManiaLink v3

This commit is contained in:
Jocy Wolff 2017-03-25 18:40:15 +01:00
parent 1010c1db6b
commit 120a0e2169
133 changed files with 16194 additions and 8949 deletions

View File

@ -10,6 +10,7 @@ use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\Controls\Quads\Quad_UIConstruction_Buttons; use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use FML\ManiaLink; use FML\ManiaLink;
use FML\Script\Features\Paging; use FML\Script\Features\Paging;
use FML\Script\Script;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
@ -88,9 +89,10 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
//Create ManiaLink //Create ManiaLink
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$script = $maniaLink->getScript();
$paging = new Paging(); $paging = new Paging();
$script = new Script();
$script->addFeature($paging); $script->addFeature($paging);
$maniaLink->setScript($script);
// Main frame // Main frame
$frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging); $frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging);
@ -120,7 +122,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
$paging->addPage($pageFrame); $paging->addPageControl($pageFrame);
$posY = $height / 2 - 10; $posY = $height / 2 - 10;
} }

View File

@ -9,6 +9,7 @@ use FML\Controls\Quads\Quad_BgRaceScore2;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons; use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use FML\ManiaLink; use FML\ManiaLink;
use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
@ -134,8 +135,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
* @param Player $player * @param Player $player
*/ */
public function handleConfigCommand(array $callback, Player $player) { public function handleConfigCommand(array $callback, Player $player) {
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_OPEN_CONFIGURATOR) if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_OPEN_CONFIGURATOR)) {
) {
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); $this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
return; return;
} }
@ -199,15 +199,16 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
$frame = new Frame(); $frame = new Frame();
$manialink->add($frame); $manialink->add($frame);
$frame->setPosition($menuPosX, $menuPosY, 34); $frame->setPosition($menuPosX, $menuPosY, ManialinkManager::MAIN_MANIALINK_Z_VALUE);
$backgroundQuad = new Quad(); $backgroundQuad = new Quad();
$frame->add($backgroundQuad); $frame->add($backgroundQuad);
$backgroundQuad->setZ(-2)->setSize($menuWidth, $menuHeight)->setStyles($quadStyle, $quadSubstyle); $backgroundQuad->setZ(-1)->setSize($menuWidth, $menuHeight)->setStyles($quadStyle, $quadSubstyle);
$menuItemsFrame = new Frame(); $menuItemsFrame = new Frame();
$frame->add($menuItemsFrame); $frame->add($menuItemsFrame);
$menuItemsFrame->setX($menuWidth * -0.5 + $menuListWidth * 0.5); $menuItemsFrame->setX($menuWidth * -0.5 + $menuListWidth * 0.5);
$menuItemsFrame->setZ(-1);
$itemsBackgroundQuad = new Quad(); $itemsBackgroundQuad = new Quad();
$menuItemsFrame->add($itemsBackgroundQuad); $menuItemsFrame->add($itemsBackgroundQuad);
@ -226,8 +227,9 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
foreach ($this->menus as $menu) { foreach ($this->menus as $menu) {
// Add title // Add title
$menuItemLabel = new Label_Text(); $menuItemLabel = new Label_Text();
$menuItemsFrame->add($menuItemLabel); $frame->add($menuItemLabel);
$menuItemLabel->setY($menuItemY)->setSize($menuListWidth * 0.9, $menuItemHeight * 0.9)->setStyle($menuItemLabel::STYLE_TextCardRaceRank)->setText($menu->getTitle())->setAction(self::ACTION_SELECTMENU . $menuId); $menuItemLabel->setX($menuWidth * -0.5 + $menuListWidth * 0.5);
$menuItemLabel->setZ(2)->setStyle(Label_Text::STYLE_TextCardRaceRank)->setY($menuItemY)->setSize($menuListWidth * 0.9, $menuItemHeight * 0.9)->setText($menu->getTitle())->setAction(self::ACTION_SELECTMENU . $menuId);
// Show the menu // Show the menu
if ($menuId === $menuIdShown) { if ($menuId === $menuIdShown) {
@ -251,12 +253,12 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
// Add close button // Add close button
$closeButton = new Label_Text(); $closeButton = new Label_Text();
$frame->add($closeButton); $frame->add($closeButton);
$closeButton->setPosition($menuWidth * -0.5 + $menuListWidth * 0.29, $menuHeight * -0.43)->setSize($menuListWidth * 0.3, $menuListWidth * 0.1)->setStyle($closeButton::STYLE_TextButtonNavBack)->setTextPrefix('$999')->setTranslate(true)->setText('Close')->setAction(self::ACTION_TOGGLEMENU); $closeButton->setPosition($menuWidth * -0.5 + $menuListWidth * 0.29, $menuHeight * -0.43)->setSize($menuListWidth * 0.3, $menuListWidth * 0.1)->setStyle($closeButton::STYLE_TextButtonNavBack)->setTextPrefix('$999')->setText('Close')->setAction(self::ACTION_TOGGLEMENU);
// Add save button // Add save button
$saveButton = new Label_Text(); $saveButton = new Label_Text();
$frame->add($saveButton); $frame->add($saveButton);
$saveButton->setPosition($menuWidth * -0.5 + $menuListWidth * 0.71, $menuHeight * -0.43)->setSize($menuListWidth * 0.3, $menuListWidth * 0.1)->setStyle($saveButton::STYLE_TextButtonNavBack)->setTextPrefix('$0f5')->setTranslate(true)->setText('Save')->setAction(self::ACTION_SAVECONFIG); $saveButton->setPosition($menuWidth * -0.5 + $menuListWidth * 0.71, $menuHeight * -0.43)->setSize($menuListWidth * 0.3, $menuListWidth * 0.1)->setStyle($saveButton::STYLE_TextButtonNavBack)->setTextPrefix('$2af')->setText('Save')->setAction(self::ACTION_SAVECONFIG);
return $manialink; return $manialink;
} }

View File

@ -59,14 +59,14 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle() * @see \ManiaControl\Configurator\ConfiguratorMenu::getTitle()
*/ */
public static function getTitle() { public static function getTitle() {
return self::TITLE; return self::TITLE;
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu() * @see \ManiaControl\Configurator\ConfiguratorMenu::getMenu()
*/ */
public function getMenu($width, $height, Script $script, Player $player) { public function getMenu($width, $height, Script $script, Player $player) {
$openedClass = $player->getCache($this, self::CACHE_CLASS_OPENED); $openedClass = $player->getCache($this, self::CACHE_CLASS_OPENED);
@ -112,8 +112,8 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pagerNext->setSize($pagerSize, $pagerSize); $pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext); $pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
$paging->addButton($pagerNext); $paging->addButtonControl($pagerNext);
$paging->addButton($pagerPrev); $paging->addButtonControl($pagerPrev);
$pageCountLabel = new Label_Text(); $pageCountLabel = new Label_Text();
$frame->add($pageCountLabel); $frame->add($pageCountLabel);
@ -150,7 +150,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
if ($index % $pageMaxCount === 0) { if ($index % $pageMaxCount === 0) {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
$paging->addPage($pageFrame); $paging->addPageControl($pageFrame);
$posY = $height * 0.41 - $settingHeight * 1.5; $posY = $height * 0.41 - $settingHeight * 1.5;
} }
@ -239,8 +239,8 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pagerNext->setSize($pagerSize, $pagerSize); $pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext); $pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
$paging->addButton($pagerNext); $paging->addButtonControl($pagerNext);
$paging->addButton($pagerPrev); $paging->addButtonControl($pagerPrev);
$pageCountLabel = new Label_Text(); $pageCountLabel = new Label_Text();
$frame->add($pageCountLabel); $frame->add($pageCountLabel);
@ -258,7 +258,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
$posY = $height * 0.41; $posY = $height * 0.41;
$paging->addPage($pageFrame); $paging->addPageControl($pageFrame);
} }
$classLabel = new Label_Text(); $classLabel = new Label_Text();

View File

@ -221,8 +221,8 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener, Communicatio
$pagerNext->setSize($pagerSize, $pagerSize); $pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext); $pagerNext->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
$paging->addButton($pagerNext); $paging->addButtonControl($pagerNext);
$paging->addButton($pagerPrev); $paging->addButtonControl($pagerPrev);
$pageCountLabel = new Label_Text(); $pageCountLabel = new Label_Text();
$frame->add($pageCountLabel); $frame->add($pageCountLabel);
@ -249,7 +249,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener, Communicatio
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
$posY = $height * 0.41; $posY = $height * 0.41;
$paging->addPage($pageFrame); $paging->addPageControl($pageFrame);
} }
$settingFrame = new Frame(); $settingFrame = new Frame();
@ -293,8 +293,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener, Communicatio
$descriptionLabel->setSize($width * 0.7, $settingHeight); $descriptionLabel->setSize($width * 0.7, $settingHeight);
$descriptionLabel->setTextSize($labelTextSize); $descriptionLabel->setTextSize($labelTextSize);
$descriptionLabel->setTranslate(true); $descriptionLabel->setTranslate(true);
$descriptionLabel->setText($scriptParam->desc); $nameLabel->addTooltipLabelFeature($descriptionLabel, $scriptParam->desc);
$nameLabel->addTooltipFeature($descriptionLabel);
$posY -= $settingHeight; $posY -= $settingHeight;
} }

View File

@ -189,7 +189,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
$posY = $height / 2 - 16; $posY = $height / 2 - 16;
$paging->addPage($pageFrame); $paging->addPageControl($pageFrame);
} }
// Map Frame // Map Frame

View File

@ -27,10 +27,11 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
/* /*
* Constants * Constants
*/ */
const MAIN_MLID = 'Main.ManiaLinkId'; const MAIN_MLID = 'Main.ManiaLinkId';
const ACTION_CLOSEWIDGET = 'ManiaLinkManager.CloseWidget'; const ACTION_CLOSEWIDGET = 'ManiaLinkManager.CloseWidget';
const CB_MAIN_WINDOW_CLOSED = 'ManialinkManagerCallback.MainWindowClosed'; const CB_MAIN_WINDOW_CLOSED = 'ManialinkManagerCallback.MainWindowClosed';
const CB_MAIN_WINDOW_OPENED = 'ManialinkManagerCallback.MainWindowOpened'; const CB_MAIN_WINDOW_OPENED = 'ManialinkManagerCallback.MainWindowOpened';
const MAIN_MANIALINK_Z_VALUE = 10;
/* /*
* Public properties * Public properties
@ -236,6 +237,8 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
public function sendManialink($manialinkText, $logins = null, $timeout = 0, $hideOnClick = false) { public function sendManialink($manialinkText, $logins = null, $timeout = 0, $hideOnClick = false) {
$manialinkText = (string) $manialinkText; $manialinkText = (string) $manialinkText;
var_dump($manialinkText);
if (!$manialinkText) { if (!$manialinkText) {
return true; return true;
} }

View File

@ -193,7 +193,7 @@ class StyleManager {
$pageCountLabel->setHAlign($pageCountLabel::RIGHT)->setPosition($width * 0.40, $height * -0.44, 1)->setStyle($pageCountLabel::STYLE_TextTitle1)->setTextSize(1.3); $pageCountLabel->setHAlign($pageCountLabel::RIGHT)->setPosition($width * 0.40, $height * -0.44, 1)->setStyle($pageCountLabel::STYLE_TextTitle1)->setTextSize(1.3);
if ($paging) { if ($paging) {
$paging->addButton($pagerNext)->addButton($pagerPrev)->setLabel($pageCountLabel); $paging->addButtonControl($pagerNext)->addButtonControl($pagerPrev)->setLabel($pageCountLabel);
} }
} }

View File

@ -253,7 +253,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
$posY = $height / 2 - 10; $posY = $height / 2 - 10;
$paging->addPage($pageFrame, $pageNumber); $paging->addPageControl($pageFrame, $pageNumber);
$pageNumber++; $pageNumber++;
} }

View File

@ -179,7 +179,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
$paging->addPage($pageFrame); $paging->addPageControl($pageFrame);
$posY = $height / 2 - 10; $posY = $height / 2 - 10;
} }

View File

@ -53,14 +53,14 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle() * @see \ManiaControl\Configurator\ConfiguratorMenu::getTitle()
*/ */
public static function getTitle() { public static function getTitle() {
return 'Install Plugins'; return 'Install Plugins';
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu() * @see \ManiaControl\Configurator\ConfiguratorMenu::getMenu()
*/ */
public function getMenu($width, $height, Script $script, Player $player) { public function getMenu($width, $height, Script $script, Player $player) {
$paging = new Paging(); $paging = new Paging();
@ -102,7 +102,7 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
$frame->add($pageCountLabel); $frame->add($pageCountLabel);
$pageCountLabel->setHAlign($pageCountLabel::RIGHT)->setPosition($width * 0.35, $height * -0.44, 1)->setStyle($pageCountLabel::STYLE_TextTitle1)->setTextSize(2); $pageCountLabel->setHAlign($pageCountLabel::RIGHT)->setPosition($width * 0.35, $height * -0.44, 1)->setStyle($pageCountLabel::STYLE_TextTitle1)->setTextSize(2);
$paging->addButton($pagerNext)->addButton($pagerPrev)->setLabel($pageCountLabel); $paging->addButtonControl($pagerNext)->addButtonControl($pagerPrev)->setLabel($pageCountLabel);
// Info tooltip // Info tooltip
$infoTooltipLabel = new Label(); $infoTooltipLabel = new Label();
@ -121,7 +121,7 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
// New page // New page
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
$paging->addPage($pageFrame); $paging->addPageControl($pageFrame);
$posY = $height * 0.41; $posY = $height * 0.41;
} }
@ -221,7 +221,7 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener {
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() * @see \ManiaControl\Configurator\ConfiguratorMenu::saveConfigData()
*/ */
public function saveConfigData(array $configData, Player $player) { public function saveConfigData(array $configData, Player $player) {
} }

View File

@ -69,7 +69,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle() * @see \ManiaControl\Configurator\ConfiguratorMenu::getTitle()
*/ */
public static function getTitle() { public static function getTitle() {
return 'Plugins'; return 'Plugins';
@ -87,7 +87,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu() * @see \ManiaControl\Configurator\ConfiguratorMenu::getMenu()
*/ */
public function getMenu($width, $height, Script $script, Player $player) { public function getMenu($width, $height, Script $script, Player $player) {
$paging = new Paging(); $paging = new Paging();
@ -114,8 +114,8 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$pagerNext->setSize($pagerSize, $pagerSize); $pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext); $pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
$paging->addButton($pagerNext); $paging->addButtonControl($pagerNext);
$paging->addButton($pagerPrev); $paging->addButtonControl($pagerPrev);
$pageCountLabel = new Label_Text(); $pageCountLabel = new Label_Text();
$frame->add($pageCountLabel); $frame->add($pageCountLabel);
@ -149,7 +149,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
if ($index % $pageMaxCount === 0) { if ($index % $pageMaxCount === 0) {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
$paging->addPage($pageFrame); $paging->addPageControl($pageFrame);
$posY = $height * 0.41; $posY = $height * 0.41;
} }
@ -186,11 +186,10 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$descriptionLabel->setTextSize(2); $descriptionLabel->setTextSize(2);
$descriptionLabel->setTranslate(true); $descriptionLabel->setTranslate(true);
$descriptionLabel->setVisible(false); $descriptionLabel->setVisible(false);
$descriptionLabel->setAutoNewLine(true);
$descriptionLabel->setMaxLines(5); $descriptionLabel->setMaxLines(5);
$descriptionLabel->setLineSpacing(1);
$description = "Author: {$pluginClass::getAuthor()}\nVersion: {$pluginClass::getVersion()}\nDesc: {$pluginClass::getDescription()}"; $description = "Author: {$pluginClass::getAuthor()}\nVersion: {$pluginClass::getVersion()}\nDesc: {$pluginClass::getDescription()}";
$descriptionLabel->setText($description); $nameLabel->addTooltipLabelFeature($descriptionLabel,$description);
$nameLabel->addTooltipFeature($descriptionLabel);
$quad = new Quad_Icons128x32_1(); $quad = new Quad_Icons128x32_1();
$pluginFrame->add($quad); $pluginFrame->add($quad);
@ -278,7 +277,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
if ($index % $pageSettingsMaxCount === 0) { if ($index % $pageSettingsMaxCount === 0) {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
$paging->addPage($pageFrame); $paging->addPageControl($pageFrame);
$posY = $height * 0.41 - $settingHeight * 1.5; $posY = $height * 0.41 - $settingHeight * 1.5;
} }
@ -392,7 +391,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() * @see \ManiaControl\Configurator\ConfiguratorMenu::saveConfigData()
*/ */
public function saveConfigData(array $configData, Player $player) { public function saveConfigData(array $configData, Player $player) {
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS) if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS)

View File

@ -104,7 +104,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle() * @see \ManiaControl\Configurator\ConfiguratorMenu::getTitle()
*/ */
public static function getTitle() { public static function getTitle() {
return 'Server Options'; return 'Server Options';
@ -241,7 +241,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu() * @see \ManiaControl\Configurator\ConfiguratorMenu::getMenu()
*/ */
public function getMenu($width, $height, Script $script, Player $player) { public function getMenu($width, $height, Script $script, Player $player) {
$paging = new Paging(); $paging = new Paging();
@ -269,7 +269,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
$frame->add($pageCountLabel); $frame->add($pageCountLabel);
$pageCountLabel->setHAlign($pageCountLabel::RIGHT)->setPosition($width * 0.35, $height * -0.44, 1)->setStyle($pageCountLabel::STYLE_TextTitle1)->setTextSize(2); $pageCountLabel->setHAlign($pageCountLabel::RIGHT)->setPosition($width * 0.35, $height * -0.44, 1)->setStyle($pageCountLabel::STYLE_TextTitle1)->setTextSize(2);
$paging->addButton($pagerNext)->addButton($pagerPrev)->setLabel($pageCountLabel); $paging->addButtonControl($pagerNext)->addButtonControl($pagerPrev)->setLabel($pageCountLabel);
// Pages // Pages
$posY = 0.; $posY = 0.;
@ -287,7 +287,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
$posY = $height * 0.41; $posY = $height * 0.41;
$paging->addPage($pageFrame); $paging->addPageControl($pageFrame);
} }
$optionsFrame = new Frame(); $optionsFrame = new Frame();
@ -326,7 +326,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() * @see \ManiaControl\Configurator\ConfiguratorMenu::saveConfigData()
*/ */
public function saveConfigData(array $configData, Player $player) { public function saveConfigData(array $configData, Player $player) {
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVER_OPTIONS)) { if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVER_OPTIONS)) {

View File

@ -5,7 +5,6 @@ namespace FML\Components;
use FML\Controls\Entry; use FML\Controls\Entry;
use FML\Controls\Frame; use FML\Controls\Frame;
use FML\Controls\Quad; use FML\Controls\Quad;
use FML\Models\CheckBoxDesign;
use FML\Script\Features\CheckBoxFeature; use FML\Script\Features\CheckBoxFeature;
use FML\Script\Features\ScriptFeature; use FML\Script\Features\ScriptFeature;
use FML\Types\Renderable; use FML\Types\Renderable;
@ -14,144 +13,257 @@ use FML\Types\ScriptFeatureable;
/** /**
* CheckBox Component * CheckBox Component
* *
* @uses Quad
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class CheckBox implements Renderable, ScriptFeatureable { class CheckBox implements Renderable, ScriptFeatureable
/* {
* Protected properties
*/
protected $name = null;
protected $feature = null;
/** /**
* Create a new CheckBox Component * @var string $name CheckBox name
* */
* @param string $name (optional) CheckBox name protected $name = null;
* @param bool $default (optional) Default value
* @param Quad $quad (optional) CheckBox quad
*/
public function __construct($name = null, $default = null, Quad $quad = null) {
$this->feature = new CheckBoxFeature();
$this->setName($name);
$this->setDefault($default);
$this->setQuad($quad);
}
/** /**
* Set the name * @var CheckBoxFeature $feature CheckBox Feature
* */
* @param string $name CheckBox name protected $feature = null;
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/** /**
* Set the default value * Construct a new CheckBox
* *
* @param bool $default Default value * @api
* @return static * @param string $name (optional) CheckBox name
*/ * @param bool $default (optional) Default value
public function setDefault($default) { * @param Quad $quad (optional) CheckBox quad
$this->feature->setDefault($default); */
return $this; public function __construct($name = null, $default = null, Quad $quad = null)
} {
$this->feature = new CheckBoxFeature();
if ($name) {
$this->setName($name);
}
if ($default !== null) {
$this->setDefault($default);
}
if ($quad) {
$this->setQuad($quad);
}
}
/** /**
* Set the enabled Design * Get the name
* *
* @param string $style Style name or image url * @api
* @param string $subStyle SubStyle name * @return string
* @return static */
*/ public function getName()
public function setEnabledDesign($style, $subStyle = null) { {
if ($style instanceof CheckBoxDesign) { return $this->name;
$this->feature->setEnabledDesign($style); }
} else {
$checkBoxDesign = new CheckBoxDesign($style, $subStyle);
$this->feature->setEnabledDesign($checkBoxDesign);
}
return $this;
}
/** /**
* Set the disabled Design * Set the name
* *
* @param string $style Style name or image url * @api
* @param string $subStyle SubStyle name * @param string $name CheckBox name
* @return static * @return static
*/ */
public function setDisabledDesign($style, $subStyle = null) { public function setName($name)
if ($style instanceof CheckBoxDesign) { {
$this->feature->setDisabledDesign($style); $this->name = (string)$name;
} else { return $this;
$checkBoxDesign = new CheckBoxDesign($style, $subStyle); }
$this->feature->setDisabledDesign($checkBoxDesign);
}
return $this;
}
/** /**
* Set the CheckBox Quad * Get the default value
* *
* @param Quad $quad CheckBox Quad * @api
* @return static * @return bool
*/ */
public function setQuad(Quad $quad = null) { public function getDefault()
$this->feature->setQuad($quad); {
return $this; return $this->feature->getDefault();
} }
/** /**
* @see \FML\Types\ScriptFeatureable::getScriptFeatures() * Set the default value
*/ *
public function getScriptFeatures() { * @api
return ScriptFeature::collect($this->feature, $this->getQuad(), $this->feature->getEntry()); * @param bool $default Default value
} * @return static
*/
public function setDefault($default)
{
$this->feature->setDefault($default);
return $this;
}
/** /**
* Get the CheckBox Quad * Get the enabled design
* *
* @param bool $createIfEmpty (optional) Create the Quad if it's not set * @api
* @return \FML\Controls\Quad * @return CheckBoxDesign
*/ */
public function getQuad($createIfEmpty = true) { public function getEnabledDesign()
if (!$this->feature->getQuad() && $createIfEmpty) { {
$quad = new Quad(); return $this->feature->getEnabledDesign();
$quad->setSize(10, 10); }
$this->setQuad($quad);
}
return $this->feature->getQuad();
}
/** /**
* @see \FML\Types\Renderable::render() * Set the enabled design
*/ *
public function render(\DOMDocument $domDocument) { * @api
$frame = new Frame(); * @param string|CheckBoxDesign $style Style name, image url or checkbox design
* @param string $subStyle SubStyle name
* @return static
*/
public function setEnabledDesign($style, $subStyle = null)
{
if ($style instanceof CheckBoxDesign) {
$this->feature->setEnabledDesign($style);
} else {
$checkBoxDesign = new CheckBoxDesign($style, $subStyle);
$this->feature->setEnabledDesign($checkBoxDesign);
}
return $this;
}
$quad = $this->getQuad(); /**
$frame->add($quad); * Get the disabled design
*
* @api
* @return CheckBoxDesign
*/
public function getDisabledDesign()
{
return $this->feature->getDisabledDesign();
}
$entry = $this->buildEntry(); /**
$frame->add($entry); * Set the disabled design
$this->feature->setEntry($entry); *
* @api
* @param string|CheckBoxDesign $style Style name, image url or checkbox design
* @param string $subStyle SubStyle name
* @return static
*/
public function setDisabledDesign($style, $subStyle = null)
{
if ($style instanceof CheckBoxDesign) {
$this->feature->setDisabledDesign($style);
} else {
$checkBoxDesign = new CheckBoxDesign($style, $subStyle);
$this->feature->setDisabledDesign($checkBoxDesign);
}
return $this;
}
return $frame->render($domDocument); /**
} * Get the CheckBox Quad
*
* @api
* @return Quad
*/
public function getQuad()
{
$quad = $this->feature->getQuad();
if ($quad) {
return $quad;
}
return $this->createQuad();
}
/**
* Set the CheckBox Quad
*
* @api
* @param Quad $quad CheckBox Quad
* @return static
*/
public function setQuad(Quad $quad)
{
$this->feature->setQuad($quad);
return $this;
}
/**
* Create the CheckBox Quad
*
* @return Quad
*/
protected function createQuad()
{
$quad = new Quad();
$quad->setSize(10, 10);
$this->setQuad($quad);
return $quad;
}
/**
* Get the hidden Entry
*
* @return Entry
*/
public function getEntry()
{
$entry = $this->feature->getEntry();
if ($entry) {
return $entry;
}
return $this->createEntry();
}
/**
* Set the hidden Entry
*
* @param Entry $entry Hidden Entry
* @return static
*/
public function setEntry(Entry $entry)
{
$this->feature->setEntry($entry);
return $this;
}
/**
* Create the hidden Entry
*
* @return Entry
*/
protected function createEntry()
{
$entry = new Entry();
$entry->setVisible(false)
->setName($this->name);
$this->setEntry($entry);
return $entry;
}
/**
* @see ScriptFeatureable::getScriptFeatures()
*/
public function getScriptFeatures()
{
return ScriptFeature::collect($this->feature, $this->getQuad(), $this->feature->getEntry());
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$frame = new Frame();
$quad = $this->getQuad();
$frame->addChild($quad);
$entry = $this->getEntry();
$frame->addChild($entry);
return $frame->render($domDocument);
}
/**
* Build the hidden Entry
*
* @return \FML\Controls\Entry
*/
protected function buildEntry() {
$entry = new Entry();
$entry->setVisible(false)->setName($this->name);
return $entry;
}
} }

View File

@ -0,0 +1,163 @@
<?php
namespace FML\Components;
use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Types\Imageable;
use FML\Types\Styleable;
use FML\Types\SubStyleable;
/**
* Class representing CheckBox Design
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class CheckBoxDesign implements Imageable, Styleable, SubStyleable
{
/**
* @var string $style Style name
*/
protected $style = null;
/**
* @var string $subStyle SubStyle name
*/
protected $subStyle = null;
/**
* @var string $imageUrl Image url
*/
protected $imageUrl = null;
/**
* Create the default Design
*
* @return static
*/
public static function defaultDesign()
{
return new static(Quad_Icons64x64_1::STYLE, Quad_Icons64x64_1::SUBSTYLE_Check);
}
/**
* Construct a new CheckBox Design
*
* @api
* @param string $style (optional) Style name or image url
* @param string $subStyle (optional) SubStyle name
*/
public function __construct($style = null, $subStyle = null)
{
if ($subStyle) {
$this->setStyles($style, $subStyle);
} elseif ($style) {
$this->setImageUrl($style);
}
}
/**
* @see Styleable::getStyle()
*/
public function getStyle()
{
return $this->style;
}
/**
* @see Styleable::setStyle()
*/
public function setStyle($style)
{
$this->style = (string)$style;
$this->url = null;
return $this;
}
/**
* @see SubStyleable::getSubStyle()
*/
public function getSubStyle()
{
return $this->subStyle;
}
/**
* @see SubStyleable::setSubStyle()
*/
public function setSubStyle($subStyle)
{
$this->subStyle = (string)$subStyle;
$this->url = null;
return $this;
}
/**
* @see SubStyleable::setStyles()
*/
public function setStyles($style, $subStyle)
{
return $this->setStyle($style)
->setSubStyle($subStyle);
}
/**
* Get the image url
*
* @api
* @return string
*/
public function getImageUrl()
{
return $this->imageUrl;
}
/**
* Set the image url
*
* @api
* @param string $imageUrl Image url
* @return static
*/
public function setImageUrl($imageUrl)
{
$this->style = null;
$this->subStyle = null;
$this->imageUrl = (string)$imageUrl;
return $this;
}
/**
* Apply the Design to the given Quad
*
* @api
* @param Quad $quad CheckBox Quad
* @return static
*/
public function applyToQuad(Quad $quad)
{
if ($this->imageUrl) {
$quad->setImageUrl($this->imageUrl);
} elseif ($this->style) {
$quad->setStyles($this->style, $this->subStyle);
}
return $this;
}
/**
* Get the CheckBox Design string
*
* @return string
*/
public function getDesignString()
{
if ($this->imageUrl) {
return $this->imageUrl;
}
return $this->style . "|" . $this->subStyle;
}
}

View File

@ -13,122 +13,224 @@ use FML\Types\ScriptFeatureable;
/** /**
* ValuePicker Component * ValuePicker Component
* *
* @uses Entry
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ValuePicker implements Renderable, ScriptFeatureable { class ValuePicker implements Renderable, ScriptFeatureable
/* {
* Protected properties
*/
protected $name = null;
protected $feature = null;
/** /**
* Create a new ValuePicker Component * @var string $name ValuePicker name
* */
* @param string $name (optional) CheckBox name protected $name = null;
* @param array $values (optional) Possible values
* @param bool $default (optional) Default value
* @param Label $label (optional) ValuePicker label
*/
public function __construct($name = null, array $values = array(), $default = null, Label $label = null) {
$this->feature = new ValuePickerFeature();
$this->setName($name);
$this->setValues($values);
$this->setDefault($default);
$this->setLabel($label);
}
/** /**
* Set Name * @var ValuePickerFeature $feature ValuePicker Feature
* */
* @param string $name ValuePicker name protected $feature = null;
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/** /**
* Set the possible values * Create a new ValuePicker
* *
* @param array $values Possible values * @api
* @return static * @param string $name (optional) ValuePicker name
*/ * @param string[] $values (optional) Possible values
public function setValues(array $values) { * @param string $default (optional) Default value
$this->feature->setValues($values); * @param Label $label (optional) ValuePicker label
return $this; */
} public function __construct($name = null, array $values = null, $default = null, Label $label = null)
{
$this->feature = new ValuePickerFeature();
if ($name) {
$this->setName($name);
}
if ($values) {
$this->setValues($values);
}
if ($default !== null) {
$this->setDefault($default);
}
if ($label) {
$this->setLabel($label);
}
}
/** /**
* Set the default value * Get the name
* *
* @param bool $default Default value * @api
* @return static * @return string
*/ */
public function setDefault($default) { public function getName()
$this->feature->setDefault($default); {
return $this; return $this->name;
} }
/** /**
* Set the ValuePicker Label * Set the name
* *
* @param Label $label ValuePicker Label * @api
* @return static * @param string $name ValuePicker name
*/ * @return static
public function setLabel(Label $label = null) { */
$this->feature->setLabel($label); public function setName($name)
return $this; {
} $this->name = (string)$name;
return $this;
}
/** /**
* Get the ValuePicker Label * Get the possible values
* *
* @param bool $createIfEmpty (optional) Create the Label if it's not set * @api
* @return \FML\Controls\Label * @return string[]
*/ */
public function getLabel($createIfEmpty = true) { public function getValues()
if (!$this->feature->getLabel() && $createIfEmpty) { {
$label = new Label(); return $this->feature->getValues();
$this->setLabel($label); }
}
return $this->feature->getLabel();
}
/** /**
* @see \FML\Types\ScriptFeatureable::getScriptFeatures() * Set the possible values
*/ *
public function getScriptFeatures() { * @api
return ScriptFeature::collect($this->feature, $this->getLabel(), $this->feature->getEntry()); * @param array $values Possible values
} * @return static
*/
public function setValues(array $values)
{
$this->feature->setValues($values);
return $this;
}
/** /**
* @see \FML\Types\Renderable::render() * Get the default value
*/ *
public function render(\DOMDocument $domDocument) { * @api
$frame = new Frame(); * @return string
*/
public function getDefault()
{
return $this->feature->getDefault();
}
$label = $this->getLabel(); /**
$frame->add($label); * Set the default value
*
* @api
* @param bool $default Default value
* @return static
*/
public function setDefault($default)
{
$this->feature->setDefault($default);
return $this;
}
$entry = $this->buildEntry(); /**
$frame->add($entry); * Get the Label
$this->feature->setEntry($entry); *
* @api
* @return Label
*/
public function getLabel()
{
$label = $this->feature->getLabel();
if ($label) {
return $label;
}
return $this->createLabel();
}
return $frame->render($domDocument); /**
} * Set the Label
*
* @api
* @param Label $label ValuePicker Label
* @return static
*/
public function setLabel(Label $label)
{
$this->feature->setLabel($label);
return $this;
}
/**
* Create the Label
*
* @return Label
*/
protected function createLabel()
{
$label = new Label();
$this->setLabel($label);
return $label;
}
/**
* Get the hidden Entry
*
* @return Entry
*/
public function getEntry()
{
$entry = $this->feature->getEntry();
if ($entry) {
return $entry;
}
return $this->createEntry();
}
/**
* Set the hidden Entry
*
* @param Entry $entry Hidden Entry
* @return static
*/
public function setEntry(Entry $entry)
{
$this->feature->setEntry($entry);
return $this;
}
/**
* Create the hidden Entry
*
* @return Entry
*/
protected function createEntry()
{
$entry = new Entry();
$entry->setVisible(false)
->setName($this->name);
$this->setEntry($entry);
return $entry;
}
/**
* @see ScriptFeatureable::getScriptFeatures()
*/
public function getScriptFeatures()
{
return ScriptFeature::collect($this->feature, $this->getLabel(), $this->feature->getEntry());
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$frame = new Frame();
$label = $this->getLabel();
$frame->addChild($label);
$entry = $this->getEntry();
$frame->addChild($entry);
return $frame->render($domDocument);
}
/**
* Build the hidden Entry
*
* @return \FML\Controls\Entry
*/
protected function buildEntry() {
$entry = new Entry();
$entry->setVisible(false)->setName($this->name);
return $entry;
}
} }

View File

@ -10,108 +10,262 @@ use FML\Types\Scriptable;
* (CMlMediaPlayer) * (CMlMediaPlayer)
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Audio extends Control implements Playable, Scriptable { class Audio extends Control implements Playable, Scriptable
/* {
* Protected properties
*/
protected $tagName = 'audio';
protected $data = null;
protected $dataId = null;
protected $play = null;
protected $looping = true;
protected $music = null;
protected $volume = 1.;
protected $scriptEvents = null;
/** /**
* @see \FML\Controls\Control::getManiaScriptClass() * @var string $data Data url
*/ */
public function getManiaScriptClass() { protected $data = null;
return 'CMlMediaPlayer';
}
/** /**
* @see \FML\Types\Playable::setData() * @var string $dataId Data id
*/ */
public function setData($data) { protected $dataId = null;
$this->data = (string)$data;
return $this;
}
/** /**
* @see \FML\Types\Playable::setDataId() * @var bool $play Play automaticcaly
*/ */
public function setDataId($dataId) { protected $play = null;
$this->dataId = (string)$dataId;
return $this;
}
/** /**
* @see \FML\Types\Playable::setPlay() * @var bool $looping Looping
*/ */
public function setPlay($play) { protected $looping = true;
$this->play = ($play ? 1 : 0);
return $this;
}
/** /**
* @see \FML\Types\Playable::setLooping() * @var bool $music Music type
*/ */
public function setLooping($looping) { protected $music = null;
$this->looping = ($looping ? 1 : 0);
return $this;
}
/** /**
* @see \FML\Types\Playable::setMusic() * @var float $volume Volume
*/ */
public function setMusic($music) { protected $volume = 1.;
$this->music = ($music ? 1 : 0);
return $this;
}
/** /**
* @see \FML\Types\Playable::setVolume() * @var bool $scriptEvents Script events usage
*/ */
public function setVolume($volume) { protected $scriptEvents = null;
$this->volume = (float)$volume;
return $this;
}
/** /**
* @see \FML\Types\Scriptable::setScriptEvents() * @var string $scriptAction Script action
*/ */
public function setScriptEvents($scriptEvents) { protected $scriptAction = null;
$this->scriptEvents = ($scriptEvents ? 1 : 0);
return $this; /**
} * @var string[] $scriptActionParameters Script action parameters
*/
protected $scriptActionParameters = null;
/**
* @see Playable::getData()
*/
public function getData()
{
return $this->data;
}
/**
* @see Playable::setData()
*/
public function setData($data)
{
$this->data = (string)$data;
return $this;
}
/**
* @see Playable::getDataId()
*/
public function getDataId()
{
return $this->dataId;
}
/**
* @see Playable::setDataId()
*/
public function setDataId($dataId)
{
$this->dataId = (string)$dataId;
return $this;
}
/**
* @see Playable::getPlay()
*/
public function getPlay()
{
return $this->play;
}
/**
* @see Playable::setPlay()
*/
public function setPlay($play)
{
$this->play = (bool)$play;
return $this;
}
/**
* @see Playable::getLooping()
*/
public function getLooping()
{
return $this->looping;
}
/**
* @see Playable::setLooping()
*/
public function setLooping($looping)
{
$this->looping = (bool)$looping;
return $this;
}
/**
* @see Playable::getMusic()
*/
public function getMusic()
{
return $this->music;
}
/**
* @see Playable::setMusic()
*/
public function setMusic($music)
{
$this->music = (bool)$music;
return $this;
}
/**
* @see Playable::getVolume()
*/
public function getVolume()
{
return $this->volume;
}
/**
* @see Playable::setVolume()
*/
public function setVolume($volume)
{
$this->volume = (float)$volume;
return $this;
}
/**
* @see Scriptable::getScriptEvents()
*/
public function getScriptEvents()
{
return $this->scriptEvents;
}
/**
* @see Scriptable::setScriptEvents()
*/
public function setScriptEvents($scriptEvents)
{
$this->scriptEvents = (bool)$scriptEvents;
return $this;
}
/**
* @see Scriptable::getScriptAction()
*/
public function getScriptAction()
{
return $this->scriptAction;
}
/**
* @see Scriptable::setScriptAction()
*/
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
{
$this->scriptAction = (string)$scriptAction;
$this->setScriptActionParameters($scriptActionParameters);
return $this;
}
/**
* @see Scriptable::getScriptActionParameters()
*/
public function getScriptActionParameters()
{
return $this->scriptActionParameters;
}
/**
* @see Scriptable::setScriptActionParameters()
*/
public function setScriptActionParameters(array $scriptActionParameters = null)
{
$this->scriptActionParameters = $scriptActionParameters;
return $this;
}
/**
* @see Control::getTagName()
*/
public function getTagName()
{
return "audio";
}
/**
* @see Control::getManiaScriptClass()
*/
public function getManiaScriptClass()
{
return "CMlMediaPlayer";
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->data) {
$domElement->setAttribute("data", $this->data);
}
if ($this->dataId) {
$domElement->setAttribute("dataid", $this->dataId);
}
if ($this->play) {
$domElement->setAttribute("play", 1);
}
if (!$this->looping) {
$domElement->setAttribute("looping", 0);
}
if ($this->music) {
$domElement->setAttribute("music", 1);
}
if ($this->volume != 1.) {
$domElement->setAttribute("volume", $this->volume);
}
if ($this->scriptEvents) {
$domElement->setAttribute("scriptevents", 1);
}
if ($this->scriptAction) {
$scriptAction = array($this->scriptAction);
if ($this->scriptActionParameters) {
$scriptAction = array_merge($scriptAction, $this->scriptActionParameters);
}
$domElement->setAttribute("scriptaction", implode("'", $scriptAction));
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->data) {
$xmlElement->setAttribute('data', $this->data);
}
if ($this->play) {
$xmlElement->setAttribute('play', $this->play);
}
if (!$this->looping) {
$xmlElement->setAttribute('looping', $this->looping);
}
if ($this->music) {
$xmlElement->setAttribute('music', $this->music);
}
if ($this->volume != 1.) {
$xmlElement->setAttribute('volume', $this->volume);
}
if ($this->scriptEvents) {
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
return $xmlElement;
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
namespace FML\Controls; namespace FML\Controls;
use FML\Form\Parameters;
use FML\Script\Features\EntrySubmit; use FML\Script\Features\EntrySubmit;
use FML\Types\NewLineable; use FML\Types\NewLineable;
use FML\Types\Scriptable; use FML\Types\Scriptable;
@ -13,205 +14,470 @@ use FML\Types\TextFormatable;
* (CMlEntry) * (CMlEntry)
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Entry extends Control implements NewLineable, Scriptable, Styleable, TextFormatable { class Entry extends Control implements NewLineable, Scriptable, Styleable, TextFormatable
/* {
* Protected properties
*/
protected $tagName = 'entry';
protected $name = null;
protected $default = null;
protected $autoNewLine = null;
protected $scriptEvents = null;
protected $style = null;
protected $textColor = null;
protected $textSize = -1;
protected $textFont = null;
protected $focusAreaColor1 = null;
protected $focusAreaColor2 = null;
protected $autoComplete = null;
/** /*
* @see \FML\Controls\Control::getManiaScriptClass() * Constants
*/ */
public function getManiaScriptClass() { const FORMAT_Default = "Default";
return 'CMlEntry'; const FORMAT_Password = "Password";
} const FORMAT_NewPassword = "NewPassword";
/** /**
* Get the Entry name * @var string $name Entry name
* */
* @return string protected $name = null;
*/
public function getName() {
return $this->name;
}
/** /**
* Set Entry name * @var string $default Default value
* */
* @param string $name Entry name protected $default = null;
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/** /**
* Get the default value * @var bool $selectText Select text
* */
* @return mixed protected $selectText = null;
*/
public function getDefault() {
return $this->default;
}
/** /**
* Set default value * @deprecated
* * @var bool $autoNewLine Auto new line
* @param string $default Default value */
* @return static protected $autoNewLine = null;
*/
public function setDefault($default) {
$this->default = $default;
return $this;
}
/** /**
* @see \FML\Types\NewLineable::setAutoNewLine() * @var string $textFormat Text format
*/ */
public function setAutoNewLine($autoNewLine) { protected $textFormat = null;
$this->autoNewLine = ($autoNewLine ? 1 : 0);
return $this;
}
/** /**
* @see \FML\Types\Scriptable::setScriptEvents() * @var bool $scriptEvents Script events usage
*/ */
public function setScriptEvents($scriptEvents) { protected $scriptEvents = null;
$this->scriptEvents = ($scriptEvents ? 1 : 0);
return $this;
}
/** /**
* @see \FML\Types\Styleable::setStyle() * @var string $scriptAction Script action
*/ */
public function setStyle($style) { protected $scriptAction = null;
$this->style = (string)$style;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setTextColor() * @var string[] $scriptActionParameters Script action parameters
*/ */
public function setTextColor($textColor) { protected $scriptActionParameters = null;
$this->textColor = (string)$textColor;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setTextSize() * @var string $style Style
*/ */
public function setTextSize($textSize) { protected $style = null;
$this->textSize = (int)$textSize;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setTextFont() * @var string $textColor Text color
*/ */
public function setTextFont($textFont) { protected $textColor = null;
$this->textFont = (string)$textFont;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setAreaColor() * @var int $textSize Text size
*/ */
public function setAreaColor($areaColor) { protected $textSize = null;
$this->focusAreaColor1 = (string)$areaColor;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setAreaFocusColor() * @var string $textFont Text font
*/ */
public function setAreaFocusColor($areaFocusColor) { protected $textFont = null;
$this->focusAreaColor2 = (string)$areaFocusColor;
return $this;
}
/** /**
* Set auto completion * @var string $areaColor Area color
* */
* @param bool $autoComplete Whether the default value should be automatically completed based on the current request parameters protected $areaColor = null;
* @return static
*/
public function setAutoComplete($autoComplete) {
$this->autoComplete = (bool)$autoComplete;
return $this;
}
/** /**
* Add a dynamic Feature submitting the Entry * @var string $focusAreaColor Focus area color
* */
* @param string $url Submit url protected $focusAreaColor = null;
* @return static
*/ /**
public function addSubmitFeature($url) { * @var bool $autoComplete Auto complete
$entrySubmit = new EntrySubmit($this, $url); */
$this->addScriptFeature($entrySubmit); protected $autoComplete = null;
return $this;
} /**
* Get the name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the name
*
* @api
* @param string $name Entry name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the default value
*
* @api
* @return mixed
*/
public function getDefault()
{
return $this->default;
}
/**
* Set the default value
*
* @api
* @param string $default Default value
* @return static
*/
public function setDefault($default)
{
$this->default = $default;
return $this;
}
/**
* Get select text
*
* @api
* @return bool
*/
public function getSelectText()
{
return $this->selectText;
}
/**
* Set select text
*
* @api
* @param bool $selectText Select text
* @return static
*/
public function setSelectText($selectText)
{
$this->selectText = $selectText;
return $this;
}
/**
* @see NewLineable::getAutoNewLine()
*/
public function getAutoNewLine()
{
return $this->autoNewLine;
}
/**
* @see NewLineable::setAutoNewLine()
*/
public function setAutoNewLine($autoNewLine)
{
$this->autoNewLine = (bool)$autoNewLine;
return $this;
}
/**
* Get text format
*
* @api
* @return string
*/
public function getTextFormat()
{
return $this->textFormat;
}
/**
* Set text format
*
* @api
* @param string $textFormat Text format
* @return static
*/
public function setTextFormat($textFormat)
{
$this->textFormat = $textFormat;
return $this;
}
/**
* @see Scriptable::getScriptEvents()
*/
public function getScriptEvents()
{
return $this->scriptEvents;
}
/**
* @see Scriptable::setScriptEvents()
*/
public function setScriptEvents($scriptEvents)
{
$this->scriptEvents = (bool)$scriptEvents;
return $this;
}
/**
* @see Scriptable::getScriptAction()
*/
public function getScriptAction()
{
return $this->scriptAction;
}
/**
* @see Scriptable::setScriptAction()
*/
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
{
$this->scriptAction = (string)$scriptAction;
$this->setScriptActionParameters($scriptActionParameters);
return $this;
}
/**
* @see Scriptable::getScriptActionParameters()
*/
public function getScriptActionParameters()
{
return $this->scriptActionParameters;
}
/**
* @see Scriptable::setScriptActionParameters()
*/
public function setScriptActionParameters(array $scriptActionParameters = null)
{
$this->scriptActionParameters = $scriptActionParameters;
return $this;
}
/**
* @see Styleable::getStyle()
*/
public function getStyle()
{
return $this->style;
}
/**
* @see Styleable::setStyle()
*/
public function setStyle($style)
{
$this->style = (string)$style;
return $this;
}
/**
* @see TextFormatable::getTextColor()
*/
public function getTextColor()
{
return $this->textColor;
}
/**
* @see TextFormatable::setTextColor()
*/
public function setTextColor($textColor)
{
$this->textColor = (string)$textColor;
return $this;
}
/**
* @see TextFormatable::getTextSize()
*/
public function getTextSize()
{
return $this->textSize;
}
/**
* @see TextFormatable::setTextSize()
*/
public function setTextSize($textSize)
{
$this->textSize = (int)$textSize;
return $this;
}
/**
* @see TextFormatable::getTextFont()
*/
public function getTextFont()
{
return $this->textFont;
}
/**
* @see TextFormatable::setTextFont()
*/
public function setTextFont($textFont)
{
$this->textFont = (string)$textFont;
return $this;
}
/**
* @see TextFormatable::getAreaColor()
*/
public function getAreaColor()
{
return $this->areaColor;
}
/**
* @see TextFormatable::setAreaColor()
*/
public function setAreaColor($areaColor)
{
$this->areaColor = (string)$areaColor;
return $this;
}
/**
* @see TextFormatable::getAreaFocusColor()
*/
public function getAreaFocusColor()
{
return $this->focusAreaColor;
}
/**
* @see TextFormatable::setAreaFocusColor()
*/
public function setAreaFocusColor($areaFocusColor)
{
$this->focusAreaColor = (string)$areaFocusColor;
return $this;
}
/**
* Get auto completion
*
* @api
* @return bool
*/
public function getAutoComplete()
{
return $this->autoComplete;
}
/**
* Set auto completion
*
* @api
* @param bool $autoComplete Automatically complete the default value based on the current request parameters
* @return static
*/
public function setAutoComplete($autoComplete)
{
$this->autoComplete = (bool)$autoComplete;
return $this;
}
/**
* Add a dynamic Feature submitting the Entry
*
* @api
* @param string $url Submit url
* @return static
*/
public function addSubmitFeature($url)
{
$entrySubmit = new EntrySubmit($this, $url);
return $this->addScriptFeature($entrySubmit);
}
/**
* @see Control::getTagName()
*/
public function getTagName()
{
return "entry";
}
/**
* @see Control::getManiaScriptClass()
*/
public function getManiaScriptClass()
{
return "CMlEntry";
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->name) {
$domElement->setAttribute("name", $this->name);
}
if ($this->default !== null) {
$domElement->setAttribute("default", $this->default);
} else if ($this->autoComplete) {
$value = Parameters::getValue($this->name);
if ($value) {
$domElement->setAttribute("default", $value);
}
}
if ($this->selectText) {
$domElement->setAttribute("selecttext", 1);
}
if ($this->autoNewLine) {
$domElement->setAttribute("autonewline", 1);
}
if ($this->textFormat) {
$domElement->setAttribute("textformat", $this->textFormat);
}
if ($this->scriptEvents) {
$domElement->setAttribute("scriptevents", 1);
}
if ($this->scriptAction) {
$scriptAction = array($this->scriptAction);
if ($this->scriptActionParameters) {
$scriptAction = array_merge($scriptAction, $this->scriptActionParameters);
}
$domElement->setAttribute("scriptaction", implode("'", $scriptAction));
}
if ($this->style) {
$domElement->setAttribute("style", $this->style);
}
if ($this->textColor) {
$domElement->setAttribute("textcolor", $this->textColor);
}
if ($this->textSize) {
$domElement->setAttribute("textsize", $this->textSize);
}
if ($this->textFont) {
$domElement->setAttribute("textfont", $this->textFont);
}
if ($this->areaColor) {
$domElement->setAttribute("focusareacolor1", $this->areaColor);
}
if ($this->focusAreaColor) {
$domElement->setAttribute("focusareacolor2", $this->focusAreaColor);
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->name) {
$xmlElement->setAttribute('name', $this->name);
}
if ($this->default !== null) {
$xmlElement->setAttribute('default', $this->default);
} else if ($this->autoComplete) {
$value = null;
if (array_key_exists($this->name, $_GET)) {
$value = $_GET[$this->name];
} else if (array_key_exists($this->name, $_POST)) {
$value = $_POST[$this->name];
}
if ($value) {
$xmlElement->setAttribute('default', $value);
}
}
if ($this->autoNewLine) {
$xmlElement->setAttribute('autonewline', $this->autoNewLine);
}
if ($this->scriptEvents) {
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
if ($this->style) {
$xmlElement->setAttribute('style', $this->style);
}
if ($this->textColor) {
$xmlElement->setAttribute('textcolor', $this->textColor);
}
if ($this->textSize >= 0.) {
$xmlElement->setAttribute('textsize', $this->textSize);
}
if ($this->textFont) {
$xmlElement->setAttribute('textfont', $this->textFont);
}
if ($this->focusAreaColor1) {
$xmlElement->setAttribute('focusareacolor1', $this->focusAreaColor1);
}
if ($this->focusAreaColor2) {
$xmlElement->setAttribute('focusareacolor2', $this->focusAreaColor2);
}
return $xmlElement;
}
} }

View File

@ -7,42 +7,67 @@ namespace FML\Controls;
* (CMlFileEntry) * (CMlFileEntry)
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class FileEntry extends Entry { class FileEntry extends Entry
/* {
* Protected properties
*/
protected $tagName = 'fileentry';
protected $folder = null;
/** /**
* @see \FML\Controls\Control::getManiaScriptClass() * @var string $folder Folder
*/ */
public function getManiaScriptClass() { protected $folder = null;
return 'CMlFileEntry';
}
/** /**
* Set the base folder * Get the folder
* *
* @param string $folder Base folder * @api
* @return static * @return string
*/ */
public function setFolder($folder) { public function getFolder()
$this->folder = (string)$folder; {
return $this; return $this->folder;
} }
/**
* Set the folder
*
* @api
* @param string $folder Base folder
* @return static
*/
public function setFolder($folder)
{
$this->folder = (string)$folder;
return $this;
}
/**
* @see Control::getTagName()
*/
public function getTagName()
{
return "fileentry";
}
/**
* @see Control::getManiaScriptClass()
*/
public function getManiaScriptClass()
{
return "CMlFileEntry";
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->folder) {
$domElement->setAttribute("folder", $this->folder);
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->folder) {
$xmlElement->setAttribute('folder', $this->folder);
}
return $xmlElement;
}
} }

View File

@ -12,88 +12,132 @@ use FML\Types\ScriptFeatureable;
* (CMlFrame) * (CMlFrame)
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Frame extends Control implements Container { class Frame extends Control implements Container
/* {
* Protected properties
*/
protected $tagName = 'frame';
/** @var Renderable[] $children */
protected $children = array();
/** @var Format $format */
protected $format = null;
/** /**
* @see \FML\Controls\Control::getManiaScriptClass() * @var Renderable[] $children Children
*/ */
public function getManiaScriptClass() { protected $children = array();
return 'CMlFrame';
}
/** /**
* @see \FML\Types\Container::add() * @var Format $format Format
*/ */
public function add(Renderable $child) { protected $format = null;
if (!in_array($child, $this->children, true)) {
array_push($this->children, $child);
}
return $this;
}
/** /**
* @see \FML\Types\Container::removeChildren() * @see Container::getChildren()
*/ */
public function removeChildren() { public function getChildren()
$this->children = array(); {
return $this; return $this->children;
} }
/** /**
* @see \FML\Types\Container::getFormat() * @see Container::addChild()
*/ * @deprecated use addChild() instead
public function getFormat($createIfEmpty = true) { */
if (!$this->format && $createIfEmpty) { public function add(Renderable $child)
$this->setFormat(new Format()); {
} return $this->addChild($child);
return $this->format; }
}
/** /**
* @see \FML\Types\Container::setFormat() * @see Container::addChild()
*/ */
public function setFormat(Format $format) { public function addChild(Renderable $child)
$this->format = $format; {
return $this; if (!in_array($child, $this->children, true)) {
} array_push($this->children, $child);
}
return $this;
}
/** /**
* @see \FML\Controls\Control::getScriptFeatures() * @see Container::addChildren()
*/ */
public function getScriptFeatures() { public function addChildren(array $children)
$scriptFeatures = $this->scriptFeatures; {
foreach ($this->children as $child) { foreach ($children as $child) {
if ($child instanceof ScriptFeatureable) { $this->addChild($child);
$scriptFeatures = array_merge($scriptFeatures, $child->getScriptFeatures()); }
} return $this;
} }
return $scriptFeatures;
} /**
* @see Container::removeAllChildren()
*/
public function removeAllChildren()
{
$this->children = array();
return $this;
}
/**
* @see Container::getFormat()
*/
public function getFormat()
{
return $this->format;
}
/**
* @see Container::setFormat()
*/
public function setFormat(Format $format = null)
{
$this->format = $format;
return $this;
}
/**
* @see Control::getTagName()
*/
public function getTagName()
{
return "frame";
}
/**
* @see Control::getManiaScriptClass()
*/
public function getManiaScriptClass()
{
return "CMlFrame";
}
/**
* @see Control::getScriptFeatures()
*/
public function getScriptFeatures()
{
$scriptFeatures = $this->scriptFeatures;
foreach ($this->children as $child) {
if ($child instanceof ScriptFeatureable) {
$scriptFeatures = array_merge($scriptFeatures, $child->getScriptFeatures());
}
}
return $scriptFeatures;
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->format) {
$formatXml = $this->format->render($domDocument);
$domElement->appendChild($formatXml);
}
foreach ($this->children as $child) {
$childXmlElement = $child->render($domDocument);
$domElement->appendChild($childXmlElement);
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->format) {
$formatXml = $this->format->render($domDocument);
$xmlElement->appendChild($formatXml);
}
foreach ($this->children as $child) {
$childXmlElement = $child->render($domDocument);
$xmlElement->appendChild($childXmlElement);
}
return $xmlElement;
}
} }

View File

@ -10,79 +10,184 @@ use FML\Types\Scriptable;
* (CMlFrame) * (CMlFrame)
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Frame3d extends Frame implements Scriptable { 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 * Constants
*/ */
protected $tagName = 'frame3d'; const STYLE_BaseStation = 'BaseStation';
protected $style3dId = null; const STYLE_BaseBoxCase = 'BaseBoxCase';
/** @var Style3d $style3d */ const STYLE_TitleLogo = 'Titlelogo';
protected $style3d = null; const STYLE_ButtonBack = 'ButtonBack';
protected $scriptEvents = null; const STYLE_ButtonNav = 'ButtonNav';
const STYLE_ButtonH = 'ButtonH';
const STYLE_Station3x3 = 'Station3x3';
const STYLE_Title = 'Title';
const STYLE_TitleEditor = 'TitleEditor';
const STYLE_Window = 'Window';
/** /**
* Set Style3d id * @var string $style3dId Style3d id
* */
* @param string $style3dId Style3d id protected $style3dId = null;
* @return static
*/
public function setStyle3dId($style3dId) {
$this->style3dId = (string)$style3dId;
$this->style3d = null;
return $this;
}
/** /**
* Set Style3d * @var Style3d $style3d Style3d
* */
* @param Style3d $style3d Style3d object protected $style3d = null;
* @return static
*/
public function setStyle3d(Style3d $style3d) {
$this->style3d = $style3d;
$this->style3dId = null;
return $this;
}
/** /**
* @see \FML\Types\Scriptable::setScriptEvents() * @var bool $scriptEvents Script events usage
*/ */
public function setScriptEvents($scriptEvents) { protected $scriptEvents = null;
$this->scriptEvents = ($scriptEvents ? 1 : 0);
return $this; /**
} * @var string[] $scriptActionParameters Script action parameters
*/
protected $scriptActionParameters = null;
/**
* @var string $scriptAction Script action
*/
protected $scriptAction = null;
/**
* Get the Style3d id
*
* @api
* @return string
*/
public function getStyle3dId()
{
return $this->style3dId;
}
/**
* Set the Style3d id
*
* @api
* @param string $style3dId Style3d id
* @return static
*/
public function setStyle3dId($style3dId)
{
$this->style3dId = (string)$style3dId;
$this->style3d = null;
return $this;
}
/**
* Get the Style3d
*
* @api
* @return Style3d
*/
public function getStyle3d()
{
return $this->style3d;
}
/**
* Set the Style3d
*
* @api
* @param Style3d $style3d Style3d
* @return static
*/
public function setStyle3d(Style3d $style3d)
{
$this->style3dId = null;
$this->style3d = $style3d;
return $this;
}
/**
* @see Scriptable::getScriptEvents()
*/
public function getScriptEvents()
{
return $this->scriptEvents;
}
/**
* @see Scriptable::setScriptEvents()
*/
public function setScriptEvents($scriptEvents)
{
$this->scriptEvents = (bool)$scriptEvents;
return $this;
}
/**
* @see Scriptable::getScriptAction()
*/
public function getScriptAction()
{
return $this->scriptAction;
}
/**
* @see Scriptable::setScriptAction()
*/
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
{
$this->scriptAction = (string)$scriptAction;
$this->setScriptActionParameters($scriptActionParameters);
return $this;
}
/**
* @see Scriptable::getScriptActionParameters()
*/
public function getScriptActionParameters()
{
return $this->scriptActionParameters;
}
/**
* @see Scriptable::setScriptActionParameters()
*/
public function setScriptActionParameters(array $scriptActionParameters = null)
{
$this->scriptActionParameters = $scriptActionParameters;
return $this;
}
/**
* @see Control::getTagName()
*/
public function getTagName()
{
return "frame3d";
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->style3d) {
$this->style3d->checkId();
$domElement->setAttribute("style3d", $this->style3d->getId());
} else if ($this->style3dId) {
$domElement->setAttribute("style3d", $this->style3dId);
}
if ($this->scriptEvents) {
$domElement->setAttribute("scriptevents", 1);
}
if ($this->scriptAction) {
$scriptAction = array($this->scriptAction);
if ($this->scriptActionParameters) {
$scriptAction = array_merge($scriptAction, $this->scriptActionParameters);
}
$domElement->setAttribute("scriptaction", implode("'", $scriptAction));
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->style3d) {
$this->style3d->checkId();
$xmlElement->setAttribute('style3d', $this->style3d->getId());
} else if ($this->style3dId) {
$xmlElement->setAttribute('style3d', $this->style3dId);
}
if ($this->scriptEvents) {
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
return $xmlElement;
}
} }

View File

@ -9,84 +9,101 @@ use FML\Elements\FrameModel;
* (CMlFrame) * (CMlFrame)
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class FrameInstance extends Control { class FrameInstance extends Control
/* {
* Protected properties
*/
protected $tagName = 'frameinstance';
protected $modelId = null;
/** @var FrameModel $model */
protected $model = null;
/** /**
* Create a new Frame Instance object * @var string $modelId FrameModel id
* */
* @param string $modelId (optional) Frame Model id protected $modelId = null;
* @param string $controlId (optional) Frame id
* @return static
*/
public static function create($modelId = null, $controlId = null) {
return new static($modelId, $controlId);
}
/** /**
* Construct a new Frame Instance object * @var FrameModel $model FrameModel
* */
* @param string $modelId (optional) Frame Model id protected $model = null;
* @param string $controlId (optional) Frame id
*/
public function __construct($modelId = null, $controlId = null) {
parent::__construct($controlId);
if ($modelId !== null) {
$this->setModelId($modelId);
}
}
/** /**
* Set Frame Model id * Get the FrameModel id
* *
* @param string $modelId Frame Model id * @api
* @return static * @return string
*/ */
public function setModelId($modelId) { public function getModelId()
$this->modelId = (string)$modelId; {
$this->model = null; return $this->modelId;
return $this; }
}
/** /**
* Set Frame Model * Set the FrameModel id
* *
* @param FrameModel $frameModel Frame Model * @api
* @return static * @param string $modelId FrameModel id
*/ * @return static
public function setModel(FrameModel $frameModel) { */
$this->model = $frameModel; public function setModelId($modelId)
$this->modelId = null; {
return $this; $this->modelId = (string)$modelId;
} $this->model = null;
return $this;
}
/** /**
* @see \FML\Controls\Control::getManiaScriptClass() * Get the FrameModel
*/ *
public function getManiaScriptClass() { * @api
return 'CMlFrame'; * @return FrameModel
} */
public function getModel()
{
return $this->model;
}
/**
* Set the FrameModel
*
* @api
* @param FrameModel $frameModel FrameModel
* @return static
*/
public function setModel(FrameModel $frameModel)
{
$this->modelId = null;
$this->model = $frameModel;
return $this;
}
/**
* @see Control::getTagName()
*/
public function getTagName()
{
return "frameinstance";
}
/**
* @see Control::getManiaScriptClass()
*/
public function getManiaScriptClass()
{
return "CMlFrame";
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->model) {
$this->model->checkId();
$domElement->setAttribute("modelid", $this->model->getId());
} else if ($this->modelId) {
$domElement->setAttribute("modelid", $this->modelId);
}
return $domElement;
}
/**
* @see \FML\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->model) {
$this->model->checkId();
$xmlElement->setAttribute('modelid', $this->model->getId());
} else if ($this->modelId) {
$xmlElement->setAttribute('modelid', $this->modelId);
}
return $xmlElement;
}
} }

View File

@ -2,6 +2,7 @@
namespace FML\Controls; namespace FML\Controls;
use FML\Types\Colorable;
use FML\Types\Styleable; use FML\Types\Styleable;
/** /**
@ -9,152 +10,298 @@ use FML\Types\Styleable;
* (CMlGauge) * (CMlGauge)
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Gauge extends Control implements Styleable { class Gauge extends Control implements Colorable, Styleable
/* {
* Constants
*/
const STYLE_BgCard = 'BgCard';
const STYLE_EnergyBar = 'EnergyBar';
const STYLE_ProgressBar = 'ProgressBar';
const STYLE_ProgressBarSmall = 'ProgressBarSmall';
/* /*
* Protected properties * Constants
*/ */
protected $tagName = 'gauge'; const STYLE_BgCard = "BgCard";
protected $ratio = 0.; const STYLE_EnergyBar = "EnergyBar";
protected $grading = 1.; const STYLE_ProgressBar = "ProgressBar";
protected $color = null; const STYLE_ProgressBarSmall = "ProgressBarSmall";
protected $centered = null;
protected $clan = null;
protected $drawBg = 1;
protected $drawBlockBg = 1;
protected $style = null;
/** /**
* @see \FML\Controls\Control::getManiaScriptClass() * @var float $ratio Ratio
*/ */
public function getManiaScriptClass() { protected $ratio = 0.0;
return 'CMlGauge';
}
/** /**
* Set ratio * @var float $grading Grading
* */
* @param float $ratio Ratio value protected $grading = 1.;
* @return static
*/
public function setRatio($ratio) {
$this->ratio = (float)$ratio;
return $this;
}
/** /**
* Set grading * @var string $color Color
* */
* @param float $grading Grading value protected $color = null;
* @return static
*/
public function setGrading($grading) {
$this->grading = (float)$grading;
return $this;
}
/** /**
* Set color * @var bool $centered Centered
* */
* @param string $color Gauge color protected $centered = null;
* @return static
*/
public function setColor($color) {
$this->color = (string)$color;
return $this;
}
/** /**
* Set centered * @var int $clan Clan number
* */
* @param bool $centered Whether the Gauge is centered protected $clan = null;
* @return static
*/
public function setCentered($centered) {
$this->centered = ($centered ? 1 : 0);
return $this;
}
/** /**
* Set clan * @var bool $drawBackground Draw background
* */
* @param int $clan Clan number protected $drawBackground = true;
* @return static
*/
public function setClan($clan) {
$this->clan = (int)$clan;
return $this;
}
/** /**
* Set draw background * @var bool $drawBlockBackground Draw block background
* */
* @param bool $drawBg Whether the Gauges background should be drawn protected $drawBlockBackground = true;
* @return static
*/
public function setDrawBg($drawBg) {
$this->drawBg = ($drawBg ? 1 : 0);
return $this;
}
/** /**
* Set draw block background * @var string $style Style
* */
* @param bool $drawBlockBg Whether the Gauges block background should be drawn protected $style = null;
* @return static
*/
public function setDrawBlockBg($drawBlockBg) {
$this->drawBlockBg = ($drawBlockBg ? 1 : 0);
return $this;
}
/** /**
* @see \FML\Types\Styleable::setStyle() * Get the ratio
*/ *
public function setStyle($style) { * @api
$this->style = (string)$style; * @return float
return $this; */
} public function getRatio()
{
return $this->ratio;
}
/**
* Set the ratio
*
* @api
* @param float $ratio Ratio value
* @return static
*/
public function setRatio($ratio)
{
$this->ratio = (float)$ratio;
return $this;
}
/**
* Get the grading
*
* @api
* @return float
*/
public function getGrading()
{
return $this->grading;
}
/**
* Set the grading
*
* @api
* @param float $grading Grading value
* @return static
*/
public function setGrading($grading)
{
$this->grading = (float)$grading;
return $this;
}
/**
* @see Colorable::getColor
*/
public function getColor()
{
return $this->color;
}
/**
* @see Colorable::setColor
*/
public function setColor($color)
{
$this->color = (string)$color;
return $this;
}
/**
* Get centered
*
* @api
* @return bool
*/
public function getCentered()
{
return $this->centered;
}
/**
* Set centered
*
* @api
* @param bool $centered If the Gauge should be centered
* @return static
*/
public function setCentered($centered)
{
$this->centered = (bool)$centered;
return $this;
}
/**
* Get the clan
*
* @api
* @return int
*/
public function getClan()
{
return $this->clan;
}
/**
* Set the clan
*
* @api
* @param int $clan Clan number
* @return static
*/
public function setClan($clan)
{
$this->clan = (int)$clan;
return $this;
}
/**
* Get draw background
*
* @api
* @return bool
*/
public function getDrawBackground()
{
return $this->drawBackground;
}
/**
* Set draw background
*
* @api
* @param bool $drawBackground If the Gauges background should be drawn
* @return static
* @deprecated use setDrawBackground() instead
*/
public function setDrawBg($drawBackground)
{
return $this->setDrawBackground($drawBackground);
}
/**
* Set draw background
*
* @api
* @param bool $drawBackground If the Gauges background should be drawn
* @return static
*/
public function setDrawBackground($drawBackground)
{
$this->drawBackground = (bool)$drawBackground;
return $this;
}
/**
* Get draw block background
*
* @api
* @return bool
*/
public function getDrawBlockBackground()
{
return $this->drawBlockBackground;
}
/**
* Set draw block background
*
* @api
* @param bool $drawBlockBackground If the Gauges block background should be drawn
* @return static
*/
public function setDrawBlockBackground($drawBlockBackground)
{
$this->drawBlockBackground = (bool)$drawBlockBackground;
return $this;
}
/**
* @see Styleable::getStyle()
*/
public function getStyle()
{
return $this->style;
}
/**
* @see Styleable::setStyle()
*/
public function setStyle($style)
{
$this->style = (string)$style;
return $this;
}
/**
* @see Control::getTagName()
*/
public function getTagName()
{
return "gauge";
}
/**
* @see Control::getManiaScriptClass()
*/
public function getManiaScriptClass()
{
return "CMlGauge";
}
/**
* @see Control::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->ratio) {
$domElement->setAttribute("ratio", $this->ratio);
}
if ($this->grading != 1.) {
$domElement->setAttribute("grading", $this->grading);
}
if ($this->color) {
$domElement->setAttribute("color", $this->color);
}
if ($this->centered) {
$domElement->setAttribute("centered", 1);
}
if ($this->clan) {
$domElement->setAttribute("clan", $this->clan);
}
if (!$this->drawBackground) {
$domElement->setAttribute("drawbg", 0);
}
if (!$this->drawBlockBackground) {
$domElement->setAttribute("drawblockbg", 0);
}
if ($this->style) {
$domElement->setAttribute("style", $this->style);
}
return $domElement;
}
/**
* @see \FML\Control::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->ratio) {
$xmlElement->setAttribute('ratio', $this->ratio);
}
if ($this->grading != 1.) {
$xmlElement->setAttribute('grading', $this->grading);
}
if ($this->color) {
$xmlElement->setAttribute('color', $this->color);
}
if ($this->centered) {
$xmlElement->setAttribute('centered', $this->centered);
}
if ($this->clan) {
$xmlElement->setAttribute('clan', $this->clan);
}
if (!$this->drawBg) {
$xmlElement->setAttribute('drawbg', $this->drawBg);
}
if (!$this->drawBlockBg) {
$xmlElement->setAttribute('drawblockbg', $this->drawBlockBg);
}
if ($this->style) {
$xmlElement->setAttribute('style', $this->style);
}
return $xmlElement;
}
} }

View File

@ -0,0 +1,82 @@
<?php
namespace FML\Controls;
use FML\Script\Features\GraphCurve;
// TODO: check CoordsMin & CoordsMax properties of CMlGraph
/**
* Graph Control
* (CMlGraph)
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Graph extends Control
{
/**
* @var GraphCurve[] $curves Curves
*/
protected $curves = array();
/**
* Get curves
*
* @api
* @return GraphCurve[]
*/
public function getCurves()
{
return $this->curves;
}
/**
* Add curve
*
* @api
* @param GraphCurve $curve Curve
* @return static
*/
public function addCurve(GraphCurve $curve)
{
$curve->setGraph($this);
$this->addScriptFeature($curve);
array_push($this->curves, $curve);
return $this;
}
/**
* Add curves
*
* @api
* @param GraphCurve[] $curves Curves
* @return static
*/
public function addCurves(array $curves)
{
foreach ($curves as $curve) {
$this->addCurve($curve);
}
return $this;
}
/**
* @see Control::getTagName()
*/
public function getTagName()
{
return "graph";
}
/**
* @see Control::getManiaScriptClass()
*/
public function getManiaScriptClass()
{
return "CMlGraph";
}
}

View File

@ -5,6 +5,7 @@ namespace FML\Controls;
use FML\Script\Features\Clock; use FML\Script\Features\Clock;
use FML\Types\Actionable; use FML\Types\Actionable;
use FML\Types\Linkable; use FML\Types\Linkable;
use FML\Types\MultiLineable;
use FML\Types\NewLineable; use FML\Types\NewLineable;
use FML\Types\Scriptable; use FML\Types\Scriptable;
use FML\Types\Styleable; use FML\Types\Styleable;
@ -15,303 +16,694 @@ use FML\Types\TextFormatable;
* (CMlLabel) * (CMlLabel)
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Label extends Control implements Actionable, Linkable, NewLineable, Scriptable, Styleable, TextFormatable { class Label extends Control implements Actionable, Linkable, NewLineable, MultiLineable, Scriptable, Styleable, TextFormatable
/* {
* Protected properties
*/
protected $tagName = 'label';
protected $text = null;
protected $textId = null;
protected $textPrefix = null;
protected $textEmboss = null;
protected $translate = null;
protected $maxLines = -1;
protected $opacity = 1.;
protected $action = null;
protected $actionKey = -1;
protected $url = null;
protected $urlId = null;
protected $manialink = null;
protected $manialinkId = null;
protected $autoNewLine = null;
protected $scriptEvents = null;
protected $style = null;
protected $textSize = -1;
protected $textFont = null;
protected $textColor = null;
protected $focusAreaColor1 = null;
protected $focusAreaColor2 = null;
/** /**
* @see \FML\Controls\Control::getManiaScriptClass() * @var string $text Text
*/ */
public function getManiaScriptClass() { protected $text = null;
return 'CMlLabel';
}
/** /**
* Set text * @var string $textId Text ID
* */
* @param string $text Text value protected $textId = null;
* @return static
*/
public function setText($text) {
$this->text = (string)$text;
return $this;
}
/** /**
* Set text id to use from Dico * @var string $textPrefix Text prefix
* */
* @param string $textId Text id protected $textPrefix = null;
* @return static
*/
public function setTextId($textId) {
$this->textId = (string)$textId;
return $this;
}
/** /**
* Set text prefix * @var bool $textEmboss Text emboss
* */
* @param string $textPrefix Text prefix protected $textEmboss = null;
* @return static
*/
public function setTextPrefix($textPrefix) {
$this->textPrefix = (string)$textPrefix;
return $this;
}
/** /**
* Set text emboss * @var bool $translate Translate text
* */
* @param bool $textEmboss Whether the text should be embossed protected $translate = null;
* @return static
*/
public function setTextEmboss($textEmboss) {
$this->textEmboss = ($textEmboss ? 1 : 0);
return $this;
}
/** /**
* Set translate * @var int $maxLines Maximum lines
* */
* @param bool $translate Whether the text should be translated protected $maxLines = -1;
* @return static
*/
public function setTranslate($translate) {
$this->translate = ($translate ? 1 : 0);
return $this;
}
/** /**
* Set max lines count * @var float $opacity Opacity
* */
* @param int $maxLines Max lines count protected $opacity = 1.;
* @return static
*/
public function setMaxLines($maxLines) {
$this->maxLines = (int)$maxLines;
return $this;
}
/** /**
* @see \FML\Types\Actionable::getAction() * @var string $action Action
*/ */
public function getAction() { protected $action = null;
return $this->action;
}
/** /**
* @see \FML\Types\Actionable::setAction() * @var int $actionKey Action key
*/ */
public function setAction($action) { protected $actionKey = -1;
$this->action = (string)$action;
return $this;
}
/** /**
* @see \FML\Types\Actionable::setActionKey() * @var string $url Url
*/ */
public function setActionKey($actionKey) { protected $url = null;
$this->actionKey = (int)$actionKey;
return $this;
}
/** /**
* @see \FML\Types\Linkable::setUrl() * @var string $urlId Url ID
*/ */
public function setUrl($url) { protected $urlId = null;
$this->url = (string)$url;
return $this;
}
/** /**
* @see \FML\Types\Linkable::setUrlId() * @var string $manialink Manialink
*/ */
public function setUrlId($urlId) { protected $manialink = null;
$this->urlId = (string)$urlId;
return $this;
}
/** /**
* @see \FML\Types\Linkable::setManialink() * @var string $manialinkId Manialink ID
*/ */
public function setManialink($manialink) { protected $manialinkId = null;
$this->manialink = (string)$manialink;
return $this;
}
/** /**
* @see \FML\Types\Linkable::setManialinkId() * @var bool $autoNewLine Automatic new line
*/ */
public function setManialinkId($manialinkId) { protected $autoNewLine = null;
$this->manialinkId = (string)$manialinkId;
return $this;
}
/** /**
* @see \FML\Types\NewLineable::setAutoNewLine() * @var float $lineSpacing Line spacing
*/ */
public function setAutoNewLine($autoNewLine) { protected $lineSpacing = -1.;
$this->autoNewLine = ($autoNewLine ? 1 : 0);
return $this;
}
/** /**
* @see \FML\Types\Scriptable::setScriptEvents() * @var bool $scriptEvents Script events usage
*/ */
public function setScriptEvents($scriptEvents) { protected $scriptEvents = null;
$this->scriptEvents = ($scriptEvents ? 1 : 0);
return $this;
}
/** /**
* @see \FML\Types\Styleable::setStyle() * @var string $scriptAction Script action
*/ */
public function setStyle($style) { protected $scriptAction = null;
$this->style = (string)$style;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setTextSize() * @var string[] $scriptActionParameters Script action parameters
*/ */
public function setTextSize($textSize) { protected $scriptActionParameters = null;
$this->textSize = (int)$textSize;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setTextFont() * @var string $style Style
*/ */
public function setTextFont($textFont) { protected $style = null;
$this->textFont = (string)$textFont;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setTextColor() * @var int $textSize Text size
*/ */
public function setTextColor($textColor) { protected $textSize = -1;
$this->textColor = (string)$textColor;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setAreaColor() * @var string $textFont Text font
*/ */
public function setAreaColor($areaColor) { protected $textFont = null;
$this->focusAreaColor1 = (string)$areaColor;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setAreaFocusColor() * @var string $textColor Text color
*/ */
public function setAreaFocusColor($areaFocusColor) { protected $textColor = null;
$this->focusAreaColor2 = (string)$areaFocusColor;
return $this;
}
/** /**
* Add a dynamic Feature showing the current time * @var string $areaColor Area color
* */
* @param bool $showSeconds (optional) Whether the seconds should be shown protected $areaColor = null;
* @param bool $showFullDate (optional) Whether the date should be shown
* @return static /**
*/ * @var string $focusAreaColor Focus area color
public function addClockFeature($showSeconds = true, $showFullDate = false) { */
$clock = new Clock($this, $showSeconds, $showFullDate); protected $focusAreaColor = null;
$this->addScriptFeature($clock);
return $this; /**
} * Get the text
*
* @api
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* Set the text
*
* @api
* @param string $text Text value
* @return static
*/
public function setText($text)
{
$this->text = (string)$text;
return $this;
}
/**
* Get the text id to use from Dico
*
* @api
* @return string
*/
public function getTextId()
{
return $this->textId;
}
/**
* Set the text id to use from Dico
*
* @api
* @param string $textId Text id
* @return static
*/
public function setTextId($textId)
{
$this->textId = (string)$textId;
return $this;
}
/**
* Get the text prefix
*
* @api
* @return string
*/
public function getTextPrefix()
{
return $this->textPrefix;
}
/**
* Set the text prefix
*
* @api
* @param string $textPrefix Text prefix
* @return static
*/
public function setTextPrefix($textPrefix)
{
$this->textPrefix = (string)$textPrefix;
return $this;
}
/**
* Get text emboss
*
* @api
* @return bool
*/
public function getTextEmboss()
{
return $this->textEmboss;
}
/**
* Set text emboss
*
* @api
* @param bool $textEmboss If the text should be embossed
* @return static
*/
public function setTextEmboss($textEmboss)
{
$this->textEmboss = (bool)$textEmboss;
return $this;
}
/**
* Get translate
*
* @api
* @return bool
*/
public function getTranslate()
{
return $this->translate;
}
/**
* Set translate
*
* @api
* @param bool $translate If the text should be translated
* @return static
*/
public function setTranslate($translate)
{
$this->translate = (bool)$translate;
return $this;
}
/**
* Get the opacity
*
* @api
* @return float
*/
public function getOpacity()
{
return $this->opacity;
}
/**
* Set the opacity
*
* @api
* @param float $opacity Opacity
* @return static
*/
public function setOpacity($opacity)
{
$this->opacity = (float)$opacity;
return $this;
}
/**
* @see Actionable::getAction()
*/
public function getAction()
{
return $this->action;
}
/**
* @see Actionable::setAction()
*/
public function setAction($action)
{
$this->action = (string)$action;
return $this;
}
/**
* @see Actionable::getActionKey()
*/
public function getActionKey()
{
return $this->actionKey;
}
/**
* @see Actionable::setActionKey()
*/
public function setActionKey($actionKey)
{
$this->actionKey = (int)$actionKey;
return $this;
}
/**
* @see Linkable::getUrl()
*/
public function getUrl()
{
return $this->url;
}
/**
* @see Linkable::setUrl()
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Linkable::getUrlId()
*/
public function getUrlId()
{
return $this->urlId;
}
/**
* @see Linkable::setUrlId()
*/
public function setUrlId($urlId)
{
$this->urlId = (string)$urlId;
return $this;
}
/**
* @see Linkable::getManialink()
*/
public function getManialink()
{
return $this->manialink;
}
/**
* @see Linkable::setManialink()
*/
public function setManialink($manialink)
{
$this->manialink = (string)$manialink;
return $this;
}
/**
* @see Linkable::getManialinkId()
*/
public function getManialinkId()
{
return $this->manialinkId;
}
/**
* @see Linkable::setManialinkId()
*/
public function setManialinkId($manialinkId)
{
$this->manialinkId = (string)$manialinkId;
return $this;
}
/**
* @see MultiLineable::getAutoNewLine()
*/
public function getAutoNewLine()
{
return $this->autoNewLine;
}
/**
* @see MultiLineable::setAutoNewLine()
*/
public function setAutoNewLine($autoNewLine)
{
$this->autoNewLine = (bool)$autoNewLine;
return $this;
}
/**
* @see MultiLineable::getLineSpacing()
*/
public function getLineSpacing()
{
return $this->lineSpacing;
}
/**
* @see MultiLineable::setLineSpacing()
*/
public function setLineSpacing($lineSpacing)
{
$this->lineSpacing = (float)$lineSpacing;
return $this;
}
/**
* @see MultiLineable::getMaxLines()
*/
public function getMaxLines()
{
return $this->maxLines;
}
/**
* @see MultiLineable::setMaxLines()
*/
public function setMaxLines($maxLines)
{
$this->maxLines = (int)$maxLines;
return $this;
}
/**
* @see Scriptable::getScriptEvents()
*/
public function getScriptEvents()
{
return $this->scriptEvents;
}
/**
* @see Scriptable::setScriptEvents()
*/
public function setScriptEvents($scriptEvents)
{
$this->scriptEvents = (bool)$scriptEvents;
return $this;
}
/**
* @see Scriptable::getScriptAction()
*/
public function getScriptAction()
{
return $this->scriptAction;
}
/**
* @see Scriptable::setScriptAction()
*/
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
{
$this->scriptAction = (string)$scriptAction;
$this->setScriptActionParameters($scriptActionParameters);
return $this;
}
/**
* @see Scriptable::getScriptActionParameters()
*/
public function getScriptActionParameters()
{
return $this->scriptActionParameters;
}
/**
* @see Scriptable::setScriptActionParameters()
*/
public function setScriptActionParameters(array $scriptActionParameters = null)
{
$this->scriptActionParameters = $scriptActionParameters;
return $this;
}
/**
* @see Styleable::getStyle()
*/
public function getStyle()
{
return $this->style;
}
/**
* @see Styleable::setStyle()
*/
public function setStyle($style)
{
$this->style = (string)$style;
return $this;
}
/**
* @see TextFormatable::getTextSize()
*/
public function getTextSize()
{
return $this->textSize;
}
/**
* @see TextFormatable::setTextSize()
*/
public function setTextSize($textSize)
{
$this->textSize = (int)$textSize;
return $this;
}
/**
* @see TextFormatable::getTextFont()
*/
public function getTextFont()
{
return $this->textFont;
}
/**
* @see TextFormatable::setTextFont()
*/
public function setTextFont($textFont)
{
$this->textFont = (string)$textFont;
return $this;
}
/**
* @see TextFormatable::getTextColor()
*/
public function getTextColor()
{
return $this->textColor;
}
/**
* @see TextFormatable::setTextColor()
*/
public function setTextColor($textColor)
{
$this->textColor = (string)$textColor;
return $this;
}
/**
* @see TextFormatable::getAreaColor()
*/
public function getAreaColor()
{
return $this->areaColor;
}
/**
* @see TextFormatable::setAreaColor()
*/
public function setAreaColor($areaColor)
{
$this->areaColor = (string)$areaColor;
return $this;
}
/**
* @see TextFormatable::getAreaFocusColor()
*/
public function getAreaFocusColor()
{
return $this->focusAreaColor;
}
/**
* @see TextFormatable::setAreaFocusColor()
*/
public function setAreaFocusColor($areaFocusColor)
{
$this->focusAreaColor = (string)$areaFocusColor;
return $this;
}
/**
* Add a dynamic Feature showing the current time
*
* @api
* @param bool $showSeconds (optional) If the seconds should be shown
* @param bool $showFullDate (optional) If the date should be shown
* @return static
*/
public function addClockFeature($showSeconds = true, $showFullDate = false)
{
$clock = new Clock($this, $showSeconds, $showFullDate);
$this->addScriptFeature($clock);
return $this;
}
/**
* @see Control::getTagName()
*/
public function getTagName()
{
return "label";
}
/**
* @see Control::getManiaScriptClass()
*/
public function getManiaScriptClass()
{
return "CMlLabel";
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->text) {
$domElement->setAttribute("text", $this->text);
}
if ($this->textId) {
$domElement->setAttribute("textid", $this->textId);
}
if ($this->textPrefix) {
$domElement->setAttribute("textprefix", $this->textPrefix);
}
if ($this->textEmboss) {
$domElement->setAttribute("textemboss", $this->textEmboss);
}
if ($this->translate) {
$domElement->setAttribute("translate", $this->translate);
}
if ($this->opacity != 1.) {
$domElement->setAttribute("opacity", $this->opacity);
}
if ($this->action) {
$domElement->setAttribute("action", $this->action);
}
if ($this->actionKey >= 0) {
$domElement->setAttribute("actionkey", $this->actionKey);
}
if ($this->url) {
$domElement->setAttribute("url", $this->url);
}
if ($this->urlId) {
$domElement->setAttribute("urlid", $this->urlId);
}
if ($this->manialink) {
$domElement->setAttribute("manialink", $this->manialink);
}
if ($this->manialinkId) {
$domElement->setAttribute("manialinkid", $this->manialinkId);
}
if ($this->autoNewLine) {
$domElement->setAttribute("autonewline", $this->autoNewLine);
}
if ($this->lineSpacing) {
$domElement->setAttribute("linespacing", $this->lineSpacing);
}
if ($this->maxLines > 0) {
$domElement->setAttribute("maxline", $this->maxLines);
}
if ($this->scriptEvents) {
$domElement->setAttribute("scriptevents", $this->scriptEvents);
}
if ($this->scriptAction) {
$scriptAction = array($this->scriptAction);
if ($this->scriptActionParameters) {
$scriptAction = array_merge($scriptAction, $this->scriptActionParameters);
}
$domElement->setAttribute("scriptaction", implode("'", $scriptAction));
}
if ($this->style) {
$domElement->setAttribute("style", $this->style);
}
if ($this->textSize >= 0) {
$domElement->setAttribute("textsize", $this->textSize);
}
if ($this->textFont) {
$domElement->setAttribute("textfont", $this->textFont);
}
if ($this->textColor) {
$domElement->setAttribute("textcolor", $this->textColor);
}
if ($this->areaColor) {
$domElement->setAttribute("focusareacolor1", $this->areaColor);
}
if ($this->focusAreaColor) {
$domElement->setAttribute("focusareacolor2", $this->focusAreaColor);
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if (strlen($this->text) > 0) {
$xmlElement->setAttribute('text', $this->text);
}
if ($this->textId) {
$xmlElement->setAttribute('textid', $this->textId);
}
if ($this->textPrefix) {
$xmlElement->setAttribute('textprefix', $this->textPrefix);
}
if ($this->textEmboss) {
$xmlElement->setAttribute('textemboss', $this->textEmboss);
}
if ($this->translate) {
$xmlElement->setAttribute('translate', $this->translate);
}
if ($this->maxLines >= 0) {
$xmlElement->setAttribute('maxlines', $this->maxLines);
}
if ($this->opacity != 1.) {
$xmlElement->setAttribute('opacity', $this->opacity);
}
if (strlen($this->action) > 0) {
$xmlElement->setAttribute('action', $this->action);
}
if ($this->actionKey >= 0) {
$xmlElement->setAttribute('actionkey', $this->actionKey);
}
if ($this->url) {
$xmlElement->setAttribute('url', $this->url);
}
if ($this->manialink) {
$xmlElement->setAttribute('manialink', $this->manialink);
}
if ($this->autoNewLine) {
$xmlElement->setAttribute('autonewline', $this->autoNewLine);
}
if ($this->scriptEvents) {
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
if ($this->style) {
$xmlElement->setAttribute('style', $this->style);
}
if ($this->textSize >= 0) {
$xmlElement->setAttribute('textsize', $this->textSize);
}
if ($this->textFont) {
$xmlElement->setAttribute('textfont', $this->textFont);
}
if ($this->textColor) {
$xmlElement->setAttribute('textcolor', $this->textColor);
}
if ($this->focusAreaColor1) {
$xmlElement->setAttribute('focusareacolor1', $this->focusAreaColor1);
}
if ($this->focusAreaColor2) {
$xmlElement->setAttribute('focusareacolor2', $this->focusAreaColor2);
}
return $xmlElement;
}
} }

View File

@ -8,31 +8,34 @@ use FML\Controls\Label;
* Label class for button styles * Label class for button styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Label_Button extends Label { class Label_Button extends Label
/* {
* Constants
*/ /*
const STYLE_CardButtonMedium = 'CardButtonMedium'; * Constants
const STYLE_CardButtonMediumL = 'CardButtonMediumL'; */
const STYLE_CardButtonMediumS = 'CardButtonMediumS'; const STYLE_CardButtonMedium = 'CardButtonMedium';
const STYLE_CardButtonMediumWide = 'CardButtonMediumWide'; const STYLE_CardButtonMediumL = 'CardButtonMediumL';
const STYLE_CardButtonMediumXL = 'CardButtonMediumXL'; const STYLE_CardButtonMediumS = 'CardButtonMediumS';
const STYLE_CardButtonMediumXS = 'CardButtonMediumXS'; const STYLE_CardButtonMediumWide = 'CardButtonMediumWide';
const STYLE_CardButtonMediumXXL = 'CardButtonMediumXXL'; const STYLE_CardButtonMediumXL = 'CardButtonMediumXL';
const STYLE_CardButtonMediumXXXL = 'CardButtonMediumXXXL'; const STYLE_CardButtonMediumXS = 'CardButtonMediumXS';
const STYLE_CardButtonSmall = 'CardButtonSmall'; const STYLE_CardButtonMediumXXL = 'CardButtonMediumXXL';
const STYLE_CardButtonSmallL = 'CardButtonSmallL'; const STYLE_CardButtonMediumXXXL = 'CardButtonMediumXXXL';
const STYLE_CardButtonSmallS = 'CardButtonSmallS'; const STYLE_CardButtonSmall = 'CardButtonSmall';
const STYLE_CardButtonSmallWide = 'CardButtonSmallWide'; const STYLE_CardButtonSmallL = 'CardButtonSmallL';
const STYLE_CardButtonSmallXL = 'CardButtonSmallXL'; const STYLE_CardButtonSmallS = 'CardButtonSmallS';
const STYLE_CardButtonSmallXS = 'CardButtonSmallXS'; const STYLE_CardButtonSmallWide = 'CardButtonSmallWide';
const STYLE_CardButtonSmallXXL = 'CardButtonSmallXXL'; const STYLE_CardButtonSmallXL = 'CardButtonSmallXL';
const STYLE_CardButtonSmallXXXL = 'CardButtonSmallXXXL'; const STYLE_CardButtonSmallXS = 'CardButtonSmallXS';
const STYLE_CardMain_Quit = 'CardMain_Quit'; const STYLE_CardButtonSmallXXL = 'CardButtonSmallXXL';
const STYLE_CardMain_Tool = 'CardMain_Tool'; const STYLE_CardButtonSmallXXXL = 'CardButtonSmallXXXL';
const STYLE_CardMain_Tool_NoBg = 'CardMain_Tool_NoBg'; const STYLE_CardMain_Quit = 'CardMain_Quit';
const STYLE_CardMain_Tool_NoBg2 = 'CardMain_Tool_NoBg2'; const STYLE_CardMain_Tool = 'CardMain_Tool';
const STYLE_CardMain_Tool_NoBg = 'CardMain_Tool_NoBg';
const STYLE_CardMain_Tool_NoBg2 = 'CardMain_Tool_NoBg2';
} }

View File

@ -8,90 +8,93 @@ use FML\Controls\Label;
* Label class for text styles * Label class for text styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Label_Text extends Label { class Label_Text extends Label
/* {
* Constants
*/ /*
const STYLE_AvatarButtonNormal = 'AvatarButtonNormal'; * Constants
const STYLE_BgMainMenuTitleHeader = 'BgMainMenuTitleHeader'; */
const STYLE_Default = 'Default'; const STYLE_AvatarButtonNormal = 'AvatarButtonNormal';
const STYLE_FrameTransitionFromLeft = 'FrameTransitionFromLeft'; const STYLE_BgMainMenuTitleHeader = 'BgMainMenuTitleHeader';
const STYLE_FrameTransitionsFromRight = 'FrameTransitionsFromRight'; const STYLE_Default = 'Default';
const STYLE_ListItemMedal = 'ListItemMedal'; const STYLE_FrameTransitionFromLeft = 'FrameTransitionFromLeft';
const STYLE_Manialink_Body = 'Manialink_Body'; const STYLE_FrameTransitionsFromRight = 'FrameTransitionsFromRight';
const STYLE_ProgressBar = 'ProgressBar'; const STYLE_ListItemMedal = 'ListItemMedal';
const STYLE_ProgressBarSmall = 'ProgressBarSmall'; const STYLE_Manialink_Body = 'Manialink_Body';
const STYLE_SliderSmall = 'SliderSmall'; const STYLE_ProgressBar = 'ProgressBar';
const STYLE_SliderVolume = 'SliderVolume'; const STYLE_ProgressBarSmall = 'ProgressBarSmall';
const STYLE_StyleTextScriptEditor = 'StyleTextScriptEditor'; const STYLE_SliderSmall = 'SliderSmall';
const STYLE_StyleValueYellowSmall = 'StyleValueYellowSmall'; const STYLE_SliderVolume = 'SliderVolume';
const STYLE_TextActionMaker = 'TextActionMaker'; const STYLE_StyleTextScriptEditor = 'StyleTextScriptEditor';
const STYLE_TextButtonBig = 'TextButtonBig'; const STYLE_StyleValueYellowSmall = 'StyleValueYellowSmall';
const STYLE_TextButtonMedium = 'TextButtonMedium'; const STYLE_TextActionMaker = 'TextActionMaker';
const STYLE_TextButtonNav = 'TextButtonNav'; const STYLE_TextButtonBig = 'TextButtonBig';
const STYLE_TextButtonNavBack = 'TextButtonNavBack'; const STYLE_TextButtonMedium = 'TextButtonMedium';
const STYLE_TextButtonSmall = 'TextButtonSmall'; const STYLE_TextButtonNav = 'TextButtonNav';
const STYLE_TextCardInfoSmall = 'TextCardInfoSmall'; const STYLE_TextButtonNavBack = 'TextButtonNavBack';
const STYLE_TextCardInfoVerySmall = 'TextCardInfoVerySmall'; const STYLE_TextButtonSmall = 'TextButtonSmall';
const STYLE_TextCardMedium = 'TextCardMedium'; const STYLE_TextCardInfoSmall = 'TextCardInfoSmall';
const STYLE_TextCardMediumWhite = 'TextCardMediumWhite'; const STYLE_TextCardInfoVerySmall = 'TextCardInfoVerySmall';
const STYLE_TextCardRaceRank = 'TextCardRaceRank'; const STYLE_TextCardMedium = 'TextCardMedium';
const STYLE_TextCardScores2 = 'TextCardScores2'; const STYLE_TextCardMediumWhite = 'TextCardMediumWhite';
const STYLE_TextCardSmall = 'TextCardSmall'; const STYLE_TextCardRaceRank = 'TextCardRaceRank';
const STYLE_TextCardSmallScores2 = 'TextCardSmallScores2'; const STYLE_TextCardScores2 = 'TextCardScores2';
const STYLE_TextCardSmallScores2Rank = 'TextCardSmallScores2Rank'; const STYLE_TextCardSmall = 'TextCardSmall';
const STYLE_TextChallengeNameMedal = 'TextChallengeNameMedal'; const STYLE_TextCardSmallScores2 = 'TextCardSmallScores2';
const STYLE_TextChallengeNameMedalNone = 'TextChallengeNameMedalNone'; const STYLE_TextCardSmallScores2Rank = 'TextCardSmallScores2Rank';
const STYLE_TextChallengeNameMedium = 'TextChallengeNameMedium'; const STYLE_TextChallengeNameMedal = 'TextChallengeNameMedal';
const STYLE_TextChallengeNameSmall = 'TextChallengeNameSmall'; const STYLE_TextChallengeNameMedalNone = 'TextChallengeNameMedalNone';
const STYLE_TextCongratsBig = 'TextCongratsBig'; const STYLE_TextChallengeNameMedium = 'TextChallengeNameMedium';
const STYLE_TextCredits = 'TextCredits'; const STYLE_TextChallengeNameSmall = 'TextChallengeNameSmall';
const STYLE_TextCreditsTitle = 'TextCreditsTitle'; const STYLE_TextCongratsBig = 'TextCongratsBig';
const STYLE_TextEditorArticle = 'TextEditorArticle'; const STYLE_TextCredits = 'TextCredits';
const STYLE_TextInfoMedium = 'TextInfoMedium'; const STYLE_TextCreditsTitle = 'TextCreditsTitle';
const STYLE_TextInfoSmall = 'TextInfoSmall'; const STYLE_TextEditorArticle = 'TextEditorArticle';
const STYLE_TextPlayerCardName = 'TextPlayerCardName'; const STYLE_TextInfoMedium = 'TextInfoMedium';
const STYLE_TextPlayerCardScore = 'TextPlayerCardScore'; const STYLE_TextInfoSmall = 'TextInfoSmall';
const STYLE_TextRaceChat = 'TextRaceChat'; const STYLE_TextPlayerCardName = 'TextPlayerCardName';
const STYLE_TextRaceChrono = 'TextRaceChrono'; const STYLE_TextPlayerCardScore = 'TextPlayerCardScore';
const STYLE_TextRaceChronoError = 'TextRaceChronoError'; const STYLE_TextRaceChat = 'TextRaceChat';
const STYLE_TextRaceChronoOfficial = 'TextRaceChronoOfficial'; const STYLE_TextRaceChrono = 'TextRaceChrono';
const STYLE_TextRaceChronoWarning = 'TextRaceChronoWarning'; const STYLE_TextRaceChronoError = 'TextRaceChronoError';
const STYLE_TextRaceMessage = 'TextRaceMessage'; const STYLE_TextRaceChronoOfficial = 'TextRaceChronoOfficial';
const STYLE_TextRaceMessageBig = 'TextRaceMessageBig'; const STYLE_TextRaceChronoWarning = 'TextRaceChronoWarning';
const STYLE_TextRaceStaticSmall = 'TextRaceStaticSmall'; const STYLE_TextRaceMessage = 'TextRaceMessage';
const STYLE_TextRaceValueSmall = 'TextRaceValueSmall'; const STYLE_TextRaceMessageBig = 'TextRaceMessageBig';
const STYLE_TextRankingsBig = 'TextRankingsBig'; const STYLE_TextRaceStaticSmall = 'TextRaceStaticSmall';
const STYLE_TextSPScoreBig = 'TextSPScoreBig'; const STYLE_TextRaceValueSmall = 'TextRaceValueSmall';
const STYLE_TextSPScoreMedium = 'TextSPScoreMedium'; const STYLE_TextRankingsBig = 'TextRankingsBig';
const STYLE_TextSPScoreSmall = 'TextSPScoreSmall'; const STYLE_TextSPScoreBig = 'TextSPScoreBig';
const STYLE_TextStaticMedium = 'TextStaticMedium'; const STYLE_TextSPScoreMedium = 'TextSPScoreMedium';
const STYLE_TextStaticSmall = 'TextStaticSmall'; const STYLE_TextSPScoreSmall = 'TextSPScoreSmall';
const STYLE_TextStaticVerySmall = 'TextStaticVerySmall'; const STYLE_TextStaticMedium = 'TextStaticMedium';
const STYLE_TextSubTitle1 = 'TextSubTitle1'; const STYLE_TextStaticSmall = 'TextStaticSmall';
const STYLE_TextSubTitle2 = 'TextSubTitle2'; const STYLE_TextStaticVerySmall = 'TextStaticVerySmall';
const STYLE_TextTips = 'TextTips'; const STYLE_TextSubTitle1 = 'TextSubTitle1';
const STYLE_TextTitle1 = 'TextTitle1'; const STYLE_TextSubTitle2 = 'TextSubTitle2';
const STYLE_TextTitle2 = 'TextTitle2'; const STYLE_TextTips = 'TextTips';
const STYLE_TextTitle2Blink = 'TextTitle2Blink'; const STYLE_TextTitle1 = 'TextTitle1';
const STYLE_TextTitle3 = 'TextTitle3'; const STYLE_TextTitle2 = 'TextTitle2';
const STYLE_TextTitle3Header = 'TextTitle3Header'; const STYLE_TextTitle2Blink = 'TextTitle2Blink';
const STYLE_TextTitleError = 'TextTitleError'; const STYLE_TextTitle3 = 'TextTitle3';
const STYLE_TextToolTipAM = 'TextToolTipAM'; const STYLE_TextTitle3Header = 'TextTitle3Header';
const STYLE_TextToolTipAMBig = 'TextToolTipAMBig'; const STYLE_TextTitleError = 'TextTitleError';
const STYLE_TextValueBig = 'TextValueBig'; const STYLE_TextToolTipAM = 'TextToolTipAM';
const STYLE_TextValueMedium = 'TextValueMedium'; const STYLE_TextToolTipAMBig = 'TextToolTipAMBig';
const STYLE_TextValueMediumSm = 'TextValueMediumSm'; const STYLE_TextValueBig = 'TextValueBig';
const STYLE_TextValueSmall = 'TextValueSmall'; const STYLE_TextValueMedium = 'TextValueMedium';
const STYLE_TextValueSmallSm = 'TextValueSmallSm'; const STYLE_TextValueMediumSm = 'TextValueMediumSm';
const STYLE_TrackerText = 'TrackerText'; const STYLE_TextValueSmall = 'TextValueSmall';
const STYLE_TrackerTextBig = 'TrackerTextBig'; const STYLE_TextValueSmallSm = 'TextValueSmallSm';
const STYLE_TrackListItem = 'TrackListItem'; const STYLE_TrackerText = 'TrackerText';
const STYLE_TrackListLine = 'TrackListLine'; const STYLE_TrackerTextBig = 'TrackerTextBig';
const STYLE_UiDriving_BgBottom = 'UiDriving_BgBottom'; const STYLE_TrackListItem = 'TrackListItem';
const STYLE_UiDriving_BgCard = 'UiDriving_BgCard'; const STYLE_TrackListLine = 'TrackListLine';
const STYLE_UiDriving_BgCenter = 'UiDriving_BgCenter'; const STYLE_UiDriving_BgBottom = 'UiDriving_BgBottom';
const STYLE_UiDriving_BgCard = 'UiDriving_BgCard';
const STYLE_UiDriving_BgCenter = 'UiDriving_BgCenter';
} }

File diff suppressed because it is too large Load Diff

View File

@ -8,21 +8,24 @@ use FML\Controls\Quad;
* Quad class for '321Go' styles * Quad class for '321Go' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_321Go extends Quad { class Quad_321Go extends Quad
/* {
* Constants
*/ /*
const STYLE = '321Go'; * Constants
const SUBSTYLE_3 = '3'; */
const SUBSTYLE_2 = '2'; const STYLE = '321Go';
const SUBSTYLE_1 = '1'; const SUBSTYLE_3 = '3';
const SUBSTYLE_Go = 'Go!'; const SUBSTYLE_2 = '2';
const SUBSTYLE_1 = '1';
const SUBSTYLE_Go = 'Go!';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,44 +8,47 @@ use FML\Controls\Quad;
* Quad class for 'BgRaceScore2' styles * Quad class for 'BgRaceScore2' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_BgRaceScore2 extends Quad { class Quad_BgRaceScore2 extends Quad
/* {
* Constants
*/ /*
const STYLE = 'BgRaceScore2'; * Constants
const SUBSTYLE_BgCardPlayer = 'BgCardPlayer'; */
const SUBSTYLE_BgCardServer = 'BgCardServer'; const STYLE = 'BgRaceScore2';
const SUBSTYLE_BgScores = 'BgScores'; const SUBSTYLE_BgCardPlayer = 'BgCardPlayer';
const SUBSTYLE_Cartouche = 'Cartouche'; const SUBSTYLE_BgCardServer = 'BgCardServer';
const SUBSTYLE_CartoucheLine = 'CartoucheLine'; const SUBSTYLE_BgScores = 'BgScores';
const SUBSTYLE_CupFinisher = 'CupFinisher'; const SUBSTYLE_Cartouche = 'Cartouche';
const SUBSTYLE_CupPotentialFinisher = 'CupPotentialFinisher'; const SUBSTYLE_CartoucheLine = 'CartoucheLine';
const SUBSTYLE_Fame = 'Fame'; const SUBSTYLE_CupFinisher = 'CupFinisher';
const SUBSTYLE_Handle = 'Handle'; const SUBSTYLE_CupPotentialFinisher = 'CupPotentialFinisher';
const SUBSTYLE_HandleBlue = 'HandleBlue'; const SUBSTYLE_Fame = 'Fame';
const SUBSTYLE_HandleRed = 'HandleRed'; const SUBSTYLE_Handle = 'Handle';
const SUBSTYLE_HandleSelectable = 'HandleSelectable'; const SUBSTYLE_HandleBlue = 'HandleBlue';
const SUBSTYLE_IsLadderDisabled = 'IsLadderDisabled'; const SUBSTYLE_HandleRed = 'HandleRed';
const SUBSTYLE_IsLocalPlayer = 'IsLocalPlayer'; const SUBSTYLE_HandleSelectable = 'HandleSelectable';
const SUBSTYLE_LadderPoints = 'LadderPoints'; const SUBSTYLE_IsLadderDisabled = 'IsLadderDisabled';
const SUBSTYLE_LadderRank = 'LadderRank'; const SUBSTYLE_IsLocalPlayer = 'IsLocalPlayer';
const SUBSTYLE_Laps = 'Laps'; const SUBSTYLE_LadderPoints = 'LadderPoints';
const SUBSTYLE_Podium = 'Podium'; const SUBSTYLE_LadderRank = 'LadderRank';
const SUBSTYLE_Points = 'Points'; const SUBSTYLE_Laps = 'Laps';
const SUBSTYLE_SandTimer = 'SandTimer'; const SUBSTYLE_Podium = 'Podium';
const SUBSTYLE_ScoreLink = 'ScoreLink'; const SUBSTYLE_Points = 'Points';
const SUBSTYLE_ScoreReplay = 'ScoreReplay'; const SUBSTYLE_SandTimer = 'SandTimer';
const SUBSTYLE_SendScore = 'SendScore'; const SUBSTYLE_ScoreLink = 'ScoreLink';
const SUBSTYLE_Speaking = 'Speaking'; const SUBSTYLE_ScoreReplay = 'ScoreReplay';
const SUBSTYLE_Spectator = 'Spectator'; const SUBSTYLE_SendScore = 'SendScore';
const SUBSTYLE_Tv = 'Tv'; const SUBSTYLE_Speaking = 'Speaking';
const SUBSTYLE_Warmup = 'Warmup'; const SUBSTYLE_Spectator = 'Spectator';
const SUBSTYLE_Tv = 'Tv';
const SUBSTYLE_Warmup = 'Warmup';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,86 +8,89 @@ use FML\Controls\Quad;
* Quad class for 'Bgs1' styles * Quad class for 'Bgs1' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_Bgs1 extends Quad { class Quad_Bgs1 extends Quad
/* {
* Constants
*/ /*
const STYLE = 'Bgs1'; * Constants
const SUBSTYLE_ArrowDown = 'ArrowDown'; */
const SUBSTYLE_ArrowLeft = 'ArrowLeft'; const STYLE = 'Bgs1';
const SUBSTYLE_ArrowRight = 'ArrowRight'; const SUBSTYLE_ArrowDown = 'ArrowDown';
const SUBSTYLE_ArrowUp = 'ArrowUp'; const SUBSTYLE_ArrowLeft = 'ArrowLeft';
const SUBSTYLE_BgButton = 'BgButton'; const SUBSTYLE_ArrowRight = 'ArrowRight';
const SUBSTYLE_BgButtonBig = 'BgButtonBig'; const SUBSTYLE_ArrowUp = 'ArrowUp';
const SUBSTYLE_BgButtonGlow = 'BgButtonGlow'; const SUBSTYLE_BgButton = 'BgButton';
const SUBSTYLE_BgButtonGrayed = 'BgButtonGrayed'; const SUBSTYLE_BgButtonBig = 'BgButtonBig';
const SUBSTYLE_BgButtonOff = 'BgButtonOff'; const SUBSTYLE_BgButtonGlow = 'BgButtonGlow';
const SUBSTYLE_BgButtonShadow = 'BgButtonShadow'; const SUBSTYLE_BgButtonGrayed = 'BgButtonGrayed';
const SUBSTYLE_BgButtonSmall = 'BgButtonSmall'; const SUBSTYLE_BgButtonOff = 'BgButtonOff';
const SUBSTYLE_BgCard = 'BgCard'; const SUBSTYLE_BgButtonShadow = 'BgButtonShadow';
const SUBSTYLE_BgCard1 = 'BgCard1'; const SUBSTYLE_BgButtonSmall = 'BgButtonSmall';
const SUBSTYLE_BgCard2 = 'BgCard2'; const SUBSTYLE_BgCard = 'BgCard';
const SUBSTYLE_BgCard3 = 'BgCard3'; const SUBSTYLE_BgCard1 = 'BgCard1';
const SUBSTYLE_BgCardBuddy = 'BgCardBuddy'; const SUBSTYLE_BgCard2 = 'BgCard2';
const SUBSTYLE_BgCardChallenge = 'BgCardChallenge'; const SUBSTYLE_BgCard3 = 'BgCard3';
const SUBSTYLE_BgCardFolder = 'BgCardFolder'; const SUBSTYLE_BgCardBuddy = 'BgCardBuddy';
const SUBSTYLE_BgCardInventoryItem = 'BgCardInventoryItem'; const SUBSTYLE_BgCardChallenge = 'BgCardChallenge';
const SUBSTYLE_BgCardList = 'BgCardList'; const SUBSTYLE_BgCardFolder = 'BgCardFolder';
const SUBSTYLE_BgCardOnline = 'BgCardOnline'; const SUBSTYLE_BgCardInventoryItem = 'BgCardInventoryItem';
const SUBSTYLE_BgCardPlayer = 'BgCardPlayer'; const SUBSTYLE_BgCardList = 'BgCardList';
const SUBSTYLE_BgCardProperty = 'BgCardProperty'; const SUBSTYLE_BgCardOnline = 'BgCardOnline';
const SUBSTYLE_BgCardSystem = 'BgCardSystem'; const SUBSTYLE_BgCardPlayer = 'BgCardPlayer';
const SUBSTYLE_BgCardZone = 'BgCardZone'; const SUBSTYLE_BgCardProperty = 'BgCardProperty';
const SUBSTYLE_BgColorContour = 'BgColorContour'; const SUBSTYLE_BgCardSystem = 'BgCardSystem';
const SUBSTYLE_BgDialogBlur = 'BgDialogBlur'; const SUBSTYLE_BgCardZone = 'BgCardZone';
const SUBSTYLE_BgEmpty = 'BgEmpty'; const SUBSTYLE_BgColorContour = 'BgColorContour';
const SUBSTYLE_BgGlow2 = 'BgGlow2'; const SUBSTYLE_BgDialogBlur = 'BgDialogBlur';
const SUBSTYLE_BgGradBottom = 'BgGradBottom'; const SUBSTYLE_BgEmpty = 'BgEmpty';
const SUBSTYLE_BgGradLeft = 'BgGradLeft'; const SUBSTYLE_BgGlow2 = 'BgGlow2';
const SUBSTYLE_BgGradRight = 'BgGradRight'; const SUBSTYLE_BgGradBottom = 'BgGradBottom';
const SUBSTYLE_BgGradTop = 'BgGradTop'; const SUBSTYLE_BgGradLeft = 'BgGradLeft';
const SUBSTYLE_BgGradV = 'BgGradV'; const SUBSTYLE_BgGradRight = 'BgGradRight';
const SUBSTYLE_BgHealthBar = 'BgHealthBar'; const SUBSTYLE_BgGradTop = 'BgGradTop';
const SUBSTYLE_BgIconBorder = 'BgIconBorder'; const SUBSTYLE_BgGradV = 'BgGradV';
const SUBSTYLE_BgList = 'BgList'; const SUBSTYLE_BgHealthBar = 'BgHealthBar';
const SUBSTYLE_BgListLine = 'BgListLine'; const SUBSTYLE_BgIconBorder = 'BgIconBorder';
const SUBSTYLE_BgMetalBar = 'BgMetalBar'; const SUBSTYLE_BgList = 'BgList';
const SUBSTYLE_BgPager = 'BgPager'; const SUBSTYLE_BgListLine = 'BgListLine';
const SUBSTYLE_BgProgressBar = 'BgProgressBar'; const SUBSTYLE_BgMetalBar = 'BgMetalBar';
const SUBSTYLE_BgShadow = 'BgShadow'; const SUBSTYLE_BgPager = 'BgPager';
const SUBSTYLE_BgSlider = 'BgSlider'; const SUBSTYLE_BgProgressBar = 'BgProgressBar';
const SUBSTYLE_BgSystemBar = 'BgSystemBar'; const SUBSTYLE_BgShadow = 'BgShadow';
const SUBSTYLE_BgTitle = 'BgTitle'; const SUBSTYLE_BgSlider = 'BgSlider';
const SUBSTYLE_BgTitle2 = 'BgTitle2'; const SUBSTYLE_BgSystemBar = 'BgSystemBar';
const SUBSTYLE_BgTitle3 = 'BgTitle3'; const SUBSTYLE_BgTitle = 'BgTitle';
const SUBSTYLE_BgTitle3_1 = 'BgTitle3_1'; const SUBSTYLE_BgTitle2 = 'BgTitle2';
const SUBSTYLE_BgTitle3_2 = 'BgTitle3_2'; const SUBSTYLE_BgTitle3 = 'BgTitle3';
const SUBSTYLE_BgTitle3_3 = 'BgTitle3_3'; const SUBSTYLE_BgTitle3_1 = 'BgTitle3_1';
const SUBSTYLE_BgTitle3_4 = 'BgTitle3_4'; const SUBSTYLE_BgTitle3_2 = 'BgTitle3_2';
const SUBSTYLE_BgTitle3_5 = 'BgTitle3_5'; const SUBSTYLE_BgTitle3_3 = 'BgTitle3_3';
const SUBSTYLE_BgTitleGlow = 'BgTitleGlow'; const SUBSTYLE_BgTitle3_4 = 'BgTitle3_4';
const SUBSTYLE_BgTitlePage = 'BgTitlePage'; const SUBSTYLE_BgTitle3_5 = 'BgTitle3_5';
const SUBSTYLE_BgTitleShadow = 'BgTitleShadow'; const SUBSTYLE_BgTitleGlow = 'BgTitleGlow';
const SUBSTYLE_BgWindow1 = 'BgWindow1'; const SUBSTYLE_BgTitlePage = 'BgTitlePage';
const SUBSTYLE_BgWindow2 = 'BgWindow2'; const SUBSTYLE_BgTitleShadow = 'BgTitleShadow';
const SUBSTYLE_BgWindow3 = 'BgWindow3'; const SUBSTYLE_BgWindow1 = 'BgWindow1';
const SUBSTYLE_BgWindow4 = 'BgWindow4'; const SUBSTYLE_BgWindow2 = 'BgWindow2';
const SUBSTYLE_EnergyBar = 'EnergyBar'; const SUBSTYLE_BgWindow3 = 'BgWindow3';
const SUBSTYLE_EnergyTeam2 = 'EnergyTeam2'; const SUBSTYLE_BgWindow4 = 'BgWindow4';
const SUBSTYLE_Glow = 'Glow'; const SUBSTYLE_EnergyBar = 'EnergyBar';
const SUBSTYLE_HealthBar = 'HealthBar'; const SUBSTYLE_EnergyTeam2 = 'EnergyTeam2';
const SUBSTYLE_NavButton = 'NavButton'; const SUBSTYLE_Glow = 'Glow';
const SUBSTYLE_NavButtonBlink = 'NavButtonBlink'; const SUBSTYLE_HealthBar = 'HealthBar';
const SUBSTYLE_NavButtonQuit = 'NavButtonQuit'; const SUBSTYLE_NavButton = 'NavButton';
const SUBSTYLE_ProgressBar = 'ProgressBar'; const SUBSTYLE_NavButtonBlink = 'NavButtonBlink';
const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall'; const SUBSTYLE_NavButtonQuit = 'NavButtonQuit';
const SUBSTYLE_Shadow = 'Shadow'; const SUBSTYLE_ProgressBar = 'ProgressBar';
const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall';
const SUBSTYLE_Shadow = 'Shadow';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,86 +8,89 @@ use FML\Controls\Quad;
* Quad class for 'Bgs1InRace' styles * Quad class for 'Bgs1InRace' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_Bgs1InRace extends Quad { class Quad_Bgs1InRace extends Quad
/* {
* Constants
*/ /*
const STYLE = 'Bgs1InRace'; * Constants
const SUBSTYLE_ArrowDown = 'ArrowDown'; */
const SUBSTYLE_ArrowLeft = 'ArrowLeft'; const STYLE = 'Bgs1InRace';
const SUBSTYLE_ArrowRight = 'ArrowRight'; const SUBSTYLE_ArrowDown = 'ArrowDown';
const SUBSTYLE_ArrowUp = 'ArrowUp'; const SUBSTYLE_ArrowLeft = 'ArrowLeft';
const SUBSTYLE_BgButton = 'BgButton'; const SUBSTYLE_ArrowRight = 'ArrowRight';
const SUBSTYLE_BgButtonBig = 'BgButtonBig'; const SUBSTYLE_ArrowUp = 'ArrowUp';
const SUBSTYLE_BgButtonGlow = 'BgButtonGlow'; const SUBSTYLE_BgButton = 'BgButton';
const SUBSTYLE_BgButtonGrayed = 'BgButtonGrayed'; const SUBSTYLE_BgButtonBig = 'BgButtonBig';
const SUBSTYLE_BgButtonOff = 'BgButtonOff'; const SUBSTYLE_BgButtonGlow = 'BgButtonGlow';
const SUBSTYLE_BgButtonShadow = 'BgButtonShadow'; const SUBSTYLE_BgButtonGrayed = 'BgButtonGrayed';
const SUBSTYLE_BgButtonSmall = 'BgButtonSmall'; const SUBSTYLE_BgButtonOff = 'BgButtonOff';
const SUBSTYLE_BgCard = 'BgCard'; const SUBSTYLE_BgButtonShadow = 'BgButtonShadow';
const SUBSTYLE_BgCard1 = 'BgCard1'; const SUBSTYLE_BgButtonSmall = 'BgButtonSmall';
const SUBSTYLE_BgCard2 = 'BgCard2'; const SUBSTYLE_BgCard = 'BgCard';
const SUBSTYLE_BgCard3 = 'BgCard3'; const SUBSTYLE_BgCard1 = 'BgCard1';
const SUBSTYLE_BgCardBuddy = 'BgCardBuddy'; const SUBSTYLE_BgCard2 = 'BgCard2';
const SUBSTYLE_BgCardChallenge = 'BgCardChallenge'; const SUBSTYLE_BgCard3 = 'BgCard3';
const SUBSTYLE_BgCardFolder = 'BgCardFolder'; const SUBSTYLE_BgCardBuddy = 'BgCardBuddy';
const SUBSTYLE_BgCardInventoryItem = 'BgCardInventoryItem'; const SUBSTYLE_BgCardChallenge = 'BgCardChallenge';
const SUBSTYLE_BgCardList = 'BgCardList'; const SUBSTYLE_BgCardFolder = 'BgCardFolder';
const SUBSTYLE_BgCardOnline = 'BgCardOnline'; const SUBSTYLE_BgCardInventoryItem = 'BgCardInventoryItem';
const SUBSTYLE_BgCardPlayer = 'BgCardPlayer'; const SUBSTYLE_BgCardList = 'BgCardList';
const SUBSTYLE_BgCardProperty = 'BgCardProperty'; const SUBSTYLE_BgCardOnline = 'BgCardOnline';
const SUBSTYLE_BgCardSystem = 'BgCardSystem'; const SUBSTYLE_BgCardPlayer = 'BgCardPlayer';
const SUBSTYLE_BgCardZone = 'BgCardZone'; const SUBSTYLE_BgCardProperty = 'BgCardProperty';
const SUBSTYLE_BgColorContour = 'BgColorContour'; const SUBSTYLE_BgCardSystem = 'BgCardSystem';
const SUBSTYLE_BgDialogBlur = 'BgDialogBlur'; const SUBSTYLE_BgCardZone = 'BgCardZone';
const SUBSTYLE_BgEmpty = 'BgEmpty'; const SUBSTYLE_BgColorContour = 'BgColorContour';
const SUBSTYLE_BgGlow2 = 'BgGlow2'; const SUBSTYLE_BgDialogBlur = 'BgDialogBlur';
const SUBSTYLE_BgGradBottom = 'BgGradBottom'; const SUBSTYLE_BgEmpty = 'BgEmpty';
const SUBSTYLE_BgGradLeft = 'BgGradLeft'; const SUBSTYLE_BgGlow2 = 'BgGlow2';
const SUBSTYLE_BgGradRight = 'BgGradRight'; const SUBSTYLE_BgGradBottom = 'BgGradBottom';
const SUBSTYLE_BgGradTop = 'BgGradTop'; const SUBSTYLE_BgGradLeft = 'BgGradLeft';
const SUBSTYLE_BgGradV = 'BgGradV'; const SUBSTYLE_BgGradRight = 'BgGradRight';
const SUBSTYLE_BgHealthBar = 'BgHealthBar'; const SUBSTYLE_BgGradTop = 'BgGradTop';
const SUBSTYLE_BgIconBorder = 'BgIconBorder'; const SUBSTYLE_BgGradV = 'BgGradV';
const SUBSTYLE_BgList = 'BgList'; const SUBSTYLE_BgHealthBar = 'BgHealthBar';
const SUBSTYLE_BgListLine = 'BgListLine'; const SUBSTYLE_BgIconBorder = 'BgIconBorder';
const SUBSTYLE_BgMetalBar = 'BgMetalBar'; const SUBSTYLE_BgList = 'BgList';
const SUBSTYLE_BgPager = 'BgPager'; const SUBSTYLE_BgListLine = 'BgListLine';
const SUBSTYLE_BgProgressBar = 'BgProgressBar'; const SUBSTYLE_BgMetalBar = 'BgMetalBar';
const SUBSTYLE_BgShadow = 'BgShadow'; const SUBSTYLE_BgPager = 'BgPager';
const SUBSTYLE_BgSlider = 'BgSlider'; const SUBSTYLE_BgProgressBar = 'BgProgressBar';
const SUBSTYLE_BgSystemBar = 'BgSystemBar'; const SUBSTYLE_BgShadow = 'BgShadow';
const SUBSTYLE_BgTitle = 'BgTitle'; const SUBSTYLE_BgSlider = 'BgSlider';
const SUBSTYLE_BgTitle2 = 'BgTitle2'; const SUBSTYLE_BgSystemBar = 'BgSystemBar';
const SUBSTYLE_BgTitle3 = 'BgTitle3'; const SUBSTYLE_BgTitle = 'BgTitle';
const SUBSTYLE_BgTitle3_1 = 'BgTitle3_1'; const SUBSTYLE_BgTitle2 = 'BgTitle2';
const SUBSTYLE_BgTitle3_2 = 'BgTitle3_2'; const SUBSTYLE_BgTitle3 = 'BgTitle3';
const SUBSTYLE_BgTitle3_3 = 'BgTitle3_3'; const SUBSTYLE_BgTitle3_1 = 'BgTitle3_1';
const SUBSTYLE_BgTitle3_4 = 'BgTitle3_4'; const SUBSTYLE_BgTitle3_2 = 'BgTitle3_2';
const SUBSTYLE_BgTitle3_5 = 'BgTitle3_5'; const SUBSTYLE_BgTitle3_3 = 'BgTitle3_3';
const SUBSTYLE_BgTitleGlow = 'BgTitleGlow'; const SUBSTYLE_BgTitle3_4 = 'BgTitle3_4';
const SUBSTYLE_BgTitlePage = 'BgTitlePage'; const SUBSTYLE_BgTitle3_5 = 'BgTitle3_5';
const SUBSTYLE_BgTitleShadow = 'BgTitleShadow'; const SUBSTYLE_BgTitleGlow = 'BgTitleGlow';
const SUBSTYLE_BgWindow1 = 'BgWindow1'; const SUBSTYLE_BgTitlePage = 'BgTitlePage';
const SUBSTYLE_BgWindow2 = 'BgWindow2'; const SUBSTYLE_BgTitleShadow = 'BgTitleShadow';
const SUBSTYLE_BgWindow3 = 'BgWindow3'; const SUBSTYLE_BgWindow1 = 'BgWindow1';
const SUBSTYLE_BgWindow4 = 'BgWindow4'; const SUBSTYLE_BgWindow2 = 'BgWindow2';
const SUBSTYLE_EnergyBar = 'EnergyBar'; const SUBSTYLE_BgWindow3 = 'BgWindow3';
const SUBSTYLE_EnergyTeam2 = 'EnergyTeam2'; const SUBSTYLE_BgWindow4 = 'BgWindow4';
const SUBSTYLE_Glow = 'Glow'; const SUBSTYLE_EnergyBar = 'EnergyBar';
const SUBSTYLE_HealthBar = 'HealthBar'; const SUBSTYLE_EnergyTeam2 = 'EnergyTeam2';
const SUBSTYLE_NavButton = 'NavButton'; const SUBSTYLE_Glow = 'Glow';
const SUBSTYLE_NavButtonBlink = 'NavButtonBlink'; const SUBSTYLE_HealthBar = 'HealthBar';
const SUBSTYLE_NavButtonQuit = 'NavButtonQuit'; const SUBSTYLE_NavButton = 'NavButton';
const SUBSTYLE_ProgressBar = 'ProgressBar'; const SUBSTYLE_NavButtonBlink = 'NavButtonBlink';
const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall'; const SUBSTYLE_NavButtonQuit = 'NavButtonQuit';
const SUBSTYLE_Shadow = 'Shadow'; const SUBSTYLE_ProgressBar = 'ProgressBar';
const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall';
const SUBSTYLE_Shadow = 'Shadow';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,24 +8,27 @@ use FML\Controls\Quad;
* Quad class for 'BgsButtons' styles * Quad class for 'BgsButtons' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_BgsButtons extends Quad { class Quad_BgsButtons extends Quad
/* {
* Constants
*/ /*
const STYLE = 'BgsButtons'; * Constants
const SUBSTYLE_BgButtonLarge = 'BgButtonLarge'; */
const SUBSTYLE_BgButtonMedium = 'BgButtonMedium'; const STYLE = 'BgsButtons';
const SUBSTYLE_BgButtonMediumSelector = 'BgButtonMediumSelector'; const SUBSTYLE_BgButtonLarge = 'BgButtonLarge';
const SUBSTYLE_BgButtonMediumSpecial = 'BgButtonMediumSpecial'; const SUBSTYLE_BgButtonMedium = 'BgButtonMedium';
const SUBSTYLE_BgButtonSmall = 'BgButtonSmall'; const SUBSTYLE_BgButtonMediumSelector = 'BgButtonMediumSelector';
const SUBSTYLE_BgButtonSmall2 = 'BgButtonSmall2'; const SUBSTYLE_BgButtonMediumSpecial = 'BgButtonMediumSpecial';
const SUBSTYLE_BgButtonXSmall = 'BgButtonXSmall'; const SUBSTYLE_BgButtonSmall = 'BgButtonSmall';
const SUBSTYLE_BgButtonSmall2 = 'BgButtonSmall2';
const SUBSTYLE_BgButtonXSmall = 'BgButtonXSmall';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,23 +8,26 @@ use FML\Controls\Quad;
* Quad class for 'BgsChallengeMedals' styles * Quad class for 'BgsChallengeMedals' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_BgsChallengeMedals extends Quad { class Quad_BgsChallengeMedals extends Quad
/* {
* Constants
*/ /*
const STYLE = 'BgsChallengeMedals'; * Constants
const SUBSTYLE_BgBronze = 'BgBronze'; */
const SUBSTYLE_BgGold = 'BgGold'; const STYLE = 'BgsChallengeMedals';
const SUBSTYLE_BgNadeo = 'BgNadeo'; const SUBSTYLE_BgBronze = 'BgBronze';
const SUBSTYLE_BgNotPlayed = 'BgNotPlayed'; const SUBSTYLE_BgGold = 'BgGold';
const SUBSTYLE_BgPlayed = 'BgPlayed'; const SUBSTYLE_BgNadeo = 'BgNadeo';
const SUBSTYLE_BgSilver = 'BgSilver'; const SUBSTYLE_BgNotPlayed = 'BgNotPlayed';
const SUBSTYLE_BgPlayed = 'BgPlayed';
const SUBSTYLE_BgSilver = 'BgSilver';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,31 +8,34 @@ use FML\Controls\Quad;
* Quad class for 'BgsPlayerCard' styles * Quad class for 'BgsPlayerCard' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_BgsPlayerCard extends Quad { class Quad_BgsPlayerCard extends Quad
/* {
* Constants
*/ /*
const STYLE = 'BgsPlayerCard'; * Constants
const SUBSTYLE_BgActivePlayerCard = 'BgActivePlayerCard'; */
const SUBSTYLE_BgActivePlayerName = 'BgActivePlayerName'; const STYLE = 'BgsPlayerCard';
const SUBSTYLE_BgActivePlayerScore = 'BgActivePlayerScore'; const SUBSTYLE_BgActivePlayerCard = 'BgActivePlayerCard';
const SUBSTYLE_BgCard = 'BgCard'; const SUBSTYLE_BgActivePlayerName = 'BgActivePlayerName';
const SUBSTYLE_BgCardSystem = 'BgCardSystem'; const SUBSTYLE_BgActivePlayerScore = 'BgActivePlayerScore';
const SUBSTYLE_BgMediaTracker = 'BgMediaTracker'; const SUBSTYLE_BgCard = 'BgCard';
const SUBSTYLE_BgPlayerCard = 'BgPlayerCard'; const SUBSTYLE_BgCardSystem = 'BgCardSystem';
const SUBSTYLE_BgPlayerCardBig = 'BgPlayerCardBig'; const SUBSTYLE_BgMediaTracker = 'BgMediaTracker';
const SUBSTYLE_BgPlayerCardSmall = 'BgPlayerCardSmall'; const SUBSTYLE_BgPlayerCard = 'BgPlayerCard';
const SUBSTYLE_BgPlayerName = 'BgPlayerName'; const SUBSTYLE_BgPlayerCardBig = 'BgPlayerCardBig';
const SUBSTYLE_BgPlayerScore = 'BgPlayerScore'; const SUBSTYLE_BgPlayerCardSmall = 'BgPlayerCardSmall';
const SUBSTYLE_BgRacePlayerLine = 'BgRacePlayerLine'; const SUBSTYLE_BgPlayerName = 'BgPlayerName';
const SUBSTYLE_BgRacePlayerName = 'BgRacePlayerName'; const SUBSTYLE_BgPlayerScore = 'BgPlayerScore';
const SUBSTYLE_ProgressBar = 'ProgressBar'; const SUBSTYLE_BgRacePlayerLine = 'BgRacePlayerLine';
const SUBSTYLE_BgRacePlayerName = 'BgRacePlayerName';
const SUBSTYLE_ProgressBar = 'ProgressBar';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,29 +8,32 @@ use FML\Controls\Quad;
* Quad class for 'Copilot' styles * Quad class for 'Copilot' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_Copilot extends Quad { class Quad_Copilot extends Quad
/* {
* Constants
*/ /*
const STYLE = 'Copilot'; * Constants
const SUBSTYLE_Down = 'Down'; */
const SUBSTYLE_DownGood = 'DownGood'; const STYLE = 'Copilot';
const SUBSTYLE_DownWrong = 'DownWrong'; const SUBSTYLE_Down = 'Down';
const SUBSTYLE_Left = 'Left'; const SUBSTYLE_DownGood = 'DownGood';
const SUBSTYLE_LeftGood = 'LeftGood'; const SUBSTYLE_DownWrong = 'DownWrong';
const SUBSTYLE_LeftWrong = 'LeftWrong'; const SUBSTYLE_Left = 'Left';
const SUBSTYLE_Right = 'Right'; const SUBSTYLE_LeftGood = 'LeftGood';
const SUBSTYLE_RightGood = 'RightGood'; const SUBSTYLE_LeftWrong = 'LeftWrong';
const SUBSTYLE_RightWrong = 'RightWrong'; const SUBSTYLE_Right = 'Right';
const SUBSTYLE_Up = 'Up'; const SUBSTYLE_RightGood = 'RightGood';
const SUBSTYLE_UpGood = 'UpGood'; const SUBSTYLE_RightWrong = 'RightWrong';
const SUBSTYLE_UpWrong = 'UpWrong'; const SUBSTYLE_Up = 'Up';
const SUBSTYLE_UpGood = 'UpGood';
const SUBSTYLE_UpWrong = 'UpWrong';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,20 +8,23 @@ use FML\Controls\Quad;
* Quad class for 'Emblems' styles * Quad class for 'Emblems' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_Emblems extends Quad { class Quad_Emblems extends Quad
/* {
* Constants
*/ /*
const STYLE = 'Emblems'; * Constants
const SUBSTYLE_0 = '#0'; */
const SUBSTYLE_1 = '#1'; const STYLE = 'Emblems';
const SUBSTYLE_2 = '#2'; const SUBSTYLE_0 = '#0';
const SUBSTYLE_1 = '#1';
const SUBSTYLE_2 = '#2';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,23 +8,26 @@ use FML\Controls\Quad;
* Quad class for 'EnergyBar' styles * Quad class for 'EnergyBar' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_EnergyBar extends Quad { class Quad_EnergyBar extends Quad
/* {
* Constants
*/ /*
const STYLE = 'EnergyBar'; * Constants
const SUBSTYLE_BgText = 'BgText'; */
const SUBSTYLE_EnergyBar = 'EnergyBar'; const STYLE = 'EnergyBar';
const SUBSTYLE_EnergyBar_0_25 = 'EnergyBar_0.25'; const SUBSTYLE_BgText = 'BgText';
const SUBSTYLE_EnergyBar_Thin = 'EnergyBar_Thin'; const SUBSTYLE_EnergyBar = 'EnergyBar';
const SUBSTYLE_HeaderGaugeLeft = 'HeaderGaugeLeft'; const SUBSTYLE_EnergyBar_0_25 = 'EnergyBar_0.25';
const SUBSTYLE_HeaderGaugeRight = 'HeaderGaugeRight'; const SUBSTYLE_EnergyBar_Thin = 'EnergyBar_Thin';
const SUBSTYLE_HeaderGaugeLeft = 'HeaderGaugeLeft';
const SUBSTYLE_HeaderGaugeRight = 'HeaderGaugeRight';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,26 +8,29 @@ use FML\Controls\Quad;
* Quad class for 'Hud3dEchelons' styles * Quad class for 'Hud3dEchelons' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_Hud3dEchelons extends Quad { class Quad_Hud3dEchelons extends Quad
/* {
* Constants
*/ /*
const STYLE = 'Hud3dEchelons'; * Constants
const SUBSTYLE_EchelonBronze1 = 'EchelonBronze1'; */
const SUBSTYLE_EchelonBronze2 = 'EchelonBronze2'; const STYLE = 'Hud3dEchelons';
const SUBSTYLE_EchelonBronze3 = 'EchelonBronze3'; const SUBSTYLE_EchelonBronze1 = 'EchelonBronze1';
const SUBSTYLE_EchelonGold1 = 'EchelonGold1'; const SUBSTYLE_EchelonBronze2 = 'EchelonBronze2';
const SUBSTYLE_EchelonGold2 = 'EchelonGold2'; const SUBSTYLE_EchelonBronze3 = 'EchelonBronze3';
const SUBSTYLE_EchelonGold3 = 'EchelonGold3'; const SUBSTYLE_EchelonGold1 = 'EchelonGold1';
const SUBSTYLE_EchelonSilver1 = 'EchelonSilver1'; const SUBSTYLE_EchelonGold2 = 'EchelonGold2';
const SUBSTYLE_EchelonSilver2 = 'EchelonSilver2'; const SUBSTYLE_EchelonGold3 = 'EchelonGold3';
const SUBSTYLE_EchelonSilver3 = 'EchelonSilver3'; const SUBSTYLE_EchelonSilver1 = 'EchelonSilver1';
const SUBSTYLE_EchelonSilver2 = 'EchelonSilver2';
const SUBSTYLE_EchelonSilver3 = 'EchelonSilver3';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,25 +8,28 @@ use FML\Controls\Quad;
* Quad class for 'Hud3dIcons' styles * Quad class for 'Hud3dIcons' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_Hud3dIcons extends Quad { class Quad_Hud3dIcons extends Quad
/* {
* Constants
*/ /*
const STYLE = 'Hud3dIcons'; * Constants
const SUBSTYLE_Cross = 'Cross'; */
const SUBSTYLE_CrossTargeted = 'CrossTargeted'; const STYLE = 'Hud3dIcons';
const SUBSTYLE_Player1 = 'Player1'; const SUBSTYLE_Cross = 'Cross';
const SUBSTYLE_Player2 = 'Player2'; const SUBSTYLE_CrossTargeted = 'CrossTargeted';
const SUBSTYLE_Player3 = 'Player3'; const SUBSTYLE_Player1 = 'Player1';
const SUBSTYLE_PointA = 'PointA'; const SUBSTYLE_Player2 = 'Player2';
const SUBSTYLE_PointB = 'PointB'; const SUBSTYLE_Player3 = 'Player3';
const SUBSTYLE_PointC = 'PointC'; const SUBSTYLE_PointA = 'PointA';
const SUBSTYLE_PointB = 'PointB';
const SUBSTYLE_PointC = 'PointC';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,81 +8,84 @@ use FML\Controls\Quad;
* Quad class for 'Icons128x128_1' styles * Quad class for 'Icons128x128_1' styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_Icons128x128_1 extends Quad { class Quad_Icons128x128_1 extends Quad
/* {
* Constants
*/ /*
const STYLE = 'Icons128x128_1'; * Constants
const SUBSTYLE_Advanced = 'Advanced'; */
const SUBSTYLE_Back = 'Back'; const STYLE = 'Icons128x128_1';
const SUBSTYLE_BackFocusable = 'BackFocusable'; const SUBSTYLE_Advanced = 'Advanced';
const SUBSTYLE_Beginner = 'Beginner'; const SUBSTYLE_Back = 'Back';
const SUBSTYLE_Browse = 'Browse'; const SUBSTYLE_BackFocusable = 'BackFocusable';
const SUBSTYLE_Buddies = 'Buddies'; const SUBSTYLE_Beginner = 'Beginner';
const SUBSTYLE_Challenge = 'Challenge'; const SUBSTYLE_Browse = 'Browse';
const SUBSTYLE_ChallengeAuthor = 'ChallengeAuthor'; const SUBSTYLE_Buddies = 'Buddies';
const SUBSTYLE_Coppers = 'Coppers'; const SUBSTYLE_Challenge = 'Challenge';
const SUBSTYLE_Create = 'Create'; const SUBSTYLE_ChallengeAuthor = 'ChallengeAuthor';
const SUBSTYLE_Credits = 'Credits'; const SUBSTYLE_Coppers = 'Coppers';
const SUBSTYLE_Custom = 'Custom'; const SUBSTYLE_Create = 'Create';
const SUBSTYLE_CustomStars = 'CustomStars'; const SUBSTYLE_Credits = 'Credits';
const SUBSTYLE_Default = 'Default'; const SUBSTYLE_Custom = 'Custom';
const SUBSTYLE_Download = 'Download'; const SUBSTYLE_CustomStars = 'CustomStars';
const SUBSTYLE_Easy = 'Easy'; const SUBSTYLE_Default = 'Default';
const SUBSTYLE_Editor = 'Editor'; const SUBSTYLE_Download = 'Download';
const SUBSTYLE_Event = 'Event'; const SUBSTYLE_Easy = 'Easy';
const SUBSTYLE_Extreme = 'Extreme'; const SUBSTYLE_Editor = 'Editor';
const SUBSTYLE_Forever = 'Forever'; const SUBSTYLE_Event = 'Event';
const SUBSTYLE_GhostEditor = 'GhostEditor'; const SUBSTYLE_Extreme = 'Extreme';
const SUBSTYLE_Hard = 'Hard'; const SUBSTYLE_Forever = 'Forever';
const SUBSTYLE_Hotseat = 'Hotseat'; const SUBSTYLE_GhostEditor = 'GhostEditor';
const SUBSTYLE_Inputs = 'Inputs'; const SUBSTYLE_Hard = 'Hard';
const SUBSTYLE_Invite = 'Invite'; const SUBSTYLE_Hotseat = 'Hotseat';
const SUBSTYLE_LadderPoints = 'LadderPoints'; const SUBSTYLE_Inputs = 'Inputs';
const SUBSTYLE_Lan = 'Lan'; const SUBSTYLE_Invite = 'Invite';
const SUBSTYLE_Launch = 'Launch'; const SUBSTYLE_LadderPoints = 'LadderPoints';
const SUBSTYLE_Load = 'Load'; const SUBSTYLE_Lan = 'Lan';
const SUBSTYLE_LoadTrack = 'LoadTrack'; const SUBSTYLE_Launch = 'Launch';
const SUBSTYLE_Manialink = 'Manialink'; const SUBSTYLE_Load = 'Load';
const SUBSTYLE_ManiaZones = 'ManiaZones'; const SUBSTYLE_LoadTrack = 'LoadTrack';
const SUBSTYLE_MedalCount = 'MedalCount'; const SUBSTYLE_Manialink = 'Manialink';
const SUBSTYLE_MediaTracker = 'MediaTracker'; const SUBSTYLE_ManiaZones = 'ManiaZones';
const SUBSTYLE_Medium = 'Medium'; const SUBSTYLE_MedalCount = 'MedalCount';
const SUBSTYLE_Multiplayer = 'Multiplayer'; const SUBSTYLE_MediaTracker = 'MediaTracker';
const SUBSTYLE_Nations = 'Nations'; const SUBSTYLE_Medium = 'Medium';
const SUBSTYLE_NewTrack = 'NewTrack'; const SUBSTYLE_Multiplayer = 'Multiplayer';
const SUBSTYLE_Options = 'Options'; const SUBSTYLE_Nations = 'Nations';
const SUBSTYLE_Padlock = 'Padlock'; const SUBSTYLE_NewTrack = 'NewTrack';
const SUBSTYLE_Paint = 'Paint'; const SUBSTYLE_Options = 'Options';
const SUBSTYLE_Platform = 'Platform'; const SUBSTYLE_Padlock = 'Padlock';
const SUBSTYLE_PlayerPage = 'PlayerPage'; const SUBSTYLE_Paint = 'Paint';
const SUBSTYLE_Profile = 'Profile'; const SUBSTYLE_Platform = 'Platform';
const SUBSTYLE_ProfileAdvanced = 'ProfileAdvanced'; const SUBSTYLE_PlayerPage = 'PlayerPage';
const SUBSTYLE_ProfileVehicle = 'ProfileVehicle'; const SUBSTYLE_Profile = 'Profile';
const SUBSTYLE_Puzzle = 'Puzzle'; const SUBSTYLE_ProfileAdvanced = 'ProfileAdvanced';
const SUBSTYLE_Quit = 'Quit'; const SUBSTYLE_ProfileVehicle = 'ProfileVehicle';
const SUBSTYLE_Race = 'Race'; const SUBSTYLE_Puzzle = 'Puzzle';
const SUBSTYLE_Rankings = 'Rankings'; const SUBSTYLE_Quit = 'Quit';
const SUBSTYLE_Replay = 'Replay'; const SUBSTYLE_Race = 'Race';
const SUBSTYLE_Save = 'Save'; const SUBSTYLE_Rankings = 'Rankings';
const SUBSTYLE_ServersAll = 'ServersAll'; const SUBSTYLE_Replay = 'Replay';
const SUBSTYLE_ServersFavorites = 'ServersFavorites'; const SUBSTYLE_Save = 'Save';
const SUBSTYLE_ServersSuggested = 'ServersSuggested'; const SUBSTYLE_ServersAll = 'ServersAll';
const SUBSTYLE_Share = 'Share'; const SUBSTYLE_ServersFavorites = 'ServersFavorites';
const SUBSTYLE_ShareBlink = 'ShareBlink'; const SUBSTYLE_ServersSuggested = 'ServersSuggested';
const SUBSTYLE_SkillPoints = 'SkillPoints'; const SUBSTYLE_Share = 'Share';
const SUBSTYLE_Solo = 'Solo'; const SUBSTYLE_ShareBlink = 'ShareBlink';
const SUBSTYLE_Statistics = 'Statistics'; const SUBSTYLE_SkillPoints = 'SkillPoints';
const SUBSTYLE_Stunts = 'Stunts'; const SUBSTYLE_Solo = 'Solo';
const SUBSTYLE_United = 'United'; const SUBSTYLE_Statistics = 'Statistics';
const SUBSTYLE_Upload = 'Upload'; const SUBSTYLE_Stunts = 'Stunts';
const SUBSTYLE_Vehicles = 'Vehicles'; const SUBSTYLE_United = 'United';
const SUBSTYLE_Upload = 'Upload';
const SUBSTYLE_Vehicles = 'Vehicles';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,81 +8,84 @@ use FML\Controls\Quad;
* Quad class for 'Icons128x128_Blink' styles * Quad class for 'Icons128x128_Blink' styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_Icons128x128_Blink extends Quad { class Quad_Icons128x128_Blink extends Quad
/* {
* Constants
*/ /*
const STYLE = 'Icons128x128_Blink'; * Constants
const SUBSTYLE_Advanced = 'Advanced'; */
const SUBSTYLE_Back = 'Back'; const STYLE = 'Icons128x128_Blink';
const SUBSTYLE_BackFocusable = 'BackFocusable'; const SUBSTYLE_Advanced = 'Advanced';
const SUBSTYLE_Beginner = 'Beginner'; const SUBSTYLE_Back = 'Back';
const SUBSTYLE_Browse = 'Browse'; const SUBSTYLE_BackFocusable = 'BackFocusable';
const SUBSTYLE_Buddies = 'Buddies'; const SUBSTYLE_Beginner = 'Beginner';
const SUBSTYLE_Challenge = 'Challenge'; const SUBSTYLE_Browse = 'Browse';
const SUBSTYLE_ChallengeAuthor = 'ChallengeAuthor'; const SUBSTYLE_Buddies = 'Buddies';
const SUBSTYLE_Coppers = 'Coppers'; const SUBSTYLE_Challenge = 'Challenge';
const SUBSTYLE_Create = 'Create'; const SUBSTYLE_ChallengeAuthor = 'ChallengeAuthor';
const SUBSTYLE_Credits = 'Credits'; const SUBSTYLE_Coppers = 'Coppers';
const SUBSTYLE_Custom = 'Custom'; const SUBSTYLE_Create = 'Create';
const SUBSTYLE_CustomStars = 'CustomStars'; const SUBSTYLE_Credits = 'Credits';
const SUBSTYLE_Default = 'Default'; const SUBSTYLE_Custom = 'Custom';
const SUBSTYLE_Download = 'Download'; const SUBSTYLE_CustomStars = 'CustomStars';
const SUBSTYLE_Easy = 'Easy'; const SUBSTYLE_Default = 'Default';
const SUBSTYLE_Editor = 'Editor'; const SUBSTYLE_Download = 'Download';
const SUBSTYLE_Event = 'Event'; const SUBSTYLE_Easy = 'Easy';
const SUBSTYLE_Extreme = 'Extreme'; const SUBSTYLE_Editor = 'Editor';
const SUBSTYLE_Forever = 'Forever'; const SUBSTYLE_Event = 'Event';
const SUBSTYLE_GhostEditor = 'GhostEditor'; const SUBSTYLE_Extreme = 'Extreme';
const SUBSTYLE_Hard = 'Hard'; const SUBSTYLE_Forever = 'Forever';
const SUBSTYLE_Hotseat = 'Hotseat'; const SUBSTYLE_GhostEditor = 'GhostEditor';
const SUBSTYLE_Inputs = 'Inputs'; const SUBSTYLE_Hard = 'Hard';
const SUBSTYLE_Invite = 'Invite'; const SUBSTYLE_Hotseat = 'Hotseat';
const SUBSTYLE_LadderPoints = 'LadderPoints'; const SUBSTYLE_Inputs = 'Inputs';
const SUBSTYLE_Lan = 'Lan'; const SUBSTYLE_Invite = 'Invite';
const SUBSTYLE_Launch = 'Launch'; const SUBSTYLE_LadderPoints = 'LadderPoints';
const SUBSTYLE_Load = 'Load'; const SUBSTYLE_Lan = 'Lan';
const SUBSTYLE_LoadTrack = 'LoadTrack'; const SUBSTYLE_Launch = 'Launch';
const SUBSTYLE_Manialink = 'Manialink'; const SUBSTYLE_Load = 'Load';
const SUBSTYLE_ManiaZones = 'ManiaZones'; const SUBSTYLE_LoadTrack = 'LoadTrack';
const SUBSTYLE_MedalCount = 'MedalCount'; const SUBSTYLE_Manialink = 'Manialink';
const SUBSTYLE_MediaTracker = 'MediaTracker'; const SUBSTYLE_ManiaZones = 'ManiaZones';
const SUBSTYLE_Medium = 'Medium'; const SUBSTYLE_MedalCount = 'MedalCount';
const SUBSTYLE_Multiplayer = 'Multiplayer'; const SUBSTYLE_MediaTracker = 'MediaTracker';
const SUBSTYLE_Nations = 'Nations'; const SUBSTYLE_Medium = 'Medium';
const SUBSTYLE_NewTrack = 'NewTrack'; const SUBSTYLE_Multiplayer = 'Multiplayer';
const SUBSTYLE_Options = 'Options'; const SUBSTYLE_Nations = 'Nations';
const SUBSTYLE_Padlock = 'Padlock'; const SUBSTYLE_NewTrack = 'NewTrack';
const SUBSTYLE_Paint = 'Paint'; const SUBSTYLE_Options = 'Options';
const SUBSTYLE_Platform = 'Platform'; const SUBSTYLE_Padlock = 'Padlock';
const SUBSTYLE_PlayerPage = 'PlayerPage'; const SUBSTYLE_Paint = 'Paint';
const SUBSTYLE_Profile = 'Profile'; const SUBSTYLE_Platform = 'Platform';
const SUBSTYLE_ProfileAdvanced = 'ProfileAdvanced'; const SUBSTYLE_PlayerPage = 'PlayerPage';
const SUBSTYLE_ProfileVehicle = 'ProfileVehicle'; const SUBSTYLE_Profile = 'Profile';
const SUBSTYLE_Puzzle = 'Puzzle'; const SUBSTYLE_ProfileAdvanced = 'ProfileAdvanced';
const SUBSTYLE_Quit = 'Quit'; const SUBSTYLE_ProfileVehicle = 'ProfileVehicle';
const SUBSTYLE_Race = 'Race'; const SUBSTYLE_Puzzle = 'Puzzle';
const SUBSTYLE_Rankings = 'Rankings'; const SUBSTYLE_Quit = 'Quit';
const SUBSTYLE_Replay = 'Replay'; const SUBSTYLE_Race = 'Race';
const SUBSTYLE_Save = 'Save'; const SUBSTYLE_Rankings = 'Rankings';
const SUBSTYLE_ServersAll = 'ServersAll'; const SUBSTYLE_Replay = 'Replay';
const SUBSTYLE_ServersFavorites = 'ServersFavorites'; const SUBSTYLE_Save = 'Save';
const SUBSTYLE_ServersSuggested = 'ServersSuggested'; const SUBSTYLE_ServersAll = 'ServersAll';
const SUBSTYLE_Share = 'Share'; const SUBSTYLE_ServersFavorites = 'ServersFavorites';
const SUBSTYLE_ShareBlink = 'ShareBlink'; const SUBSTYLE_ServersSuggested = 'ServersSuggested';
const SUBSTYLE_SkillPoints = 'SkillPoints'; const SUBSTYLE_Share = 'Share';
const SUBSTYLE_Solo = 'Solo'; const SUBSTYLE_ShareBlink = 'ShareBlink';
const SUBSTYLE_Statistics = 'Statistics'; const SUBSTYLE_SkillPoints = 'SkillPoints';
const SUBSTYLE_Stunts = 'Stunts'; const SUBSTYLE_Solo = 'Solo';
const SUBSTYLE_United = 'United'; const SUBSTYLE_Statistics = 'Statistics';
const SUBSTYLE_Upload = 'Upload'; const SUBSTYLE_Stunts = 'Stunts';
const SUBSTYLE_Vehicles = 'Vehicles'; const SUBSTYLE_United = 'United';
const SUBSTYLE_Upload = 'Upload';
const SUBSTYLE_Vehicles = 'Vehicles';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,47 +8,50 @@ use FML\Controls\Quad;
* Quad class for 'Icons128x32_1' styles * Quad class for 'Icons128x32_1' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_Icons128x32_1 extends Quad { class Quad_Icons128x32_1 extends Quad
/* {
* Constants
*/ /*
const STYLE = 'Icons128x32_1'; * Constants
const SUBSTYLE_ArrowUp = 'ArrowUp'; */
const SUBSTYLE_BgQuadWhite = 'BgQuadWhite'; const STYLE = 'Icons128x32_1';
// TODO: validate existence of 'close' const SUBSTYLE_ArrowUp = 'ArrowUp';
const SUBSTYLE_Close = 'Close'; const SUBSTYLE_BgQuadWhite = 'BgQuadWhite';
const SUBSTYLE_Empty = 'Empty'; // TODO: validate existence of 'close'
const SUBSTYLE_ManiaLinkHome = 'ManiaLinkHome'; const SUBSTYLE_Close = 'Close';
const SUBSTYLE_ManiaLinkSwitch = 'ManiaLinkSwitch'; const SUBSTYLE_Empty = 'Empty';
const SUBSTYLE_ManiaPlanet = 'ManiaPlanet'; const SUBSTYLE_ManiaLinkHome = 'ManiaLinkHome';
const SUBSTYLE_Minimize = 'Minimize'; const SUBSTYLE_ManiaLinkSwitch = 'ManiaLinkSwitch';
const SUBSTYLE_Music = 'Music'; const SUBSTYLE_ManiaPlanet = 'ManiaPlanet';
const SUBSTYLE_PainterBrush = 'PainterBrush'; const SUBSTYLE_Minimize = 'Minimize';
const SUBSTYLE_PainterFill = 'PainterFill'; const SUBSTYLE_Music = 'Music';
const SUBSTYLE_PainterLayer = 'PainterLayer'; const SUBSTYLE_PainterBrush = 'PainterBrush';
const SUBSTYLE_PainterMirror = 'PainterMirror'; const SUBSTYLE_PainterFill = 'PainterFill';
const SUBSTYLE_PainterSticker = 'PainterSticker'; const SUBSTYLE_PainterLayer = 'PainterLayer';
const SUBSTYLE_PainterTeam = 'PainterTeam'; const SUBSTYLE_PainterMirror = 'PainterMirror';
const SUBSTYLE_RT_Cup = 'RT_Cup'; const SUBSTYLE_PainterSticker = 'PainterSticker';
const SUBSTYLE_RT_Laps = 'RT_Laps'; const SUBSTYLE_PainterTeam = 'PainterTeam';
const SUBSTYLE_RT_Rounds = 'RT_Rounds'; const SUBSTYLE_RT_Cup = 'RT_Cup';
const SUBSTYLE_RT_Script = 'RT_Script'; const SUBSTYLE_RT_Laps = 'RT_Laps';
const SUBSTYLE_RT_Team = 'RT_Team'; const SUBSTYLE_RT_Rounds = 'RT_Rounds';
const SUBSTYLE_RT_TimeAttack = 'RT_TimeAttack'; const SUBSTYLE_RT_Script = 'RT_Script';
const SUBSTYLE_RT_Stunts = 'RT_Stunts'; const SUBSTYLE_RT_Team = 'RT_Team';
const SUBSTYLE_Settings = 'Settings'; const SUBSTYLE_RT_TimeAttack = 'RT_TimeAttack';
const SUBSTYLE_SliderBar = 'SliderBar'; const SUBSTYLE_RT_Stunts = 'RT_Stunts';
const SUBSTYLE_SliderBar2 = 'SliderBar2'; const SUBSTYLE_Settings = 'Settings';
const SUBSTYLE_SliderCursor = 'SliderCursor'; const SUBSTYLE_SliderBar = 'SliderBar';
const SUBSTYLE_Sound = 'Sound'; const SUBSTYLE_SliderBar2 = 'SliderBar2';
const SUBSTYLE_UrlBg = 'UrlBg'; const SUBSTYLE_SliderCursor = 'SliderCursor';
const SUBSTYLE_Windowed = 'Windowed'; const SUBSTYLE_Sound = 'Sound';
const SUBSTYLE_UrlBg = 'UrlBg';
const SUBSTYLE_Windowed = 'Windowed';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,103 +8,106 @@ use FML\Controls\Quad;
* Quad class for 'Icons64x64_1' styles * Quad class for 'Icons64x64_1' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_Icons64x64_1 extends Quad { class Quad_Icons64x64_1 extends Quad
/* {
* Constants
*/ /*
const STYLE = 'Icons64x64_1'; * Constants
const SUBSTYLE_3DStereo = '3DStereo'; */
const SUBSTYLE_Add = 'Add'; const STYLE = 'Icons64x64_1';
const SUBSTYLE_ArrowBlue = 'ArrowBlue'; const SUBSTYLE_3DStereo = '3DStereo';
const SUBSTYLE_ArrowDisabled = 'ArrowDisabled'; const SUBSTYLE_Add = 'Add';
const SUBSTYLE_ArrowDown = 'ArrowDown'; const SUBSTYLE_ArrowBlue = 'ArrowBlue';
const SUBSTYLE_ArrowFastNext = 'ArrowFastNext'; const SUBSTYLE_ArrowDisabled = 'ArrowDisabled';
const SUBSTYLE_ArrowFastPrev = 'ArrowFastPrev'; const SUBSTYLE_ArrowDown = 'ArrowDown';
const SUBSTYLE_ArrowFirst = 'ArrowFirst'; const SUBSTYLE_ArrowFastNext = 'ArrowFastNext';
const SUBSTYLE_ArrowGreen = 'ArrowGreen'; const SUBSTYLE_ArrowFastPrev = 'ArrowFastPrev';
const SUBSTYLE_ArrowLast = 'ArrowLast'; const SUBSTYLE_ArrowFirst = 'ArrowFirst';
const SUBSTYLE_ArrowNext = 'ArrowNext'; const SUBSTYLE_ArrowGreen = 'ArrowGreen';
const SUBSTYLE_ArrowPrev = 'ArrowPrev'; const SUBSTYLE_ArrowLast = 'ArrowLast';
const SUBSTYLE_ArrowRed = 'ArrowRed'; const SUBSTYLE_ArrowNext = 'ArrowNext';
const SUBSTYLE_ArrowUp = 'ArrowUp'; const SUBSTYLE_ArrowPrev = 'ArrowPrev';
const SUBSTYLE_Browser = 'Browser'; const SUBSTYLE_ArrowRed = 'ArrowRed';
const SUBSTYLE_Buddy = 'Buddy'; const SUBSTYLE_ArrowUp = 'ArrowUp';
const SUBSTYLE_ButtonLeagues = 'ButtonLeagues'; const SUBSTYLE_Browser = 'Browser';
const SUBSTYLE_Camera = 'Camera'; const SUBSTYLE_Buddy = 'Buddy';
const SUBSTYLE_CameraLocal = 'CameraLocal'; const SUBSTYLE_ButtonLeagues = 'ButtonLeagues';
const SUBSTYLE_Check = 'Check'; const SUBSTYLE_Camera = 'Camera';
const SUBSTYLE_ClipPause = 'ClipPause'; const SUBSTYLE_CameraLocal = 'CameraLocal';
const SUBSTYLE_ClipPlay = 'ClipPlay'; const SUBSTYLE_Check = 'Check';
const SUBSTYLE_ClipRewind = 'ClipRewind'; const SUBSTYLE_ClipPause = 'ClipPause';
const SUBSTYLE_Close = 'Close'; const SUBSTYLE_ClipPlay = 'ClipPlay';
const SUBSTYLE_Empty = 'Empty'; const SUBSTYLE_ClipRewind = 'ClipRewind';
const SUBSTYLE_Finish = 'Finish'; const SUBSTYLE_Close = 'Close';
const SUBSTYLE_FinishGrey = 'FinishGrey'; const SUBSTYLE_Empty = 'Empty';
const SUBSTYLE_First = 'First'; const SUBSTYLE_Finish = 'Finish';
const SUBSTYLE_GenericButton = 'GenericButton'; const SUBSTYLE_FinishGrey = 'FinishGrey';
const SUBSTYLE_Green = 'Green'; const SUBSTYLE_First = 'First';
const SUBSTYLE_IconLeaguesLadder = 'IconLeaguesLadder'; const SUBSTYLE_GenericButton = 'GenericButton';
const SUBSTYLE_IconPlayers = 'IconPlayers'; const SUBSTYLE_Green = 'Green';
const SUBSTYLE_IconPlayersLadder = 'IconPlayersLadder'; const SUBSTYLE_IconLeaguesLadder = 'IconLeaguesLadder';
const SUBSTYLE_IconServers = 'IconServers'; const SUBSTYLE_IconPlayers = 'IconPlayers';
const SUBSTYLE_Inbox = 'Inbox'; const SUBSTYLE_IconPlayersLadder = 'IconPlayersLadder';
const SUBSTYLE_LvlGreen = 'LvlGreen'; const SUBSTYLE_IconServers = 'IconServers';
const SUBSTYLE_LvlRed = 'LvlRed'; const SUBSTYLE_Inbox = 'Inbox';
const SUBSTYLE_LvlYellow = 'LvlYellow'; const SUBSTYLE_LvlGreen = 'LvlGreen';
const SUBSTYLE_ManiaLinkNext = 'ManiaLinkNext'; const SUBSTYLE_LvlRed = 'LvlRed';
const SUBSTYLE_ManiaLinkPrev = 'ManiaLinkPrev'; const SUBSTYLE_LvlYellow = 'LvlYellow';
const SUBSTYLE_Maximize = 'Maximize'; const SUBSTYLE_ManiaLinkNext = 'ManiaLinkNext';
const SUBSTYLE_MediaAudioDownloading = 'MediaAudioDownloading'; const SUBSTYLE_ManiaLinkPrev = 'ManiaLinkPrev';
const SUBSTYLE_MediaPlay = 'MediaPlay'; const SUBSTYLE_Maximize = 'Maximize';
const SUBSTYLE_MediaStop = 'MediaStop'; const SUBSTYLE_MediaAudioDownloading = 'MediaAudioDownloading';
const SUBSTYLE_MediaVideoDownloading = 'MediaVideoDownloading'; const SUBSTYLE_MediaPlay = 'MediaPlay';
const SUBSTYLE_NewMessage = 'NewMessage'; const SUBSTYLE_MediaStop = 'MediaStop';
const SUBSTYLE_NotBuddy = 'NotBuddy'; const SUBSTYLE_MediaVideoDownloading = 'MediaVideoDownloading';
const SUBSTYLE_OfficialRace = 'OfficialRace'; const SUBSTYLE_NewMessage = 'NewMessage';
const SUBSTYLE_Opponents = 'Opponents'; const SUBSTYLE_NotBuddy = 'NotBuddy';
const SUBSTYLE_Outbox = 'Outbox'; const SUBSTYLE_OfficialRace = 'OfficialRace';
const SUBSTYLE_QuitRace = 'QuitRace'; const SUBSTYLE_Opponents = 'Opponents';
const SUBSTYLE_RedHigh = 'RedHigh'; const SUBSTYLE_Outbox = 'Outbox';
const SUBSTYLE_RedLow = 'RedLow'; const SUBSTYLE_QuitRace = 'QuitRace';
const SUBSTYLE_Refresh = 'Refresh'; const SUBSTYLE_RedHigh = 'RedHigh';
const SUBSTYLE_RestartRace = 'RestartRace'; const SUBSTYLE_RedLow = 'RedLow';
const SUBSTYLE_Save = 'Save'; const SUBSTYLE_Refresh = 'Refresh';
const SUBSTYLE_Second = 'Second'; const SUBSTYLE_RestartRace = 'RestartRace';
const SUBSTYLE_ShowDown = 'ShowDown'; const SUBSTYLE_Save = 'Save';
const SUBSTYLE_ShowDown2 = 'ShowDown2'; const SUBSTYLE_Second = 'Second';
const SUBSTYLE_ShowLeft = 'ShowLeft'; const SUBSTYLE_ShowDown = 'ShowDown';
const SUBSTYLE_ShowLeft2 = 'ShowLeft2'; const SUBSTYLE_ShowDown2 = 'ShowDown2';
const SUBSTYLE_ShowRight = 'ShowRight'; const SUBSTYLE_ShowLeft = 'ShowLeft';
const SUBSTYLE_ShowRight2 = 'ShowRight2'; const SUBSTYLE_ShowLeft2 = 'ShowLeft2';
const SUBSTYLE_ShowUp = 'ShowUp'; const SUBSTYLE_ShowRight = 'ShowRight';
const SUBSTYLE_ShowUp2 = 'ShowUp2'; const SUBSTYLE_ShowRight2 = 'ShowRight2';
const SUBSTYLE_ShowUpChanging = 'ShowUpChanging'; const SUBSTYLE_ShowUp = 'ShowUp';
const SUBSTYLE_SliderCursor = 'SliderCursor'; const SUBSTYLE_ShowUp2 = 'ShowUp2';
const SUBSTYLE_SliderCursor2 = 'SliderCursor2'; const SUBSTYLE_ShowUpChanging = 'ShowUpChanging';
const SUBSTYLE_StateFavourite = 'StateFavourite'; const SUBSTYLE_SliderCursor = 'SliderCursor';
const SUBSTYLE_StatePrivate = 'StatePrivate'; const SUBSTYLE_SliderCursor2 = 'SliderCursor2';
const SUBSTYLE_StateSuggested = 'StateSuggested'; const SUBSTYLE_StateFavourite = 'StateFavourite';
const SUBSTYLE_Sub = 'Sub'; const SUBSTYLE_StatePrivate = 'StatePrivate';
const SUBSTYLE_TagTypeBronze = 'TagTypeBronze'; const SUBSTYLE_StateSuggested = 'StateSuggested';
const SUBSTYLE_TagTypeGold = 'TagTypeGold'; const SUBSTYLE_Sub = 'Sub';
const SUBSTYLE_TagTypeNadeo = 'TagTypeNadeo'; const SUBSTYLE_TagTypeBronze = 'TagTypeBronze';
const SUBSTYLE_TagTypeNone = 'TagTypeNone'; const SUBSTYLE_TagTypeGold = 'TagTypeGold';
const SUBSTYLE_TagTypeSilver = 'TagTypeSilver'; const SUBSTYLE_TagTypeNadeo = 'TagTypeNadeo';
const SUBSTYLE_Third = 'Third'; const SUBSTYLE_TagTypeNone = 'TagTypeNone';
const SUBSTYLE_ToolLeague1 = 'ToolLeague1'; const SUBSTYLE_TagTypeSilver = 'TagTypeSilver';
const SUBSTYLE_ToolRoot = 'ToolRoot'; const SUBSTYLE_Third = 'Third';
const SUBSTYLE_ToolTree = 'ToolTree'; const SUBSTYLE_ToolLeague1 = 'ToolLeague1';
const SUBSTYLE_ToolUp = 'ToolUp'; const SUBSTYLE_ToolRoot = 'ToolRoot';
const SUBSTYLE_TrackInfo = 'TrackInfo'; const SUBSTYLE_ToolTree = 'ToolTree';
const SUBSTYLE_TV = 'TV'; const SUBSTYLE_ToolUp = 'ToolUp';
const SUBSTYLE_YellowHigh = 'YellowHigh'; const SUBSTYLE_TrackInfo = 'TrackInfo';
const SUBSTYLE_YellowLow = 'YellowLow'; const SUBSTYLE_TV = 'TV';
const SUBSTYLE_YellowHigh = 'YellowHigh';
const SUBSTYLE_YellowLow = 'YellowLow';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,32 +8,35 @@ use FML\Controls\Quad;
* Quad class for 'Icons64x64_2' styles * Quad class for 'Icons64x64_2' styles
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_Icons64x64_2 extends Quad { class Quad_Icons64x64_2 extends Quad
/* {
* Constants
*/ /*
const STYLE = 'Icons64x64_2'; * Constants
const SUBSTYLE_ArrowElimination = 'ArrowElimination'; */
const SUBSTYLE_ArrowHit = 'ArrowHit'; const STYLE = 'Icons64x64_2';
const SUBSTYLE_Calendar = 'Calendar'; const SUBSTYLE_ArrowElimination = 'ArrowElimination';
const SUBSTYLE_Disconnected = 'Disconnected'; const SUBSTYLE_ArrowHit = 'ArrowHit';
const SUBSTYLE_DisconnectedLight = 'DisconnectedLight'; const SUBSTYLE_Calendar = 'Calendar';
const SUBSTYLE_LaserElimination = 'LaserElimination'; const SUBSTYLE_Disconnected = 'Disconnected';
const SUBSTYLE_LaserHit = 'LaserHit'; const SUBSTYLE_DisconnectedLight = 'DisconnectedLight';
const SUBSTYLE_NucleusElimination = 'NucleusElimination'; const SUBSTYLE_LaserElimination = 'LaserElimination';
const SUBSTYLE_NucleusHit = 'NucleusHit'; const SUBSTYLE_LaserHit = 'LaserHit';
const SUBSTYLE_RocketElimination = 'RocketElimination'; const SUBSTYLE_NucleusElimination = 'NucleusElimination';
const SUBSTYLE_RocketHit = 'RocketHit'; const SUBSTYLE_NucleusHit = 'NucleusHit';
const SUBSTYLE_ServerNotice = 'ServerNotice'; const SUBSTYLE_RocketElimination = 'RocketElimination';
const SUBSTYLE_SortBy = 'SortBy'; const SUBSTYLE_RocketHit = 'RocketHit';
const SUBSTYLE_UnknownElimination = 'UnknownElimination'; const SUBSTYLE_ServerNotice = 'ServerNotice';
const SUBSTYLE_UnknownHit = 'UnknownHit'; const SUBSTYLE_SortBy = 'SortBy';
const SUBSTYLE_UnknownElimination = 'UnknownElimination';
const SUBSTYLE_UnknownHit = 'UnknownHit';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,24 +8,27 @@ use FML\Controls\Quad;
* Quad class for 'ManiaPlanetLogos' styles * Quad class for 'ManiaPlanetLogos' styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_ManiaPlanetLogos extends Quad { class Quad_ManiaPlanetLogos extends Quad
/* {
* Constants
*/ /*
const STYLE = 'ManiaPlanetLogos'; * Constants
const SUBSTYLE_IconPlanets = 'IconPlanets'; */
const SUBSTYLE_IconPlanetsPerspective = 'IconPlanetsPerspective'; const STYLE = 'ManiaPlanetLogos';
const SUBSTYLE_IconPlanetsSmall = 'IconPlanetsSmall'; const SUBSTYLE_IconPlanets = 'IconPlanets';
const SUBSTYLE_ManiaPlanetLogoBlack = 'ManiaPlanetLogoBlack'; const SUBSTYLE_IconPlanetsPerspective = 'IconPlanetsPerspective';
const SUBSTYLE_ManiaPlanetLogoBlackSmall = 'ManiaPlanetLogoBlackSmall'; const SUBSTYLE_IconPlanetsSmall = 'IconPlanetsSmall';
const SUBSTYLE_ManiaPlanetLogoWhite = 'ManiaPlanetLogoWhite'; const SUBSTYLE_ManiaPlanetLogoBlack = 'ManiaPlanetLogoBlack';
const SUBSTYLE_ManiaPlanetLogoWhiteSmall = 'ManiaPlanetLogoWhiteSmall'; const SUBSTYLE_ManiaPlanetLogoBlackSmall = 'ManiaPlanetLogoBlackSmall';
const SUBSTYLE_ManiaPlanetLogoWhite = 'ManiaPlanetLogoWhite';
const SUBSTYLE_ManiaPlanetLogoWhiteSmall = 'ManiaPlanetLogoWhiteSmall';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,28 +8,31 @@ use FML\Controls\Quad;
* Quad class for 'ManiaPlanetMainMenu' styles * Quad class for 'ManiaPlanetMainMenu' styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_ManiaPlanetMainMenu extends Quad { class Quad_ManiaPlanetMainMenu extends Quad
/* {
* Constants
*/ /*
const STYLE = 'ManiaPlanetMainMenu'; * Constants
const SUBSTYLE_BottomBar = 'BottomBar'; */
const SUBSTYLE_Highlight = 'Highlight'; const STYLE = 'ManiaPlanetMainMenu';
const SUBSTYLE_IconAdd = 'IconAdd'; const SUBSTYLE_BottomBar = 'BottomBar';
const SUBSTYLE_IconHome = 'IconHome'; const SUBSTYLE_Highlight = 'Highlight';
const SUBSTYLE_IconPlay = 'IconPlay'; const SUBSTYLE_IconAdd = 'IconAdd';
const SUBSTYLE_IconQuit = 'IconQuit'; const SUBSTYLE_IconHome = 'IconHome';
const SUBSTYLE_IconSettings = 'IconSettings'; const SUBSTYLE_IconPlay = 'IconPlay';
const SUBSTYLE_IconStore = 'IconStore'; const SUBSTYLE_IconQuit = 'IconQuit';
const SUBSTYLE_MainBg = 'MainBg'; const SUBSTYLE_IconSettings = 'IconSettings';
const SUBSTYLE_TitleBg = 'TitleBg'; const SUBSTYLE_IconStore = 'IconStore';
const SUBSTYLE_TopBar = 'TopBar'; const SUBSTYLE_MainBg = 'MainBg';
const SUBSTYLE_TitleBg = 'TitleBg';
const SUBSTYLE_TopBar = 'TopBar';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,23 +8,26 @@ use FML\Controls\Quad;
* Quad class for 'ManiaplanetSystem' styles * Quad class for 'ManiaplanetSystem' styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_ManiaplanetSystem extends Quad { class Quad_ManiaplanetSystem extends Quad
/* {
* Constants
*/ /*
const STYLE = 'ManiaplanetSystem'; * Constants
const SUBSTYLE_BgDialog = 'BgDialog'; */
const SUBSTYLE_BgDialogAnchor = 'BgDialogAnchor'; const STYLE = 'ManiaplanetSystem';
const SUBSTYLE_BgFloat = 'BgFloat'; const SUBSTYLE_BgDialog = 'BgDialog';
const SUBSTYLE_Events = 'Events'; const SUBSTYLE_BgDialogAnchor = 'BgDialogAnchor';
const SUBSTYLE_Medals = 'Medals'; const SUBSTYLE_BgFloat = 'BgFloat';
const SUBSTYLE_Statistics = 'Statistics'; const SUBSTYLE_Events = 'Events';
const SUBSTYLE_Medals = 'Medals';
const SUBSTYLE_Statistics = 'Statistics';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,24 +8,27 @@ use FML\Controls\Quad;
* Quad class for 'MedalsBig' styles * Quad class for 'MedalsBig' styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_MedalsBig extends Quad { class Quad_MedalsBig extends Quad
/* {
* Constants
*/ /*
const STYLE = 'MedalsBig'; * Constants
const SUBSTYLE_MedalBronze = 'MedalBronze'; */
const SUBSTYLE_MedalGold = 'MedalGold'; const STYLE = 'MedalsBig';
const SUBSTYLE_MedalGoldPerspective = 'MedalGoldPerspective'; const SUBSTYLE_MedalBronze = 'MedalBronze';
const SUBSTYLE_MedalNadeo = 'MedalNadeo'; const SUBSTYLE_MedalGold = 'MedalGold';
const SUBSTYLE_MedalNadeoPerspective = 'MedalNadeoPerspective'; const SUBSTYLE_MedalGoldPerspective = 'MedalGoldPerspective';
const SUBSTYLE_MedalSilver = 'MedalSilver'; const SUBSTYLE_MedalNadeo = 'MedalNadeo';
const SUBSTYLE_MedalSlot = 'MedalSlot'; const SUBSTYLE_MedalNadeoPerspective = 'MedalNadeoPerspective';
const SUBSTYLE_MedalSilver = 'MedalSilver';
const SUBSTYLE_MedalSlot = 'MedalSlot';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,21 +8,24 @@ use FML\Controls\Quad;
* Quad class for 'TitleLogos' styles * Quad class for 'TitleLogos' styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_TitleLogos extends Quad { class Quad_TitleLogos extends Quad
/* {
* Constants
*/ /*
const STYLE = 'TitleLogos'; * Constants
const SUBSTYLE_Author = 'Author'; */
const SUBSTYLE_Collection = 'Collection'; const STYLE = 'TitleLogos';
const SUBSTYLE_Icon = 'Icon'; const SUBSTYLE_Author = 'Author';
const SUBSTYLE_Title = 'Title'; const SUBSTYLE_Collection = 'Collection';
const SUBSTYLE_Icon = 'Icon';
const SUBSTYLE_Title = 'Title';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,40 +8,43 @@ use FML\Controls\Quad;
* Quad class for 'UIConstructionBullet_Buttons' styles * Quad class for 'UIConstructionBullet_Buttons' styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_UIConstructionBullet_Buttons extends Quad { class Quad_UIConstructionBullet_Buttons extends Quad
/* {
* Constants
*/ /*
const STYLE = 'UIConstructionBullet_Buttons'; * Constants
const SUBSTYLE_AnimMode = 'AnimMode'; */
const SUBSTYLE_BlocMode = 'BlocMode'; const STYLE = 'UIConstructionBullet_Buttons';
const SUBSTYLE_BulletEditorMode = 'BulletEditorMode'; const SUBSTYLE_AnimMode = 'AnimMode';
const SUBSTYLE_Circle = 'Circle'; const SUBSTYLE_BlocMode = 'BlocMode';
const SUBSTYLE_Core = 'Core'; const SUBSTYLE_BulletEditorMode = 'BulletEditorMode';
const SUBSTYLE_CoreFolder = 'CoreFolder'; const SUBSTYLE_Circle = 'Circle';
const SUBSTYLE_DeltaMode = 'DeltaMode'; const SUBSTYLE_Core = 'Core';
const SUBSTYLE_Disc = 'Disc'; const SUBSTYLE_CoreFolder = 'CoreFolder';
const SUBSTYLE_ExplosionMode = 'ExplosionMode'; const SUBSTYLE_DeltaMode = 'DeltaMode';
const SUBSTYLE_NewBullet = 'NewBullet'; const SUBSTYLE_Disc = 'Disc';
const SUBSTYLE_NewRandomBullet = 'NewRandomBullet'; const SUBSTYLE_ExplosionMode = 'ExplosionMode';
const SUBSTYLE_Point = 'Point'; const SUBSTYLE_NewBullet = 'NewBullet';
const SUBSTYLE_Power = 'Power'; const SUBSTYLE_NewRandomBullet = 'NewRandomBullet';
const SUBSTYLE_PowerFolder = 'PowerFolder'; const SUBSTYLE_Point = 'Point';
const SUBSTYLE_PreviewMode = 'PreviewMode'; const SUBSTYLE_Power = 'Power';
const SUBSTYLE_RootMotionMode = 'RootMotionMode'; const SUBSTYLE_PowerFolder = 'PowerFolder';
const SUBSTYLE_SmokeDebris = 'SmokeDebris'; const SUBSTYLE_PreviewMode = 'PreviewMode';
const SUBSTYLE_SmokeDebrisFolder = 'SmokeDebrisFolder'; const SUBSTYLE_RootMotionMode = 'RootMotionMode';
const SUBSTYLE_SoundMode = 'SoundMode'; const SUBSTYLE_SmokeDebris = 'SmokeDebris';
const SUBSTYLE_SphereEmpty = 'SphereEmpty'; const SUBSTYLE_SmokeDebrisFolder = 'SmokeDebrisFolder';
const SUBSTYLE_SphereFull = 'SphereFull'; const SUBSTYLE_SoundMode = 'SoundMode';
const SUBSTYLE_Trail = 'Trail'; const SUBSTYLE_SphereEmpty = 'SphereEmpty';
const SUBSTYLE_TrailFolder = 'TrailFolder'; const SUBSTYLE_SphereFull = 'SphereFull';
const SUBSTYLE_Trail = 'Trail';
const SUBSTYLE_TrailFolder = 'TrailFolder';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,74 +8,77 @@ use FML\Controls\Quad;
* Quad class for 'UIConstruction_Buttons' styles * Quad class for 'UIConstruction_Buttons' styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_UIConstruction_Buttons extends Quad { class Quad_UIConstruction_Buttons extends Quad
/* {
* Constants
*/ /*
const STYLE = 'UIConstruction_Buttons'; * Constants
const SUBSTYLE_ActionMaker = 'ActionMaker'; */
const SUBSTYLE_Add = 'Add'; const STYLE = 'UIConstruction_Buttons';
const SUBSTYLE_AirMapping = 'AirMapping'; const SUBSTYLE_ActionMaker = 'ActionMaker';
const SUBSTYLE_Author = 'Author'; const SUBSTYLE_Add = 'Add';
const SUBSTYLE_AuthorTime = 'AuthorTime'; const SUBSTYLE_AirMapping = 'AirMapping';
const SUBSTYLE_BgEditors = 'BgEditors'; const SUBSTYLE_Author = 'Author';
const SUBSTYLE_BgIcons = 'BgIcons'; const SUBSTYLE_AuthorTime = 'AuthorTime';
const SUBSTYLE_BgMain = 'BgMain'; const SUBSTYLE_BgEditors = 'BgEditors';
const SUBSTYLE_BgTools = 'BgTools'; const SUBSTYLE_BgIcons = 'BgIcons';
const SUBSTYLE_BlockEditor = 'BlockEditor'; const SUBSTYLE_BgMain = 'BgMain';
const SUBSTYLE_Camera = 'Camera'; const SUBSTYLE_BgTools = 'BgTools';
const SUBSTYLE_Challenge = 'Challenge'; const SUBSTYLE_BlockEditor = 'BlockEditor';
const SUBSTYLE_CopyPaste = 'CopyPaste'; const SUBSTYLE_Camera = 'Camera';
const SUBSTYLE_DecalEditor = 'DecalEditor'; const SUBSTYLE_Challenge = 'Challenge';
const SUBSTYLE_Delete = 'Delete'; const SUBSTYLE_CopyPaste = 'CopyPaste';
const SUBSTYLE_Directory = 'Directory'; const SUBSTYLE_DecalEditor = 'DecalEditor';
const SUBSTYLE_Down = 'Down'; const SUBSTYLE_Delete = 'Delete';
const SUBSTYLE_Drive = 'Drive'; const SUBSTYLE_Directory = 'Directory';
const SUBSTYLE_Erase = 'Erase'; const SUBSTYLE_Down = 'Down';
const SUBSTYLE_FreeItems = 'FreeItems'; const SUBSTYLE_Drive = 'Drive';
const SUBSTYLE_GhostBlocks = 'GhostBlocks'; const SUBSTYLE_Erase = 'Erase';
const SUBSTYLE_Help = 'Help'; const SUBSTYLE_FreeItems = 'FreeItems';
const SUBSTYLE_Item = 'Item'; const SUBSTYLE_GhostBlocks = 'GhostBlocks';
const SUBSTYLE_Left = 'Left'; const SUBSTYLE_Help = 'Help';
const SUBSTYLE_MacroBlockEditor = 'MacroBlockEditor'; const SUBSTYLE_Item = 'Item';
const SUBSTYLE_MediaTracker = 'MediaTracker'; const SUBSTYLE_Left = 'Left';
const SUBSTYLE_ObjectEditor = 'ObjectEditor'; const SUBSTYLE_MacroBlockEditor = 'MacroBlockEditor';
const SUBSTYLE_OffZone = 'OffZone'; const SUBSTYLE_MediaTracker = 'MediaTracker';
const SUBSTYLE_Options = 'Options'; const SUBSTYLE_ObjectEditor = 'ObjectEditor';
const SUBSTYLE_Paint = 'Paint'; const SUBSTYLE_OffZone = 'OffZone';
const SUBSTYLE_Pick = 'Pick'; const SUBSTYLE_Options = 'Options';
const SUBSTYLE_Plugins = 'Plugins'; const SUBSTYLE_Paint = 'Paint';
const SUBSTYLE_Quit = 'Quit'; const SUBSTYLE_Pick = 'Pick';
const SUBSTYLE_Redo = 'Redo'; const SUBSTYLE_Plugins = 'Plugins';
const SUBSTYLE_Reload = 'Reload'; const SUBSTYLE_Quit = 'Quit';
const SUBSTYLE_Right = 'Right'; const SUBSTYLE_Redo = 'Redo';
const SUBSTYLE_Save = 'Save'; const SUBSTYLE_Reload = 'Reload';
const SUBSTYLE_SaveAs = 'SaveAs'; const SUBSTYLE_Right = 'Right';
const SUBSTYLE_ScriptEditor = 'ScriptEditor'; const SUBSTYLE_Save = 'Save';
const SUBSTYLE_SpotModelClearUnused = 'SpotModelClearUnused'; const SUBSTYLE_SaveAs = 'SaveAs';
const SUBSTYLE_SpotModelDuplicate = 'SpotModelDuplicate'; const SUBSTYLE_ScriptEditor = 'ScriptEditor';
const SUBSTYLE_SpotModelNew = 'SpotModelNew'; const SUBSTYLE_SpotModelClearUnused = 'SpotModelClearUnused';
const SUBSTYLE_SpotModelRename = 'SpotModelRename'; const SUBSTYLE_SpotModelDuplicate = 'SpotModelDuplicate';
const SUBSTYLE_Square = 'Square'; const SUBSTYLE_SpotModelNew = 'SpotModelNew';
const SUBSTYLE_Stats = 'Stats'; const SUBSTYLE_SpotModelRename = 'SpotModelRename';
const SUBSTYLE_Sub = 'Sub'; const SUBSTYLE_Square = 'Square';
const SUBSTYLE_TerrainEditor = 'TerrainEditor'; const SUBSTYLE_Stats = 'Stats';
const SUBSTYLE_TestSm = 'TestSm'; const SUBSTYLE_Sub = 'Sub';
const SUBSTYLE_Text = 'Text'; const SUBSTYLE_TerrainEditor = 'TerrainEditor';
const SUBSTYLE_Tools = 'Tools'; const SUBSTYLE_TestSm = 'TestSm';
const SUBSTYLE_Underground = 'Underground'; const SUBSTYLE_Text = 'Text';
const SUBSTYLE_Undo = 'Undo'; const SUBSTYLE_Tools = 'Tools';
const SUBSTYLE_Up = 'Up'; const SUBSTYLE_Underground = 'Underground';
const SUBSTYLE_Validate = 'Validate'; const SUBSTYLE_Undo = 'Undo';
const SUBSTYLE_Validate_Step1 = 'Validate_Step1'; const SUBSTYLE_Up = 'Up';
const SUBSTYLE_Validate_Step2 = 'Validate_Step2'; const SUBSTYLE_Validate = 'Validate';
const SUBSTYLE_Validate_Step3 = 'Validate_Step3'; const SUBSTYLE_Validate_Step1 = 'Validate_Step1';
const SUBSTYLE_Validate_Step2 = 'Validate_Step2';
const SUBSTYLE_Validate_Step3 = 'Validate_Step3';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,29 +8,32 @@ use FML\Controls\Quad;
* Quad class for 'UIConstruction_Buttons2' styles * Quad class for 'UIConstruction_Buttons2' styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_UIConstruction_Buttons2 extends Quad { class Quad_UIConstruction_Buttons2 extends Quad
/* {
* Constants
*/ /*
const STYLE = 'UIConstruction_Buttons2'; * Constants
const SUBSTYLE_AirMapping = 'AirMapping'; */
const SUBSTYLE_BlockEditor = 'BlockEditor'; const STYLE = 'UIConstruction_Buttons2';
const SUBSTYLE_Copy = 'Copy'; const SUBSTYLE_AirMapping = 'AirMapping';
const SUBSTYLE_Cut = 'Cut'; const SUBSTYLE_BlockEditor = 'BlockEditor';
const SUBSTYLE_GhostBlocks = 'GhostBlocks'; const SUBSTYLE_Copy = 'Copy';
const SUBSTYLE_KeysAdd = 'KeysAdd'; const SUBSTYLE_Cut = 'Cut';
const SUBSTYLE_KeysCopy = 'KeysCopy'; const SUBSTYLE_GhostBlocks = 'GhostBlocks';
const SUBSTYLE_KeysDelete = 'KeysDelete'; const SUBSTYLE_KeysAdd = 'KeysAdd';
const SUBSTYLE_KeysPaste = 'KeysPaste'; const SUBSTYLE_KeysCopy = 'KeysCopy';
const SUBSTYLE_New = 'New'; const SUBSTYLE_KeysDelete = 'KeysDelete';
const SUBSTYLE_Open = 'Open'; const SUBSTYLE_KeysPaste = 'KeysPaste';
const SUBSTYLE_Symmetry = 'Symmetry'; const SUBSTYLE_New = 'New';
const SUBSTYLE_Open = 'Open';
const SUBSTYLE_Symmetry = 'Symmetry';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -8,38 +8,41 @@ use FML\Controls\Quad;
* Quad class for 'UiSMSpectatorScoreBig' styles * Quad class for 'UiSMSpectatorScoreBig' styles
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Quad_UiSMSpectatorScoreBig extends Quad { class Quad_UiSMSpectatorScoreBig extends Quad
/* {
* Constants
*/ /*
const STYLE = 'UiSMSpectatorScoreBig'; * Constants
CONST SUBSTYLE_BotLeft = 'BotLeft'; */
CONST SUBSTYLE_BotLeftGlass = 'BotLeftGlass'; const STYLE = 'UiSMSpectatorScoreBig';
CONST SUBSTYLE_BotRight = 'BotRight'; CONST SUBSTYLE_BotLeft = 'BotLeft';
CONST SUBSTYLE_BotRightGlass = 'BotRightGlass'; CONST SUBSTYLE_BotLeftGlass = 'BotLeftGlass';
CONST SUBSTYLE_CenterShield = 'CenterShield'; CONST SUBSTYLE_BotRight = 'BotRight';
CONST SUBSTYLE_CenterShieldSmall = 'CenterShieldSmall'; CONST SUBSTYLE_BotRightGlass = 'BotRightGlass';
CONST SUBSTYLE_HandleLeft = 'HandleLeft'; CONST SUBSTYLE_CenterShield = 'CenterShield';
CONST SUBSTYLE_HandleRight = 'HandleRight'; CONST SUBSTYLE_CenterShieldSmall = 'CenterShieldSmall';
CONST SUBSTYLE_PlayerGlass = 'PlayerGlass'; CONST SUBSTYLE_HandleLeft = 'HandleLeft';
CONST SUBSTYLE_PlayerIconBg = 'PlayerIconBg'; CONST SUBSTYLE_HandleRight = 'HandleRight';
CONST SUBSTYLE_PlayerJunction = 'PlayerJunction'; CONST SUBSTYLE_PlayerGlass = 'PlayerGlass';
CONST SUBSTYLE_PlayerSlot = 'PlayerSlot'; CONST SUBSTYLE_PlayerIconBg = 'PlayerIconBg';
CONST SUBSTYLE_PlayerSlotCenter = 'PlayerSlotCenter'; CONST SUBSTYLE_PlayerJunction = 'PlayerJunction';
CONST SUBSTYLE_PlayerSlotRev = 'PlayerSlotRev'; CONST SUBSTYLE_PlayerSlot = 'PlayerSlot';
CONST SUBSTYLE_PlayerSlotSmall = 'PlayerSlotSmall'; CONST SUBSTYLE_PlayerSlotCenter = 'PlayerSlotCenter';
CONST SUBSTYLE_PlayerSlotSmallRev = 'PlayerSlotSmallRev'; CONST SUBSTYLE_PlayerSlotRev = 'PlayerSlotRev';
CONST SUBSTYLE_TableBgHoriz = 'TableBgHoriz'; CONST SUBSTYLE_PlayerSlotSmall = 'PlayerSlotSmall';
CONST SUBSTYLE_TableBgVert = 'TableBgVert'; CONST SUBSTYLE_PlayerSlotSmallRev = 'PlayerSlotSmallRev';
CONST SUBSTYLE_Top = 'Top'; CONST SUBSTYLE_TableBgHoriz = 'TableBgHoriz';
CONST SUBSTYLE_UIRange1Bg = 'UIRange1Bg'; CONST SUBSTYLE_TableBgVert = 'TableBgVert';
CONST SUBSTYLE_UIRange2Bg = 'UIRange2Bg'; CONST SUBSTYLE_Top = 'Top';
CONST SUBSTYLE_UIRange1Bg = 'UIRange1Bg';
CONST SUBSTYLE_UIRange2Bg = 'UIRange2Bg';
/**
* @var string $style Style
*/
protected $style = self::STYLE;
/*
* Protected properties
*/
protected $style = self::STYLE;
} }

View File

@ -0,0 +1,452 @@
<?php
namespace FML\Controls;
use FML\Types\MultiLineable;
use FML\Types\Scriptable;
use FML\Types\Styleable;
use FML\Types\TextFormatable;
/**
* TextEdit Control
* (CMlTextEdit)
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class TextEdit extends Control implements MultiLineable, Scriptable, Styleable, TextFormatable
{
/*
* Constants
*/
const FORMAT_Default = "Default";
const FORMAT_Script = "Script";
const FORMAT_Password = "Password";
const FORMAT_NewPassword = "NewPassword";
/**
* @var string $default Default value
*/
protected $default = null;
/**
* @var bool $autoNewLine Auto new line
*/
protected $autoNewLine = null;
/**
* @var float $lineSpacing Line spacing
*/
protected $lineSpacing = -1.;
/**
* @var int $maxLines Maximum number of lines
*/
protected $maxLines = -1;
/**
* @var bool $showLineNumbers Show lines numbers
*/
protected $showLineNumbers = null;
/**
* @var string $textFormat Text format
*/
protected $textFormat = null;
/**
* @var bool $scriptEvents Script events usage
*/
protected $scriptEvents = null;
/**
* @var string $scriptAction Script action
*/
protected $scriptAction = null;
/**
* @var string[] $scriptActionParameters Script action parameters
*/
protected $scriptActionParameters = null;
/**
* @var string $style Style
*/
protected $style = null;
/**
* @var string $textColor Text color
*/
protected $textColor = null;
/**
* @var int $textSize Text size
*/
protected $textSize = null;
/**
* @var string $textFont Text font
*/
protected $textFont = null;
/**
* @var string $areaColor Area color
*/
protected $areaColor = null;
/**
* @var string $focusAreaColor Focus area color
*/
protected $focusAreaColor = null;
/**
* Get the default value
*
* @api
* @return mixed
*/
public function getDefault()
{
return $this->default;
}
/**
* Set the default value
*
* @api
* @param string $default Default value
* @return static
*/
public function setDefault($default)
{
$this->default = $default;
return $this;
}
/**
* @see MultiLineable::getAutoNewLine()
*/
public function getAutoNewLine()
{
return $this->autoNewLine;
}
/**
* @see MultiLineable::setAutoNewLine()
*/
public function setAutoNewLine($autoNewLine)
{
$this->autoNewLine = (bool)$autoNewLine;
return $this;
}
/**
* @see MultiLineable::getLineSpacing()
*/
public function getLineSpacing()
{
return $this->lineSpacing;
}
/**
* @see MultiLineable::setLineSpacing()
*/
public function setLineSpacing($lineSpacing)
{
$this->lineSpacing = (float)$lineSpacing;
return $this;
}
/**
* @see MultiLineable::getMaxLines()
*/
public function getMaxLines()
{
return $this->maxLines;
}
/**
* @see MultiLineable::setMaxLines()
*/
public function setMaxLines($maxLines)
{
$this->maxLines = (int)$maxLines;
return $this;
}
/**
* Get showing of line numbers
*
* @api
* @return bool
*/
public function getShowLineNumbers()
{
return $this->showLineNumbers;
}
/**
* Set showing of line numbers
*
* @api
* @param bool $showLineNumbers Show line numbers
* @return static
*/
public function setShowLineNumbers($showLineNumbers)
{
$this->showLineNumbers = (bool)$showLineNumbers;
return $this;
}
/**
* Get text format
*
* @api
* @return string
*/
public function getTextFormat()
{
return $this->textFormat;
}
/**
* Set text format
*
* @api
* @param string $textFormat Text format
* @return static
*/
public function setTextFormat($textFormat)
{
$this->textFormat = (string)$textFormat;
return $this;
}
/**
* @see Scriptable::getScriptEvents()
*/
public function getScriptEvents()
{
return $this->scriptEvents;
}
/**
* @see Scriptable::setScriptEvents()
*/
public function setScriptEvents($scriptEvents)
{
$this->scriptEvents = (bool)$scriptEvents;
return $this;
}
/**
* @see Scriptable::getScriptAction()
*/
public function getScriptAction()
{
return $this->scriptAction;
}
/**
* @see Scriptable::setScriptAction()
*/
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
{
$this->scriptAction = (string)$scriptAction;
$this->setScriptActionParameters($scriptActionParameters);
return $this;
}
/**
* @see Scriptable::getScriptActionParameters()
*/
public function getScriptActionParameters()
{
return $this->scriptActionParameters;
}
/**
* @see Scriptable::setScriptActionParameters()
*/
public function setScriptActionParameters(array $scriptActionParameters = null)
{
$this->scriptActionParameters = $scriptActionParameters;
return $this;
}
/**
* @see Styleable::getStyle()
*/
public function getStyle()
{
return $this->style;
}
/**
* @see Styleable::setStyle()
*/
public function setStyle($style)
{
$this->style = (string)$style;
return $this;
}
/**
* @see TextFormatable::getTextColor()
*/
public function getTextColor()
{
return $this->textColor;
}
/**
* @see TextFormatable::setTextColor()
*/
public function setTextColor($textColor)
{
$this->textColor = (string)$textColor;
return $this;
}
/**
* @see TextFormatable::getTextSize()
*/
public function getTextSize()
{
return $this->textSize;
}
/**
* @see TextFormatable::setTextSize()
*/
public function setTextSize($textSize)
{
$this->textSize = (int)$textSize;
return $this;
}
/**
* @see TextFormatable::getTextFont()
*/
public function getTextFont()
{
return $this->textFont;
}
/**
* @see TextFormatable::setTextFont()
*/
public function setTextFont($textFont)
{
$this->textFont = (string)$textFont;
return $this;
}
/**
* @see TextFormatable::getAreaColor()
*/
public function getAreaColor()
{
return $this->areaColor;
}
/**
* @see TextFormatable::setAreaColor()
*/
public function setAreaColor($areaColor)
{
$this->areaColor = (string)$areaColor;
return $this;
}
/**
* @see TextFormatable::getAreaFocusColor()
*/
public function getAreaFocusColor()
{
return $this->focusAreaColor;
}
/**
* @see TextFormatable::setAreaFocusColor()
*/
public function setAreaFocusColor($areaFocusColor)
{
$this->focusAreaColor = (string)$areaFocusColor;
return $this;
}
/**
* @see Control::getTagName()
*/
public function getTagName()
{
return "textedit";
}
/**
* @see Control::getManiaScriptClass()
*/
public function getManiaScriptClass()
{
return "CMlTextEdit";
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->default !== null) {
$domElement->setAttribute("default", $this->default);
}
if ($this->autoNewLine) {
$domElement->setAttribute("autonewline", 1);
}
if ($this->lineSpacing > 0) {
$domElement->setAttribute("linespacing", $this->lineSpacing);
}
if ($this->maxLines > 0) {
$domElement->setAttribute("maxline", $this->maxLines);
}
if ($this->showLineNumbers) {
$domElement->setAttribute("showlinenumbers", 1);
}
if ($this->textFormat) {
$domElement->setAttribute("textformat", $this->textFormat);
}
if ($this->scriptEvents) {
$domElement->setAttribute("scriptevents", 1);
}
if ($this->scriptAction) {
$scriptAction = array($this->scriptAction);
if ($this->scriptActionParameters) {
$scriptAction = array_merge($scriptAction, $this->scriptActionParameters);
}
$domElement->setAttribute("scriptaction", implode("'", $scriptAction));
}
if ($this->style) {
$domElement->setAttribute("style", $this->style);
}
if ($this->textColor) {
$domElement->setAttribute("textcolor", $this->textColor);
}
if ($this->textSize) {
$domElement->setAttribute("textsize", $this->textSize);
}
if ($this->textFont) {
$domElement->setAttribute("textfont", $this->textFont);
}
if ($this->areaColor) {
$domElement->setAttribute("focusareacolor1", $this->areaColor);
}
if ($this->focusAreaColor) {
$domElement->setAttribute("focusareacolor2", $this->focusAreaColor);
}
return $domElement;
}
}

View File

@ -10,108 +10,262 @@ use FML\Types\Scriptable;
* (CMlMediaPlayer) * (CMlMediaPlayer)
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Video extends Control implements Playable, Scriptable { class Video extends Control implements Playable, Scriptable
/* {
* Protected properties
*/
protected $tagName = 'video';
protected $data = null;
protected $dataId = null;
protected $play = null;
protected $looping = true;
protected $music = null;
protected $volume = 1.;
protected $scriptEvents = null;
/** /**
* @see \FML\Controls\Control::getManiaScriptClass() * @var string $data Data url
*/ */
public function getManiaScriptClass() { protected $data = null;
return 'CMlMediaPlayer';
}
/** /**
* @see \FML\Types\Playable::setData() * @var string $dataId Data id
*/ */
public function setData($data) { protected $dataId = null;
$this->data = (string)$data;
return $this;
}
/** /**
* @see \FML\Types\Playable::setDataId() * @var bool $play Play automaticcaly
*/ */
public function setDataId($dataId) { protected $play = null;
$this->dataId = (string)$dataId;
return $this;
}
/** /**
* @see \FML\Types\Playable::setPlay() * @var bool $looping Looping
*/ */
public function setPlay($play) { protected $looping = true;
$this->play = ($play ? 1 : 0);
return $this;
}
/** /**
* @see \FML\Types\Playable::setLooping() * @var bool $music Music type
*/ */
public function setLooping($looping) { protected $music = null;
$this->looping = ($looping ? 1 : 0);
return $this;
}
/** /**
* @see \FML\Types\Playable::setMusic() * @var float $volume Volume
*/ */
public function setMusic($music) { protected $volume = 1.;
$this->music = ($music ? 1 : 0);
return $this;
}
/** /**
* @see \FML\Types\Playable::setVolume() * @var bool $scriptEvents Script events usage
*/ */
public function setVolume($volume) { protected $scriptEvents = null;
$this->volume = (float)$volume;
return $this;
}
/** /**
* @see \FML\Types\Scriptable::setScriptEvents() * @var string $scriptAction Script action
*/ */
public function setScriptEvents($scriptEvents) { protected $scriptAction = null;
$this->scriptEvents = ($scriptEvents ? 1 : 0);
return $this; /**
} * @var string[] $scriptActionParameters Script action parameters
*/
protected $scriptActionParameters = null;
/**
* @see Playable::getData()
*/
public function getData()
{
return $this->data;
}
/**
* @see Playable::setData()
*/
public function setData($data)
{
$this->data = (string)$data;
return $this;
}
/**
* @see Playable::getDataId()
*/
public function getDataId()
{
return $this->dataId;
}
/**
* @see Playable::setDataId()
*/
public function setDataId($dataId)
{
$this->dataId = (string)$dataId;
return $this;
}
/**
* @see Playable::getPlay()
*/
public function getPlay()
{
return $this->play;
}
/**
* @see Playable::setPlay()
*/
public function setPlay($play)
{
$this->play = (bool)$play;
return $this;
}
/**
* @see Playable::getLooping()
*/
public function getLooping()
{
return $this->looping;
}
/**
* @see Playable::setLooping()
*/
public function setLooping($looping)
{
$this->looping = (bool)$looping;
return $this;
}
/**
* @see Playable::getMusic()
*/
public function getMusic()
{
return $this->music;
}
/**
* @see Playable::setMusic()
*/
public function setMusic($music)
{
$this->music = (bool)$music;
return $this;
}
/**
* @see Playable::getVolume()
*/
public function getVolume()
{
return $this->volume;
}
/**
* @see Playable::setVolume()
*/
public function setVolume($volume)
{
$this->volume = (float)$volume;
return $this;
}
/**
* @see Scriptable::getScriptEvents()
*/
public function getScriptEvents()
{
return $this->scriptEvents;
}
/**
* @see Scriptable::setScriptEvents()
*/
public function setScriptEvents($scriptEvents)
{
$this->scriptEvents = (bool)$scriptEvents;
return $this;
}
/**
* @see Scriptable::getScriptAction()
*/
public function getScriptAction()
{
return $this->scriptAction;
}
/**
* @see Scriptable::setScriptAction()
*/
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
{
$this->scriptAction = (string)$scriptAction;
$this->setScriptActionParameters($scriptActionParameters);
return $this;
}
/**
* @see Scriptable::getScriptActionParameters()
*/
public function getScriptActionParameters()
{
return $this->scriptActionParameters;
}
/**
* @see Scriptable::setScriptActionParameters()
*/
public function setScriptActionParameters(array $scriptActionParameters = null)
{
$this->scriptActionParameters = $scriptActionParameters;
return $this;
}
/**
* @see Control::getTagName()
*/
public function getTagName()
{
return "video";
}
/**
* @see Control::getManiaScriptClass()
*/
public function getManiaScriptClass()
{
return "CMlMediaPlayer";
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->data) {
$domElement->setAttribute("data", $this->data);
}
if ($this->dataId) {
$domElement->setAttribute("dataid", $this->dataId);
}
if ($this->play) {
$domElement->setAttribute("play", 1);
}
if (!$this->looping) {
$domElement->setAttribute("looping", 0);
}
if ($this->music) {
$domElement->setAttribute("music", 1);
}
if ($this->volume != 1.) {
$domElement->setAttribute("volume", $this->volume);
}
if ($this->scriptEvents) {
$domElement->setAttribute("scriptevents", 1);
}
if ($this->scriptAction) {
$scriptAction = array($this->scriptAction);
if ($this->scriptActionParameters) {
$scriptAction = array_merge($scriptAction, $this->scriptActionParameters);
}
$domElement->setAttribute("scriptaction", implode("'", $scriptAction));
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->data) {
$xmlElement->setAttribute('data', $this->data);
}
if ($this->play) {
$xmlElement->setAttribute('play', $this->play);
}
if (!$this->looping) {
$xmlElement->setAttribute('looping', $this->looping);
}
if ($this->music) {
$xmlElement->setAttribute('music', $this->music);
}
if ($this->volume != 1.) {
$xmlElement->setAttribute('volume', $this->volume);
}
if ($this->scriptEvents) {
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
}
return $xmlElement;
}
} }

View File

@ -6,187 +6,323 @@ namespace FML;
* Class representing a Custom_UI * Class representing a Custom_UI
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class CustomUI { class CustomUI
/* {
* Protected properties
*/
protected $encoding = 'utf-8';
protected $tagName = 'custom_ui';
protected $noticeVisible = null;
protected $challengeInfoVisible = null;
protected $netInfosVisible = null;
protected $chatVisible = null;
protected $checkpointListVisible = null;
protected $roundScoresVisible = null;
protected $scoretableVisible = null;
protected $globalVisible = null;
/** /**
* Create a new CustomUI object * @var bool $globalVisible If the UI should be shown at all
* */
* @return static protected $globalVisible = null;
*/
public static function create() {
return new static();
}
/** /**
* Set XML encoding * @var bool $challengeInfoVisible If the challenge info should be shown
* */
* @param string $encoding XML encoding protected $challengeInfoVisible = null;
* @return static
*/
public function setXMLEncoding($encoding) {
$this->encoding = (string)$encoding;
return $this;
}
/** /**
* Set showing of notices * @var bool $chatVisible If the chat should be shown
* */
* @param bool $visible Whether notices should be shown protected $chatVisible = null;
* @return static
*/
public function setNoticeVisible($visible) {
$this->noticeVisible = $visible;
return $this;
}
/** /**
* Set showing of the challenge info * @var bool $checkpointListVisible If the checkpoint list should be shown
* */
* @param bool $visible Whether the challenge info should be shown protected $checkpointListVisible = null;
* @return static
*/
public function setChallengeInfoVisible($visible) {
$this->challengeInfoVisible = $visible;
return $this;
}
/** /**
* Set showing of the net infos * @var bool $netInfosVisible If the net infos should be shown
* */
* @param bool $visible Whether the net infos should be shown protected $netInfosVisible = null;
* @return static
*/
public function setNetInfosVisible($visible) {
$this->netInfosVisible = $visible;
return $this;
}
/** /**
* Set showing of the chat * @var bool $noticeVisible If notices should be shown
* */
* @param bool $visible Whether the chat should be shown protected $noticeVisible = null;
* @return static
*/
public function setChatVisible($visible) {
$this->chatVisible = $visible;
return $this;
}
/** /**
* Set showing of the checkpoint list * @var bool $roundScoresVisible If round scores should be shown
* */
* @param bool $visible Whether the checkpoint should be shown protected $roundScoresVisible = null;
* @return static
*/
public function setCheckpointListVisible($visible) {
$this->checkpointListVisible = $visible;
return $this;
}
/** /**
* Set showing of round scores * @var bool $scoretableVisible If the score table should be shown
* */
* @param bool $visible Whether the round scores should be shown protected $scoretableVisible = null;
* @return static
*/
public function setRoundScoresVisible($visible) {
$this->roundScoresVisible = $visible;
return $this;
}
/** /**
* Set showing of the scoretable * Create a new CustomUI
* *
* @param bool $visible Whether the scoretable should be shown * @api
* @return static * @return static
*/ */
public function setScoretableVisible($visible) { public static function create()
$this->scoretableVisible = $visible; {
return $this; return new static();
} }
/** /**
* Set global showing * Get global visibility
* *
* @param bool $visible Whether the UI should be disabled completely * @api
* @return static * @return bool
*/ */
public function setGlobalVisible($visible) { public function getGlobalVisible()
$this->globalVisible = $visible; {
return $this; return $this->globalVisible;
} }
/** /**
* Render the XML document * Set global visibility
* *
* @param \DOMDocument $domDocument (optional) DOMDocument for which the XML element should be rendered * @api
* @return \DOMDocument * @param bool $visible If the UI should be shown at all
*/ * @return static
public function render($domDocument = null) { */
$isChild = (bool)$domDocument; public function setGlobalVisible($visible)
if (!$isChild) { {
$domDocument = new \DOMDocument('1.0', $this->encoding); $this->globalVisible = $visible;
$domDocument->xmlStandalone = true; return $this;
} }
$xmlElement = $domDocument->createElement($this->tagName);
if (!$isChild) {
$domDocument->appendChild($xmlElement);
}
$settings = $this->getSettings();
foreach ($settings as $setting => $value) {
if ($value === null) {
continue;
}
$xmlSubElement = $domDocument->createElement($setting);
$xmlSubElement->setAttribute('visible', ($value ? 1 : 0));
$xmlElement->appendChild($xmlSubElement);
}
if ($isChild) {
return $xmlElement;
}
return $domDocument;
}
/** /**
* Get string representation * Get showing of the challenge info
* *
* @return string * @api
*/ * @return bool
public function __toString() { */
return $this->render()->saveXML(); public function getChallengeInfoVisible()
} {
return $this->challengeInfoVisible;
}
/**
* Set showing of the challenge info
*
* @api
* @param bool $visible If the challenge info should be shown
* @return static
*/
public function setChallengeInfoVisible($visible)
{
$this->challengeInfoVisible = $visible;
return $this;
}
/**
* Get showing of the chat
*
* @api
* @return bool
*/
public function getChatVisible()
{
return $this->chatVisible;
}
/**
* Set showing of the chat
*
* @api
* @param bool $visible If the chat should be shown
* @return static
*/
public function setChatVisible($visible)
{
$this->chatVisible = $visible;
return $this;
}
/**
* Get showing of the checkpoint list
*
* @api
* @return bool
*/
public function getCheckpointListVisible()
{
return $this->checkpointListVisible;
}
/**
* Set showing of the checkpoint list
*
* @api
* @param bool $visible If the checkpoint list should be shown
* @return static
*/
public function setCheckpointListVisible($visible)
{
$this->checkpointListVisible = $visible;
return $this;
}
/**
* Get showing of the net infos
*
* @api
* @return bool
*/
public function getNetInfosVisible()
{
return $this->netInfosVisible;
}
/**
* Set showing of the net infos
*
* @api
* @param bool $visible If the net infos should be shown
* @return static
*/
public function setNetInfosVisible($visible)
{
$this->netInfosVisible = $visible;
return $this;
}
/**
* Get showing of notices
*
* @api
* @return bool
*/
public function getNoticeVisible()
{
return $this->noticeVisible;
}
/**
* Set showing of notices
*
* @api
* @param bool $visible If notices should be shown
* @return static
*/
public function setNoticeVisible($visible)
{
$this->noticeVisible = $visible;
return $this;
}
/**
* Get showing of round scores
*
* @api
* @return bool
*/
public function getRoundScoresVisible()
{
return $this->roundScoresVisible;
}
/**
* Set showing of round scores
*
* @api
* @param bool $visible If round scores should be shown
* @return static
*/
public function setRoundScoresVisible($visible)
{
$this->roundScoresVisible = $visible;
return $this;
}
/**
* Get showing of the score table
*
* @api
* @return bool
*/
public function getScoretableVisible()
{
return $this->scoretableVisible;
}
/**
* Set showing of the score table
*
* @api
* @param bool $visible If the score table should be shown
* @return static
*/
public function setScoretableVisible($visible)
{
$this->scoretableVisible = $visible;
return $this;
}
/**
* Render the CustomUI standalone
*
* @return \DOMDocument
*/
public function renderStandalone()
{
$domDocument = new \DOMDocument("1.0", "utf-8");
$domDocument->xmlStandalone = true;
$domElement = $this->render($domDocument);
$domDocument->appendChild($domElement);
return $domDocument;
}
/**
* Render the CustomUI
*
* @param \DOMDocument $domDocument DOMDocument for which the CustomUI should be rendered
* @return \DOMElement
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("custom_ui");
$settings = $this->getSettings();
foreach ($settings as $setting => $value) {
if ($value === null) {
continue;
}
$settingDomElement = $domDocument->createElement($setting);
$settingDomElement->setAttribute("visible", ($value ? 1 : 0));
$domElement->appendChild($settingDomElement);
}
return $domElement;
}
/**
* Get string representation
*
* @return string
*/
public function __toString()
{
return $this->renderStandalone()
->saveXML();
}
/**
* Get associative array of all CustomUI settings
*
* @return array
*/
protected function getSettings()
{
return array(
"global" => $this->globalVisible,
"challenge_info" => $this->challengeInfoVisible,
"chat" => $this->chatVisible,
"checkpoint_list" => $this->checkpointListVisible,
"net_infos" => $this->netInfosVisible,
"notice" => $this->noticeVisible,
"round_scores" => $this->roundScoresVisible,
"scoretable" => $this->scoretableVisible
);
}
/**
* Get associative array of all CustomUI settings
*
* @return array
*/
protected function getSettings() {
$settings = array();
$settings['challenge_info'] = $this->challengeInfoVisible;
$settings['chat'] = $this->chatVisible;
$settings['checkpoint_list'] = $this->checkpointListVisible;
$settings['global'] = $this->globalVisible;
$settings['net_infos'] = $this->netInfosVisible;
$settings['notice'] = $this->noticeVisible;
$settings['round_scores'] = $this->roundScoresVisible;
$settings['scoretable'] = $this->scoretableVisible;
return $settings;
}
} }

View File

@ -6,261 +6,276 @@ namespace FML\Elements;
* Dictionary Element * Dictionary Element
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Dico { class Dico
/** {
* Czech language
*
* @var string
*/
const LANG_CZECH = 'cz';
/** /**
* Danish language * Czech language
* *
* @var string * @var string
*/ */
const LANG_DANISH = 'da'; const LANG_CZECH = 'cz';
/** /**
* German language * Danish language
* *
* @var string * @var string
*/ */
const LANG_GERMAN = 'de'; const LANG_DANISH = 'da';
/** /**
* English language * German language
* *
* @var string * @var string
*/ */
const LANG_ENGLISH = 'en'; const LANG_GERMAN = 'de';
/** /**
* Spanish language * English language
* *
* @var string * @var string
*/ */
const LANG_SPANISH = 'es'; const LANG_ENGLISH = 'en';
/** /**
* French language * Spanish language
* *
* @var string * @var string
*/ */
const LANG_FRENCH = 'fr'; const LANG_SPANISH = 'es';
/** /**
* Hungarian language * French language
* *
* @var string * @var string
*/ */
const LANG_HUNGARIAN = 'hu'; const LANG_FRENCH = 'fr';
/** /**
* Italian language * Hungarian language
* *
* @var string * @var string
*/ */
const LANG_ITALIAN = 'it'; const LANG_HUNGARIAN = 'hu';
/** /**
* Japanese language * Italian language
* *
* @var string * @var string
*/ */
const LANG_JAPANESE = 'jp'; const LANG_ITALIAN = 'it';
/** /**
* Korean language * Japanese language
* *
* @var string * @var string
*/ */
const LANG_KOREAN = 'kr'; const LANG_JAPANESE = 'jp';
/** /**
* Norwegian language * Korean language
* *
* @var string * @var string
*/ */
const LANG_NORWEGIAN = 'nb'; const LANG_KOREAN = 'kr';
/** /**
* Dutch language * Norwegian language
* *
* @var string * @var string
*/ */
const LANG_DUTCH = 'nl'; const LANG_NORWEGIAN = 'nb';
/** /**
* Polish language * Dutch language
* *
* @var string * @var string
*/ */
const LANG_POLISH = 'pl'; const LANG_DUTCH = 'nl';
/** /**
* Portuguese language * Polish language
* *
* @var string * @var string
*/ */
const LANG_PORTUGUESE = 'pt'; const LANG_POLISH = 'pl';
/** /**
* Brazilian Portuguese language * Portuguese language
* *
* @var string * @var string
*/ */
const LANG_BRAZILIAN_PORTUGUESE = 'pt_BR'; const LANG_PORTUGUESE = 'pt';
/** /**
* Romanian language * Brazilian Portuguese language
* *
* @var string * @var string
*/ */
const LANG_ROMANIAN = 'ro'; const LANG_BRAZILIAN_PORTUGUESE = 'pt_BR';
/** /**
* Russian language * Romanian language
* *
* @var string * @var string
*/ */
const LANG_RUSSIAN = 'ru'; const LANG_ROMANIAN = 'ro';
/** /**
* Slovak language * Russian language
* *
* @var string * @var string
*/ */
const LANG_SLOVAK = 'sk'; const LANG_RUSSIAN = 'ru';
/** /**
* Turkish language * Slovak language
* *
* @var string * @var string
*/ */
const LANG_TURKISH = 'tr'; const LANG_SLOVAK = 'sk';
/** /**
* Chinese language * Turkish language
* *
* @var string * @var string
*/ */
const LANG_CHINESE = 'zh'; const LANG_TURKISH = 'tr';
/* /**
* Protected properties * Chinese language
*/ *
protected $tagName = 'dico'; * @var string
protected $entries = array(); */
const LANG_CHINESE = 'zh';
/** /*
* Create a new Dictionary object * Protected properties
* */
* @return static protected $entries = array();
*/
public static function create() {
return new static();
}
/** /**
* Set the translatable entry for the specific language * Create a new Dico
* *
* @param string $language Language id * @api
* @param string $entryId Entry id * @return static
* @param string $entryValue Translated entry value */
* @return static public static function create()
*/ {
public function setEntry($language, $entryId, $entryValue) { return new static();
$language = (string)$language; }
$entryId = (string)$entryId;
$entryValue = (string)$entryValue;
if (!isset($this->entries[$language]) && $entryValue) {
$this->entries[$language] = array();
}
if ($entryValue) {
$this->entries[$language][$entryId] = $entryValue;
} else {
if (isset($this->entries[$language][$entryId])) {
unset($this->entries[$language][$entryId]);
}
}
return $this;
}
/** /**
* Remove entries of the given id * Get the translatable entry
* *
* @param string $entryId Entry id that should be removed * @api
* @param string $language (optional) Only remove entries of the given language * @param string $language Language id
* @return static * @param string $entryId Entry id
*/ * @return string
public function removeEntry($entryId, $language = null) { */
$entryId = (string)$entryId; public function getEntry($language, $entryId)
if ($language) { {
$language = (string)$language; if (isset($this->entries[$language]) && isset($this->entries[$language][$entryId])) {
if (isset($this->entries[$language])) { return $this->entries[$language][$entryId];
unset($this->entries[$language][$entryId]); }
} return null;
} else { }
foreach ($this->entries as $language => $entries) {
if (isset($entries[$entryId])) {
unset($entries[$language][$entryId]);
}
}
}
return $this;
}
/** /**
* Remove entries of the given language * Set the translatable entry for the specific language
* *
* @param string $language Language which entries should be removed * @api
* @param string $entryId (optional) Only remove the given entry id * @param string $language Language id
* @return static * @param string $entryId Entry id
*/ * @param string $entryValue Translated entry value
public function removeLanguage($language, $entryId = null) { * @return static
$language = (string)$language; */
if (isset($this->entries[$language])) { public function setEntry($language, $entryId, $entryValue)
if ($entryId) { {
$entryId = (string)$entryId; $language = (string)$language;
unset($this->entries[$language][$entryId]); $entryId = (string)$entryId;
} else { $entryValue = (string)$entryValue;
unset($this->entries[$language]); if (!isset($this->entries[$language]) && $entryValue) {
} $this->entries[$language] = array();
} }
return $this; if ($entryValue) {
} $this->entries[$language][$entryId] = $entryValue;
} else {
if (isset($this->entries[$language][$entryId])) {
unset($this->entries[$language][$entryId]);
}
}
return $this;
}
/** /**
* Remove all entries from the Dictionary * Remove entries of the given id
* *
* @return static * @api
*/ * @param string $entryId Entry id that should be removed
public function removeEntries() { * @return static
$this->entries = array(); */
return $this; public function removeEntry($entryId)
} {
$entryId = (string)$entryId;
foreach ($this->entries as $language => $entries) {
if (isset($this->entries[$language][$entryId])) {
unset($this->entries[$language][$entryId]);
}
}
return $this;
}
/**
* Remove entries of the given language
*
* @api
* @param string $language Language which entries should be removed
* @return static
*/
public function removeLanguage($language)
{
$language = (string)$language;
if (isset($this->entries[$language])) {
unset($this->entries[$language]);
}
return $this;
}
/**
* Remove all entries
*
* @api
* @return static
*/
public function removeAllEntries()
{
$this->entries = array();
return $this;
}
/**
* Render the Dico
*
* @param \DOMDocument $domDocument DOMDocument for which the Dico should be rendered
* @return \DOMElement
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("dico");
foreach ($this->entries as $language => $entries) {
$languageElement = $domDocument->createElement("language");
$languageElement->setAttribute("id", $language);
foreach ($entries as $entryId => $entryValue) {
$entryElement = $domDocument->createElement($entryId, $entryValue);
$languageElement->appendChild($entryElement);
}
$domElement->appendChild($languageElement);
}
return $domElement;
}
/**
* Render the Dico XML element
*
* @param \DOMDocument $domDocument DOMDocument for which the Dico XML element should be rendered
* @return \DOMElement
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = $domDocument->createElement($this->tagName);
foreach ($this->entries as $language => $entries) {
$languageElement = $domDocument->createElement('language');
$languageElement->setAttribute('id', $language);
foreach ($entries as $entryId => $entryValue) {
$entryElement = $domDocument->createElement($entryId, $entryValue);
$languageElement->appendChild($entryElement);
}
$xmlElement->appendChild($languageElement);
}
return $xmlElement;
}
} }

View File

@ -2,7 +2,7 @@
namespace FML\Elements; namespace FML\Elements;
use FML\Types\BgColorable; use FML\Types\BackgroundColorable;
use FML\Types\Renderable; use FML\Types\Renderable;
use FML\Types\Styleable; use FML\Types\Styleable;
use FML\Types\TextFormatable; use FML\Types\TextFormatable;
@ -11,113 +11,205 @@ use FML\Types\TextFormatable;
* Format Element * Format Element
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Format implements BgColorable, Renderable, Styleable, TextFormatable { class Format implements BackgroundColorable, Renderable, Styleable, TextFormatable
/* {
* Protected properties
*/
protected $tagName = 'format';
protected $bgColor = null;
protected $style = null;
protected $textSize = -1;
protected $textFont = null;
protected $textColor = null;
protected $focusAreaColor1 = null;
protected $focusAreaColor2 = null;
/** /**
* Create a new Format Element * @var string $backgroundColor Background color
* */
* @return static protected $backgroundColor = null;
*/
public static function create() {
return new static();
}
/** /**
* @see \FML\Types\BgColorable::setBgColor() * @var string $style Style
*/ */
public function setBgColor($bgColor) { protected $style = null;
$this->bgColor = (string)$bgColor;
return $this;
}
/** /**
* @see \FML\Types\Styleable::setStyle() * @var int $textSize Text size
*/ */
public function setStyle($style) { protected $textSize = null;
$this->style = (string)$style;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setTextSize() * @var string $textFont Text font
*/ */
public function setTextSize($textSize) { protected $textFont = null;
$this->textSize = (int)$textSize;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setTextFont() * @var string $textColor Text color
*/ */
public function setTextFont($textFont) { protected $textColor = null;
$this->textFont = (string)$textFont;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setTextColor() * @var string $areaColor Area color
*/ */
public function setTextColor($textColor) { protected $areaColor = null;
$this->textColor = (string)$textColor;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setAreaColor() * @var string $focusAreaColor Focus area color
*/ */
public function setAreaColor($areaColor) { protected $focusAreaColor = null;
$this->focusAreaColor1 = (string)$areaColor;
return $this;
}
/** /**
* @see \FML\Types\TextFormatable::setAreaFocusColor() * Create a new Format
*/ *
public function setAreaFocusColor($areaFocusColor) { * @api
$this->focusAreaColor2 = (string)$areaFocusColor; * @return static
return $this; */
} public static function create()
{
return new static();
}
/**
* @see BgColorable::getBackgroundColor()
*/
public function getBackgroundColor()
{
return $this->backgroundColor;
}
/**
* @see BgColorable::setBackgroundColor()
*/
public function setBackgroundColor($backgroundColor)
{
$this->backgroundColor = (string)$backgroundColor;
return $this;
}
/**
* @see Styleable::getStyle()
*/
public function getStyle()
{
return $this->style;
}
/**
* @see Styleable::setStyle()
*/
public function setStyle($style)
{
$this->style = (string)$style;
return $this;
}
/**
* @see TextFormatable::getTextSize()
*/
public function getTextSize()
{
return $this->textSize;
}
/**
* @see TextFormatable::setTextSize()
*/
public function setTextSize($textSize)
{
$this->textSize = (int)$textSize;
return $this;
}
/**
* @see TextFormatable::getTextFont()
*/
public function getTextFont()
{
return $this->textFont;
}
/**
* @see TextFormatable::setTextFont()
*/
public function setTextFont($textFont)
{
$this->textFont = (string)$textFont;
return $this;
}
/**
* @see TextFormatable::getTextColor()
*/
public function getTextColor()
{
return $this->textColor;
}
/**
* @see TextFormatable::setTextColor()
*/
public function setTextColor($textColor)
{
$this->textColor = (string)$textColor;
return $this;
}
/**
* @see TextFormatable::getAreaColor()
*/
public function getAreaColor()
{
return $this->areaColor;
}
/**
* @see TextFormatable::setAreaColor()
*/
public function setAreaColor($areaColor)
{
$this->areaColor = (string)$areaColor;
return $this;
}
/**
* @see TextFormatable::getAreaFocusColor()
*/
public function getAreaFocusColor()
{
return $this->focusAreaColor;
}
/**
* @see TextFormatable::setAreaFocusColor()
*/
public function setAreaFocusColor($areaFocusColor)
{
$this->focusAreaColor = (string)$areaFocusColor;
return $this;
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("format");
if ($this->backgroundColor) {
$domElement->setAttribute("bgcolor", $this->backgroundColor);
}
if ($this->style) {
$domElement->setAttribute("style", $this->style);
}
if ($this->textSize) {
$domElement->setAttribute("textsize", $this->textSize);
}
if ($this->textFont) {
$domElement->setAttribute("textfont", $this->textFont);
}
if ($this->textColor) {
$domElement->setAttribute("textcolor", $this->textColor);
}
if ($this->areaColor) {
$domElement->setAttribute("focusareacolor1", $this->areaColor);
}
if ($this->focusAreaColor) {
$domElement->setAttribute("focusareacolor2", $this->focusAreaColor);
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$formatXmlElement = $domDocument->createElement($this->tagName);
if ($this->bgColor) {
$formatXmlElement->setAttribute('bgcolor', $this->bgColor);
}
if ($this->style) {
$formatXmlElement->setAttribute('style', $this->style);
}
if ($this->textSize >= 0) {
$formatXmlElement->setAttribute('textsize', $this->textSize);
}
if ($this->textFont) {
$formatXmlElement->setAttribute('textfont', $this->textFont);
}
if ($this->textColor) {
$formatXmlElement->setAttribute('textcolor', $this->textColor);
}
if ($this->focusAreaColor1) {
$formatXmlElement->setAttribute('focusareacolor1', $this->focusAreaColor1);
}
if ($this->focusAreaColor2) {
$formatXmlElement->setAttribute('focusareacolor2', $this->focusAreaColor2);
}
return $formatXmlElement;
}
} }

View File

@ -3,6 +3,7 @@
namespace FML\Elements; namespace FML\Elements;
use FML\Types\Container; use FML\Types\Container;
use FML\Types\Identifiable;
use FML\Types\Renderable; use FML\Types\Renderable;
use FML\UniqueID; use FML\UniqueID;
@ -10,103 +11,172 @@ use FML\UniqueID;
* Class representing a Frame Model * Class representing a Frame Model
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class FrameModel implements Container, Renderable { class FrameModel implements Container, Identifiable, Renderable
/* {
* Protected properties
*/
protected $tagName = 'framemodel';
protected $modelId = null;
/** @var Renderable[] $children */
protected $children = array();
/** @var Format $format */
protected $format = null;
/** /**
* Set Model id * @var string $modelId Model id
* */
* @param string $modelId Model id protected $modelId = null;
* @return static
*/
public function setId($modelId) {
$this->modelId = (string)$modelId;
return $this;
}
/** /**
* Get Model id * @var Renderable[] $children Children
* */
* @return string protected $children = array();
*/
public function getId() {
return $this->modelId;
}
/** /**
* Assign an id if necessary * @var Format $format Format
* */
* @return string protected $format = null;
*/
public function checkId() {
if (!$this->modelId) {
$this->setId(UniqueID::create());
}
return $this;
}
/** /**
* @see \FML\Types\Container::add() * Create a new Frame Model
*/ *
public function add(Renderable $childElement) { * @api
if (!in_array($childElement, $this->children, true)) { * @param string $modelId Model id
array_push($this->children, $childElement); * @param Renderable[] $children Children
} * @return static
return $this; */
} public static function create($modelId = null, array $children = null)
{
return new static($modelId, $children);
}
/** /**
* @see \FML\Types\Container::removeChildren() * Construct a new Frame Model
*/ *
public function removeChildren() { * @api
$this->children = array(); * @param string $modelId Model id
return $this; * @param Renderable[] $children Children
} */
public function __construct($modelId = null, array $children = null)
{
if ($modelId) {
$this->setId($modelId);
}
if ($children) {
$this->addChildren($children);
}
}
/** /**
* @see \FML\Types\Container::setFormat() * @see Identifiable::getId()
*/ */
public function setFormat(Format $format) { public function getId()
$this->format = $format; {
return $this; if (!$this->modelId) {
} return $this->createId();
}
return $this->modelId;
}
/** /**
* @see \FML\Types\Container::getFormat() * @see Identifiable::setId()
*/ */
public function getFormat($createIfEmpty = true) { public function setId($modelId)
if (!$this->format && $createIfEmpty) { {
$this->setFormat(new Format()); $this->modelId = (string)$modelId;
} return $this;
return $this->format; }
}
/**
* @see Identifiable::checkId()
*/
public function checkId()
{
return UniqueID::check($this);
}
/**
* Create a new model id
*
* @return string
*/
protected function createId()
{
$modelId = UniqueID::create();
$this->setId($modelId);
return $this->getId();
}
/**
* @see Container::getChildren()
*/
public function getChildren()
{
return $this->children;
}
/**
* @see Container::addChild()
*/
public function addChild(Renderable $childElement)
{
if (!in_array($childElement, $this->children, true)) {
array_push($this->children, $childElement);
}
return $this;
}
/**
* @see Container::addChildren()
*/
public function addChildren(array $children)
{
foreach ($children as $child) {
$this->addChild($child);
}
return $this;
}
/**
* @see Container::removeAllChildren()
*/
public function removeAllChildren()
{
$this->children = array();
return $this;
}
/**
* @see Container::getFormat()
*/
public function getFormat()
{
return $this->format;
}
/**
* @see Container::setFormat()
*/
public function setFormat(Format $format = null)
{
$this->format = $format;
return $this;
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("framemodel");
$domElement->setAttribute("id", $this->getId());
if ($this->format) {
$formatElement = $this->format->render($domDocument);
$domElement->appendChild($formatElement);
}
foreach ($this->children as $child) {
$childElement = $child->render($domDocument);
$domElement->appendChild($childElement);
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = $domDocument->createElement($this->tagName);
$this->checkId();
$xmlElement->setAttribute('id', $this->getId());
if ($this->format) {
$formatXml = $this->format->render($domDocument);
$xmlElement->appendChild($formatXml);
}
foreach ($this->children as $child) {
$childElement = $child->render($domDocument);
$xmlElement->appendChild($childElement);
}
return $xmlElement;
}
} }

View File

@ -8,56 +8,76 @@ use FML\Types\Renderable;
* Include Element * Include Element
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Including implements Renderable { class Including implements Renderable
/* {
* Protected properties
*/
protected $tagName = 'include';
protected $url = null;
/** /**
* Create a new Include object * @var string $url Include url
* */
* @param string $url (optional) Include url protected $url = null;
* @return static
*/
public static function create($url = null) {
return new static($url);
}
/** /**
* Construct a new Include object * Create a new Include
* *
* @param string $url (optional) Include url * @api
*/ * @param string $url (optional) Include url
public function __construct($url = null) { * @return static
if ($url !== null) { */
$this->setUrl($url); public static function create($url = null)
} {
} return new static($url);
}
/** /**
* Set url * Construct a new Include
* *
* @param string $url Include url * @api
* @return static * @param string $url (optional) Include url
*/ */
public function setUrl($url) { public function __construct($url = null)
$this->url = (string)$url; {
return $this; if ($url) {
} $this->setUrl($url);
}
}
/**
* Get the url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the url
*
* @api
* @param string $url Include url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("include");
if ($this->url) {
$domElement->setAttribute("url", $this->url);
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = $domDocument->createElement($this->tagName);
if ($this->url) {
$xmlElement->setAttribute('url', $this->url);
}
return $xmlElement;
}
} }

View File

@ -8,56 +8,76 @@ use FML\Types\Renderable;
* Music Element * Music Element
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Music implements Renderable { class Music implements Renderable
/* {
* Protected properties
*/
protected $tagName = 'music';
protected $data = null;
/** /**
* Create a new Music object * @var string $data Media url
* */
* @param string $data (optional) Media url protected $data = null;
* @return static
*/
public static function create($data = null) {
return new static($data);
}
/** /**
* Construct a new Music object * Create a new Music
* *
* @param string $data (optional) Media url * @api
*/ * @param string $data (optional) Media url
public function __construct($data = null) { * @return static
if ($data !== null) { */
$this->setData($data); public static function create($data = null)
} {
} return new static($data);
}
/** /**
* Set data url * Construct a new Music
* *
* @param string $data Data url * @api
* @return static * @param string $data (optional) Media url
*/ */
public function setData($data) { public function __construct($data = null)
$this->data = (string)$data; {
return $this; if ($data) {
} $this->setData($data);
}
}
/**
* Get the media url
*
* @api
* @return string
*/
public function getData()
{
return $this->data;
}
/**
* Set the media url
*
* @api
* @param string $data Media url
* @return static
*/
public function setData($data)
{
$this->data = (string)$data;
return $this;
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("music");
if ($this->data) {
$domElement->setAttribute("data", $this->data);
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = $domDocument->createElement($this->tagName);
if ($this->data) {
$xmlElement->setAttribute('data', $this->data);
}
return $xmlElement;
}
} }

View File

@ -8,57 +8,77 @@ use FML\Types\Renderable;
* Class representing a ManiaLink script tag with a simple script text * Class representing a ManiaLink script tag with a simple script text
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class SimpleScript implements Renderable { class SimpleScript implements Renderable
/* {
* Protected properties
*/
protected $tagName = 'script';
protected $text = null;
/** /**
* Create a new SimpleScript object * @var string $text Script text
* */
* @param string $text (optional) Script text protected $text = null;
* @return static
*/
public static function create($text = null) {
return new static($text);
}
/** /**
* Construct a new SimpleScript object * Create a new SimpleScript
* *
* @param string $text (optional) Script text * @api
*/ * @param string $text (optional) Script text
public function __construct($text = null) { * @return static
if ($text !== null) { */
$this->setText($text); public static function create($text = null)
} {
} return new static($text);
}
/** /**
* Set script text * Construct a new SimpleScript
* *
* @param string $text Complete script text * @api
* @return static * @param string $text (optional) Script text
*/ */
public function setText($text) { public function __construct($text = null)
$this->text = (string)$text; {
return $this; if ($text) {
} $this->setText($text);
}
}
/**
* Get the script text
*
* @api
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* Set the script text
*
* @api
* @param string $text Complete script text
* @return static
*/
public function setText($text)
{
$this->text = (string)$text;
return $this;
}
/**
* @see Renderable::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("script");
if ($this->text) {
$scriptComment = $domDocument->createComment($this->text);
$domElement->appendChild($scriptComment);
}
return $domElement;
}
/**
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = $domDocument->createElement($this->tagName);
if ($this->text) {
$scriptComment = $domDocument->createComment($this->text);
$xmlElement->appendChild($scriptComment);
}
return $xmlElement;
}
} }

View File

@ -0,0 +1,32 @@
<?php
namespace FML\Form;
/**
* Parameters Class
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Parameters
{
/**
* Get the submitted form value
*
* @param string $name Value name
* @return string
*/
public static function getValue($name)
{
if (array_key_exists($name, $_GET)) {
return $_GET[$name];
}
if (array_key_exists($name, $_POST)) {
return $_POST[$name];
}
return null;
}
}

View File

@ -23,297 +23,358 @@ use FML\ManiaCode\ViewReplay;
* Class representing a ManiaCode * Class representing a ManiaCode
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ManiaCode { class ManiaCode
/* {
* Protected properties
*/
protected $encoding = 'utf-8';
protected $tagName = 'maniacode';
protected $noConfirmation = null;
/** @var Element[] $elements */
protected $elements = array();
/** /**
* Create a new ManiaCode object * @var bool $disableConfirmation Disable the confirmation
* */
* @return static protected $disableConfirmation = null;
*/
public static function create() {
return new static();
}
/** /**
* Set XML encoding * @var Element[] $elements ManiaCode Elements
* */
* @param string $encoding XML encoding protected $elements = array();
* @return static
*/
public function setXmlEncoding($encoding) {
$this->encoding = (string)$encoding;
return $this;
}
/** /**
* Disable the showing of the confirmation at the end of the ManiaCode * Create a new ManiaCode
* *
* @param bool $disable Whether the confirmation should be shown * @api
* @return static * @return static
*/ */
public function disableConfirmation($disable) { public static function create()
$this->noConfirmation = ($disable ? 1 : 0); {
return $this; return new static();
} }
/** /**
* Show a message * Get if the confirmation is disabled
* *
* @param string $message Message text * @api
* @return static * @return bool
*/ */
public function addShowMessage($message) { public function getDisableConfirmation()
$messageElement = new ShowMessage($message); {
$this->addElement($messageElement); return $this->disableConfirmation;
return $this; }
}
/** /**
* Install a Macroblock * Disable the showing of the confirmation at the end of the ManiaCode
* *
* @param string $name Macroblock name * @api
* @param string $file Macroblock file * @param bool $disableConfirmation If the confirmation should be disabled
* @param string $url Macroblock url * @return static
* @return static */
*/ public function setDisableConfirmation($disableConfirmation)
public function addInstallMacroblock($name, $file, $url) { {
$macroblockElement = new InstallMacroblock($name, $file, $url); $this->disableConfirmation = (bool)$disableConfirmation;
$this->addElement($macroblockElement); return $this;
return $this; }
}
/** /**
* Install a map * Show a message
* *
* @param string $name Map name * @api
* @param string $url Map url * @param string $message Message text
* @return static * @return static
*/ */
public function addInstallMap($name, $url) { public function addShowMessage($message)
$mapElement = new InstallMap($name, $url); {
$this->addElement($mapElement); $messageElement = new ShowMessage($message);
return $this; return $this->addElement($messageElement);
} }
/** /**
* Play a map * Install a Macroblock
* *
* @param string $name Map name * @api
* @param string $url Map url * @param string $name Macroblock name
* @return static * @param string $file Macroblock file
*/ * @param string $url Macroblock url
public function addPlayMap($name, $url) { * @return static
$mapElement = new PlayMap($name, $url); */
$this->addElement($mapElement); public function addInstallMacroblock($name, $file, $url)
return $this; {
} $macroblockElement = new InstallMacroblock($name, $file, $url);
return $this->addElement($macroblockElement);
}
/** /**
* Install a replay * Install a map
* *
* @param string $name Replay name * @api
* @param string $url Replay url * @param string $name Map name
* @return static * @param string $url Map url
*/ * @return static
public function addInstallReplay($name, $url) { */
$replayElement = new InstallReplay($name, $url); public function addInstallMap($name, $url)
$this->addElement($replayElement); {
return $this; $mapElement = new InstallMap($name, $url);
} return $this->addElement($mapElement);
}
/** /**
* View a replay * Play a map
* *
* @param string $name Replay name * @api
* @param string $url Replay url * @param string $name Map name
* @return static * @param string $url Map url
*/ * @return static
public function addViewReplay($name, $url) { */
$replayElement = new ViewReplay($name, $url); public function addPlayMap($name, $url)
$this->addElement($replayElement); {
return $this; $mapElement = new PlayMap($name, $url);
} return $this->addElement($mapElement);
}
/** /**
* Play a replay * Install a replay
* *
* @param string $name Replay name * @api
* @param string $url Replay url * @param string $name Replay name
* @return static * @param string $url Replay url
*/ * @return static
public function addPlayReplay($name, $url) { */
$replayElement = new PlayReplay($name, $url); public function addInstallReplay($name, $url)
$this->addElement($replayElement); {
return $this; $replayElement = new InstallReplay($name, $url);
} return $this->addElement($replayElement);
}
/** /**
* Install a skin * View a replay
* *
* @param string $name Skin name * @api
* @param string $file Skin file * @param string $name Replay name
* @param string $url Skin url * @param string $url Replay url
* @return static * @return static
*/ */
public function addInstallSkin($name, $file, $url) { public function addViewReplay($name, $url)
$skinElement = new InstallSkin($name, $file, $url); {
$this->addElement($skinElement); $replayElement = new ViewReplay($name, $url);
return $this; return $this->addElement($replayElement);
} }
/** /**
* Get a skin * Play a replay
* *
* @param string $name Skin name * @api
* @param string $file Skin file * @param string $name Replay name
* @param string $url Skin url * @param string $url Replay url
* @return static * @return static
*/ */
public function addGetSkin($name, $file, $url) { public function addPlayReplay($name, $url)
$skinElement = new GetSkin($name, $file, $url); {
$this->addElement($skinElement); $replayElement = new PlayReplay($name, $url);
return $this; return $this->addElement($replayElement);
} }
/** /**
* Add a buddy * Install a skin
* *
* @param string $login Buddy login * @api
* @return static * @param string $name Skin name
*/ * @param string $file Skin file
public function addAddBuddy($login) { * @param string $url Skin url
$buddyElement = new AddBuddy($login); * @return static
$this->addElement($buddyElement); */
return $this; public function addInstallSkin($name, $file, $url)
} {
$skinElement = new InstallSkin($name, $file, $url);
return $this->addElement($skinElement);
}
/** /**
* Go to a link * Get a skin
* *
* @param string $link Goto link * @api
* @return static * @param string $name Skin name
*/ * @param string $file Skin file
public function addGoto($link) { * @param string $url Skin url
$gotoElement = new Go_To($link); * @return static
$this->addElement($gotoElement); */
return $this; public function addGetSkin($name, $file, $url)
} {
$skinElement = new GetSkin($name, $file, $url);
return $this->addElement($skinElement);
}
/** /**
* Join a server * Add a buddy
* *
* @param string $login Server login * @api
* @return static * @param string $login Buddy login
*/ * @return static
public function addJoinServer($login) { */
$serverElement = new JoinServer($login); public function addAddBuddy($login)
$this->addElement($serverElement); {
return $this; $buddyElement = new AddBuddy($login);
} return $this->addElement($buddyElement);
}
/** /**
* Add a server as favorite * Go to a link
* *
* @param string $login Server login * @api
* @return static * @param string $link Goto link
*/ * @return static
public function addAddFavorite($login) { */
$favoriteElement = new AddFavorite($login); public function addGoto($link)
$this->addElement($favoriteElement); {
return $this; $gotoElement = new Go_To($link);
} return $this->addElement($gotoElement);
}
/** /**
* Install a script * Join a server
* *
* @param string $name Script name * @api
* @param string $file Script file * @param string $login Server login
* @param string $url Script url * @return static
* @return static */
*/ public function addJoinServer($login)
public function addInstallScript($name, $file, $url) { {
$scriptElement = new InstallScript($name, $file, $url); $serverElement = new JoinServer($login);
$this->addElement($scriptElement); return $this->addElement($serverElement);
return $this; }
}
/** /**
* Install a title pack * Add a server as favorite
* *
* @param string $name Pack name * @api
* @param string $file Pack file * @param string $login Server login
* @param string $url Pack url * @return static
* @return static */
*/ public function addAddFavorite($login)
public function addInstallPack($name, $file, $url) { {
$packElement = new InstallPack($name, $file, $url); $favoriteElement = new AddFavorite($login);
$this->addElement($packElement); return $this->addElement($favoriteElement);
return $this; }
}
/** /**
* Add a ManiaCode element * Install a script
* *
* @param Element $element Element to add * @api
* @return static * @param string $name Script name
*/ * @param string $file Script file
public function addElement(Element $element) { * @param string $url Script url
array_push($this->elements, $element); * @return static
return $this; */
} public function addInstallScript($name, $file, $url)
{
$scriptElement = new InstallScript($name, $file, $url);
return $this->addElement($scriptElement);
}
/** /**
* Remove all elements from the ManiaCode * Install a title pack
* *
* @return static * @api
*/ * @param string $name Pack name
public function removeElements() { * @param string $file Pack file
$this->elements = array(); * @param string $url Pack url
return $this; * @return static
} */
public function addInstallPack($name, $file, $url)
{
$packElement = new InstallPack($name, $file, $url);
return $this->addElement($packElement);
}
/** /**
* Render the XML document * Get all Elements
* *
* @param bool $echo (optional) Whether the XML text should be echoed and the Content-Type header should be set * @api
* @return \DOMDocument * @return Element[]
*/ */
public function render($echo = false) { public function getElements()
$domDocument = new \DOMDocument('1.0', $this->encoding); {
$domDocument->xmlStandalone = true; return $this->elements;
$maniaCode = $domDocument->createElement($this->tagName); }
$domDocument->appendChild($maniaCode);
if ($this->noConfirmation) { /**
$maniaCode->setAttribute('noconfirmation', $this->noConfirmation); * Add a ManiaCode Element
} *
foreach ($this->elements as $element) { * @api
$xmlElement = $element->render($domDocument); * @param Element $element Element to add
$maniaCode->appendChild($xmlElement); * @return static
} */
if ($echo) { public function addElement(Element $element)
header('Content-Type: application/xml; charset=utf-8;'); {
echo $domDocument->saveXML(); if (!in_array($element, $this->elements, true)) {
} array_push($this->elements, $element);
return $domDocument; }
} return $this;
}
/**
* Remove all ManiaCode Elements
*
* @api
* @return static
* @deprecated use removeAllElements() instead
*/
public function removeElements()
{
return $this->removeAllElements();
}
/**
* Remove all ManiaCode Elements
*
* @api
* @return static
*/
public function removeAllElements()
{
$this->elements = array();
return $this;
}
/**
* Render the ManiaCode
*
* @api
* @param bool $echo (optional) If the XML text should be echoed and the Content-Type header should be set
* @return \DOMDocument
*/
public function render($echo = false)
{
$domDocument = new \DOMDocument("1.0", "utf-8");
$domDocument->xmlStandalone = true;
$domElement = $domDocument->createElement("maniacode");
$domDocument->appendChild($domElement);
if ($this->disableConfirmation) {
$domElement->setAttribute("noconfirmation", 1);
}
foreach ($this->elements as $element) {
$childDomElement = $element->render($domDocument);
$domElement->appendChild($childDomElement);
}
if ($echo) {
header("Content-Type: application/xml; charset=utf-8;");
echo $domDocument->saveXML();
}
return $domDocument;
}
/**
* Get the string representation
*
* @return string
*/
public function __toString()
{
return $this->render()
->saveXML();
}
/**
* Get string representation
*
* @return string
*/
public function __toString() {
return $this->render()->saveXML();
}
} }

View File

@ -6,55 +6,77 @@ namespace FML\ManiaCode;
* ManiaCode Element adding a buddy * ManiaCode Element adding a buddy
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class AddBuddy extends Element { class AddBuddy implements Element
/* {
* Protected properties
*/
protected $tagName = 'add_buddy';
protected $login = null;
/** /**
* Create a new AddBuddy Element * @var string $login Buddy login
* */
* @param string $login (optional) Buddy login protected $login = null;
* @return static
*/
public static function create($login = null) {
return new static($login);
}
/** /**
* Construct a new AddBuddy Element * Create a new AddBuddy Element
* *
* @param string $login (optional) Buddy login * @api
*/ * @param string $login (optional) Buddy login
public function __construct($login = null) { * @return static
if ($login !== null) { */
$this->setLogin($login); public static function create($login = null)
} {
} return new static($login);
}
/** /**
* Set the buddy login * Construct a new AddBuddy Element
* *
* @param string $login Buddy login * @api
* @return static * @param string $login (optional) Buddy login
*/ */
public function setLogin($login) { public function __construct($login = null)
$this->login = (string)$login; {
return $this; if ($login) {
} $this->setLogin($login);
}
}
/**
* Get the buddy login
*
* @api
* @return string
*/
public function getLogin()
{
return $this->login;
}
/**
* Set the buddy login
*
* @api
* @param string $login Buddy login
* @return static
*/
public function setLogin($login)
{
$this->login = (string)$login;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("add_buddy");
$loginElement = $domDocument->createElement("login", $this->login);
$domElement->appendChild($loginElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$loginElement = $domDocument->createElement('login', $this->login);
$xmlElement->appendChild($loginElement);
return $xmlElement;
}
} }

View File

@ -6,78 +6,150 @@ namespace FML\ManiaCode;
* ManiaCode Element adding a server as favorite * ManiaCode Element adding a server as favorite
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class AddFavorite extends Element { class AddFavorite implements Element
/* {
* Protected properties
*/
protected $tagName = 'add_favourite';
protected $login = null;
protected $serverIp = null;
protected $serverPort = null;
/** /**
* Create a new AddFavorite object * @var string $login Server login
* */
* @param string $login (optional) Server login protected $login = null;
* @return static
*/
public static function create($login = null) {
return new static($login);
}
/** /**
* Construct a new AddFavorite object * @var string $ip Server ip
* */
* @param string $login (optional) Server login protected $ip = null;
*/
public function __construct($login = null) {
if ($login !== null) {
$this->setLogin($login);
}
}
/** /**
* Set the server login * @var int $port Server port
* */
* @param string $login Server login protected $port = null;
* @return static
*/
public function setLogin($login) {
$this->login = (string)$login;
$this->serverIp = null;
$this->serverPort = null;
return $this;
}
/** /**
* Set the server ip and port * Create a new AddFavorite Element
* *
* @param string $serverIp Server ip * @api
* @param int $serverPort Server port * @param string $loginOrIp (optional) Server login or ip
* @return static * @param int $port (optional) Server port
*/ * @return static
public function setIp($serverIp, $serverPort) { */
$this->serverIp = (string)$serverIp; public static function create($loginOrIp = null, $port = null)
$this->serverPort = (int)$serverPort; {
$this->login = null; return new static($loginOrIp, $port);
return $this; }
}
/**
* Construct a new AddFavorite Element
*
* @api
* @param string $loginOrIp (optional) Server login or ip
* @param int $port (optional) Server port
*/
public function __construct($loginOrIp = null, $port = null)
{
if ($port) {
$this->setIp($loginOrIp, $port);
} elseif ($loginOrIp) {
$this->setLogin($loginOrIp);
}
}
/**
* Get the server login
*
* @api
* @return string
*/
public function getLogin()
{
return $this->login;
}
/**
* Set the server login
*
* @api
* @param string $login Server login
* @return static
*/
public function setLogin($login)
{
$this->login = (string)$login;
$this->ip = null;
$this->port = null;
return $this;
}
/**
* Get the server ip
*
* @api
* @return string
*/
public function getIp()
{
return $this->ip;
}
/**
* Set the server ip and port
*
* @api
* @param string $ip Server ip
* @param int $port (optional) Server port
* @return static
*/
public function setIp($ip, $port = null)
{
$this->login = null;
$this->ip = (string)$ip;
if ($port) {
$this->setPort($port);
}
return $this;
}
/**
* Get the server port
*
* @api
* @return int
*/
public function getPort()
{
return $this->port;
}
/**
* Set the server port
*
* @param int $port Server port
* @return static
*/
public function setPort($port)
{
$this->port = (int)$port;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("add_favourite");
if ($this->login) {
$loginElement = $domDocument->createElement("login", $this->login);
$domElement->appendChild($loginElement);
} else {
$ipElement = $domDocument->createElement("ip", $this->ip . ":" . $this->port);
$domElement->appendChild($ipElement);
}
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->serverIp === null) {
$loginElement = $domDocument->createElement('login', $this->login);
$xmlElement->appendChild($loginElement);
} else {
$ipElement = $domDocument->createElement('ip', $this->serverIp . ':' . $this->serverPort);
$xmlElement->appendChild($ipElement);
}
return $xmlElement;
}
} }

View File

@ -6,23 +6,18 @@ namespace FML\ManiaCode;
* Base ManiaCode Element * Base ManiaCode Element
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
abstract class Element { interface Element
/* {
* Protected properties
*/ /**
protected $tagName = 'element'; * Render the ManiaCode Element
*
* @param \DOMDocument $domDocument The DOMDocument for which the Element should be rendered
* @return \DOMElement
*/
public function render(\DOMDocument $domDocument);
/**
* Render the ManiaCode Element
*
* @param \DOMDocument $domDocument The DOMDocument for which the Element should be rendered
* @return \DOMElement
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = $domDocument->createElement($this->tagName);
return $xmlElement;
}
} }

View File

@ -6,93 +6,151 @@ namespace FML\ManiaCode;
* ManiaCode Element downloading a skin * ManiaCode Element downloading a skin
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class GetSkin extends Element { class GetSkin implements Element
/* {
* Protected properties
*/
protected $tagName = 'get_skin';
protected $name = null;
protected $file = null;
protected $url = null;
/** /**
* Create a new GetSkin object * @var string $name Skin name
* */
* @param string $name (optional) Skin name protected $name = null;
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
* @return static
*/
public static function create($name = null, $file = null, $url = null) {
return new static($name, $file, $url);
}
/** /**
* Construct a new GetSkin object * @var string $file Skin file
* */
* @param string $name (optional) Skin name protected $file = null;
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
*/
public function __construct($name = null, $file = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($file !== null) {
$this->setFile($file);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/** /**
* Set the name of the skin * @var string $url Skin url
* */
* @param string $name Skin name protected $url = null;
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/** /**
* Set the file of the skin * Create a new GetSkin Element
* *
* @param string $file Skin file * @api
* @return static * @param string $name (optional) Skin name
*/ * @param string $file (optional) Skin file
public function setFile($file) { * @param string $url (optional) Skin url
$this->file = (string)$file; * @return static
return $this; */
} public static function create($name = null, $file = null, $url = null)
{
return new static($name, $file, $url);
}
/** /**
* Set the url of the skin * Construct a new GetSkin Element
* *
* @param string $url Skin url * @api
* @return static * @param string $name (optional) Skin name
*/ * @param string $file (optional) Skin file
public function setUrl($url) { * @param string $url (optional) Skin url
$this->url = (string)$url; */
return $this; public function __construct($name = null, $file = null, $url = null)
} {
if ($name) {
$this->setName($name);
}
if ($file) {
$this->setFile($file);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the skin name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the skin name
*
* @api
* @param string $name Skin name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the skin file
*
* @api
* @return string
*/
public function getFile()
{
return $this->file;
}
/**
* Set the skin file
*
* @api
* @param string $file Skin file
* @return static
*/
public function setFile($file)
{
$this->file = (string)$file;
return $this;
}
/**
* Get the skin url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the skin url
*
* @api
* @param string $url Skin url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("get_skin");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$fileElement = $domDocument->createElement("file", $this->file);
$domElement->appendChild($fileElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$fileElement = $domDocument->createElement('file', $this->file);
$xmlElement->appendChild($fileElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
} }

View File

@ -6,55 +6,77 @@ namespace FML\ManiaCode;
* ManiaCode Element for going to a link * ManiaCode Element for going to a link
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Go_To extends Element { class Go_To implements Element
/* {
* Protected properties
*/
protected $tagName = 'goto';
protected $link = null;
/** /**
* Create a new Go_To object * @var string $link Link
* */
* @param string $link (optional) Goto link protected $link = null;
* @return static
*/
public static function create($link = null) {
return new static($link);
}
/** /**
* Construct a new Go_To object * Create a new Go_To Element
* *
* @param string $link (optional) Goto link * @api
*/ * @param string $link (optional) Link
public function __construct($link = null) { * @return static
if ($link !== null) { */
$this->setLink($link); public static function create($link = null)
} {
} return new static($link);
}
/** /**
* Set link * Construct a new Go_To Element
* *
* @param string $link Goto link * @api
* @return static * @param string $link (optional) Link
*/ */
public function setLink($link) { public function __construct($link = null)
$this->link = (string)$link; {
return $this; if ($link) {
} $this->setLink($link);
}
}
/**
* Get the link
*
* @api
* @return string
*/
public function getLink()
{
return $this->link;
}
/**
* Set the link
*
* @api
* @param string $link Link
* @return static
*/
public function setLink($link)
{
$this->link = (string)$link;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("goto");
$linkElement = $domDocument->createElement("link", $this->link);
$domElement->appendChild($linkElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$linkElement = $domDocument->createElement('link', $this->link);
$xmlElement->appendChild($linkElement);
return $xmlElement;
}
} }

View File

@ -6,92 +6,151 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a macroblock * ManiaCode Element installing a macroblock
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class InstallMacroblock extends Element { class InstallMacroblock implements Element
/* {
* Protected properties
*/
protected $tagName = 'install_macroblock';
protected $name = null;
protected $file = null;
protected $url = null;
/** /**
* Create a new InstallMacroblock object * @var string $name Macroblock name
* */
* @param string $name (optional) Macroblock name protected $name = null;
* @param string $url (optional) Macroblock url
* @return static
*/
public static function create($name = null, $url = null) {
return new static($name, $url);
}
/** /**
* Construct a new InstallMacroblock object * @var string $file Macroblock file
* */
* @param string $name (optional) Macroblock name protected $file = null;
* @param string $file (optional) Macroblock file
* @param string $url (optional) Macroblock url
*/
public function __construct($name = null, $file = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($file !== null) {
$this->setFile($file);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/** /**
* Set the name of the macroblock * @var string $url Macroblock url
* */
* @param string $name Macroblock name protected $url = null;
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/** /**
* Set the file of the macroblock * Create a new InstallMacroblock Element
* *
* @param string $file Macroblock file * @api
* @return static * @param string $name (optional) Macroblock name
*/ * @param string $file (optional) Macroblock file
public function setFile($file) { * @param string $url (optional) Macroblock url
$this->file = (string)$file; * @return static
return $this; */
} public static function create($name = null, $file = null, $url = null)
{
return new static($name, $file, $url);
}
/** /**
* Set the url of the macroblock * Construct a new InstallMacroblock Element
* *
* @param string $url Macroblock url * @api
* @return static * @param string $name (optional) Macroblock name
*/ * @param string $file (optional) Macroblock file
public function setUrl($url) { * @param string $url (optional) Macroblock url
$this->url = (string)$url; */
return $this; public function __construct($name = null, $file = null, $url = null)
} {
if ($name) {
$this->setName($name);
}
if ($file) {
$this->setFile($file);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the macroblock name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the macroblock name
*
* @api
* @param string $name Macroblock name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the macroblock file
*
* @api
* @return string
*/
public function getFile()
{
return $this->file;
}
/**
* Set the macroblock file
*
* @api
* @param string $file Macroblock file
* @return static
*/
public function setFile($file)
{
$this->file = (string)$file;
return $this;
}
/**
* Get the macroblock url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the macroblock url
*
* @api
* @param string $url Macroblock url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("install_macroblock");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$fileElement = $domDocument->createElement("file", $this->file);
$domElement->appendChild($fileElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$fileElement = $domDocument->createElement('file', $this->file);
$xmlElement->appendChild($fileElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
} }

View File

@ -6,74 +6,114 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a map * ManiaCode Element installing a map
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class InstallMap extends Element { class InstallMap implements Element
/* {
* Protected properties
*/
protected $tagName = 'install_map';
protected $name = null;
protected $url = null;
/** /**
* Create a new InstallMap object * @var string $name Map name
* */
* @param string $name (optional) Map name protected $name = null;
* @param string $url (optional) Map url
* @return static
*/
public static function create($name = null, $url = null) {
return new static($name, $url);
}
/** /**
* Construct a new InstallMap object * @var string $url Map url
* */
* @param string $name (optional) Map name protected $url = null;
* @param string $url (optional) Map url
*/
public function __construct($name = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/** /**
* Set the name of the map * Create a new InstallMap Element
* *
* @param string $name Map name * @api
* @return static * @param string $name (optional) Map name
*/ * @param string $url (optional) Map url
public function setName($name) { * @return static
$this->name = (string)$name; */
return $this; public static function create($name = null, $url = null)
} {
return new static($name, $url);
}
/** /**
* Set the url of the map * Construct a new InstallMap Element
* *
* @param string $url Map url * @api
* @return static * @param string $name (optional) Map name
*/ * @param string $url (optional) Map url
public function setUrl($url) { */
$this->url = (string)$url; public function __construct($name = null, $url = null)
return $this; {
} if ($name) {
$this->setName($name);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the map name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the map name
*
* @api
* @param string $name Map name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the map url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the map url
*
* @api
* @param string $url Map url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("install_map");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
} }

View File

@ -6,93 +6,151 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a title pack * ManiaCode Element installing a title pack
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class InstallPack extends Element { class InstallPack implements Element
/* {
* Protected properties
*/
protected $tagName = 'install_pack';
protected $name = null;
protected $file = null;
protected $url = null;
/** /**
* Create a new InstallPack object * @var string $name Pack name
* */
* @param string $name (optional) Pack name protected $name = null;
* @param string $file (optional) Pack file
* @param string $url (optional) Pack url
* @return static
*/
public static function create($name = null, $file = null, $url = null) {
return new static($name, $file, $url);
}
/** /**
* Construct a new InstallPack object * @var string $file Pack file
* */
* @param string $name (optional) Pack name protected $file = null;
* @param string $file (optional) Pack file
* @param string $url (optional) Pack url
*/
public function __construct($name = null, $file = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($file !== null) {
$this->setFile($file);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/** /**
* Set the name of the pack * @var string $url Pack url
* */
* @param string $name Pack name protected $url = null;
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/** /**
* Set the file of the pack * Create a new InstallPack Element
* *
* @param string $file Pack file * @api
* @return static * @param string $name (optional) Pack name
*/ * @param string $file (optional) Pack file
public function setFile($file) { * @param string $url (optional) Pack url
$this->file = (string)$file; * @return static
return $this; */
} public static function create($name = null, $file = null, $url = null)
{
return new static($name, $file, $url);
}
/** /**
* Set the url of the pack * Construct a new InstallPack Element
* *
* @param string $url Pack url * @api
* @return static * @param string $name (optional) Pack name
*/ * @param string $file (optional) Pack file
public function setUrl($url) { * @param string $url (optional) Pack url
$this->url = (string)$url; */
return $this; public function __construct($name = null, $file = null, $url = null)
} {
if ($name) {
$this->setName($name);
}
if ($file) {
$this->setFile($file);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the pack name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the pack name
*
* @api
* @param string $name Pack name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the pack file
*
* @api
* @return string
*/
public function getFile()
{
return $this->file;
}
/**
* Set the pack file
*
* @api
* @param string $file Pack file
* @return static
*/
public function setFile($file)
{
$this->file = (string)$file;
return $this;
}
/**
* Get the pack url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the pack url
*
* @api
* @param string $url Pack url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("install_pack");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$fileElement = $domDocument->createElement("file", $this->file);
$domElement->appendChild($fileElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$fileElement = $domDocument->createElement('file', $this->file);
$xmlElement->appendChild($fileElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
} }

View File

@ -6,74 +6,114 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a replay * ManiaCode Element installing a replay
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class InstallReplay extends Element { class InstallReplay implements Element
/* {
* Protected properties
*/
protected $tagName = 'install_replay';
protected $name = null;
protected $url = null;
/** /**
* Create a new InstallReplay object * @var string $name Replay name
* */
* @param string $name (optional) Replay name protected $name = null;
* @param string $url (optional) Replay url
* @return static
*/
public static function create($name = null, $url = null) {
return new static($name, $url);
}
/** /**
* Construct a new InstallReplay object * @var string $url Replay url
* */
* @param string $name (optional) Replay name protected $url = null;
* @param string $url (optional) Replay url
*/
public function __construct($name = null, $url = null) {
if ($name!== null) {
$this->setName($name);
}
if ($url!== null) {
$this->setUrl($url);
}
}
/** /**
* Set the name of the replay * Create a new InstallReplay Element
* *
* @param string $name Replay name * @api
* @return static * @param string $name (optional) Replay name
*/ * @param string $url (optional) Replay url
public function setName($name) { * @return static
$this->name = (string)$name; */
return $this; public static function create($name = null, $url = null)
} {
return new static($name, $url);
}
/** /**
* Set the url of the replay * Construct a new InstallReplay Element
* *
* @param string $url Replay url * @api
* @return static * @param string $name (optional) Replay name
*/ * @param string $url (optional) Replay url
public function setUrl($url) { */
$this->url = (string)$url; public function __construct($name = null, $url = null)
return $this; {
} if ($name) {
$this->setName($name);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the replay name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the replay name
*
* @api
* @param string $name Replay name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the replay url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the replay url
*
* @api
* @param string $url Replay url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("install_replay");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
} }

View File

@ -6,93 +6,151 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a script * ManiaCode Element installing a script
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class InstallScript extends Element { class InstallScript implements Element
/* {
* Protected properties
*/
protected $tagName = 'install_script';
protected $name = null;
protected $file = null;
protected $url = null;
/** /**
* Create a new InstallScript object * @var string $name Script name
* */
* @param string $name (optional) Script name protected $name = null;
* @param string $file (optional) Script file
* @param string $url (optional) Script url
* @return static
*/
public static function create($name = null, $file = null, $url = null) {
return new static($name, $file, $url);
}
/** /**
* Construct a new InstallScript object * @var string $file Script file
* */
* @param string $name (optional) Script name protected $file = null;
* @param string $file (optional) Script file
* @param string $url (optional) Script url
*/
public function __construct($name = null, $file = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($file !== null) {
$this->setFile($file);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/** /**
* Set the name of the script * @var string $url Script url
* */
* @param string $name Script name protected $url = null;
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/** /**
* Set the file of the script * Create a new InstallScript Element
* *
* @param string $file Script file * @api
* @return static * @param string $name (optional) Script name
*/ * @param string $file (optional) Script file
public function setFile($file) { * @param string $url (optional) Script url
$this->file = (string)$file; * @return static
return $this; */
} public static function create($name = null, $file = null, $url = null)
{
return new static($name, $file, $url);
}
/** /**
* Set the url of the script * Construct a new InstallScript Element
* *
* @param string $url Script url * @api
* @return static * @param string $name (optional) Script name
*/ * @param string $file (optional) Script file
public function setUrl($url) { * @param string $url (optional) Script url
$this->url = (string)$url; */
return $this; public function __construct($name = null, $file = null, $url = null)
} {
if ($name) {
$this->setName($name);
}
if ($file) {
$this->setFile($file);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the script name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the script name
*
* @api
* @param string $name Script name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the script file
*
* @api
* @return string
*/
public function getFile()
{
return $this->file;
}
/**
* Set the script file
*
* @api
* @param string $file Script file
* @return static
*/
public function setFile($file)
{
$this->file = (string)$file;
return $this;
}
/**
* Get the script url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the script url
*
* @api
* @param string $url Script url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("install_script");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$fileElement = $domDocument->createElement("file", $this->file);
$domElement->appendChild($fileElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$fileElement = $domDocument->createElement('file', $this->file);
$xmlElement->appendChild($fileElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
} }

View File

@ -6,93 +6,151 @@ namespace FML\ManiaCode;
* ManiaCode Element installing a skin * ManiaCode Element installing a skin
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class InstallSkin extends Element { class InstallSkin implements Element
/* {
* Protected properties
*/
protected $tagName = 'install_skin';
protected $name = null;
protected $file = null;
protected $url = null;
/** /**
* Create a new InstallSkin object * @var string $name Skin name
* */
* @param string $name (optional) Skin name protected $name = null;
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
* @return static
*/
public static function create($name = null, $file = null, $url = null) {
return new static($name, $file, $url);
}
/** /**
* Construct a new InstallSkin object * @var string $file Skin file
* */
* @param string $name (optional) Skin name protected $file = null;
* @param string $file (optional) Skin file
* @param string $url (optional) Skin url
*/
public function __construct($name = null, $file = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($file !== null) {
$this->setFile($file);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/** /**
* Set the name of the skin * @var string $url Skin url
* */
* @param string $name Skin name protected $url = null;
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/** /**
* Set the file of the skin * Create a new InstallSkin Element
* *
* @param string $file Skin file * @api
* @return static * @param string $name (optional) Skin name
*/ * @param string $file (optional) Skin file
public function setFile($file) { * @param string $url (optional) Skin url
$this->file = (string)$file; * @return static
return $this; */
} public static function create($name = null, $file = null, $url = null)
{
return new static($name, $file, $url);
}
/** /**
* Set the url of the skin * Construct a new InstallSkin Element
* *
* @param string $url Skin url * @api
* @return static * @param string $name (optional) Skin name
*/ * @param string $file (optional) Skin file
public function setUrl($url) { * @param string $url (optional) Skin url
$this->url = (string)$url; */
return $this; public function __construct($name = null, $file = null, $url = null)
} {
if ($name) {
$this->setName($name);
}
if ($file) {
$this->setFile($file);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the skin name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the skin name
*
* @api
* @param string $name Skin name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the skin file
*
* @api
* @return string
*/
public function getFile()
{
return $this->file;
}
/**
* Set the skin file
*
* @api
* @param string $file Skin file
* @return static
*/
public function setFile($file)
{
$this->file = (string)$file;
return $this;
}
/**
* Get the skin url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the skin url
*
* @api
* @param string $url Skin url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("install_skin");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$fileElement = $domDocument->createElement("file", $this->file);
$domElement->appendChild($fileElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$fileElement = $domDocument->createElement('file', $this->file);
$xmlElement->appendChild($fileElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
} }

View File

@ -6,78 +6,150 @@ namespace FML\ManiaCode;
* ManiaCode Element for joining a server * ManiaCode Element for joining a server
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class JoinServer extends Element { class JoinServer implements Element
/* {
* Protected properties
*/
protected $tagName = 'join_server';
protected $login = null;
protected $serverIp = null;
protected $serverPort = null;
/** /**
* Create a new JoinServer object * @var string $login Server login
* */
* @param string $login (optional) Server login protected $login = null;
* @return static
*/
public static function create($login = null) {
return new static($login);
}
/** /**
* Construct a new JoinServer object * @var string $ip Server ip
* */
* @param string $login (optional) Server login protected $ip = null;
*/
public function __construct($login = null) {
if ($login !== null) {
$this->setLogin($login);
}
}
/** /**
* Set the server login * @var int $port Server port
* */
* @param string $login Server login protected $port = null;
* @return static
*/
public function setLogin($login) {
$this->login = (string)$login;
$this->serverIp = null;
$this->serverPort = null;
return $this;
}
/** /**
* Set the server ip and port * Create a new JoinServer Element
* *
* @param string $serverIp Server ip * @api
* @param int $serverPort Server port * @param string $loginOrIp (optional) Server login or ip
* @return static * @param int $port (optional) Server port
*/ * @return static
public function setIp($serverIp, $serverPort) { */
$this->serverIp = (string)$serverIp; public static function create($loginOrIp = null, $port = null)
$this->serverPort = (int)$serverPort; {
$this->login = null; return new static($loginOrIp, $port);
return $this; }
}
/**
* Construct a new JoinServer Element
*
* @api
* @param string $loginOrIp (optional) Server login or ip
* @param int $port (optional) Server port
*/
public function __construct($loginOrIp = null, $port = null)
{
if ($port) {
$this->setIp($loginOrIp, $port);
} elseif ($loginOrIp) {
$this->setLogin($loginOrIp);
}
}
/**
* Get the server login
*
* @api
* @return string
*/
public function getLogin()
{
return $this->login;
}
/**
* Set the server login
*
* @api
* @param string $login Server login
* @return static
*/
public function setLogin($login)
{
$this->login = (string)$login;
$this->ip = null;
$this->port = null;
return $this;
}
/**
* Get the server ip
*
* @api
* @return string
*/
public function getIp()
{
return $this->ip;
}
/**
* Set the server ip and port
*
* @api
* @param string $ip Server ip
* @param int $port (optional) Server port
* @return static
*/
public function setIp($ip, $port = null)
{
$this->login = null;
$this->ip = (string)$ip;
if ($port) {
$this->setPort($port);
}
return $this;
}
/**
* Get the server port
*
* @api
* @return int
*/
public function getPort()
{
return $this->port;
}
/**
* Set the server port
*
* @param int $port Server port
* @return static
*/
public function setPort($port)
{
$this->port = (int)$port;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("join_server");
if ($this->login) {
$loginElement = $domDocument->createElement("login", $this->login);
$domElement->appendChild($loginElement);
} else {
$ipElement = $domDocument->createElement("ip", $this->ip . ":" . $this->port);
$domElement->appendChild($ipElement);
}
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
if ($this->serverIp === null) {
$loginElement = $domDocument->createElement('login', $this->login);
$xmlElement->appendChild($loginElement);
} else {
$ipElement = $domDocument->createElement('ip', $this->serverIp . ':' . $this->serverPort);
$xmlElement->appendChild($ipElement);
}
return $xmlElement;
}
} }

View File

@ -6,74 +6,114 @@ namespace FML\ManiaCode;
* ManiaCode Element for playing a map * ManiaCode Element for playing a map
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class PlayMap extends Element { class PlayMap implements Element
/* {
* Protected properties
*/
protected $tagName = 'play_map';
protected $name = null;
protected $url = null;
/** /*+
* Create a new PlayMap object * @var string $name Map name
* */
* @param string $name (optional) Map name protected $name = null;
* @param string $url (optional) Map url
* @return static
*/
public static function create($name = null, $url = null) {
return new static($name, $url);
}
/** /**
* Construct a new PlayMap object * @var string $url Map url
* */
* @param string $name (optional) Map name protected $url = null;
* @param string $url (optional) Map url
*/
public function __construct($name = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/** /**
* Set the name of the map * Create a new PlayMap Element
* *
* @param string $name Map name * @api
* @return static * @param string $name (optional) Map name
*/ * @param string $url (optional) Map url
public function setName($name) { * @return static
$this->name = (string)$name; */
return $this; public static function create($name = null, $url = null)
} {
return new static($name, $url);
}
/** /**
* Set the url of the map * Construct a new PlayMap Element
* *
* @param string $url Map url * @api
* @return static * @param string $name (optional) Map name
*/ * @param string $url (optional) Map url
public function setUrl($url) { */
$this->url = (string)$url; public function __construct($name = null, $url = null)
return $this; {
} if ($name) {
$this->setName($name);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the map name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the map name
*
* @api
* @param string $name Map name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the map url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the map url
*
* @api
* @param string $url Map url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("play_map");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
} }

View File

@ -6,74 +6,114 @@ namespace FML\ManiaCode;
* ManiaCode Element playing a replay * ManiaCode Element playing a replay
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class PlayReplay extends Element { class PlayReplay implements Element
/* {
* Protected properties
*/
protected $tagName = 'play_replay';
protected $name = null;
protected $url = null;
/** /**
* Create a new PlayReplay object * @var string $name Replay name
* */
* @param string $name (optional) Replay name protected $name = null;
* @param string $url (optional) Replay url
* @return static
*/
public static function create($name = null, $url = null) {
return new static($name, $url);
}
/** /**
* Construct a new PlayReplay object * @var string $url Replay url
* */
* @param string $name (optional) Replay name protected $url = null;
* @param string $url (optional) Replay url
*/
public function __construct($name = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/** /**
* Set the name of the replay * Create a new PlayReplay Element
* *
* @param string $name Replay name * @api
* @return static * @param string $name (optional) Replay name
*/ * @param string $url (optional) Replay url
public function setName($name) { * @return static
$this->name = (string)$name; */
return $this; public static function create($name = null, $url = null)
} {
return new static($name, $url);
}
/** /**
* Set the url of the replay * Construct a new PlayReplay Element
* *
* @param string $url Replay url * @api
* @return static * @param string $name (optional) Replay name
*/ * @param string $url (optional) Replay url
public function setUrl($url) { */
$this->url = (string)$url; public function __construct($name = null, $url = null)
return $this; {
} if ($name) {
$this->setName($name);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the replay name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the replay name
*
* @api
* @param string $name Replay name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the replay url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the replay url
*
* @api
* @param string $url Replay url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("play_replay");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
} }

View File

@ -6,55 +6,77 @@ namespace FML\ManiaCode;
* ManiaCode Element showing a Message * ManiaCode Element showing a Message
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ShowMessage extends Element { class ShowMessage implements Element
/* {
* Protected properties
*/
protected $tagName = 'show_message';
protected $message = null;
/** /**
* Create a new ShowMessage object * @var string $message Message text
* */
* @param string $message (optional) Message text protected $message = null;
* @return static
*/
public static function create($message = null) {
return new static($message);
}
/** /**
* Construct a new ShowMessage object * Create a new ShowMessage Element
* *
* @param string $message (optional) Message text * @api
*/ * @param string $message (optional) Message text
public function __construct($message = null) { * @return static
if ($message !== null) { */
$this->setMessage($message); public static function create($message = null)
} {
} return new static($message);
}
/** /**
* Set the message text * Construct a new ShowMessage Element
* *
* @param string $message Message text * @api
* @return static * @param string $message (optional) Message text
*/ */
public function setMessage($message) { public function __construct($message = null)
$this->message = (string)$message; {
return $this; if ($message) {
} $this->setMessage($message);
}
}
/**
* Get the message text
*
* @api
* @return string
*/
public function getMessage()
{
return $this->message;
}
/**
* Set the message text
*
* @api
* @param string $message Message text
* @return static
*/
public function setMessage($message)
{
$this->message = (string)$message;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("show_message");
$messageElement = $domDocument->createElement("message", $this->message);
$domElement->appendChild($messageElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$messageElement = $domDocument->createElement('message', $this->message);
$xmlElement->appendChild($messageElement);
return $xmlElement;
}
} }

View File

@ -6,74 +6,114 @@ namespace FML\ManiaCode;
* ManiaCode Element for viewing a replay * ManiaCode Element for viewing a replay
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ViewReplay extends Element { class ViewReplay implements Element
/* {
* Protected properties
*/
protected $tagName = 'view_replay';
protected $name = null;
protected $url = null;
/** /**
* Create a new ViewReplay object * @var string $name Replay name
* */
* @param string $name (optional) Replay name protected $name = null;
* @param string $url (optional) Replay url
* @return static
*/
public static function create($name = null, $url = null) {
return new static($name, $url);
}
/** /**
* Construct a new ViewReplay object * @var string $url Replay url
* */
* @param string $name (optional) Replay name protected $url = null;
* @param string $url (optional) Replay url
*/
public function __construct($name = null, $url = null) {
if ($name !== null) {
$this->setName($name);
}
if ($url !== null) {
$this->setUrl($url);
}
}
/** /**
* Set the name of the replay * Create a new ViewReplay Element
* *
* @param string $name Replay name * @api
* @return static * @param string $name (optional) Replay name
*/ * @param string $url (optional) Replay url
public function setName($name) { * @return static
$this->name = (string)$name; */
return $this; public static function create($name = null, $url = null)
} {
return new static($name, $url);
}
/** /**
* Set the url of the replay * Construct a new ViewReplay Element
* *
* @param string $url Replay url * @api
* @return static * @param string $name (optional) Replay name
*/ * @param string $url (optional) Replay url
public function setUrl($url) { */
$this->url = (string)$url; public function __construct($name = null, $url = null)
return $this; {
} if ($name) {
$this->setName($name);
}
if ($url) {
$this->setUrl($url);
}
}
/**
* Get the replay name
*
* @api
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the replay name
*
* @api
* @param string $name Replay name
* @return static
*/
public function setName($name)
{
$this->name = (string)$name;
return $this;
}
/**
* Get the replay url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the replay url
*
* @api
* @param string $url Replay url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see Element::render()
*/
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("view_replay");
$nameElement = $domDocument->createElement("name", $this->name);
$domElement->appendChild($nameElement);
$urlElement = $domDocument->createElement("url", $this->url);
$domElement->appendChild($urlElement);
return $domElement;
}
/**
* @see \FML\ManiaCode\Element::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
$nameElement = $domDocument->createElement('name', $this->name);
$xmlElement->appendChild($nameElement);
$urlElement = $domDocument->createElement('url', $this->url);
$xmlElement->appendChild($urlElement);
return $xmlElement;
}
} }

View File

@ -12,317 +12,522 @@ use FML\Types\ScriptFeatureable;
* Class representing a ManiaLink * Class representing a ManiaLink
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ManiaLink { class ManiaLink
/* {
* Constants
*/
const BACKGROUND_0 = '0';
const BACKGROUND_1 = '1';
const BACKGROUND_STARS = 'stars';
const BACKGROUND_STATIONS = 'stations';
const BACKGROUND_TITLE = 'title';
/* /*
* Protected properties * Constants
*/ */
protected $encoding = 'utf-8'; const MANIALINK_VERSION = 3;
protected $tagName = 'manialink'; const BACKGROUND_0 = "0";
protected $maniaLinkId = null; const BACKGROUND_1 = "1";
protected $version = 1; const BACKGROUND_STARS = "stars";
protected $background = null; const BACKGROUND_STATIONS = "stations";
protected $navigable3d = 1; const BACKGROUND_TITLE = "title";
protected $name = null;
protected $timeout = 0;
/** @var Renderable[] $children */
protected $children = array();
/** @var Dico $dico */
protected $dico = null;
/** @var Stylesheet $stylesheet */
protected $stylesheet = null;
/** @var Script $script */
protected $script = null;
/** /**
* Create a new ManiaLink object * @var string $maniaLinkId ManiaLink ID
* */
* @param string $maniaLinkId (optional) ManiaLink id protected $maniaLinkId = null;
* @param string $maniaLinkName (optional) ManiaLink Name
* @return static
*/
public static function create($maniaLinkId = null, $maniaLinkName = null) {
return new static($maniaLinkId, $maniaLinkName);
}
/** /**
* Construct a new ManiaLink object * @var int $version ManiaLink version
* */
* @param string $maniaLinkId (optional) ManiaLink id protected $version = 1;
* @param string $maniaLinkName (optional) ManiaLink Name
*/
public function __construct($maniaLinkId = null, $maniaLinkName = null) {
if ($maniaLinkId !== null) {
$this->setId($maniaLinkId);
}
if ($maniaLinkName !== false) {
if ($maniaLinkName) {
$this->setName($maniaLinkName);
} else {
$this->setName($maniaLinkId);
}
}
}
/** /**
* Set XML encoding * @var string $name ManiaLink name
* */
* @param string $encoding XML encoding protected $name = null;
* @return static
*/
public function setXmlEncoding($encoding) {
$this->encoding = (string)$encoding;
return $this;
}
/** /**
* Set ManiaLink id * @var string $background Background
* */
* @param string $maniaLinkId ManiaLink id protected $background = null;
* @return static
*/
public function setId($maniaLinkId) {
$this->maniaLinkId = (string)$maniaLinkId;
return $this;
}
/** /**
* Get ManiaLink id * @var bool $navigable3d 3d navigable
* */
* @return string protected $navigable3d = true;
*/
public function getId() {
return $this->maniaLinkId;
}
/** /**
* Set background * @var int $timeout Timeout
* */
* @param string $background Background value protected $timeout = null;
* @return static
*/
public function setBackground($background) {
$this->background = (string)$background;
return $this;
}
/** /**
* Set navigable3d * @var Renderable[] $children Children
* */
* @param bool $navigable3d Whether the manialink should be 3d navigable protected $children = array();
* @return static
*/
public function setNavigable3d($navigable3d) {
$this->navigable3d = ($navigable3d ? 1 : 0);
return $this;
}
/** /**
* Set the ManiaLink Name * @var Dico $dico Dictionary
* */
* @param string $name protected $dico = null;
* @return static
*/
public function setName($name) {
$this->name = (string)$name;
return $this;
}
/** /**
* Set timeout * @var Stylesheet $stylesheet Style sheet
* */
* @param int $timeout Timeout duration protected $stylesheet = null;
* @return static
*/
public function setTimeout($timeout) {
$this->timeout = (int)$timeout;
return $this;
}
/** /**
* Add an element to the ManiaLink * @var Script $script Script
* */
* @param Renderable $child Child element to add protected $script = null;
* @return static
*/
public function add(Renderable $child) {
if (!in_array($child, $this->children, true)) {
array_push($this->children, $child);
}
return $this;
}
/** /**
* Remove all elements from the ManiaLink * Create a new ManiaLink
* *
* @return static * @api
*/ * @param string $maniaLinkId (optional) ManiaLink ID
public function removeChildren() { * @param int $version (optional) Version
$this->children = array(); * @param string $name (optional) Name
return $this; * @param Renderable[] $children (optional) Children
} * @return static
*/
public static function create($maniaLinkId = null, $version = null, $name = null, array $children = null)
{
return new static($maniaLinkId, $version, $name, $children);
}
/** /**
* Set the Dictionary of the ManiaLink * Construct a new ManiaLink
* *
* @param Dico $dico Dictionary for the ManiaLink * @api
* @return static * @param string $maniaLinkId (optional) ManiaLink ID
*/ * @param int $version (optional) Version
public function setDico(Dico $dico) { * @param string $name (optional) Name
$this->dico = $dico; * @param Renderable[] $children (optional) Children
return $this; */
} public function __construct($maniaLinkId = null, $version = null, $name = null, array $children = null)
{
if (is_string($version)) {
// backwards-compatibility (version has been introduced later)
$children = $name;
$name = $version;
$version = null;
}
if ($maniaLinkId) {
$this->setId($maniaLinkId);
}
$this->setVersion(self::MANIALINK_VERSION);
if ($version) {
$this->setVersion($version);
}
if ($name) {
$this->setName($name);
}
if ($children) {
$this->setChildren($children);
}
$this->createScript();
}
/** /**
* Get the Dictionary of the ManiaLink * Get the ID
* *
* @param bool $createIfEmpty (optional) Whether the Dico object should be created if it's not set * @api
* @return \FML\Elements\Dico * @return string
*/ */
public function getDico($createIfEmpty = true) { public function getId()
if (!$this->dico && $createIfEmpty) { {
$this->setDico(new Dico()); return $this->maniaLinkId;
} }
return $this->dico;
}
/** /**
* Set the Stylesheet of the ManiaLink * Set the ID
* *
* @param Stylesheet $stylesheet Stylesheet for the ManiaLink * @api
* @return static * @param string $maniaLinkId ManiaLink ID
*/ * @return static
public function setStylesheet(Stylesheet $stylesheet) { */
$this->stylesheet = $stylesheet; public function setId($maniaLinkId)
return $this; {
} $this->maniaLinkId = (string)$maniaLinkId;
if ($this->maniaLinkId && !$this->name) {
$this->setName($this->maniaLinkId);
}
return $this;
}
/** /**
* Get the Stylesheet of the ManiaLink * Get the version
* *
* @param bool $createIfEmpty (optional) Whether the Stylesheet object should be created if it's not set * @api
* @return \FML\Stylesheet\Stylesheet * @return int
*/ */
public function getStylesheet($createIfEmpty = true) { public function getVersion()
if (!$this->stylesheet && $createIfEmpty) { {
$this->setStylesheet(new Stylesheet()); return $this->version;
} }
return $this->stylesheet;
}
/** /**
* Set the Script of the ManiaLink * Set the version
* *
* @param Script $script Script for the ManiaLink * @api
* @return static * @param int $version ManiaLink version
*/ * @return static
public function setScript(Script $script) { */
$this->script = $script; public function setVersion($version)
return $this; {
} $this->version = (int)$version;
return $this;
}
/** /**
* Get the current Script of the ManiaLink * Get the name
* *
* @param bool $createIfEmpty (optional) Whether the Script object should be created if it's not set * @api
* @return \FML\Script\Script * @return string
*/ */
public function getScript($createIfEmpty = true) { public function getName()
if (!$this->script && $createIfEmpty) { {
$this->setScript(new Script()); return $this->name;
} }
return $this->script;
}
/** /**
* Render the XML document * Set the name
* *
* @param bool $echo (optional) If the XML text should be echoed and the Content-Type header should be set * @api
* @param \DOMDocument $domDocument (optional) DOMDocument for which the XML element should be created * @param string $name ManiaLink Name
* @return \DOMDocument * @return static
*/ */
public function render($echo = false, $domDocument = null) { public function setName($name)
$isChild = (bool)$domDocument; {
if (!$isChild) { $this->name = (string)$name;
$domDocument = new \DOMDocument('1.0', $this->encoding); return $this;
$domDocument->xmlStandalone = true; }
}
$maniaLink = $domDocument->createElement($this->tagName); /**
if (!$isChild) { * Get the background
$domDocument->appendChild($maniaLink); *
} * @api
if (strlen($this->maniaLinkId) > 0) { * @return string
$maniaLink->setAttribute('id', $this->maniaLinkId); */
} public function getBackground()
if ($this->version) { {
$maniaLink->setAttribute('version', $this->version); return $this->background;
} }
if (strlen($this->background) > 0) {
$maniaLink->setAttribute('background', $this->background); /**
} * Set the background
if (!$this->navigable3d) { *
$maniaLink->setAttribute('navigable3d', $this->navigable3d); * @api
} * @param string $background Background value
if ($this->name) { * @return static
$maniaLink->setAttribute('name', $this->name); */
} public function setBackground($background)
if ($this->timeout) { {
$timeoutXml = $domDocument->createElement('timeout', $this->timeout); $this->background = (string)$background;
$maniaLink->appendChild($timeoutXml); return $this;
} }
if ($this->dico) {
$dicoXml = $this->dico->render($domDocument); /**
$maniaLink->appendChild($dicoXml); * Get navigable3d
} *
$scriptFeatures = array(); * @api
foreach ($this->children as $child) { * @return bool
$childXml = $child->render($domDocument, $this->getScript()); */
$maniaLink->appendChild($childXml); public function getNavigable3d()
if ($child instanceof ScriptFeatureable) { {
$scriptFeatures = array_merge($scriptFeatures, $child->getScriptFeatures()); return $this->navigable3d;
} }
}
if ($scriptFeatures) { /**
$this->getScript()->loadFeatures($scriptFeatures); * Set navigable3d
} *
if ($this->stylesheet) { * @api
$stylesheetXml = $this->stylesheet->render($domDocument); * @param bool $navigable3d If the ManiaLink should be 3d navigable
$maniaLink->appendChild($stylesheetXml); * @return static
} */
if ($this->script) { public function setNavigable3d($navigable3d)
if ($this->script->needsRendering()) { {
$scriptXml = $this->script->render($domDocument); $this->navigable3d = (bool)$navigable3d;
$maniaLink->appendChild($scriptXml); return $this;
} }
$this->script->resetGenericScriptLabels();
} /**
if ($isChild) { * Get the timeout
return $maniaLink; *
} * @api
if ($echo) { * @return int
header('Content-Type: application/xml; charset=utf-8;'); */
echo $domDocument->saveXML(); public function getTimeout()
} {
return $domDocument; return $this->timeout;
} }
/**
* Set the timeout
*
* @api
* @param int $timeout Timeout duration
* @return static
*/
public function setTimeout($timeout)
{
$this->timeout = (int)$timeout;
return $this;
}
/**
* Get children
*
* @api
* @return Renderable[]
*/
public function getChildren()
{
return $this->children;
}
/**
* Add a child
*
* @api
* @param Renderable $child Child Element to add
* @return static
* @deprecated use addChild() instead
*/
public function add(Renderable $child)
{
return $this->addChild($child);
}
/**
* Add a child
*
* @api
* @param Renderable $child Child Element to add
* @return static
*/
public function addChild(Renderable $child)
{
if (!in_array($child, $this->children, true)) {
array_push($this->children, $child);
}
return $this;
}
/**
* Set children
*
* @api
* @param Renderable[] $children Child Elements
* @return static
*/
public function setChildren(array $children)
{
$this->children = array();
foreach ($children as $child) {
$this->addChild($child);
}
return $this;
}
/**
* Remove all children
*
* @api
* @return static
* @deprecated use removeAllChildren() instead
*/
public function removeChildren()
{
return $this->removeAllChildren();
}
/**
* Remove all children
*
* @api
* @return static
*/
public function removeAllChildren()
{
$this->children = array();
return $this;
}
/**
* Get the Dictionary
*
* @api
* @return Dico
*/
public function getDico()
{
return $this->dico;
}
/**
* Set the Dictionary
*
* @api
* @param Dico $dico Dictionary
* @return static
*/
public function setDico(Dico $dico = null)
{
$this->dico = $dico;
return $this;
}
/**
* Get the Stylesheet
*
* @api
* @return Stylesheet
*/
public function getStylesheet()
{
return $this->stylesheet;
}
/**
* Set the Stylesheet
*
* @api
* @param Stylesheet $stylesheet Stylesheet
* @return static
*/
public function setStylesheet(Stylesheet $stylesheet = null)
{
$this->stylesheet = $stylesheet;
return $this;
}
/**
* Get the Script
*
* @api
* @return Script
*/
public function getScript()
{
return $this->script;
}
/**
* Set the Script
*
* @api
* @param Script $script Script
* @return static
*/
public function setScript(Script $script = null)
{
$this->script = $script;
return $this;
}
/**
* Create and assign a new Script if necessary
*
* @api
* @return Script
*/
public function createScript()
{
if ($this->script) {
return $this->script;
}
$script = new Script();
$this->setScript($script);
return $this->script;
}
/**
* Render the ManiaLink
*
* @param bool $echo (optional) If the XML text should be echoed and the Content-Type header should be set
* @param \DOMDocument $domDocument (optional) DOMDocument for which the ManiaLink should be rendered
* @return \DOMDocument
*/
public function render($echo = false, $domDocument = null)
{
$isChild = (bool)$domDocument;
if (!$isChild) {
$domDocument = new \DOMDocument("1.0", "utf-8");
$domDocument->xmlStandalone = true;
}
$maniaLink = $domDocument->createElement("manialink");
if (!$isChild) {
$domDocument->appendChild($maniaLink);
}
if ($this->maniaLinkId) {
$maniaLink->setAttribute("id", $this->maniaLinkId);
}
if ($this->version > 0) {
$maniaLink->setAttribute("version", $this->version);
}
if ($this->name) {
$maniaLink->setAttribute("name", $this->name);
}
if ($this->background) {
$maniaLink->setAttribute("background", $this->background);
}
if (!$this->navigable3d) {
$maniaLink->setAttribute("navigable3d", "0");
}
if ($this->timeout) {
$timeoutXml = $domDocument->createElement("timeout", $this->timeout);
$maniaLink->appendChild($timeoutXml);
}
if ($this->dico) {
$dicoXml = $this->dico->render($domDocument);
$maniaLink->appendChild($dicoXml);
}
$scriptFeatures = array();
foreach ($this->children as $child) {
$childXml = $child->render($domDocument);
$maniaLink->appendChild($childXml);
if ($child instanceof ScriptFeatureable) {
$scriptFeatures = array_merge($scriptFeatures, $child->getScriptFeatures());
}
}
if ($this->stylesheet) {
$stylesheetXml = $this->stylesheet->render($domDocument);
$maniaLink->appendChild($stylesheetXml);
}
if ($scriptFeatures) {
$this->createScript()
->loadFeatures($scriptFeatures);
}
if ($this->script) {
if ($this->script->needsRendering()) {
$scriptXml = $this->script->render($domDocument);
$maniaLink->appendChild($scriptXml);
}
$this->script->resetGenericScriptLabels();
}
if ($isChild) {
return $maniaLink;
}
if ($echo) {
header("Content-Type: application/xml; charset=utf-8;");
echo $domDocument->saveXML();
}
return $domDocument;
}
/**
* Get the string representation
*
* @return string
*/
public function __toString()
{
return $this->render()
->saveXML();
}
/**
* Get string representation
*
* @return string
*/
public function __toString() {
return $this->render()->saveXML();
}
} }

View File

@ -6,119 +6,190 @@ namespace FML;
* Class holding several ManiaLinks at once * Class holding several ManiaLinks at once
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ManiaLinks { class ManiaLinks
/* {
* Protected Properties
*/
protected $encoding = 'utf-8';
protected $tagName = 'manialinks';
/** @var ManiaLink[] $children */
protected $children = array();
/** @var CustomUI $customUI */
protected $customUI = null;
/** /**
* Create a new ManiaLinks object * @var ManiaLink[] $children ManiaLinks children
* */
* @return static protected $children = array();
*/
public static function create() {
return new static();
}
/** /**
* Set XML encoding * @var CustomUI $customUI Custom UI
* */
* @param string $encoding XML encoding protected $customUI = null;
* @return static
*/
public function setXmlEncoding($encoding) {
$this->encoding = (string)$encoding;
return $this;
}
/** /**
* Add a child ManiaLink * Create a new ManiaLinks object
* *
* @param ManiaLink $child Child ManiaLink * @api
* @return static * @param ManiaLink[] $children ManiaLink children
*/ * @return static
public function add(ManiaLink $child) { */
if (!in_array($child, $this->children, true)) { public static function create(array $children = null)
array_push($this->children, $child); {
} return new static($children);
return $this; }
}
/** /**
* Remove all child ManiaLinks * Construct a new ManiaLinks object
* *
* @return static * @api
*/ * @param ManiaLink[] $children ManiaLink children
public function removeChildren() { */
$this->children = array(); public function __construct(array $children = null)
return $this; {
} if ($children) {
$this->setChildren($children);
}
}
/** /**
* Set the CustomUI * Get all child ManiaLinks
* *
* @param CustomUI $customUI CustomUI object * @api
* @return static * @return ManiaLink[]
*/ */
public function setCustomUI(CustomUI $customUI) { public function getChildren()
$this->customUI = $customUI; {
return $this; return $this->children;
} }
/** /**
* Get the CustomUI * Add a child ManiaLink
* *
* @param bool $createIfEmpty (optional) Whether the CustomUI object should be created if it's not set * @api
* @return \FML\CustomUI * @param ManiaLink $child Child ManiaLink
*/ * @return static
public function getCustomUI($createIfEmpty = true) { * @deprecated use addChild() instead
if (!$this->customUI && $createIfEmpty) { */
$this->setCustomUI(new CustomUI()); public function add(ManiaLink $child)
} {
return $this->customUI; return $this->addChild($child);
} }
/** /**
* Render the XML document * Add a child ManiaLink
* *
* @param bool (optional) $echo Whether the XML text should be echoed and the Content-Type header should be set * @api
* @return \DOMDocument * @param ManiaLink $child Child ManiaLink
*/ * @return static
public function render($echo = false) { */
$domDocument = new \DOMDocument('1.0', $this->encoding); public function addChild(ManiaLink $child)
$domDocument->xmlStandalone = true; {
$maniaLinks = $domDocument->createElement($this->tagName); if (!in_array($child, $this->children, true)) {
$domDocument->appendChild($maniaLinks); array_push($this->children, $child);
foreach ($this->children as $child) { }
$childXml = $child->render(false, $domDocument); return $this;
$maniaLinks->appendChild($childXml); }
}
if ($this->customUI) { /**
$customUIXml = $this->customUI->render($domDocument); * Set ManiaLink children
$maniaLinks->appendChild($customUIXml); *
} * @api
if ($echo) { * @param ManiaLink[] $children ManiaLink children
header('Content-Type: application/xml; charset=utf-8;'); * @return static
echo $domDocument->saveXML(); */
} public function setChildren(array $children)
return $domDocument; {
} $this->children = array();
foreach ($children as $child) {
$this->addChild($child);
}
return $this;
}
/**
* Remove all child ManiaLinks
*
* @api
* @return static
* @deprecated use removeAllChildren instead
*/
public function removeChildren()
{
return $this->removeAllChildren();
}
/**
* Remove all child ManiaLinks
*
* @api
* @return static
*/
public function removeAllChildren()
{
$this->children = array();
return $this;
}
/**
* Get the CustomUI
*
* @api
* @return CustomUI
*/
public function getCustomUI()
{
return $this->customUI;
}
/**
* Set the CustomUI
*
* @api
* @param CustomUI $customUI CustomUI object
* @return static
*/
public function setCustomUI(CustomUI $customUI = null)
{
$this->customUI = $customUI;
return $this;
}
/**
* Render the ManiaLinks object
*
* @param bool (optional) $echo If the XML text should be echoed and the Content-Type header should be set
* @return \DOMDocument
*/
public function render($echo = false)
{
$domDocument = new \DOMDocument("1.0", "utf-8");
$domDocument->xmlStandalone = true;
$maniaLinks = $domDocument->createElement("manialinks");
$domDocument->appendChild($maniaLinks);
foreach ($this->children as $child) {
$childXml = $child->render(false, $domDocument);
$maniaLinks->appendChild($childXml);
}
if ($this->customUI) {
$customUIElement = $this->customUI->render($domDocument);
$maniaLinks->appendChild($customUIElement);
}
if ($echo) {
header("Content-Type: application/xml; charset=utf-8;");
echo $domDocument->saveXML();
}
return $domDocument;
}
/**
* Get string representation
*
* @return string
*/
public function __toString()
{
return $this->render()
->saveXML();
}
/**
* Get string representation
*
* @return string
*/
public function __toString() {
return $this->render()->saveXML();
}
} }

View File

@ -1,129 +0,0 @@
<?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 <mail@steeffeen.com>
* @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 static
*/
public static function defaultEnabledDesign() {
return new static(Quad_Icons64x64_1::STYLE, Quad_Icons64x64_1::SUBSTYLE_Check);
}
/**
* Create the default disabled Design
*
* @return static
*/
public static function defaultDisabledDesign() {
return new static(Quad_Icons64x64_1::STYLE, Quad_Icons64x64_1::SUBSTYLE_Check);
}
/**
* Construct a new CheckBox Design object
*
* @param string $style Style name or image url
* @param string $subStyle (optional) 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 static
*/
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 static
*/
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
* @param bool $addApostrophes (optional) Whether to add apostrophes before and after the text
* @return string
*/
public function getDesignString($escaped = true, $addApostrophes = true) {
if ($this->url !== null) {
$string = $this->url;
} else {
$string = $this->style . '|' . $this->subStyle;;
}
if ($escaped) {
return Builder::escapeText($string, $addApostrophes);
}
return $string;
}
}

View File

@ -2,149 +2,222 @@
namespace FML\Script; namespace FML\Script;
use FML\Types\Identifiable;
/** /**
* ManiaScript Builder class * ManiaScript Builder class
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
abstract class Builder { abstract class Builder
/* {
* Constants
*/
const EMPTY_STRING = '""';
/** /*
* Build a label implementation block * Constants
* */
* @param string $labelName Name of the label const EMPTY_STRING = '""';
* @param string $implementationCode Label implementation coding (without declaration)
* @param bool $isolate Whether the code should be isolated in an own block
* @return string
*/
public static function getLabelImplementationBlock($labelName, $implementationCode, $isolate = true) {
if ($isolate) {
$implementationCode = 'if(True){' . $implementationCode . '}';
}
$labelText = PHP_EOL . "***{$labelName}***" . PHP_EOL . "***{$implementationCode}***" . PHP_EOL;
return $labelText;
}
/** /**
* Escape dangerous characters in the given text * Build a script label implementation block
* *
* @param string $text Text to escape * @api
* @param bool $addApostrophes (optional) Whether to add apostrophes before and after the text * @param string $labelName Name of the label
* @return string * @param string $implementationCode Label implementation coding (without declaration)
*/ * @param bool $isolate (optional) If the code should be isolated in an own block
public static function escapeText($text, $addApostrophes = false) { * @return string
$dangers = array('\\', '"', "\n"); */
$replacements = array('\\\\', '\\"', '\\n'); public static function getLabelImplementationBlock($labelName, $implementationCode, $isolate = true)
$escapedText = str_ireplace($dangers, $replacements, $text); {
if ($addApostrophes) { if ($isolate) {
$escapedText = '"' . $escapedText . '"'; $implementationCode = "if(True){{$implementationCode}}";
} }
return $escapedText; return "
} ***{$labelName}***
***{$implementationCode}***
";
}
/** /**
* Get the 'Real' string representation of the given value * Escape dangerous characters in the given text
* *
* @param float $value Float value to convert to a ManiaScript 'Real' * @api
* @return string * @param string $text Text to escape
*/ * @param bool $addApostrophes (optional) Add apostrophes before and after the text
public static function getReal($value) { * @return string
$value = (float)$value; */
$stringVal = (string)$value; public static function escapeText($text, $addApostrophes = true)
if (!fmod($value, 1)) { {
$stringVal .= '.'; $dangers = array('\\', '"', "\n");
} $replacements = array('\\\\', '\\"', '\\n');
return $stringVal; $escapedText = str_ireplace($dangers, $replacements, $text);
} if ($addApostrophes) {
$escapedText = '"' . $escapedText . '"';
}
return $escapedText;
}
/** /**
* Get the 'Boolean' string representation of the given value * Get the escaped Id of the given Element
* *
* @param bool $value Value to convert to a ManiaScript 'Boolean' * @param Identifiable $element Element
* @return string * @return string
*/ */
public static function getBoolean($value) { public static function getId(Identifiable $element)
$bool = (bool)$value; {
if ($bool) { return static::escapeText($element->getId(), false);
return 'True'; }
}
return 'False';
}
/** /**
* Get the string representation of the given array * Get the 'Real' string representation of the given value
* *
* @param array $array Array to convert to a ManiaScript array * @api
* @param bool $associative (optional) Whether the array should be associative * @param float $value Float value to convert to a ManiaScript 'Real'
* @return string * @return string
*/ */
public static function getArray(array $array, $associative = false) { public static function getReal($value)
$arrayText = '['; {
$index = 0; $value = (float)$value;
$count = count($array); $stringVal = (string)$value;
foreach ($array as $key => $value) { if (!fmod($value, 1)) {
if ($associative) { $stringVal .= ".";
if (is_string($key)) { }
$arrayText .= '"' . static::escapeText($key) . '"'; return $stringVal;
} else { }
$arrayText .= $key;
}
$arrayText .= ' => ';
}
if (is_string($value)) {
$arrayText .= '"' . static::escapeText($value) . '"';
} else {
$arrayText .= $value;
}
if ($index < $count - 1) {
$arrayText .= ', ';
$index++;
}
}
$arrayText .= ']';
return $arrayText;
}
/** /**
* Get the include command for the given file and namespace * Get the 'Boolean' string representation of the given value
* *
* @param string $file Include file * @api
* @param string $namespace (optional) Include namespace * @param bool $value Value to convert to a ManiaScript 'Boolean'
* @return string * @return string
*/ */
public static function getInclude($file, $namespace = null) { public static function getBoolean($value)
if (!$namespace && stripos($file, '.') === false) { {
$namespace = $file; $bool = (bool)$value;
} if ($bool) {
$file = static::escapeText($file, true); return "True";
$includeText = "#Include {$file}"; }
if ($namespace) { return "False";
$includeText .= " as {$namespace}"; }
}
$includeText .= PHP_EOL; /**
return $includeText; * Get the Vec3 representation for the given values
} *
* @api
* @param float|float[] $valueX Value X
* @param float $valueY (optional) Value Y
* @return string
*/
public static function getVec2($valueX, $valueY = null)
{
if (is_array($valueX)) {
$valueY = (isset($valueX[1]) ? $valueX[1] : 0.);
$valueX = (isset($valueX[0]) ? $valueX[0] : 0.);
}
return "<" . static::getReal($valueX) . "," . static::getReal($valueY) . ">";
}
/**
* Get the Vec3 representation for the given values
*
* @api
* @param float|float[] $valueX Value X
* @param float $valueY (optional) Value Y
* @param float $valueZ (optional) Value Z
* @return string
*/
public static function getVec3($valueX, $valueY = null, $valueZ = null)
{
if (is_array($valueX)) {
$valueZ = (isset($valueX[2]) ? $valueX[2] : 0.);
$valueY = (isset($valueX[1]) ? $valueX[1] : 0.);
$valueX = (isset($valueX[0]) ? $valueX[0] : 0.);
}
return "<" . static::getReal($valueX) . "," . static::getReal($valueY) . "," . static::getReal($valueZ) . ">";
}
/**
* Get the string representation of the given array
*
* @api
* @param array $array Array to convert to a ManiaScript array
* @param bool $associative (optional) Whether the array should be associative
* @return string
*/
public static function getArray(array $array, $associative = false)
{
$arrayText = "[";
$index = 0;
$count = count($array);
foreach ($array as $key => $value) {
if ($associative) {
$arrayText .= static::getValue($key);
$arrayText .= " => ";
}
$arrayText .= static::getValue($value);
if ($index < $count - 1) {
$arrayText .= ", ";
$index++;
}
}
return $arrayText . "]";
}
/**
* Get the string representation for the given value
*
* @api
* @param mixed $value Value
* @return string
*/
public static function getValue($value)
{
if (is_string($value)) {
return static::escapeText($value);
}
if (is_bool($value)) {
return static::getBoolean($value);
}
return $value;
}
/**
* Get the include command for the given file and namespace
*
* @api
* @param string $file Include file
* @param string $namespace (optional) Include namespace
* @return string
*/
public static function getInclude($file, $namespace = null)
{
if (!$namespace && stripos($file, ".") === false) {
$namespace = $file;
}
$file = static::escapeText($file);
$includeText = "#Include {$file}";
if ($namespace) {
$includeText .= " as {$namespace}";
}
return $includeText . "
";
}
/**
* Get the constant command for the given name and value
*
* @api
* @param string $name Constant name
* @param string $value Constant value
* @return string
*/
public static function getConstant($name, $value)
{
$value = static::getValue($value);
return "#Const {$name} {$value}
";
}
/**
* Get the constant command for the given name and value
*
* @param string $name Constant name
* @param string $value Constant value
* @return string
*/
public static function getConstant($name, $value) {
if (is_string($value)) {
$value = static::escapeText($value, true);
} else if (is_bool($value)) {
$value = static::getBoolean($value);
}
$constantText = "#Const {$name} {$value}" . PHP_EOL;
return $constantText;
}
} }

View File

@ -9,104 +9,159 @@ use FML\Script\ScriptLabel;
use FML\Types\Scriptable; use FML\Types\Scriptable;
/** /**
* Script Feature for triggering a manialink page action * Script Feature for triggering a ManiaLink page action
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ActionTrigger extends ScriptFeature { class ActionTrigger extends ScriptFeature
/* {
* Protected properties
*/
protected $actionName = null;
/** @var Control $control */
protected $control = null;
protected $labelName = null;
/** /**
* Construct a new Action Trigger Feature * @var string $actionName Triggered action
* */
* @param string $actionName (optional) Triggered action protected $actionName = null;
* @param Control $control (optional) Action Control
* @param string $labelName (optional) Script Label name
*/
public function __construct($actionName = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK) {
if ($actionName !== null) {
$this->setActionName($actionName);
}
if ($control !== null) {
$this->setControl($control);
}
if ($labelName !== null) {
$this->setLabelName($labelName);
}
}
/** /**
* Set the action to trigger * @var Control $control Action Control
* */
* @param string $actionName protected $control = null;
* @return static
*/
public function setActionName($actionName) {
$this->actionName = (string)$actionName;
return $this;
}
/** /**
* Set the Control * @var string $labelName Script label name
* */
* @param Control $control Action Control protected $labelName = null;
* @return static
*/
public function setControl(Control $control) {
$control->checkId();
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
$this->control = $control;
return $this;
}
/** /**
* Set the label name * Construct a new Action Trigger
* *
* @param string $labelName Script Label name * @api
* @return static * @param string $actionName (optional) Triggered action
*/ * @param Control $control (optional) Action Control
public function setLabelName($labelName) { * @param string $labelName (optional) Script label name
$this->labelName = (string)$labelName; */
return $this; public function __construct($actionName = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK)
} {
if ($actionName) {
$this->setActionName($actionName);
}
if ($control) {
$this->setControl($control);
}
if ($labelName) {
$this->setLabelName($labelName);
}
}
/** /**
* @see \FML\Script\Features\ScriptFeature::prepare() * Get the action to trigger
*/ *
public function prepare(Script $script) { * @api
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText()); * @return string
return $this; */
} public function getActionName()
{
return $this->actionName;
}
/** /**
* Get the script text * Set the action to trigger
* *
* @return string * @api
*/ * @param string $actionName Action name
protected function getScriptText() { * @return static
$actionName = Builder::escapeText($this->actionName, true); */
if ($this->control) { public function setActionName($actionName)
// Control event {
$controlId = Builder::escapeText($this->control->getId(), true); $this->actionName = (string)$actionName;
$scriptText = " return $this;
}
/**
* Get the Control that should trigger the action
*
* @api
* @return Control
*/
public function getControl()
{
return $this->control;
}
/**
* Set the Control that should trigger the action
*
* @api
* @param Control $control Action Control
* @return static
*/
public function setControl(Control $control = null)
{
if ($control) {
$control->checkId();
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
}
$this->control = $control;
return $this;
}
/**
* Get the script label name
*
* @api
* @return string
*/
public function getLabelName()
{
return $this->labelName;
}
/**
* Set the script label name
*
* @api
* @param string $labelName Script Label name
* @return static
*/
public function setLabelName($labelName)
{
$this->labelName = (string)$labelName;
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText());
return $this;
}
/**
* Get the script text
*
* @return string
*/
protected function getScriptText()
{
$actionName = Builder::escapeText($this->actionName);
if ($this->control) {
// Control event
$controlId = Builder::escapeText($this->control->getId());
$scriptText = "
if (Event.Control.ControlId == {$controlId}) { if (Event.Control.ControlId == {$controlId}) {
TriggerPageAction({$actionName}); TriggerPageAction({$actionName});
}"; }";
} else { } else {
// Other // Other
$scriptText = " $scriptText = "
TriggerPageAction({$actionName});"; TriggerPageAction({$actionName});";
} }
return $scriptText; return $scriptText;
} }
} }

View File

@ -2,9 +2,9 @@
namespace FML\Script\Features; namespace FML\Script\Features;
use FML\Components\CheckBoxDesign;
use FML\Controls\Entry; use FML\Controls\Entry;
use FML\Controls\Quad; use FML\Controls\Quad;
use FML\Models\CheckBoxDesign;
use FML\Script\Builder; use FML\Script\Builder;
use FML\Script\Script; use FML\Script\Script;
use FML\Script\ScriptInclude; use FML\Script\ScriptInclude;
@ -14,145 +14,213 @@ use FML\Script\ScriptLabel;
* Script Feature for creating a CheckBox behavior * Script Feature for creating a CheckBox behavior
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class CheckBoxFeature extends ScriptFeature { 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 * Constants
*/ */
/** @var Quad $quad */ const FUNCTION_UPDATE_QUAD_DESIGN = "FML_UpdateQuadDesign";
protected $quad = null; const VAR_CHECKBOX_ENABLED = "FML_CheckBox_Enabled";
/** @var Entry $entry */ const VAR_CHECKBOX_DESIGNS = "FML_CheckBox_Designs";
protected $entry = null; const VAR_CHECKBOX_ENTRY_ID = "FML_CheckBox_EntryId";
protected $default = null;
/** @var CheckBoxDesign $enabledDesign */
protected $enabledDesign = null;
/** @var CheckBoxDesign $disabledDesign */
protected $disabledDesign = null;
/** /**
* Construct a new CheckBox Feature * @var Quad $quad CheckBox Quad
* */
* @param Quad $quad (optional) CheckBox Quad protected $quad = null;
* @param Entry $entry (optional) Hidden Entry
* @param bool $default (optional) Default value
*/
public function __construct(Quad $quad = null, Entry $entry = null, $default = null) {
if ($quad !== null) {
$this->setQuad($quad);
}
if ($entry !== null) {
$this->setEntry($entry);
}
if ($default !== null) {
$this->setDefault($default);
}
$this->setEnabledDesign(CheckBoxDesign::defaultEnabledDesign());
$this->setDisabledDesign(CheckBoxDesign::defaultDisabledDesign());
}
/** /**
* Set the CheckBox Quad * @var Entry $entry Hidden Entry for submitting the value
* */
* @param Quad $quad CheckBox Quad protected $entry = null;
* @return static
*/
public function setQuad(Quad $quad) {
$this->quad = $quad->checkId()->setScriptEvents(true);
return $this;
}
/** /**
* Get the CheckBox Quad * @var bool $default Default value
* */
* @return \FML\Controls\Quad protected $default = null;
*/
public function getQuad() {
return $this->quad;
}
/** /**
* Set the CheckBox Entry * @var CheckBoxDesign $enabledDesign Enabled Design
* */
* @param Entry $entry CheckBox Entry protected $enabledDesign = null;
* @return static
*/
public function setEntry(Entry $entry) {
$this->entry = $entry->checkId();
return $this;
}
/** /**
* Get the managed Entry * @var CheckBoxDesign $disabledDesign Disabled Design
* */
* @return \FML\Controls\Entry protected $disabledDesign = null;
*/
public function getEntry() {
return $this->entry;
}
/** /**
* Set the default value * Construct a new CheckBox Feature
* *
* @param bool $default Default value * @api
* @return static * @param Quad $quad (optional) CheckBox Quad
*/ * @param Entry $entry (optional) Hidden Entry
public function setDefault($default) { * @param bool $default (optional) Default value
$this->default = (bool)$default; */
return $this; public function __construct(Quad $quad = null, Entry $entry = null, $default = null)
} {
if ($quad) {
$this->setQuad($quad);
}
if ($entry) {
$this->setEntry($entry);
}
if ($default !== null) {
$this->setDefault($default);
}
$this->setEnabledDesign(CheckBoxDesign::defaultDesign());
$this->setDisabledDesign(CheckBoxDesign::defaultDesign());
}
/** /**
* Set the enabled Design * Get the CheckBox Quad
* *
* @param CheckBoxDesign $checkBoxDesign Enabled CheckBox Design * @api
* @return static * @return Quad
*/ */
public function setEnabledDesign(CheckBoxDesign $checkBoxDesign) { public function getQuad()
$this->enabledDesign = $checkBoxDesign; {
return $this; return $this->quad;
} }
/** /**
* Set the disabled Design * Set the CheckBox Quad
* *
* @param CheckBoxDesign $checkBoxDesign Disabled CheckBox Design * @api
* @return static * @param Quad $quad CheckBox Quad
*/ * @return static
public function setDisabledDesign(CheckBoxDesign $checkBoxDesign) { */
$this->disabledDesign = $checkBoxDesign; public function setQuad(Quad $quad)
return $this; {
} $quad->checkId();
$quad->setScriptEvents(true);
$this->quad = $quad;
return $this;
}
/** /**
* @see \FML\Script\Features\ScriptFeature::prepare() * Get the hidden Entry
*/ *
public function prepare(Script $script) { * @api
if ($this->getQuad()) { * @return Entry
$script->setScriptInclude(ScriptInclude::TEXTLIB); */
$script->addScriptFunction(self::FUNCTION_UPDATE_QUAD_DESIGN, $this->buildUpdateQuadDesignFunction()); public function getEntry()
$script->appendGenericScriptLabel(ScriptLabel::ONINIT, $this->buildInitScriptText(), true); {
$script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK, $this->buildClickScriptText()); return $this->entry;
} }
return $this;
}
/** /**
* Build the function text * Set the hidden Entry
* *
* @return string * @api
*/ * @param Entry $entry Hidden Entry
protected function buildUpdateQuadDesignFunction() { * @return static
return " */
public function setEntry(Entry $entry)
{
$entry->checkId();
$this->entry = $entry;
return $this;
}
/**
* Get the default value
*
* @api
* @return bool
*/
public function getDefault()
{
return $this->default;
}
/**
* Set the default value
*
* @api
* @param bool $default Default value
* @return static
*/
public function setDefault($default)
{
$this->default = (bool)$default;
return $this;
}
/**
* Get the enabled Design
*
* @api
* @return CheckBoxDesign
*/
public function getEnabledDesign()
{
return $this->enabledDesign;
}
/**
* Set the enabled Design
*
* @api
* @param CheckBoxDesign $checkBoxDesign Enabled CheckBox Design
* @return static
*/
public function setEnabledDesign(CheckBoxDesign $checkBoxDesign)
{
$this->enabledDesign = $checkBoxDesign;
return $this;
}
/**
* Get the disabled Design
*
* @api
* @return CheckBoxDesign
*/
public function getDisabledDesign()
{
return $this->disabledDesign;
}
/**
* Set the disabled Design
*
* @api
* @param CheckBoxDesign $checkBoxDesign Disabled CheckBox Design
* @return static
*/
public function setDisabledDesign(CheckBoxDesign $checkBoxDesign)
{
$this->disabledDesign = $checkBoxDesign;
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
if ($this->getQuad()) {
$script->setScriptInclude(ScriptInclude::TEXTLIB);
$script->addScriptFunction(self::FUNCTION_UPDATE_QUAD_DESIGN, $this->buildUpdateQuadDesignFunction());
$script->appendGenericScriptLabel(ScriptLabel::ONINIT, $this->buildInitScriptText(), true);
$script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK, $this->buildClickScriptText());
}
return $this;
}
/**
* Build the function text
*
* @return string
*/
protected function buildUpdateQuadDesignFunction()
{
return "
Void " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(CMlQuad _Quad) { Void " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(CMlQuad _Quad) {
declare " . self::VAR_CHECKBOX_ENABLED . " as Enabled for _Quad = True; declare " . self::VAR_CHECKBOX_ENABLED . " as Enabled for _Quad = True;
Enabled = !Enabled; Enabled = !Enabled;
@ -160,62 +228,69 @@ Void " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(CMlQuad _Quad) {
declare " . self::VAR_CHECKBOX_DESIGNS . " as Designs for _Quad = Text[Boolean]; declare " . self::VAR_CHECKBOX_DESIGNS . " as Designs for _Quad = Text[Boolean];
declare Design = Designs[Enabled]; declare Design = Designs[Enabled];
declare DesignParts = TextLib::Split(\"|\", Design); declare DesignParts = TextLib::Split(\"|\", Design);
if (DesignParts.count > 1) { if (DesignParts.count == 2) {
_Quad.Style = DesignParts[0]; _Quad.Style = DesignParts[0];
_Quad.Substyle = DesignParts[1]; _Quad.Substyle = DesignParts[1];
} else { } else {
_Quad.ImageUrl = Design; _Quad.ImageUrl = Design;
} }
declare " . self::VAR_CHECKBOX_ENTRY_ID . " as EntryId for _Quad = " . Builder::EMPTY_STRING . "; declare " . self::VAR_CHECKBOX_ENTRY_ID . " as EntryId for _Quad = \"\";
if (EntryId != " . Builder::EMPTY_STRING . ") { if (EntryId != \"\") {
declare Value = \"0\";
if (Enabled) {
Value = \"1\";
}
declare Entry <=> (Page.GetFirstChild(EntryId) as CMlEntry); declare Entry <=> (Page.GetFirstChild(EntryId) as CMlEntry);
Entry.Value = Value; if (Entry != Null) {
if (Enabled) {
Entry.Value = \"1\";
} else {
Entry.Value = \"0\";
}
}
} }
}"; }";
} }
/** /**
* Build the init script text * Build the init script text
* *
* @return string * @return string
*/ */
protected function buildInitScriptText() { protected function buildInitScriptText()
$quadId = $this->getQuad()->getId(true, true); {
$entryId = '""'; $quadId = Builder::getId($this->getQuad());
if ($this->entry) { $entryId = Builder::EMPTY_STRING;
$entryId = $this->entry->getId(true, true); if ($this->entry) {
} $entryId = Builder::getId($this->getEntry());
$default = Builder::getBoolean($this->default); }
$enabledDesignString = $this->enabledDesign->getDesignString();
$disabledDesignString = $this->disabledDesign->getDesignString(); $default = Builder::getBoolean($this->default);
return " $enabledDesignString = $this->enabledDesign->getDesignString();
declare Quad_CheckBox <=> (Page.GetFirstChild({$quadId}) as CMlQuad); $disabledDesignString = $this->disabledDesign->getDesignString();
return "
declare Quad_CheckBox <=> (Page.GetFirstChild(\"{$quadId}\") as CMlQuad);
declare Text[Boolean] " . self::VAR_CHECKBOX_DESIGNS . " as Designs for Quad_CheckBox; declare Text[Boolean] " . self::VAR_CHECKBOX_DESIGNS . " as Designs for Quad_CheckBox;
Designs[True] = {$enabledDesignString}; Designs[True] = \"{$enabledDesignString}\";
Designs[False] = {$disabledDesignString}; Designs[False] = \"{$disabledDesignString}\";
declare Boolean " . self::VAR_CHECKBOX_ENABLED . " as Enabled for Quad_CheckBox; declare Boolean " . self::VAR_CHECKBOX_ENABLED . " as Enabled for Quad_CheckBox;
Enabled = !{$default}; Enabled = !{$default};
declare Text " . self::VAR_CHECKBOX_ENTRY_ID . " as EntryId for Quad_CheckBox; declare Text " . self::VAR_CHECKBOX_ENTRY_ID . " as EntryId for Quad_CheckBox;
EntryId = {$entryId}; EntryId = \"{$entryId}\";
" . self::FUNCTION_UPDATE_QUAD_DESIGN . "(Quad_CheckBox); " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(Quad_CheckBox);
"; ";
} }
/** /**
* Build the script text for Quad clicks * Build the script text for Quad clicks
* *
* @return string * @return string
*/ */
protected function buildClickScriptText() { protected function buildClickScriptText()
$quadId = $this->getQuad()->getId(true, true); {
return " $quadId = Builder::getId($this->getQuad());
if (Event.ControlId == {$quadId}) { return "
if (Event.ControlId == \"{$quadId}\") {
declare Quad_CheckBox <=> (Event.Control as CMlQuad); declare Quad_CheckBox <=> (Event.Control as CMlQuad);
" . self::FUNCTION_UPDATE_QUAD_DESIGN . "(Quad_CheckBox); " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(Quad_CheckBox);
}"; }";
} }
} }

View File

@ -3,6 +3,7 @@
namespace FML\Script\Features; namespace FML\Script\Features;
use FML\Controls\Label; use FML\Controls\Label;
use FML\Script\Builder;
use FML\Script\Script; use FML\Script\Script;
use FML\Script\ScriptInclude; use FML\Script\ScriptInclude;
use FML\Script\ScriptLabel; use FML\Script\ScriptLabel;
@ -11,95 +12,149 @@ use FML\Script\ScriptLabel;
* Script Feature showing the current time on a Label * Script Feature showing the current time on a Label
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Clock extends ScriptFeature { class Clock extends ScriptFeature
/* {
* Protected properties
*/
/** @var Label $label */
protected $label = null;
protected $showSeconds = null;
protected $showFullDate = null;
/** /**
* Construct a new Clock Feature * @var Label $label Clock Label
* */
* @param Label $label (optional) Clock Label protected $label = null;
* @param bool $showSeconds (optional) Whether the seconds should be shown
* @param bool $showFullDate (optional) Whether the date should be shown
*/
public function __construct(Label $label = null, $showSeconds = true, $showFullDate = false) {
if ($label !== null) {
$this->setLabel($label);
}
$this->setShowSeconds($showSeconds);
$this->setShowFullDate($showFullDate);
}
/** /**
* Set the Label * @var bool $showSeconds Show the seconds
* */
* @param Label $label Clock Label protected $showSeconds = null;
* @return static
*/
public function setLabel(Label $label) {
$this->label = $label->checkId();
return $this;
}
/** /**
* Set whether seconds should be shown * @var bool $showFullDate Show the date
* */
* @param bool $showSeconds Whether seconds should be shown protected $showFullDate = null;
* @return static
*/
public function setShowSeconds($showSeconds) {
$this->showSeconds = (bool)$showSeconds;
return $this;
}
/** /**
* Set whether the full date should be shown * Construct a new Clock
* *
* @param bool $showFullDate Whether the full date should be shown * @api
* @return static * @param Label $label (optional) Clock Label
*/ * @param bool $showSeconds (optional) Show the seconds
public function setShowFullDate($showFullDate) { * @param bool $showFullDate (optional) Show the date
$this->showFullDate = (bool)$showFullDate; */
return $this; public function __construct(Label $label = null, $showSeconds = true, $showFullDate = false)
} {
if ($label) {
$this->setLabel($label);
}
$this->setShowSeconds($showSeconds)
->setShowFullDate($showFullDate);
}
/** /**
* @see \FML\Script\Features\ScriptFeature::prepare() * Get the Label
*/ *
public function prepare(Script $script) { * @api
$script->setScriptInclude(ScriptInclude::TEXTLIB); * @return Label
$script->appendGenericScriptLabel(ScriptLabel::TICK, $this->getScriptText(), true); */
return $this; public function getLabel()
} {
return $this->label;
}
/** /**
* Get the script text * Set the Label
* *
* @return string * @api
*/ * @param Label $label Clock Label
protected function getScriptText() { * @return static
$controlId = $this->label->getId(true, true); */
$scriptText = " public function setLabel(Label $label)
{
$label->checkId();
$this->label = $label;
return $this;
}
/**
* Get if seconds should be shown
*
* @api
* @return bool
*/
public function getShowSeconds()
{
return $this->showSeconds;
}
/**
* Set if seconds should be shown
*
* @api
* @param bool $showSeconds If seconds should be shown
* @return static
*/
public function setShowSeconds($showSeconds)
{
$this->showSeconds = (bool)$showSeconds;
return $this;
}
/**
* Get if the full date should be shown
*
* @api
* @return bool
*/
public function getShowFullDate()
{
return $this->showFullDate;
}
/**
* Set if the full date should be shown
*
* @api
* @param bool $showFullDate If the full date should be shown
* @return static
*/
public function setShowFullDate($showFullDate)
{
$this->showFullDate = (bool)$showFullDate;
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
$script->setScriptInclude(ScriptInclude::TEXTLIB)
->appendGenericScriptLabel(ScriptLabel::TICK, $this->getScriptText(), true);
return $this;
}
/**
* Get the script text
*
* @return string
*/
protected function getScriptText()
{
$controlId = Builder::escapeText($this->label->getId());
$scriptText = "
declare ClockLabel <=> (Page.GetFirstChild({$controlId}) as CMlLabel); declare ClockLabel <=> (Page.GetFirstChild({$controlId}) as CMlLabel);
declare TimeText = CurrentLocalDateText;"; declare TimeText = CurrentLocalDateText;";
if (!$this->showSeconds) { if (!$this->showSeconds) {
$scriptText .= " $scriptText .= "
TimeText = TextLib::SubText(TimeText, 0, 16);"; TimeText = TextLib::SubText(TimeText, 0, 16);";
} }
if (!$this->showFullDate) { if (!$this->showFullDate) {
$scriptText .= " $scriptText .= "
TimeText = TextLib::SubText(TimeText, 11, 9);"; TimeText = TextLib::SubText(TimeText, 11, 9);";
} }
$scriptText .= " $scriptText .= "
ClockLabel.Value = TimeText;"; ClockLabel.Value = TimeText;";
return $scriptText; return $scriptText;
} }
} }

View File

@ -3,6 +3,7 @@
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\Types\Scriptable; use FML\Types\Scriptable;
@ -11,115 +12,179 @@ use FML\Types\Scriptable;
* Script Feature for a Control related script * Script Feature for a Control related script
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ControlScript extends ScriptFeature { class ControlScript extends ScriptFeature
/* {
* Protected properties
*/
/** @var Control $control */
protected $control = null;
protected $labelName = null;
protected $text = null;
/** /**
* Construct a new Control Script * @var Control $control Control
* */
* @param Control $control Event Control protected $control = null;
* @param string $text Script text
* @param string $labelName (optional) Script Label name
*/
public function __construct(Control $control, $text, $labelName = ScriptLabel::MOUSECLICK) {
$this->setControl($control);
$this->setText($text);
$this->setLabelName($labelName);
}
/** /**
* Set the Control * @var string $labelName Script Label name
* */
* @param Control $control Event Control protected $labelName = null;
* @return static
*/
public function setControl(Control $control) {
$this->control = $control->checkId();
$this->updateScriptEvents();
return $this;
}
/** /**
* Set the script text * @var string $scriptText Script text
* */
* @param string $text Script text protected $scriptText = null;
* @return static
*/
public function setText($text) {
$this->text = (string)$text;
return $this;
}
/** /**
* Set the label name * Construct a new Control Script
* *
* @param string $labelName Script Label name * @api
* @return static * @param Control $control (optional) Control
*/ * @param string $scriptText (optional) Script text
public function setLabelName($labelName) { * @param string $labelName (optional) Script Label name
$this->labelName = (string)$labelName; */
$this->updateScriptEvents(); public function __construct(Control $control = null, $scriptText = null, $labelName = ScriptLabel::MOUSECLICK)
return $this; {
} if ($control) {
$this->setControl($control);
}
if ($scriptText) {
$this->setScriptText($scriptText);
}
if ($labelName) {
$this->setLabelName($labelName);
}
}
/** /**
* Enable Script Events on the Control if needed * Get the Control
*/ *
protected function updateScriptEvents() { * @api
if (!$this->control || !ScriptLabel::isEventLabel($this->labelName)) { * @return Control
return; */
} public function getControl()
if ($this->control instanceof Scriptable) { {
$this->control->setScriptEvents(true); return $this->control;
} }
}
/** /**
* @see \FML\Script\Features\ScriptFeature::prepare() * Set the Control
*/ *
public function prepare(Script $script) { * @api
$isolated = !ScriptLabel::isEventLabel($this->labelName); * @param Control $control Control
$script->appendGenericScriptLabel($this->labelName, $this->buildScriptText(), $isolated); * @return static
return $this; */
} public function setControl(Control $control)
{
$control->checkId();
$this->control = $control;
$this->updateScriptEvents();
return $this;
}
/**
* Get the script text
*
* @api
* @return string
*/
public function getScriptText()
{
return $this->scriptText;
}
/**
* Set the script text
*
* @api
* @param string $scriptText Script text
* @return static
*/
public function setScriptText($scriptText)
{
$this->scriptText = (string)$scriptText;
return $this;
}
/**
* Get the Script Label name
*
* @api
* @return string
*/
public function getLabelName()
{
return $this->labelName;
}
/**
* Set the Script Label name
*
* @api
* @param string $labelName Script Label name
* @return static
*/
public function setLabelName($labelName)
{
$this->labelName = (string)$labelName;
$this->updateScriptEvents();
return $this;
}
/**
* Enable Script Events on the Control if needed
*
* @return static
*/
protected function updateScriptEvents()
{
if (!$this->control || !ScriptLabel::isEventLabel($this->labelName)) {
return $this;
}
if ($this->control instanceof Scriptable) {
$this->control->setScriptEvents(true);
}
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
$isolated = !ScriptLabel::isEventLabel($this->labelName);
$script->appendGenericScriptLabel($this->labelName, $this->buildScriptText(), $isolated);
return $this;
}
/**
* Build the script text for the Control
*
* @return string
*/
protected function buildScriptText()
{
$controlId = Builder::escapeText($this->control->getId());
$scriptText = '';
$closeBlock = false;
if (ScriptLabel::isEventLabel($this->labelName)) {
$scriptText .= "
if (Event.ControlId == {$controlId}) {
declare Control <=> Event.Control;";
$closeBlock = true;
} else {
$scriptText .= "
declare Control <=> Page.GetFirstChild({$controlId});";
}
$class = $this->control->getManiaScriptClass();
$name = preg_replace('/^CMl/', '', $class, 1);
$scriptText .= "
declare {$name} <=> (Control as {$class});
";
$scriptText .= $this->scriptText . "
";
if ($closeBlock) {
$scriptText .= "}";
}
return $scriptText;
}
/**
* Build the script text for the Control
*
* @return string
*/
protected function buildScriptText() {
$controlId = $this->control->getId(true);
$scriptText = '';
$closeBlock = false;
if (ScriptLabel::isEventLabel($this->labelName)) {
$scriptText .= '
if (Event.ControlId == "' . $controlId . '") {
declare Control <=> Event.Control;';
$closeBlock = true;
} else {
$scriptText .= '
declare Control <=> Page.GetFirstChild("' . $controlId . '");';
}
$class = $this->control->getManiaScriptClass();
$name = preg_replace('/^CMl/', '', $class, 1);
$scriptText .= '
declare ' . $name . ' <=> (Control as ' . $class . ');
';
$scriptText .= $this->text . '
';
if ($closeBlock) {
$scriptText .= '}';
}
return $scriptText;
}
} }

View File

@ -12,90 +12,131 @@ use FML\Script\ScriptLabel;
* Script Feature for submitting an Entry * Script Feature for submitting an Entry
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class EntrySubmit extends ScriptFeature { class EntrySubmit extends ScriptFeature
/* {
* Protected properties
*/
/** @var Entry $entry */
protected $entry = null;
protected $url = null;
/** /**
* Construct a new Entry Submit Feature * @var Entry $entry Entry
* */
* @param Entry $entry (optional) Entry Control protected $entry = null;
* @param string $url (optional) Submit url
*/
public function __construct(Entry $entry = null, $url = null) {
if ($entry !== null) {
$this->setEntry($entry);
}
$this->setUrl($url);
}
/** /**
* Set the Entry * @var string $url Sumit url
* */
* @param Entry $entry Entry Control protected $url = null;
* @return static
*/
public function setEntry(Entry $entry) {
$this->entry = $entry->checkId()->setScriptEvents(true);
return $this;
}
/** /**
* Set the submit url * Construct a new Entry Submit
* *
* @param string $url Submit url * @api
* @return static * @param Entry $entry (optional) Entry Control
*/ * @param string $url (optional) Submit url
public function setUrl($url) { */
$this->url = (string)$url; public function __construct(Entry $entry = null, $url = null)
return $this; {
} if ($entry) {
$this->setEntry($entry);
}
if ($url) {
$this->setUrl($url);
}
}
/** /**
* @see \FML\Script\Features\ScriptFeature::prepare() * Get the Entry
*/ *
public function prepare(Script $script) { * @api
$script->setScriptInclude(ScriptInclude::TEXTLIB); * @return Entry
$controlScript = new ControlScript($this->entry, $this->getScriptText(), ScriptLabel::ENTRYSUBMIT); */
$controlScript->prepare($script); public function getEntry()
return $this; {
} return $this->entry;
}
/** /**
* Get the script text * Set the Entry
* *
* @return string * @api
*/ * @param Entry $entry Entry Control
protected function getScriptText() { * @return static
$url = $this->buildCompatibleUrl(); */
$entryName = $this->entry->getName(); public function setEntry(Entry $entry)
$link = Builder::escapeText($entryName . $url . '=', true); {
return " $entry->setScriptEvents(true)
->checkId();
$this->entry = $entry;
return $this;
}
/**
* Get the submit url
*
* @api
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set the submit url
*
* @api
* @param string $url Submit url
* @return static
*/
public function setUrl($url)
{
$this->url = (string)$url;
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
$script->setScriptInclude(ScriptInclude::TEXTLIB);
$controlScript = new ControlScript($this->entry, $this->getScriptText(), ScriptLabel::ENTRYSUBMIT);
$controlScript->prepare($script);
return $this;
}
/**
* Get the script text
*
* @return string
*/
protected function getScriptText()
{
$url = $this->buildCompatibleUrl();
$entryName = $this->entry->getName();
$link = Builder::escapeText($entryName . $url . "=");
return "
declare Value = TextLib::URLEncode(Entry.Value); declare Value = TextLib::URLEncode(Entry.Value);
OpenLink({$link}^Value, CMlScript::LinkType::Goto); OpenLink({$link}^Value, CMlScript::LinkType::Goto);
"; ";
} }
/**
* Build the submit url compatible for the Entry parameter
*
* @return string
*/
protected function buildCompatibleUrl()
{
$url = $this->url;
$paramsBegin = stripos($url, '?');
if (!is_int($paramsBegin) || $paramsBegin < 0) {
$url .= '?';
} else {
$url .= '&';
}
return $url;
}
/**
* Build the submit url compatible for the Entry parameter
*
* @return string
*/
protected function buildCompatibleUrl() {
$url = $this->url;
$paramsBegin = stripos($url, '?');
if (!is_int($paramsBegin) || $paramsBegin < 0) {
$url .= '?';
} else {
$url .= '&';
}
return $url;
}
} }

View File

@ -0,0 +1,303 @@
<?php
namespace FML\Script\Features;
use FML\Controls\Graph;
use FML\Script\Builder;
use FML\Script\Script;
use FML\Script\ScriptLabel;
/**
* Script Feature adding a Curve to a Graph
*
* @author steeffeen
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class GraphCurve extends ScriptFeature
{
/**
* @var Graph $graph Graph
*/
protected $graph = null;
/**
* @var array[] $points Points
*/
protected $points = array();
/**
* @var bool $sortPoints Sort points
*/
protected $sortPoints = false;
/**
* @var float[] $color Color
*/
protected $color = null;
/**
* @var string $style Style
*/
protected $style = null;
/**
* @var float $width Width
*/
protected $width = -1.;
/**
* Construct a new Graph Curve
*
* @api
* @param Graph $graph (optional) Graph
* @param array[] $points (optional) Points
*/
public function __construct(Graph $graph = null, array $points = null)
{
if ($graph) {
$this->setGraph($graph);
}
if ($points) {
$this->setPoints($points);
}
}
/**
* Get the Graph
*
* @api
* @return Graph
*/
public function getGraph()
{
return $this->graph;
}
/**
* Set the Graph
*
* @api
* @param Graph $graph Graph
* @return static
*/
public function setGraph(Graph $graph)
{
$graph->checkId();
$this->graph = $graph;
return $this;
}
/**
* Get the points
*
* @api
* @return array[]
*/
public function getPoints()
{
return $this->points;
}
/**
* Add point
*
* @api
* @param float|float[] $coordX X-coordinate or point
* @param float $coordY (optional) Y-coordinate
* @return static
*/
public function addPoint($coordX, $coordY = null)
{
if (is_array($coordX)) {
$coordY = (isset($coordX[1]) ? $coordX[1] : 0.);
$coordX = (isset($coordX[0]) ? $coordX[0] : 0.);
}
array_push($this->points, array($coordX, $coordY));
return $this;
}
/**
* Add points
*
* @api
* @param array[] $points Points
* @return static
*/
public function addPoints(array $points)
{
foreach ($points as $point) {
$this->addPoint($point);
}
return $this;
}
/**
* Set the points
*
* @api
* @param array[] $points Points
* @return static
*/
public function setPoints(array $points)
{
return $this->removeAllPoints()
->addPoints($points);
}
/**
* Remove all points
*
* @api
* @return static
*/
public function removeAllPoints()
{
$this->points = array();
return $this;
}
/**
* Get if point should be sorted
*
* @api
* @return bool
*/
public function getSortPoints()
{
return $this->sortPoints;
}
/**
* Set if point should be sorted
*
* @api
* @param bool $sortPoints If point should be sorted
* @return static
*/
public function setSortPoints($sortPoints)
{
$this->sortPoints = (bool)$sortPoints;
return $this;
}
/**
* Get the color
*
* @api
* @return float[]
*/
public function getColor()
{
return $this->color;
}
/**
* Set the color
*
* @api
* @param float[] $color (optional) Color
* @return static
*/
public function setColor(array $color = null)
{
$this->color = $color;
return $this;
}
/**
* Get the style
*
* @api
* @return string
*/
public function getStyle()
{
return $this->style;
}
/**
* Set the style
*
* @api
* @return static
*/
public function setStyle($style)
{
$this->style = (string)$style;
return $this;
}
/**
* Get the width
*
* @api
* @return float
*/
public function getWidth()
{
return $this->width;
}
/**
* Set the width
*
* @api
* @return static
*/
public function setWidth($width)
{
$this->width = (float)$width;
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
$script->appendGenericScriptLabel(ScriptLabel::ONINIT, $this->getScriptText(), true);
return $this;
}
/**
* Get the script text
*
* @return string
*/
protected function getScriptText()
{
$graphId = Builder::escapeText($this->graph->getId(), false);
$scriptText = "
declare Graph <=> (Page.GetFirstChild(\"{$graphId}\") as CMlGraph);
if (Graph != Null) {
declare GraphCurve <=> Graph.AddCurve();
";
foreach ($this->points as $point) {
$pointVec2 = Builder::getVec2($point);
$scriptText .= "
GraphCurve.Points.add({$pointVec2});";
}
if ($this->sortPoints) {
$scriptText .= "
GraphCurve.SortPoints();";
}
if ($this->color) {
$colorVec3 = Builder::getVec3($this->color);
$scriptText .= "
GraphCurve.Color = {$colorVec3};";
}
if ($this->style) {
$scriptText .= "
GraphCurve.Style = {$this->style};";
}
if ($this->width > 0) {
$scriptText .= "
GraphCurve.Width = {$this->width};";
}
return $scriptText . "
}";
}
}

View File

@ -11,114 +11,185 @@ use FML\Script\ScriptLabel;
* *
* @author steeffeen * @author steeffeen
* @link http://destroflyer.mania-community.de/maniascript/keycharid_table.php * @link http://destroflyer.mania-community.de/maniascript/keycharid_table.php
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class KeyAction extends ScriptFeature { class KeyAction extends ScriptFeature
/* {
* Protected properties
*/
protected $actionName = null;
protected $keyName = null;
protected $keyCode = null;
protected $charPressed = null;
/** /**
* Construct a new Key Action Feature * @var string $actionName Action name
* */
* @param string $actionName (optional) Triggered action protected $actionName = null;
* @param string $keyName (optional) Key name
*/
public function __construct($actionName = null, $keyName = null) {
if ($actionName !== null) {
$this->setActionName($actionName);
}
if ($keyName !== null) {
$this->setKeyName($keyName);
}
}
/** /**
* Set the action to trigger * @var string $keyName Key name
* */
* @param string $actionName Triggered action protected $keyName = null;
* @return static
*/
public function setActionName($actionName) {
$this->actionName = (string)$actionName;
return $this;
}
/** /**
* Set the key name for triggering the action * @var int $keyCode Key code
* */
* @param string $keyName Key Name protected $keyCode = null;
* @return static
*/
public function setKeyName($keyName) {
$this->keyName = (string)$keyName;
$this->keyCode = null;
$this->charPressed = null;
return $this;
}
/** /**
* Set the key code for triggering the action * @var string $charPressed Pressed character
* */
* @param int $keyCode Key Code protected $charPressed = null;
* @return static
*/
public function setKeyCode($keyCode) {
$this->keyCode = (int)$keyCode;
$this->keyName = null;
$this->charPressed = null;
return $this;
}
/** /**
* Set the char to press for triggering the action * Construct a new Key Action
* *
* @param string $charPressed Pressed char * @api
* @return static * @param string $actionName (optional) Triggered action
*/ * @param string $keyName (optional) Key name
public function setCharPressed($charPressed) { */
$this->charPressed = (string)$charPressed; public function __construct($actionName = null, $keyName = null)
$this->keyName = null; {
$this->keyCode = null; if ($actionName) {
return $this; $this->setActionName($actionName);
} }
if ($keyName) {
$this->setKeyName($keyName);
}
}
/** /**
* @see \FML\Script\Features\ScriptFeature::prepare() * Get the action to trigger
*/ *
public function prepare(Script $script) { * @api
$script->appendGenericScriptLabel(ScriptLabel::KEYPRESS, $this->getScriptText()); * @return string
return $this; */
} public function getActionName()
{
return $this->actionName;
}
/** /**
* Get the script text * Set the action to trigger
* *
* @return string * @api
*/ * @param string $actionName Triggered action
protected function getScriptText() { * @return static
$actionName = Builder::escapeText($this->actionName, true); */
$key = null; public function setActionName($actionName)
$value = null; {
if ($this->keyName !== null) { $this->actionName = (string)$actionName;
$key = 'KeyName'; return $this;
$value = $this->keyName; }
} else if ($this->keyCode !== null) {
$key = 'KeyCode'; /**
$value = $this->keyCode; * Get the key name for triggering the action
} else if ($this->charPressed !== null) { *
$key = 'CharPressed'; * @api
$value = $this->charPressed; * @return string
} */
$value = Builder::escapeText($value, true); public function getKeyName()
return " {
return $this->keyName;
}
/**
* Set the key name for triggering the action
*
* @api
* @param string $keyName Key Name
* @return static
*/
public function setKeyName($keyName)
{
$this->keyName = (string)$keyName;
$this->keyCode = null;
$this->charPressed = null;
return $this;
}
/**
* Get the key code for triggering the action
*
* @api
* @return int
*/
public function getKeyCode()
{
return $this->keyCode;
}
/**
* Set the key code for triggering the action
*
* @api
* @param int $keyCode Key Code
* @return static
*/
public function setKeyCode($keyCode)
{
$this->keyName = null;
$this->keyCode = (int)$keyCode;
$this->charPressed = null;
return $this;
}
/**
* Get the character to press for triggering the action
*
* @api
* @return string
*/
public function getCharPressed()
{
return $this->charPressed;
}
/**
* Set the character to press for triggering the action
*
* @api
* @param string $charPressed Pressed character
* @return static
*/
public function setCharPressed($charPressed)
{
$this->keyName = null;
$this->keyCode = null;
$this->charPressed = (string)$charPressed;
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
$script->appendGenericScriptLabel(ScriptLabel::KEYPRESS, $this->getScriptText());
return $this;
}
/**
* Get the script text
*
* @return string
*/
protected function getScriptText()
{
$actionName = Builder::escapeText($this->actionName);
$key = null;
$value = null;
if ($this->keyName !== null) {
$key = "KeyName";
$value = $this->keyName;
} else if ($this->keyCode !== null) {
$key = "KeyCode";
$value = $this->keyCode;
} else if ($this->charPressed !== null) {
$key = "CharPressed";
$value = $this->charPressed;
}
$value = Builder::escapeText($value);
return "
if (Event.{$key} == {$value}) { if (Event.{$key} == {$value}) {
TriggerPageAction({$actionName}); TriggerPageAction({$actionName});
}"; }";
} }
} }

View File

@ -12,80 +12,119 @@ use FML\Types\Scriptable;
* Script Feature for opening the map info * Script Feature for opening the map info
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class MapInfo extends ScriptFeature { class MapInfo extends ScriptFeature
/* {
* Protected properties
*/
/** @var Control $control */
protected $control = null;
protected $labelName = null;
/** /**
* Construct a new Map Info Feature * @var Control $control Map Info Control
* */
* @param Control $control (optional) Map Info Control protected $control = null;
* @param string $labelName (optional) Script Label name
*/
public function __construct(Control $control, $labelName = ScriptLabel::MOUSECLICK) {
$this->setControl($control);
$this->setLabelName($labelName);
}
/** /**
* Set the Control * @var string $labelName Script Label name
* */
* @param Control $control Map Info Control protected $labelName = null;
* @return static
*/
public function setControl(Control $control) {
$control->checkId();
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
$this->control = $control;
return $this;
}
/** /**
* Set the label name * Construct a new Map Info
* *
* @param string $labelName Script Label name * @api
* @return static * @param Control $control (optional) Map Info Control
*/ * @param string $labelName (optional) Script Label name
public function setLabelName($labelName) { */
$this->labelName = (string)$labelName; public function __construct(Control $control = null, $labelName = ScriptLabel::MOUSECLICK)
return $this; {
} if ($control) {
$this->setControl($control);
}
if ($labelName) {
$this->setLabelName($labelName);
}
}
/** /**
* @see \FML\Script\Features\ScriptFeature::prepare() * Get the Control
*/ *
public function prepare(Script $script) { * @api
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText()); * @return Control
return $this; */
} public function getControl()
{
return $this->control;
}
/** /**
* Get the script text * Set the Control
* *
* @return string * @api
*/ * @param Control $control Map Info Control
protected function getScriptText() { * @return static
if ($this->control) { */
// Control event public function setControl(Control $control)
$controlId = Builder::escapeText($this->control->getId(), true); {
$scriptText = " $control->checkId();
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
$this->control = $control;
return $this;
}
/**
* Get the Script Label name
*
* @api
* @return string
*/
public function getLabelName()
{
return $this->labelName;
}
/**
* Set the Script Label name
*
* @api
* @param string $labelName Script Label name
* @return static
*/
public function setLabelName($labelName)
{
$this->labelName = (string)$labelName;
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText());
return $this;
}
/**
* Get the script text
*
* @return string
*/
protected function getScriptText()
{
if ($this->control) {
// Control event
$controlId = Builder::escapeText($this->control->getId());
return "
if (Event.Control.ControlId == {$controlId}) { if (Event.Control.ControlId == {$controlId}) {
ShowCurChallengeCard(); ShowCurChallengeCard();
}"; }";
} else { }
// Other
$scriptText = " // Other events
return "
ShowCurChallengeCard();"; ShowCurChallengeCard();";
} }
return $scriptText;
}
} }

View File

@ -11,130 +11,173 @@ use FML\Script\ScriptLabel;
* Script Feature realising a Menu showing specific Controls for the different items * Script Feature realising a Menu showing specific Controls for the different items
* *
* @author steeffeen * @author steeffeen
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Menu extends ScriptFeature { class Menu extends ScriptFeature
/* {
* Constants
*/
const FUNCTION_UPDATE_MENU = 'FML_UpdateMenu';
/* /*
* Protected properties * Constants
*/ */
/** @var MenuElement[] $elements */ const FUNCTION_UPDATE_MENU = "FML_UpdateMenu";
protected $elements = array();
/** @var MenuElement $startElement */
protected $startElement = null;
/** /**
* Construct a new Menu Feature * @var MenuElement[] $elements Menu Elements
* */
* @param Control $item (optional) Item Control in the Menu bar protected $elements = array();
* @param Control $control (optional) Toggled Menu Control
*/
public function __construct(Control $item = null, Control $control = null) {
if ($item && $control) {
$this->addElement($item, $control);
}
}
/** /**
* Add a new Element to the Menu * @var MenuElement $startElement Start Element
* */
* @param Control $item Item Control in the Menu bar protected $startElement = null;
* @param Control $control Toggled Menu Control
* @param bool $isStartElement (optional) Whether the Menu should start with this Element
* @return static
*/
public function addElement(Control $item, Control $control, $isStartElement = false) {
$menuElement = new MenuElement($item, $control);
$this->appendElement($menuElement, $isStartElement);
return $this;
}
/** /**
* Append an Element to the Menu * Construct a new Menu
* *
* @param MenuElement $menuElement Menu Element * @api
* @param bool $isStartElement (optional) Whether the Menu should start with this Element * @param Control $item (optional) Item Control in the Menu bar
* @return static * @param Control $control (optional) Toggled Menu Control
*/ * @param bool $isStartElement (optional) Whether the Menu should start with the given Element
public function appendElement(MenuElement $menuElement, $isStartElement = false) { */
if (!in_array($menuElement, $this->elements, true)) { public function __construct(Control $item = null, Control $control = null, $isStartElement = true)
array_push($this->elements, $menuElement); {
if ($isStartElement) { if ($item && $control) {
$this->setStartElement($menuElement); $this->addItem($item, $control, $isStartElement);
} else if (count($this->elements) > 1) { }
$menuElement->getControl()->setVisible(false); }
}
}
return $this;
}
/** /**
* Set the Element to start with * Get the Menu Elements
* *
* @param MenuElement $startElement Starting Element * @api
* @return static * @return MenuElement[]
*/ */
public function setStartElement(MenuElement $startElement) { public function getElements()
$this->startElement = $startElement; {
if (!in_array($startElement, $this->elements, true)) { return $this->elements;
array_push($this->elements, $startElement); }
}
return $this;
}
/** /**
* @see \FML\Script\Features\ScriptFeature::prepare() * Add a Menu item
*/ *
public function prepare(Script $script) { * @api
$updateFunctionName = self::FUNCTION_UPDATE_MENU; * @param Control $item Item Control in the Menu bar
$elementsArrayText = $this->getElementsArrayText(); * @param Control $control Toggled Menu Control
* @param bool $isStartElement (optional) Whether the Menu should start with this Element
* @return static
*/
public function addItem(Control $item, Control $control, $isStartElement = false)
{
$menuElement = new MenuElement($item, $control);
$this->addElement($menuElement, $isStartElement);
return $this;
}
// OnInit /**
if ($this->startElement) { * Add a Menu Element
$startControlId = $this->startElement->getControl()->getId(true, true); *
$initScriptText = " * @api
* @param MenuElement $menuElement Menu Element
* @param bool $isStartElement (optional) Whether the Menu should start with this Element
* @return static
*/
public function addElement(MenuElement $menuElement, $isStartElement = false)
{
if (!in_array($menuElement, $this->elements, true)) {
array_push($this->elements, $menuElement);
if ($isStartElement) {
// new start element
$this->setStartElement($menuElement);
} else {
// additional element - set invisible
$menuElement->getControl()
->setVisible(false);
}
}
return $this;
}
/**
* Get the Element to start with
*
* @api
* @return MenuElement
*/
public function getStartElement()
{
return $this->startElement;
}
/**
* Set the Element to start with
*
* @api
* @param MenuElement $startElement Start Element
* @return static
*/
public function setStartElement(MenuElement $startElement = null)
{
$this->startElement = $startElement;
if ($startElement && !in_array($startElement, $this->elements, true)) {
array_push($this->elements, $startElement);
}
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
$updateFunctionName = self::FUNCTION_UPDATE_MENU;
$elementsArrayText = $this->getElementsArrayText();
// OnInit
if ($this->startElement) {
$startControlId = Builder::escapeText($this->startElement->getControl()->getId());
$initScriptText = "
{$updateFunctionName}({$elementsArrayText}, {$startControlId});"; {$updateFunctionName}({$elementsArrayText}, {$startControlId});";
$script->appendGenericScriptLabel(ScriptLabel::ONINIT, $initScriptText, true); $script->appendGenericScriptLabel(ScriptLabel::ONINIT, $initScriptText, true);
} }
// MouseClick // MouseClick
$scriptText = " $scriptText = "
declare MenuElements = {$elementsArrayText}; declare MenuElements = {$elementsArrayText};
if (MenuElements.existskey(Event.Control.ControlId)) { if (MenuElements.existskey(Event.Control.ControlId)) {
declare ShownControlId = MenuElements[Event.Control.ControlId]; declare ShownControlId = MenuElements[Event.Control.ControlId];
{$updateFunctionName}(MenuElements, ShownControlId); {$updateFunctionName}(MenuElements, ShownControlId);
}"; }";
$script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK, $scriptText, true); $script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK, $scriptText, true);
// Update menu function // Update menu function
$updateFunctionText = " $updateFunctionText = "
Void {$updateFunctionName}(Text[Text] _Elements, Text _ShownControlId) { Void {$updateFunctionName}(Text[Text] _Elements, Text _ShownControlId) {
foreach (ItemId => ControlId in _Elements) { foreach (ItemId => ControlId in _Elements) {
declare Control <=> (Page.GetFirstChild(ControlId)); declare Control <=> (Page.GetFirstChild(ControlId));
Control.Visible = (ControlId == _ShownControlId); Control.Visible = (ControlId == _ShownControlId);
} }
}"; }";
$script->addScriptFunction($updateFunctionName, $updateFunctionText); $script->addScriptFunction($updateFunctionName, $updateFunctionText);
return $this; return $this;
} }
/**
* Build the array text for the Elements
*
* @return string
*/
protected function getElementsArrayText()
{
$elements = array();
foreach ($this->elements as $element) {
$elementId = $element->getItem()
->getId();
$elements[$elementId] = $element->getControl()
->getId();
}
return Builder::getArray($elements, true);
}
/**
* Build the array text for the Elements
*
* @return string
*/
protected function getElementsArrayText() {
$elements = array();
foreach ($this->elements as $element) {
$elementId = $element->getItem()->getId();
$elements[$elementId] = $element->getControl()->getId();
}
return Builder::getArray($elements, true);
}
} }

View File

@ -9,72 +9,90 @@ use FML\Types\Scriptable;
* Menu Element for the Menu Feature * Menu Element for the Menu Feature
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class MenuElement { class MenuElement
/* {
* Protected properties
*/
protected $item = null;
protected $control = null;
/** /**
* Create a new Menu Element * @var Control $item Menu Item
* */
* @param Control $item (optional) Item Control in the Menu bar protected $item = null;
* @param Control $control (optional) Toggled Menu Control
*/
public function __construct(Control $item = null, Control $control = null) {
if ($item !== null) {
$this->setItem($item);
}
if ($control !== null) {
$this->setControl($control);
}
}
/** /**
* Set the Item Control * @var Control $control Menu Control
* */
* @param Control $item Item Control in the Menu bar protected $control = null;
* @return static
*/
public function setItem(Control $item) {
$item->checkId();
if ($item instanceof Scriptable) {
$item->setScriptEvents(true);
}
$this->item = $item;
return $this;
}
/** /**
* Get the Item Control * Create a new Menu Element
* *
* @return \FML\Controls\Control * @api
*/ * @param Control $item (optional) Item Control in the Menu bar
public function getItem() { * @param Control $control (optional) Toggled Menu Control
return $this->item; */
} public function __construct(Control $item = null, Control $control = null)
{
if ($item) {
$this->setItem($item);
}
if ($control) {
$this->setControl($control);
}
}
/** /**
* Set the Menu Control * Get the Item Control
* *
* @param Control $control Toggled Menu Control * @api
* @return static * @return Control
*/ */
public function setControl(Control $control) { public function getItem()
$this->control = $control->checkId(); {
return $this; return $this->item;
} }
/**
* Set the Item Control
*
* @api
* @param Control $item Item Control
* @return static
*/
public function setItem(Control $item)
{
$item->checkId();
if ($item instanceof Scriptable) {
$item->setScriptEvents(true);
}
$this->item = $item;
return $this;
}
/**
* Get the Menu Control
*
* @api
* @return Control
*/
public function getControl()
{
return $this->control;
}
/**
* Set the Menu Control
*
* @api
* @param Control $control Menu Control
* @return static
*/
public function setControl(Control $control)
{
$control->checkId();
$this->control = $control;
return $this;
}
/**
* Get the Menu Control
*
* @return \FML\Controls\Control
*/
public function getControl() {
return $this->control;
}
} }

View File

@ -10,235 +10,418 @@ use FML\Script\ScriptInclude;
use FML\Script\ScriptLabel; use FML\Script\ScriptLabel;
/** /**
* Script Feature realising a mechanism for browsing through Pages * Script Feature realizing a mechanism for browsing through Pages
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Paging extends ScriptFeature { class Paging extends ScriptFeature
/* {
* Constants
*/
const VAR_CURRENT_PAGE = 'FML_Paging_CurrentPage';
const FUNCTION_UPDATE_CURRENT_PAGE = 'FML_UpdateCurrentPage';
/* /*
* Protected properties * Constants
*/ */
/** @var PagingPage[] $pages */ const VAR_CURRENT_PAGE = "FML_Paging_CurrentPage";
protected $pages = array(); const FUNCTION_UPDATE_CURRENT_PAGE = "FML_UpdateCurrentPage";
/** @var PagingButton[] $buttons */
protected $buttons = array();
/** @var Label $label */
protected $label = null;
protected $startPageNumber = null;
protected $customMaxPageNumber = null;
protected $previousChunkAction = null;
protected $nextChunkAction = null;
protected $chunkActionAppendsPageNumber = null;
/** /**
* Construct a new Paging Script Feature * @var Label $label Page number Label
* */
* @param Label $label (optional) Page number Label protected $label = null;
*/
public function __construct(Label $label = null) {
if ($label !== null) {
$this->setLabel($label);
}
}
/** /**
* Add a new Page Control * @var PagingPage[] $pages Pages
* */
* @param Control $pageControl Page Control protected $pages = array();
* @param string $pageNumber (optional) Page number
* @return static
*/
public function addPage(Control $pageControl, $pageNumber = null) {
if ($pageNumber === null) {
$pageNumber = count($this->pages) + 1;
}
$page = new PagingPage($pageControl, $pageNumber);
$this->appendPage($page);
return $this;
}
/** /**
* Append a Page * @var PagingButton[] $buttons Paging Buttons
* */
* @param PagingPage $page Paging Page protected $buttons = array();
* @return static
*/
public function appendPage(PagingPage $page) {
if (!in_array($page, $this->pages, true)) {
array_push($this->pages, $page);
}
return $this;
}
/** /**
* Add a new Button to browse through the Pages * @var int $startPageNumber Start Page number
* */
* @param Control $buttonControl Button used for browsing protected $startPageNumber = null;
* @param int $browseAction (optional) Number of browsed Pages per click
* @return static
*/
public function addButton(Control $buttonControl, $browseAction = null) {
if ($browseAction === null) {
$buttonCount = count($this->buttons);
if ($buttonCount % 2 === 0) {
$browseAction = $buttonCount / 2 + 1;
} else {
$browseAction = $buttonCount / -2 - 1;
}
}
$button = new PagingButton($buttonControl, $browseAction);
$this->appendButton($button);
return $this;
}
/** /**
* Append a Button to browse through Pages * @var int $customMaxPageNumber Custom maximum page number
* */
* @param PagingButton $button Paging Button protected $customMaxPageNumber = null;
* @return static
*/
public function appendButton(PagingButton $button) {
if (!in_array($button, $this->buttons, true)) {
array_push($this->buttons, $button);
}
return $this;
}
/** /**
* Set the Label showing the Page number * @var string $previousChunkAction Previous chunk action name
* */
* @param Label $label Page number Label protected $previousChunkAction = null;
* @return static
*/
public function setLabel(Label $label) {
$this->label = $label->checkId();
return $this;
}
/** /**
* Set the Start Page number * @var string $nextChunkAction Next chunk action name
* */
* @param int $startPageNumber Page number to start with protected $nextChunkAction = null;
* @return static
*/
public function setStartPageNumber($startPageNumber) {
$this->startPageNumber = (int)$startPageNumber;
}
/** /**
* Set a custom maximum Page number for using chunks * @var bool $chunkActionAppendsPageNumber Chunk action appended with Page number
* */
* @param int $maxPageNumber Custom maximum Page number protected $chunkActionAppendsPageNumber = null;
* @return static
*/
public function setCustomMaxPageNumber($maxPageNumber) {
$this->customMaxPageNumber = (int)$maxPageNumber;
return $this;
}
/** /**
* Set the action triggered when the previous chunk is needed * Construct a new Paging
* *
* @param string $previousChunkAction Triggered action * @api
* @return static * @param Label $label (optional) Page number Label
*/ * @param PagingPage[] $pages (optional) Pages
public function setPreviousChunkAction($previousChunkAction) { * @param PagingButton[] $buttons (optional) Pageing Buttons
$this->previousChunkAction = (string)$previousChunkAction; */
return $this; public function __construct(Label $label = null, array $pages = null, array $buttons = null)
} {
if ($label) {
$this->setLabel($label);
}
if ($pages) {
$this->setPages($pages);
}
if ($buttons) {
$this->setButtons($buttons);
}
}
/** /**
* Set the action triggered when the next chunk is needed * Get the Label showing the Page number
* *
* @param string $nextChunkAction Triggered action * @api
* @return static * @return Label
*/ */
public function setNextChunkAction($nextChunkAction) { public function getLabel()
$this->nextChunkAction = (string)$nextChunkAction; {
return $this; return $this->label;
} }
/** /**
* Set the actions triggered when another chunk is needed * Set the Label showing the Page number
* *
* @param string $chunkAction Triggered action * @api
* @return static * @param Label $label Page number Label
*/ * @return static
public function setChunkActions($chunkAction) { */
$this->setNextChunkAction($chunkAction); public function setLabel(Label $label)
$this->setPreviousChunkAction($chunkAction); {
return $this; $label->checkId();
} $this->label = $label;
return $this;
}
/** /**
* Set if the chunk action should get the needed Page number appended * Get the Pages
* *
* @param bool $appendPageNumber Whether to append the needed Page number * @api
* @return static * @return PagingPage[]
*/ */
public function setChunkActionAppendsPageNumber($appendPageNumber) { public function getPages()
$this->chunkActionAppendsPageNumber = (bool)$appendPageNumber; {
return $this; return $this->pages;
} }
/** /**
* @see \FML\Script\Features\ScriptFeature::prepare() * Add a new Page Control
*/ *
public function prepare(Script $script) { * @api
if (empty($this->pages)) { * @param Control $pageControl Page Control
return $this; * @param string $pageNumber (optional) Page number
} * @return static
$script->setScriptInclude(ScriptInclude::TEXTLIB); */
public function addPageControl(Control $pageControl, $pageNumber = null)
{
if ($pageNumber === null) {
$pageNumber = count($this->pages) + 1;
}
$page = new PagingPage($pageControl, $pageNumber);
return $this->addPage($page);
}
$currentPageVariable = self::VAR_CURRENT_PAGE; /**
$updatePageFunction = self::FUNCTION_UPDATE_CURRENT_PAGE; * Add a new Page
*
* @api
* @param PagingPage $page Page
* @return static
*/
public function addPage(PagingPage $page)
{
if (!in_array($page, $this->pages, true)) {
array_push($this->pages, $page);
}
return $this;
}
$minPageNumber = 1; /**
$startPageNumber = (is_int($this->startPageNumber) ? $this->startPageNumber : $minPageNumber); * Add new Pages
$maxPage = $this->getMaxPage(); *
$maxPageNumber = $this->customMaxPageNumber; * @api
if (!is_int($maxPageNumber)) { * @param PagingPage[] $pages Pages
$maxPageNumber = $maxPage->getPageNumber(); * @return static
} */
public function setPages(array $pages)
{
$this->pages = array();
foreach ($pages as $page) {
$this->addPage($page);
}
return $this;
}
$pagingId = $maxPage->getControl()->getId(true, true); /**
$pageLabelId = '""'; * Get the Buttons
if ($this->label) { *
$pageLabelId = $this->label->getId(true, true); * @api
} * @return PagingButton[]
$pagesArrayText = $this->getPagesArrayText(); */
$pageButtonsArrayText = $this->getPageButtonsArrayText(); public function getButtons()
{
return $this->buttons;
}
$previousChunkAction = Builder::escapeText($this->previousChunkAction, true); /**
$nextChunkAction = Builder::escapeText($this->nextChunkAction, true); * Add a new Button Control to browse through the Pages
$chunkActionAppendsPageNumber = Builder::getBoolean($this->chunkActionAppendsPageNumber); *
* @api
* @param Control $buttonControl Button used for browsing
* @param int $browseAction (optional) Number of browsed Pages per click
* @return static
*/
public function addButtonControl(Control $buttonControl, $browseAction = null)
{
if ($browseAction === null) {
$buttonCount = count($this->buttons);
if ($buttonCount % 2 === 0) {
$browseAction = $buttonCount / 2 + 1;
} else {
$browseAction = $buttonCount / -2 - 1;
}
}
$button = new PagingButton($buttonControl, $browseAction);
return $this->addButton($button);
}
// Init /**
$initScriptText = " * Add a new Button to browse through Pages
*
* @api
* @param PagingButton $button Paging Button
* @return static
*/
public function addButton(PagingButton $button)
{
if (!in_array($button, $this->buttons, true)) {
array_push($this->buttons, $button);
}
return $this;
}
/**
* Set the Paging Buttons
*
* @api
* @param PagingButton[] $buttons Paging Buttons
* @return static
*/
public function setButtons(array $buttons)
{
$this->buttons = array();
foreach ($buttons as $button) {
$this->addButton($button);
}
return $this;
}
/**
* Get the start Page number
*
* @api
* @return int
*/
public function getStartPageNumber()
{
return $this->startPageNumber;
}
/**
* Set the start Page number
*
* @api
* @param int $startPageNumber Page number to start with
* @return static
*/
public function setStartPageNumber($startPageNumber)
{
$this->startPageNumber = (int)$startPageNumber;
return $this;
}
/**
* Get a custom maximum Page number for using chunks
*
* @api
* @return int
*/
public function getCustomMaxPageNumber()
{
return $this->customMaxPageNumber;
}
/**
* Set a custom maximum Page number for using chunks
*
* @api
* @param int $maxPageNumber Custom maximum Page number
* @return static
*/
public function setCustomMaxPageNumber($maxPageNumber)
{
$this->customMaxPageNumber = (int)$maxPageNumber;
return $this;
}
/**
* Get the action triggered when the previous chunk is needed
*
* @api
* @return string
*/
public function getPreviousChunkAction()
{
return $this->previousChunkAction;
}
/**
* Set the action triggered when the previous chunk is needed
*
* @api
* @param string $previousChunkAction Triggered action
* @return static
*/
public function setPreviousChunkAction($previousChunkAction)
{
$this->previousChunkAction = (string)$previousChunkAction;
return $this;
}
/**
* Get the action triggered when the next chunk is needed
*
* @api
* @return string
*/
public function getNextChunkAction()
{
return $this->nextChunkAction;
}
/**
* Set the action triggered when the next chunk is needed
*
* @api
* @param string $nextChunkAction Triggered action
* @return static
*/
public function setNextChunkAction($nextChunkAction)
{
$this->nextChunkAction = (string)$nextChunkAction;
return $this;
}
/**
* Set the actions triggered when another chunk is needed
*
* @api
* @param string $chunkAction Triggered action
* @return static
*/
public function setChunkActions($chunkAction)
{
return $this->setNextChunkAction($chunkAction)
->setPreviousChunkAction($chunkAction);
}
/**
* Get if the chunk action should append the needed Page number
*
* @api
* @return bool
*/
public function getChunkActionAppendsPageNumber()
{
return $this->chunkActionAppendsPageNumber;
}
/**
* Set if the chunk action should append the needed Page number
*
* @api
* @param bool $appendPageNumber Append the needed Page number
* @return static
*/
public function setChunkActionAppendsPageNumber($appendPageNumber)
{
$this->chunkActionAppendsPageNumber = (bool)$appendPageNumber;
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
if (empty($this->pages)) {
return $this;
}
$script->setScriptInclude(ScriptInclude::TEXTLIB);
$currentPageVariable = self::VAR_CURRENT_PAGE;
$updatePageFunction = self::FUNCTION_UPDATE_CURRENT_PAGE;
$minPageNumber = 1;
$startPageNumber = (is_int($this->startPageNumber) ? $this->startPageNumber : $minPageNumber);
$maxPage = $this->getMaxPage();
$maxPageNumber = $this->customMaxPageNumber;
if (!is_int($maxPageNumber)) {
$maxPageNumber = $maxPage->getPageNumber();
}
$pagingId = $maxPage->getControl()
->getId(true, true);
$pagingId = Builder::escapeText($maxPage->getControl()
->getId());
$pageLabelId = Builder::EMPTY_STRING;
if ($this->label) {
$pageLabelId = Builder::escapeText($this->label->getId());
}
$pagesArrayText = $this->getPagesArrayText();
$pageButtonsArrayText = $this->getPageButtonsArrayText();
$previousChunkAction = Builder::escapeText($this->previousChunkAction);
$nextChunkAction = Builder::escapeText($this->nextChunkAction);
$chunkActionAppendsPageNumber = Builder::getBoolean($this->chunkActionAppendsPageNumber);
// Init
$initScriptText = "
declare {$currentPageVariable} for This = Integer[Text]; declare {$currentPageVariable} for This = Integer[Text];
{$currentPageVariable}[{$pagingId}] = {$startPageNumber}; {$currentPageVariable}[{$pagingId}] = {$startPageNumber};
{$updatePageFunction}({$pagingId}, {$pageLabelId}, 0, {$minPageNumber}, {$maxPageNumber}, {$pagesArrayText}, {$previousChunkAction}, {$nextChunkAction}, {$chunkActionAppendsPageNumber});"; {$updatePageFunction}({$pagingId}, {$pageLabelId}, 0, {$minPageNumber}, {$maxPageNumber}, {$pagesArrayText}, {$previousChunkAction}, {$nextChunkAction}, {$chunkActionAppendsPageNumber});";
$script->appendGenericScriptLabel(ScriptLabel::ONINIT, $initScriptText, true); $script->appendGenericScriptLabel(ScriptLabel::ONINIT, $initScriptText, true);
// MouseClick // MouseClick
$clickScriptText = " $clickScriptText = "
declare PageButtons = {$pageButtonsArrayText}; declare PageButtons = {$pageButtonsArrayText};
if (PageButtons.existskey(Event.Control.ControlId)) { if (PageButtons.existskey(Event.Control.ControlId)) {
declare BrowseAction = PageButtons[Event.Control.ControlId]; declare BrowseAction = PageButtons[Event.Control.ControlId];
{$updatePageFunction}({$pagingId}, {$pageLabelId}, BrowseAction, {$minPageNumber}, {$maxPageNumber}, {$pagesArrayText}, {$previousChunkAction}, {$nextChunkAction}, {$chunkActionAppendsPageNumber}); {$updatePageFunction}({$pagingId}, {$pageLabelId}, BrowseAction, {$minPageNumber}, {$maxPageNumber}, {$pagesArrayText}, {$previousChunkAction}, {$nextChunkAction}, {$chunkActionAppendsPageNumber});
}"; }";
$script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK, $clickScriptText, true); $script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK, $clickScriptText, true);
// Update function // Update function
$functionText = " $functionText = "
Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAction, Integer _MinPageNumber, Integer _MaxPageNumber, Text[Integer] _Pages, Text _PreviousChunkAction, Text _NextChunkAction, Boolean _ChunkActionAppendPageNumber) { Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAction, Integer _MinPageNumber, Integer _MaxPageNumber, Text[Integer] _Pages, Text _PreviousChunkAction, Text _NextChunkAction, Boolean _ChunkActionAppendPageNumber) {
declare {$currentPageVariable} for This = Integer[Text]; declare {$currentPageVariable} for This = Integer[Text];
if (!{$currentPageVariable}.existskey(_PagingId)) return; if (!{$currentPageVariable}.existskey(_PagingId)) return;
@ -274,75 +457,82 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct
if (PageLabel == Null) return; if (PageLabel == Null) return;
PageLabel.Value = CurrentPage^\"/\"^_MaxPageNumber; PageLabel.Value = CurrentPage^\"/\"^_MaxPageNumber;
}"; }";
$script->addScriptFunction($updatePageFunction, $functionText); $script->addScriptFunction($updatePageFunction, $functionText);
return $this; return $this;
} }
/** /**
* Get the minimum Page * Get the minimum Page
* *
* @return \FML\Script\Features\PagingPage * @return PagingPage
*/ */
protected function getMinPage() { protected function getMinPage()
$minPageNumber = null; {
$minPage = null; $minPageNumber = null;
foreach ($this->pages as $page) { $minPage = null;
$pageNumber = $page->getPageNumber(); foreach ($this->pages as $page) {
if ($minPageNumber === null || $pageNumber < $minPageNumber) { $pageNumber = $page->getPageNumber();
$minPageNumber = $pageNumber; if ($minPageNumber === null || $pageNumber < $minPageNumber) {
$minPage = $page; $minPageNumber = $pageNumber;
} $minPage = $page;
} }
return $minPage; }
} return $minPage;
}
/** /**
* Get the maximum Page * Get the maximum Page
* *
* @return \FML\Script\Features\PagingPage * @return PagingPage
*/ */
protected function getMaxPage() { protected function getMaxPage()
$maxPageNumber = null; {
$maxPage = null; $maxPageNumber = null;
foreach ($this->pages as $page) { $maxPage = null;
$pageNumber = $page->getPageNumber(); foreach ($this->pages as $page) {
if ($maxPageNumber === null || $pageNumber > $maxPageNumber) { $pageNumber = $page->getPageNumber();
$maxPageNumber = $pageNumber; if ($maxPageNumber === null || $pageNumber > $maxPageNumber) {
$maxPage = $page; $maxPageNumber = $pageNumber;
} $maxPage = $page;
} }
return $maxPage; }
} return $maxPage;
}
/** /**
* Build the array text for the Pages * Build the array text for the Pages
* *
* @return string * @return string
*/ */
protected function getPagesArrayText() { protected function getPagesArrayText()
if (empty($this->pages)) { {
return Builder::getArray(array(0 => ''), true); if (empty($this->pages)) {
} return Builder::getArray(array(0 => ''), true);
$pages = array(); }
foreach ($this->pages as $page) { $pages = array();
$pages[$page->getPageNumber()] = $page->getControl()->getId(); foreach ($this->pages as $page) {
} $pages[$page->getPageNumber()] = $page->getControl()
return Builder::getArray($pages, true); ->getId();
} }
return Builder::getArray($pages, true);
}
/**
* Build the array text for the Page Buttons
*
* @return string
*/
protected function getPageButtonsArrayText()
{
if (empty($this->buttons)) {
return Builder::getArray(array('' => 0), true);
}
$pageButtons = array();
foreach ($this->buttons as $pageButton) {
$pageButtons[$pageButton->getControl()
->getId()] = $pageButton->getPagingCount();
}
return Builder::getArray($pageButtons, true);
}
/**
* Build the array text for the Page Buttons
*
* @return string
*/
protected function getPageButtonsArrayText() {
if (empty($this->buttons)) {
return Builder::getArray(array('' => 0), true);
}
$pageButtons = array();
foreach ($this->buttons as $pageButton) {
$pageButtons[$pageButton->getControl()->getId()] = $pageButton->getBrowseAction();
}
return Builder::getArray($pageButtons, true);
}
} }

View File

@ -9,73 +9,89 @@ use FML\Types\Scriptable;
* Paging Button for browsing through Pages * Paging Button for browsing through Pages
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class PagingButton { class PagingButton
/* {
* Protected properties
*/
/** @var Control $control */
protected $control = null;
protected $browseAction = null;
/** /**
* Construct a new Paging Button * @var Control $control Paging Control
* */
* @param Control $control (optional) Browse Control protected $control = null;
* @param int $browseAction (optional) Number of browsed Pages per Click
*/
public function __construct(Control $control = null, $browseAction = null) {
if ($control !== null) {
$this->setControl($control);
}
if ($browseAction !== null) {
$this->setBrowseAction($browseAction);
}
}
/** /**
* Set the Button Control * @var int Paging count
* */
* @param Control $control Browse Control protected $pagingCount = 1;
* @return static
*/
public function setControl(Control $control) {
$control->checkId();
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
$this->control = $control;
return $this;
}
/** /**
* Get the Button Control * Construct a new Paging Button
* *
* @return \FML\Controls\Control * @api
*/ * @param Control $control (optional) Paging Control
public function getControl() { * @param int $pagingCount (optional) Number of browsed pages per click
return $this->control; */
} public function __construct(Control $control = null, $pagingCount = 1)
{
if ($control) {
$this->setControl($control);
}
if ($pagingCount) {
$this->setPagingCount($pagingCount);
}
}
/** /**
* Set the browse action * Get the paging Control
* *
* @param int $browseAction Number of browsed Pages per click * @api
* @return static * @return Control
*/ */
public function setBrowseAction($browseAction) { public function getControl()
$this->browseAction = (int)$browseAction; {
return $this; return $this->control;
} }
/**
* Set the paging Control
*
* @api
* @param Control $control Paging Control
* @return static
*/
public function setControl(Control $control)
{
$control->checkId();
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
$this->control = $control;
return $this;
}
/**
* Get the paging count
*
* @api
* @return int
*/
public function getPagingCount()
{
return $this->pagingCount;
}
/**
* Set the paging count
*
* @api
* @param int $pagingCount Number of browsed pages per click
* @return static
*/
public function setPagingCount($pagingCount)
{
$this->pagingCount = (int)$pagingCount;
return $this;
}
/**
* Get the browse action
*
* @return int
*/
public function getBrowseAction() {
return $this->browseAction;
}
} }

View File

@ -8,67 +8,86 @@ use FML\Controls\Control;
* Paging Page * Paging Page
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class PagingPage { class PagingPage
/* {
* Protected properties
*/
/** @var Control $control */
protected $control = null;
protected $number = null;
/** /**
* Construct a new Paging Page * @var Control $control Page Control
* */
* @param Control $control (optional) Page Control protected $control = null;
* @param int $pageNumber (optional) Number of the Page
*/
public function __construct(Control $control = null, $pageNumber = 1) {
if ($control !== null) {
$this->setControl($control);
}
$this->setPageNumber($pageNumber);
}
/** /**
* Set the Page Control * @var int $pageNumber Page number
* */
* @param Control $control Page Control protected $pageNumber = null;
* @return static
*/
public function setControl(Control $control) {
$this->control = $control->checkId();
return $this;
}
/** /**
* Get the Page Control * Construct a new Paging Page
* *
* @return \FML\Controls\Control * @api
*/ * @param Control $control (optional) Page Control
public function getControl() { * @param int $pageNumber (optional) Number of the Page
return $this->control; */
} public function __construct(Control $control = null, $pageNumber = null)
{
if ($control) {
$this->setControl($control);
}
if ($pageNumber) {
$this->setPageNumber($pageNumber);
}
}
/** /**
* Set the Page number * Get the Page Control
* *
* @param int $pageNumber Number of the Page * @api
* @return static * @return Control
*/ */
public function setPageNumber($pageNumber) { public function getControl()
$this->number = (int)$pageNumber; {
return $this; return $this->control;
} }
/**
* Set the Page Control
*
* @api
* @param Control $control Page Control
* @return static
*/
public function setControl(Control $control)
{
$control->checkId();
$this->control = $control;
return $this;
}
/**
* Get the Page number
*
* @api
* @return int
*/
public function getPageNumber()
{
return $this->pageNumber;
}
/**
* Set the Page number
*
* @api
* @param int $pageNumber Number of the Page
* @return static
*/
public function setPageNumber($pageNumber)
{
$this->pageNumber = (int)$pageNumber;
return $this;
}
/**
* Get the Page number
*
* @return int
*/
public function getPageNumber() {
return $this->number;
}
} }

View File

@ -12,97 +12,154 @@ use FML\Types\Scriptable;
* Script Feature for opening a player profile * Script Feature for opening a player profile
* *
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class PlayerProfile extends ScriptFeature { class PlayerProfile extends ScriptFeature
/* {
* Protected properties
*/
protected $login = null;
/** @var Control $control */
protected $control = null;
protected $labelName = null;
/** /**
* Construct a new Player Profile Feature * @var string $login Player login
* */
* @param string $login (optional) Player login protected $login = null;
* @param Control $control (optional) Action Control
* @param string $labelName (optional) Script Label name
*/
public function __construct($login = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK) {
$this->setLogin($login);
if ($control !== null) {
$this->setControl($control);
}
$this->setLabelName($labelName);
}
/** /**
* Set the login of the opened player * @var Control $control Profile Control
* */
* @param string $login Player login protected $control = null;
* @return static
*/
public function setLogin($login) {
$this->login = $login;
return $this;
}
/** /**
* Set the Control * @var string $labelName Script Label name
* */
* @param Control $control Profile Control protected $labelName = null;
* @return static
*/
public function setControl(Control $control) {
$control->checkId();
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
$this->control = $control;
return $this;
}
/** /**
* Set the label name * Construct a new Player Profile
* *
* @param string $labelName Script Label name * @api
* @return static * @param string $login (optional) Player login
*/ * @param Control $control (optional) Profile Control
public function setLabelName($labelName) { * @param string $labelName (optional) Script Label name
$this->labelName = (string)$labelName; */
return $this; public function __construct($login = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK)
} {
if ($login) {
$this->setLogin($login);
}
if ($control) {
$this->setControl($control);
}
if ($labelName) {
$this->setLabelName($labelName);
}
}
/** /**
* @see \FML\Script\Features\ScriptFeature::prepare() * Get the login of the opened player
*/ *
public function prepare(Script $script) { * @api
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText()); * @return string
return $this; */
} public function getLogin()
{
return $this->login;
}
/** /**
* Get the script text * Set the login of the opened player
* *
* @return string * @api
*/ * @param string $login Player login
protected function getScriptText() { * @return static
$login = Builder::escapeText($this->login, true); */
if ($this->control) { public function setLogin($login)
// Control event {
$controlId = Builder::escapeText($this->control->getId(), true); $this->login = (string)$login;
$scriptText = " return $this;
}
/**
* Get the Profile Control
*
* @api
* @return Control
*/
public function getControl()
{
return $this->control;
}
/**
* Set the Profile Control
*
* @api
* @param Control $control Profile Control
* @return static
*/
public function setControl(Control $control)
{
$control->checkId();
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
$this->control = $control;
return $this;
}
/**
* Get the Script Label name
*
* @api
* @return string
*/
public function getLabelName()
{
return $this->labelName;
}
/**
* Set the Script Label name
*
* @api
* @param string $labelName Script Label name
* @return static
*/
public function setLabelName($labelName)
{
$this->labelName = (string)$labelName;
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText());
return $this;
}
/**
* Get the script text
*
* @return string
*/
protected function getScriptText()
{
$login = Builder::escapeText($this->login);
if ($this->control) {
// Control event
$controlId = Builder::escapeText($this->control->getId());
return "
if (Event.Control.ControlId == {$controlId}) { if (Event.Control.ControlId == {$controlId}) {
ShowProfile({$login}); ShowProfile({$login});
}"; }";
} else { }
// Other
$scriptText = " // Other events
return "
ShowProfile({$login});"; ShowProfile({$login});";
} }
return $scriptText;
}
} }

View File

@ -0,0 +1,113 @@
<?php
namespace FML\Script\Features;
use FML\Script\Builder;
use FML\Script\Script;
use FML\Script\ScriptLabel;
/**
* Script Feature for Image Preloading
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Preload extends ScriptFeature
{
/**
* @var string[] $imageUrls Image urls
*/
protected $imageUrls = array();
/**
* Construct a new Preload
*
* @api
* @param string[] $imageUrls (optional) Image urls
*/
public function __construct(array $imageUrls = null)
{
if ($imageUrls) {
$this->setImageUrls($imageUrls);
}
}
/**
* Get Image Urls to preload
*
* @api
* @return string[]
*/
public function getImageUrls()
{
return $this->imageUrls;
}
/**
* Add an Image Url to preload
*
* @api
* @param string $imageUrl Image Url
* @return static
*/
public function addImageUrl($imageUrl)
{
if (!in_array($imageUrl, $this->imageUrls)) {
array_push($this->imageUrls, $imageUrl);
}
return $this;
}
/**
* Set Image Urls to preload
*
* @api
* @param string[] $imageUrls Image Urls
* @return static
*/
public function setImageUrls(array $imageUrls = array())
{
$this->imageUrls = $imageUrls;
return $this;
}
/**
* Remove all Image Urls
*
* @api
* @return static
*/
public function removeAllImageUrls()
{
$this->imageUrls = array();
return $this;
}
/**
* @see ScriptFeature::prepare()
*/
public function prepare(Script $script)
{
$script->appendGenericScriptLabel(ScriptLabel::ONINIT, $this->getScriptText());
return $this;
}
/**
* Get the script text
*
* @return string
*/
protected function getScriptText()
{
$scriptText = "";
foreach ($this->imageUrls as $imageUrl) {
$escapedImageUrl = Builder::escapeText($imageUrl);
$scriptText .= "
PreloadImage({$escapedImageUrl});";
}
return $scriptText;
}
}

Some files were not shown because too many files have changed in this diff Show More