Updated to ManiaLink v3
This commit is contained in:
parent
1010c1db6b
commit
120a0e2169
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -31,6 +31,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
@ -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)) {
|
||||||
|
@ -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,61 +13,115 @@ 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
|
|
||||||
|
/**
|
||||||
|
* @var string $name CheckBox name
|
||||||
*/
|
*/
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var CheckBoxFeature $feature CheckBox Feature
|
||||||
|
*/
|
||||||
protected $feature = null;
|
protected $feature = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new CheckBox Component
|
* Construct a new CheckBox
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) CheckBox name
|
* @param string $name (optional) CheckBox name
|
||||||
* @param bool $default (optional) Default value
|
* @param bool $default (optional) Default value
|
||||||
* @param Quad $quad (optional) CheckBox quad
|
* @param Quad $quad (optional) CheckBox quad
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $default = null, Quad $quad = null) {
|
public function __construct($name = null, $default = null, Quad $quad = null)
|
||||||
|
{
|
||||||
$this->feature = new CheckBoxFeature();
|
$this->feature = new CheckBoxFeature();
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
|
}
|
||||||
|
if ($default !== null) {
|
||||||
$this->setDefault($default);
|
$this->setDefault($default);
|
||||||
|
}
|
||||||
|
if ($quad) {
|
||||||
$this->setQuad($quad);
|
$this->setQuad($quad);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name
|
* Set the name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name CheckBox name
|
* @param string $name CheckBox name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default value
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getDefault()
|
||||||
|
{
|
||||||
|
return $this->feature->getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the default value
|
* Set the default value
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param bool $default Default value
|
* @param bool $default Default value
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setDefault($default) {
|
public function setDefault($default)
|
||||||
|
{
|
||||||
$this->feature->setDefault($default);
|
$this->feature->setDefault($default);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the enabled Design
|
* Get the enabled design
|
||||||
*
|
*
|
||||||
* @param string $style Style name or image url
|
* @api
|
||||||
|
* @return CheckBoxDesign
|
||||||
|
*/
|
||||||
|
public function getEnabledDesign()
|
||||||
|
{
|
||||||
|
return $this->feature->getEnabledDesign();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the enabled design
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string|CheckBoxDesign $style Style name, image url or checkbox design
|
||||||
* @param string $subStyle SubStyle name
|
* @param string $subStyle SubStyle name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setEnabledDesign($style, $subStyle = null) {
|
public function setEnabledDesign($style, $subStyle = null)
|
||||||
|
{
|
||||||
if ($style instanceof CheckBoxDesign) {
|
if ($style instanceof CheckBoxDesign) {
|
||||||
$this->feature->setEnabledDesign($style);
|
$this->feature->setEnabledDesign($style);
|
||||||
} else {
|
} else {
|
||||||
@ -79,13 +132,26 @@ class CheckBox implements Renderable, ScriptFeatureable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the disabled Design
|
* Get the disabled design
|
||||||
*
|
*
|
||||||
* @param string $style Style name or image url
|
* @api
|
||||||
|
* @return CheckBoxDesign
|
||||||
|
*/
|
||||||
|
public function getDisabledDesign()
|
||||||
|
{
|
||||||
|
return $this->feature->getDisabledDesign();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the disabled design
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string|CheckBoxDesign $style Style name, image url or checkbox design
|
||||||
* @param string $subStyle SubStyle name
|
* @param string $subStyle SubStyle name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setDisabledDesign($style, $subStyle = null) {
|
public function setDisabledDesign($style, $subStyle = null)
|
||||||
|
{
|
||||||
if ($style instanceof CheckBoxDesign) {
|
if ($style instanceof CheckBoxDesign) {
|
||||||
$this->feature->setDisabledDesign($style);
|
$this->feature->setDisabledDesign($style);
|
||||||
} else {
|
} else {
|
||||||
@ -95,63 +161,109 @@ class CheckBox implements Renderable, ScriptFeatureable {
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Set the CheckBox Quad
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Quad $quad CheckBox Quad
|
* @param Quad $quad CheckBox Quad
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setQuad(Quad $quad = null) {
|
public function setQuad(Quad $quad)
|
||||||
|
{
|
||||||
$this->feature->setQuad($quad);
|
$this->feature->setQuad($quad);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\ScriptFeatureable::getScriptFeatures()
|
* Create the CheckBox Quad
|
||||||
|
*
|
||||||
|
* @return Quad
|
||||||
*/
|
*/
|
||||||
public function getScriptFeatures() {
|
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());
|
return ScriptFeature::collect($this->feature, $this->getQuad(), $this->feature->getEntry());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the CheckBox Quad
|
* @see Renderable::render()
|
||||||
*
|
|
||||||
* @param bool $createIfEmpty (optional) Create the Quad if it's not set
|
|
||||||
* @return \FML\Controls\Quad
|
|
||||||
*/
|
*/
|
||||||
public function getQuad($createIfEmpty = true) {
|
public function render(\DOMDocument $domDocument)
|
||||||
if (!$this->feature->getQuad() && $createIfEmpty) {
|
{
|
||||||
$quad = new Quad();
|
|
||||||
$quad->setSize(10, 10);
|
|
||||||
$this->setQuad($quad);
|
|
||||||
}
|
|
||||||
return $this->feature->getQuad();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\Renderable::render()
|
|
||||||
*/
|
|
||||||
public function render(\DOMDocument $domDocument) {
|
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
|
|
||||||
$quad = $this->getQuad();
|
$quad = $this->getQuad();
|
||||||
$frame->add($quad);
|
$frame->addChild($quad);
|
||||||
|
|
||||||
$entry = $this->buildEntry();
|
$entry = $this->getEntry();
|
||||||
$frame->add($entry);
|
$frame->addChild($entry);
|
||||||
$this->feature->setEntry($entry);
|
|
||||||
|
|
||||||
return $frame->render($domDocument);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
163
libs/FML/Components/CheckBoxDesign.php
Normal file
163
libs/FML/Components/CheckBoxDesign.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $name ValuePicker name
|
||||||
*/
|
*/
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ValuePickerFeature $feature ValuePicker Feature
|
||||||
|
*/
|
||||||
protected $feature = null;
|
protected $feature = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ValuePicker Component
|
* Create a new ValuePicker
|
||||||
*
|
*
|
||||||
* @param string $name (optional) CheckBox name
|
* @api
|
||||||
* @param array $values (optional) Possible values
|
* @param string $name (optional) ValuePicker name
|
||||||
* @param bool $default (optional) Default value
|
* @param string[] $values (optional) Possible values
|
||||||
|
* @param string $default (optional) Default value
|
||||||
* @param Label $label (optional) ValuePicker label
|
* @param Label $label (optional) ValuePicker label
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, array $values = array(), $default = null, Label $label = null) {
|
public function __construct($name = null, array $values = null, $default = null, Label $label = null)
|
||||||
|
{
|
||||||
$this->feature = new ValuePickerFeature();
|
$this->feature = new ValuePickerFeature();
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
|
}
|
||||||
|
if ($values) {
|
||||||
$this->setValues($values);
|
$this->setValues($values);
|
||||||
|
}
|
||||||
|
if ($default !== null) {
|
||||||
$this->setDefault($default);
|
$this->setDefault($default);
|
||||||
|
}
|
||||||
|
if ($label) {
|
||||||
$this->setLabel($label);
|
$this->setLabel($label);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Name
|
* Get the name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $name ValuePicker name
|
* @param string $name ValuePicker name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the possible values
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getValues()
|
||||||
|
{
|
||||||
|
return $this->feature->getValues();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the possible values
|
* Set the possible values
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param array $values Possible values
|
* @param array $values Possible values
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setValues(array $values) {
|
public function setValues(array $values)
|
||||||
|
{
|
||||||
$this->feature->setValues($values);
|
$this->feature->setValues($values);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default value
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDefault()
|
||||||
|
{
|
||||||
|
return $this->feature->getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the default value
|
* Set the default value
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param bool $default Default value
|
* @param bool $default Default value
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setDefault($default) {
|
public function setDefault($default)
|
||||||
|
{
|
||||||
$this->feature->setDefault($default);
|
$this->feature->setDefault($default);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the ValuePicker Label
|
* Get the Label
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return Label
|
||||||
|
*/
|
||||||
|
public function getLabel()
|
||||||
|
{
|
||||||
|
$label = $this->feature->getLabel();
|
||||||
|
if ($label) {
|
||||||
|
return $label;
|
||||||
|
}
|
||||||
|
return $this->createLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Label
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param Label $label ValuePicker Label
|
* @param Label $label ValuePicker Label
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLabel(Label $label = null) {
|
public function setLabel(Label $label)
|
||||||
|
{
|
||||||
$this->feature->setLabel($label);
|
$this->feature->setLabel($label);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ValuePicker Label
|
* Create the Label
|
||||||
*
|
*
|
||||||
* @param bool $createIfEmpty (optional) Create the Label if it's not set
|
* @return Label
|
||||||
* @return \FML\Controls\Label
|
|
||||||
*/
|
*/
|
||||||
public function getLabel($createIfEmpty = true) {
|
protected function createLabel()
|
||||||
if (!$this->feature->getLabel() && $createIfEmpty) {
|
{
|
||||||
$label = new Label();
|
$label = new Label();
|
||||||
$this->setLabel($label);
|
$this->setLabel($label);
|
||||||
}
|
return $label;
|
||||||
return $this->feature->getLabel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\ScriptFeatureable::getScriptFeatures()
|
* Get the hidden Entry
|
||||||
|
*
|
||||||
|
* @return Entry
|
||||||
*/
|
*/
|
||||||
public function getScriptFeatures() {
|
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());
|
return ScriptFeature::collect($this->feature, $this->getLabel(), $this->feature->getEntry());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Renderable::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
|
{
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
|
|
||||||
$label = $this->getLabel();
|
$label = $this->getLabel();
|
||||||
$frame->add($label);
|
$frame->addChild($label);
|
||||||
|
|
||||||
$entry = $this->buildEntry();
|
$entry = $this->getEntry();
|
||||||
$frame->add($entry);
|
$frame->addChild($entry);
|
||||||
$this->feature->setEntry($entry);
|
|
||||||
|
|
||||||
return $frame->render($domDocument);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $data Data url
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'audio';
|
|
||||||
protected $data = null;
|
protected $data = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $dataId Data id
|
||||||
|
*/
|
||||||
protected $dataId = null;
|
protected $dataId = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $play Play automaticcaly
|
||||||
|
*/
|
||||||
protected $play = null;
|
protected $play = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $looping Looping
|
||||||
|
*/
|
||||||
protected $looping = true;
|
protected $looping = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $music Music type
|
||||||
|
*/
|
||||||
protected $music = null;
|
protected $music = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float $volume Volume
|
||||||
|
*/
|
||||||
protected $volume = 1.;
|
protected $volume = 1.;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $scriptEvents Script events usage
|
||||||
|
*/
|
||||||
protected $scriptEvents = null;
|
protected $scriptEvents = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Controls\Control::getManiaScriptClass()
|
* @var string $scriptAction Script action
|
||||||
*/
|
*/
|
||||||
public function getManiaScriptClass() {
|
protected $scriptAction = null;
|
||||||
return 'CMlMediaPlayer';
|
|
||||||
|
/**
|
||||||
|
* @var string[] $scriptActionParameters Script action parameters
|
||||||
|
*/
|
||||||
|
protected $scriptActionParameters = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::getData()
|
||||||
|
*/
|
||||||
|
public function getData()
|
||||||
|
{
|
||||||
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setData()
|
* @see Playable::setData()
|
||||||
*/
|
*/
|
||||||
public function setData($data) {
|
public function setData($data)
|
||||||
|
{
|
||||||
$this->data = (string)$data;
|
$this->data = (string)$data;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setDataId()
|
* @see Playable::getDataId()
|
||||||
*/
|
*/
|
||||||
public function setDataId($dataId) {
|
public function getDataId()
|
||||||
|
{
|
||||||
|
return $this->dataId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::setDataId()
|
||||||
|
*/
|
||||||
|
public function setDataId($dataId)
|
||||||
|
{
|
||||||
$this->dataId = (string)$dataId;
|
$this->dataId = (string)$dataId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setPlay()
|
* @see Playable::getPlay()
|
||||||
*/
|
*/
|
||||||
public function setPlay($play) {
|
public function getPlay()
|
||||||
$this->play = ($play ? 1 : 0);
|
{
|
||||||
|
return $this->play;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::setPlay()
|
||||||
|
*/
|
||||||
|
public function setPlay($play)
|
||||||
|
{
|
||||||
|
$this->play = (bool)$play;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setLooping()
|
* @see Playable::getLooping()
|
||||||
*/
|
*/
|
||||||
public function setLooping($looping) {
|
public function getLooping()
|
||||||
$this->looping = ($looping ? 1 : 0);
|
{
|
||||||
|
return $this->looping;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::setLooping()
|
||||||
|
*/
|
||||||
|
public function setLooping($looping)
|
||||||
|
{
|
||||||
|
$this->looping = (bool)$looping;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setMusic()
|
* @see Playable::getMusic()
|
||||||
*/
|
*/
|
||||||
public function setMusic($music) {
|
public function getMusic()
|
||||||
$this->music = ($music ? 1 : 0);
|
{
|
||||||
|
return $this->music;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::setMusic()
|
||||||
|
*/
|
||||||
|
public function setMusic($music)
|
||||||
|
{
|
||||||
|
$this->music = (bool)$music;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setVolume()
|
* @see Playable::getVolume()
|
||||||
*/
|
*/
|
||||||
public function setVolume($volume) {
|
public function getVolume()
|
||||||
|
{
|
||||||
|
return $this->volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::setVolume()
|
||||||
|
*/
|
||||||
|
public function setVolume($volume)
|
||||||
|
{
|
||||||
$this->volume = (float)$volume;
|
$this->volume = (float)$volume;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
* @see Scriptable::getScriptEvents()
|
||||||
*/
|
*/
|
||||||
public function setScriptEvents($scriptEvents) {
|
public function getScriptEvents()
|
||||||
$this->scriptEvents = ($scriptEvents ? 1 : 0);
|
{
|
||||||
|
return $this->scriptEvents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Scriptable::setScriptEvents()
|
||||||
|
*/
|
||||||
|
public function setScriptEvents($scriptEvents)
|
||||||
|
{
|
||||||
|
$this->scriptEvents = (bool)$scriptEvents;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Scriptable::getScriptAction()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function getScriptAction()
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
|
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) {
|
if ($this->data) {
|
||||||
$xmlElement->setAttribute('data', $this->data);
|
$domElement->setAttribute("data", $this->data);
|
||||||
|
}
|
||||||
|
if ($this->dataId) {
|
||||||
|
$domElement->setAttribute("dataid", $this->dataId);
|
||||||
}
|
}
|
||||||
if ($this->play) {
|
if ($this->play) {
|
||||||
$xmlElement->setAttribute('play', $this->play);
|
$domElement->setAttribute("play", 1);
|
||||||
}
|
}
|
||||||
if (!$this->looping) {
|
if (!$this->looping) {
|
||||||
$xmlElement->setAttribute('looping', $this->looping);
|
$domElement->setAttribute("looping", 0);
|
||||||
}
|
}
|
||||||
if ($this->music) {
|
if ($this->music) {
|
||||||
$xmlElement->setAttribute('music', $this->music);
|
$domElement->setAttribute("music", 1);
|
||||||
}
|
}
|
||||||
if ($this->volume != 1.) {
|
if ($this->volume != 1.) {
|
||||||
$xmlElement->setAttribute('volume', $this->volume);
|
$domElement->setAttribute("volume", $this->volume);
|
||||||
}
|
}
|
||||||
if ($this->scriptEvents) {
|
if ($this->scriptEvents) {
|
||||||
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
|
$domElement->setAttribute("scriptevents", 1);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
if ($this->scriptAction) {
|
||||||
|
$scriptAction = array($this->scriptAction);
|
||||||
|
if ($this->scriptActionParameters) {
|
||||||
|
$scriptAction = array_merge($scriptAction, $this->scriptActionParameters);
|
||||||
}
|
}
|
||||||
|
$domElement->setAttribute("scriptaction", implode("'", $scriptAction));
|
||||||
|
}
|
||||||
|
return $domElement;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -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,49 +14,115 @@ 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
|
* Constants
|
||||||
|
*/
|
||||||
|
const FORMAT_Default = "Default";
|
||||||
|
const FORMAT_Password = "Password";
|
||||||
|
const FORMAT_NewPassword = "NewPassword";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $name Entry name
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'entry';
|
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $default Default value
|
||||||
|
*/
|
||||||
protected $default = null;
|
protected $default = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $selectText Select text
|
||||||
|
*/
|
||||||
|
protected $selectText = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @var bool $autoNewLine Auto new line
|
||||||
|
*/
|
||||||
protected $autoNewLine = null;
|
protected $autoNewLine = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $textFormat Text format
|
||||||
|
*/
|
||||||
|
protected $textFormat = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $scriptEvents Script events usage
|
||||||
|
*/
|
||||||
protected $scriptEvents = null;
|
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;
|
protected $style = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $textColor Text color
|
||||||
|
*/
|
||||||
protected $textColor = null;
|
protected $textColor = null;
|
||||||
protected $textSize = -1;
|
|
||||||
|
/**
|
||||||
|
* @var int $textSize Text size
|
||||||
|
*/
|
||||||
|
protected $textSize = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $textFont Text font
|
||||||
|
*/
|
||||||
protected $textFont = null;
|
protected $textFont = null;
|
||||||
protected $focusAreaColor1 = null;
|
|
||||||
protected $focusAreaColor2 = null;
|
/**
|
||||||
|
* @var string $areaColor Area color
|
||||||
|
*/
|
||||||
|
protected $areaColor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $focusAreaColor Focus area color
|
||||||
|
*/
|
||||||
|
protected $focusAreaColor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $autoComplete Auto complete
|
||||||
|
*/
|
||||||
protected $autoComplete = null;
|
protected $autoComplete = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Controls\Control::getManiaScriptClass()
|
* Get the name
|
||||||
*/
|
|
||||||
public function getManiaScriptClass() {
|
|
||||||
return 'CMlEntry';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Entry name
|
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName() {
|
public function getName()
|
||||||
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Entry name
|
* Set the name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Entry name
|
* @param string $name Entry name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -63,94 +130,266 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
|||||||
/**
|
/**
|
||||||
* Get the default value
|
* Get the default value
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getDefault() {
|
public function getDefault()
|
||||||
|
{
|
||||||
return $this->default;
|
return $this->default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set default value
|
* Set the default value
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $default Default value
|
* @param string $default Default value
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setDefault($default) {
|
public function setDefault($default)
|
||||||
|
{
|
||||||
$this->default = $default;
|
$this->default = $default;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\NewLineable::setAutoNewLine()
|
* Get select text
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function setAutoNewLine($autoNewLine) {
|
public function getSelectText()
|
||||||
$this->autoNewLine = ($autoNewLine ? 1 : 0);
|
{
|
||||||
|
return $this->selectText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set select text
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param bool $selectText Select text
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setSelectText($selectText)
|
||||||
|
{
|
||||||
|
$this->selectText = $selectText;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
* @see NewLineable::getAutoNewLine()
|
||||||
*/
|
*/
|
||||||
public function setScriptEvents($scriptEvents) {
|
public function getAutoNewLine()
|
||||||
$this->scriptEvents = ($scriptEvents ? 1 : 0);
|
{
|
||||||
|
return $this->autoNewLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see NewLineable::setAutoNewLine()
|
||||||
|
*/
|
||||||
|
public function setAutoNewLine($autoNewLine)
|
||||||
|
{
|
||||||
|
$this->autoNewLine = (bool)$autoNewLine;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Styleable::setStyle()
|
* Get text format
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function setStyle($style) {
|
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;
|
$this->style = (string)$style;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setTextColor()
|
* @see TextFormatable::getTextColor()
|
||||||
*/
|
*/
|
||||||
public function setTextColor($textColor) {
|
public function getTextColor()
|
||||||
|
{
|
||||||
|
return $this->textColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setTextColor()
|
||||||
|
*/
|
||||||
|
public function setTextColor($textColor)
|
||||||
|
{
|
||||||
$this->textColor = (string)$textColor;
|
$this->textColor = (string)$textColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setTextSize()
|
* @see TextFormatable::getTextSize()
|
||||||
*/
|
*/
|
||||||
public function setTextSize($textSize) {
|
public function getTextSize()
|
||||||
|
{
|
||||||
|
return $this->textSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setTextSize()
|
||||||
|
*/
|
||||||
|
public function setTextSize($textSize)
|
||||||
|
{
|
||||||
$this->textSize = (int)$textSize;
|
$this->textSize = (int)$textSize;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setTextFont()
|
* @see TextFormatable::getTextFont()
|
||||||
*/
|
*/
|
||||||
public function setTextFont($textFont) {
|
public function getTextFont()
|
||||||
|
{
|
||||||
|
return $this->textFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setTextFont()
|
||||||
|
*/
|
||||||
|
public function setTextFont($textFont)
|
||||||
|
{
|
||||||
$this->textFont = (string)$textFont;
|
$this->textFont = (string)$textFont;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setAreaColor()
|
* @see TextFormatable::getAreaColor()
|
||||||
*/
|
*/
|
||||||
public function setAreaColor($areaColor) {
|
public function getAreaColor()
|
||||||
$this->focusAreaColor1 = (string)$areaColor;
|
{
|
||||||
|
return $this->areaColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setAreaColor()
|
||||||
|
*/
|
||||||
|
public function setAreaColor($areaColor)
|
||||||
|
{
|
||||||
|
$this->areaColor = (string)$areaColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setAreaFocusColor()
|
* @see TextFormatable::getAreaFocusColor()
|
||||||
*/
|
*/
|
||||||
public function setAreaFocusColor($areaFocusColor) {
|
public function getAreaFocusColor()
|
||||||
$this->focusAreaColor2 = (string)$areaFocusColor;
|
{
|
||||||
|
return $this->focusAreaColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setAreaFocusColor()
|
||||||
|
*/
|
||||||
|
public function setAreaFocusColor($areaFocusColor)
|
||||||
|
{
|
||||||
|
$this->focusAreaColor = (string)$areaFocusColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get auto completion
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getAutoComplete()
|
||||||
|
{
|
||||||
|
return $this->autoComplete;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set auto completion
|
* Set auto completion
|
||||||
*
|
*
|
||||||
* @param bool $autoComplete Whether the default value should be automatically completed based on the current request parameters
|
* @api
|
||||||
|
* @param bool $autoComplete Automatically complete the default value based on the current request parameters
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setAutoComplete($autoComplete) {
|
public function setAutoComplete($autoComplete)
|
||||||
|
{
|
||||||
$this->autoComplete = (bool)$autoComplete;
|
$this->autoComplete = (bool)$autoComplete;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -158,60 +397,87 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
|||||||
/**
|
/**
|
||||||
* Add a dynamic Feature submitting the Entry
|
* Add a dynamic Feature submitting the Entry
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Submit url
|
* @param string $url Submit url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addSubmitFeature($url) {
|
public function addSubmitFeature($url)
|
||||||
|
{
|
||||||
$entrySubmit = new EntrySubmit($this, $url);
|
$entrySubmit = new EntrySubmit($this, $url);
|
||||||
$this->addScriptFeature($entrySubmit);
|
return $this->addScriptFeature($entrySubmit);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Control::getTagName()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function getTagName()
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
|
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) {
|
if ($this->name) {
|
||||||
$xmlElement->setAttribute('name', $this->name);
|
$domElement->setAttribute("name", $this->name);
|
||||||
}
|
}
|
||||||
if ($this->default !== null) {
|
if ($this->default !== null) {
|
||||||
$xmlElement->setAttribute('default', $this->default);
|
$domElement->setAttribute("default", $this->default);
|
||||||
} else if ($this->autoComplete) {
|
} else if ($this->autoComplete) {
|
||||||
$value = null;
|
$value = Parameters::getValue($this->name);
|
||||||
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) {
|
if ($value) {
|
||||||
$xmlElement->setAttribute('default', $value);
|
$domElement->setAttribute("default", $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->selectText) {
|
||||||
|
$domElement->setAttribute("selecttext", 1);
|
||||||
|
}
|
||||||
if ($this->autoNewLine) {
|
if ($this->autoNewLine) {
|
||||||
$xmlElement->setAttribute('autonewline', $this->autoNewLine);
|
$domElement->setAttribute("autonewline", 1);
|
||||||
|
}
|
||||||
|
if ($this->textFormat) {
|
||||||
|
$domElement->setAttribute("textformat", $this->textFormat);
|
||||||
}
|
}
|
||||||
if ($this->scriptEvents) {
|
if ($this->scriptEvents) {
|
||||||
$xmlElement->setAttribute('scriptevents', $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) {
|
if ($this->style) {
|
||||||
$xmlElement->setAttribute('style', $this->style);
|
$domElement->setAttribute("style", $this->style);
|
||||||
}
|
}
|
||||||
if ($this->textColor) {
|
if ($this->textColor) {
|
||||||
$xmlElement->setAttribute('textcolor', $this->textColor);
|
$domElement->setAttribute("textcolor", $this->textColor);
|
||||||
}
|
}
|
||||||
if ($this->textSize >= 0.) {
|
if ($this->textSize) {
|
||||||
$xmlElement->setAttribute('textsize', $this->textSize);
|
$domElement->setAttribute("textsize", $this->textSize);
|
||||||
}
|
}
|
||||||
if ($this->textFont) {
|
if ($this->textFont) {
|
||||||
$xmlElement->setAttribute('textfont', $this->textFont);
|
$domElement->setAttribute("textfont", $this->textFont);
|
||||||
}
|
}
|
||||||
if ($this->focusAreaColor1) {
|
if ($this->areaColor) {
|
||||||
$xmlElement->setAttribute('focusareacolor1', $this->focusAreaColor1);
|
$domElement->setAttribute("focusareacolor1", $this->areaColor);
|
||||||
}
|
}
|
||||||
if ($this->focusAreaColor2) {
|
if ($this->focusAreaColor) {
|
||||||
$xmlElement->setAttribute('focusareacolor2', $this->focusAreaColor2);
|
$domElement->setAttribute("focusareacolor2", $this->focusAreaColor);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $folder Folder
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'fileentry';
|
|
||||||
protected $folder = null;
|
protected $folder = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Controls\Control::getManiaScriptClass()
|
* Get the folder
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getManiaScriptClass() {
|
public function getFolder()
|
||||||
return 'CMlFileEntry';
|
{
|
||||||
|
return $this->folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the base folder
|
* Set the folder
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $folder Base folder
|
* @param string $folder Base folder
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setFolder($folder) {
|
public function setFolder($folder)
|
||||||
|
{
|
||||||
$this->folder = (string)$folder;
|
$this->folder = (string)$folder;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Control::getTagName()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function getTagName()
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
|
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) {
|
if ($this->folder) {
|
||||||
$xmlElement->setAttribute('folder', $this->folder);
|
$domElement->setAttribute("folder", $this->folder);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,30 +12,44 @@ 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
|
|
||||||
|
/**
|
||||||
|
* @var Renderable[] $children Children
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'frame';
|
|
||||||
/** @var Renderable[] $children */
|
|
||||||
protected $children = array();
|
protected $children = array();
|
||||||
/** @var Format $format */
|
|
||||||
|
/**
|
||||||
|
* @var Format $format Format
|
||||||
|
*/
|
||||||
protected $format = null;
|
protected $format = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Controls\Control::getManiaScriptClass()
|
* @see Container::getChildren()
|
||||||
*/
|
*/
|
||||||
public function getManiaScriptClass() {
|
public function getChildren()
|
||||||
return 'CMlFrame';
|
{
|
||||||
|
return $this->children;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Container::add()
|
* @see Container::addChild()
|
||||||
|
* @deprecated use addChild() instead
|
||||||
*/
|
*/
|
||||||
public function add(Renderable $child) {
|
public function add(Renderable $child)
|
||||||
|
{
|
||||||
|
return $this->addChild($child);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Container::addChild()
|
||||||
|
*/
|
||||||
|
public function addChild(Renderable $child)
|
||||||
|
{
|
||||||
if (!in_array($child, $this->children, true)) {
|
if (!in_array($child, $this->children, true)) {
|
||||||
array_push($this->children, $child);
|
array_push($this->children, $child);
|
||||||
}
|
}
|
||||||
@ -43,35 +57,63 @@ class Frame extends Control implements Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Container::removeChildren()
|
* @see Container::addChildren()
|
||||||
*/
|
*/
|
||||||
public function removeChildren() {
|
public function addChildren(array $children)
|
||||||
|
{
|
||||||
|
foreach ($children as $child) {
|
||||||
|
$this->addChild($child);
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Container::removeAllChildren()
|
||||||
|
*/
|
||||||
|
public function removeAllChildren()
|
||||||
|
{
|
||||||
$this->children = array();
|
$this->children = array();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Container::getFormat()
|
* @see Container::getFormat()
|
||||||
*/
|
*/
|
||||||
public function getFormat($createIfEmpty = true) {
|
public function getFormat()
|
||||||
if (!$this->format && $createIfEmpty) {
|
{
|
||||||
$this->setFormat(new Format());
|
|
||||||
}
|
|
||||||
return $this->format;
|
return $this->format;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Container::setFormat()
|
* @see Container::setFormat()
|
||||||
*/
|
*/
|
||||||
public function setFormat(Format $format) {
|
public function setFormat(Format $format = null)
|
||||||
|
{
|
||||||
$this->format = $format;
|
$this->format = $format;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Controls\Control::getScriptFeatures()
|
* @see Control::getTagName()
|
||||||
*/
|
*/
|
||||||
public function getScriptFeatures() {
|
public function getTagName()
|
||||||
|
{
|
||||||
|
return "frame";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Control::getManiaScriptClass()
|
||||||
|
*/
|
||||||
|
public function getManiaScriptClass()
|
||||||
|
{
|
||||||
|
return "CMlFrame";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Control::getScriptFeatures()
|
||||||
|
*/
|
||||||
|
public function getScriptFeatures()
|
||||||
|
{
|
||||||
$scriptFeatures = $this->scriptFeatures;
|
$scriptFeatures = $this->scriptFeatures;
|
||||||
foreach ($this->children as $child) {
|
foreach ($this->children as $child) {
|
||||||
if ($child instanceof ScriptFeatureable) {
|
if ($child instanceof ScriptFeatureable) {
|
||||||
@ -82,18 +124,20 @@ class Frame extends Control implements Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Renderable::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
|
$domElement = parent::render($domDocument);
|
||||||
if ($this->format) {
|
if ($this->format) {
|
||||||
$formatXml = $this->format->render($domDocument);
|
$formatXml = $this->format->render($domDocument);
|
||||||
$xmlElement->appendChild($formatXml);
|
$domElement->appendChild($formatXml);
|
||||||
}
|
}
|
||||||
foreach ($this->children as $child) {
|
foreach ($this->children as $child) {
|
||||||
$childXmlElement = $child->render($domDocument);
|
$childXmlElement = $child->render($domDocument);
|
||||||
$xmlElement->appendChild($childXmlElement);
|
$domElement->appendChild($childXmlElement);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,16 +10,18 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
const STYLE_BaseStation = 'BaseStation';
|
const STYLE_BaseStation = 'BaseStation';
|
||||||
const STYLE_BaseBoxCase = 'BaseBoxCase';
|
const STYLE_BaseBoxCase = 'BaseBoxCase';
|
||||||
const STYLE_Titlelogo = 'Titlelogo';
|
const STYLE_TitleLogo = 'Titlelogo';
|
||||||
const STYLE_ButtonBack = 'ButtonBack';
|
const STYLE_ButtonBack = 'ButtonBack';
|
||||||
const STYLE_ButtonNav = 'ButtonNav';
|
const STYLE_ButtonNav = 'ButtonNav';
|
||||||
const STYLE_ButtonH = 'ButtonH';
|
const STYLE_ButtonH = 'ButtonH';
|
||||||
@ -28,61 +30,164 @@ class Frame3d extends Frame implements Scriptable {
|
|||||||
const STYLE_TitleEditor = 'TitleEditor';
|
const STYLE_TitleEditor = 'TitleEditor';
|
||||||
const STYLE_Window = 'Window';
|
const STYLE_Window = 'Window';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style3dId Style3d id
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'frame3d';
|
|
||||||
protected $style3dId = null;
|
protected $style3dId = null;
|
||||||
/** @var Style3d $style3d */
|
|
||||||
|
/**
|
||||||
|
* @var Style3d $style3d Style3d
|
||||||
|
*/
|
||||||
protected $style3d = null;
|
protected $style3d = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $scriptEvents Script events usage
|
||||||
|
*/
|
||||||
protected $scriptEvents = null;
|
protected $scriptEvents = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Style3d id
|
* @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
|
* @param string $style3dId Style3d id
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setStyle3dId($style3dId) {
|
public function setStyle3dId($style3dId)
|
||||||
|
{
|
||||||
$this->style3dId = (string)$style3dId;
|
$this->style3dId = (string)$style3dId;
|
||||||
$this->style3d = null;
|
$this->style3d = null;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Style3d
|
* Get the Style3d
|
||||||
*
|
*
|
||||||
* @param Style3d $style3d Style3d object
|
* @api
|
||||||
|
* @return Style3d
|
||||||
|
*/
|
||||||
|
public function getStyle3d()
|
||||||
|
{
|
||||||
|
return $this->style3d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Style3d
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param Style3d $style3d Style3d
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setStyle3d(Style3d $style3d) {
|
public function setStyle3d(Style3d $style3d)
|
||||||
$this->style3d = $style3d;
|
{
|
||||||
$this->style3dId = null;
|
$this->style3dId = null;
|
||||||
|
$this->style3d = $style3d;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
* @see Scriptable::getScriptEvents()
|
||||||
*/
|
*/
|
||||||
public function setScriptEvents($scriptEvents) {
|
public function getScriptEvents()
|
||||||
$this->scriptEvents = ($scriptEvents ? 1 : 0);
|
{
|
||||||
|
return $this->scriptEvents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Scriptable::setScriptEvents()
|
||||||
|
*/
|
||||||
|
public function setScriptEvents($scriptEvents)
|
||||||
|
{
|
||||||
|
$this->scriptEvents = (bool)$scriptEvents;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Scriptable::getScriptAction()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function getScriptAction()
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
|
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) {
|
if ($this->style3d) {
|
||||||
$this->style3d->checkId();
|
$this->style3d->checkId();
|
||||||
$xmlElement->setAttribute('style3d', $this->style3d->getId());
|
$domElement->setAttribute("style3d", $this->style3d->getId());
|
||||||
} else if ($this->style3dId) {
|
} else if ($this->style3dId) {
|
||||||
$xmlElement->setAttribute('style3d', $this->style3dId);
|
$domElement->setAttribute("style3d", $this->style3dId);
|
||||||
}
|
}
|
||||||
if ($this->scriptEvents) {
|
if ($this->scriptEvents) {
|
||||||
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
|
$domElement->setAttribute("scriptevents", 1);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
if ($this->scriptAction) {
|
||||||
|
$scriptAction = array($this->scriptAction);
|
||||||
|
if ($this->scriptActionParameters) {
|
||||||
|
$scriptAction = array_merge($scriptAction, $this->scriptActionParameters);
|
||||||
}
|
}
|
||||||
|
$domElement->setAttribute("scriptaction", implode("'", $scriptAction));
|
||||||
|
}
|
||||||
|
return $domElement;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $modelId FrameModel id
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'frameinstance';
|
|
||||||
protected $modelId = null;
|
protected $modelId = null;
|
||||||
/** @var FrameModel $model */
|
|
||||||
|
/**
|
||||||
|
* @var FrameModel $model FrameModel
|
||||||
|
*/
|
||||||
protected $model = null;
|
protected $model = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Frame Instance object
|
* Get the FrameModel id
|
||||||
*
|
*
|
||||||
* @param string $modelId (optional) Frame Model id
|
* @api
|
||||||
* @param string $controlId (optional) Frame id
|
* @return string
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public static function create($modelId = null, $controlId = null) {
|
public function getModelId()
|
||||||
return new static($modelId, $controlId);
|
{
|
||||||
|
return $this->modelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Frame Instance object
|
* Set the FrameModel id
|
||||||
*
|
|
||||||
* @param string $modelId (optional) Frame Model id
|
|
||||||
* @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
|
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $modelId FrameModel id
|
* @param string $modelId FrameModel id
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setModelId($modelId) {
|
public function setModelId($modelId)
|
||||||
|
{
|
||||||
$this->modelId = (string)$modelId;
|
$this->modelId = (string)$modelId;
|
||||||
$this->model = null;
|
$this->model = null;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Frame Model
|
* Get the FrameModel
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return FrameModel
|
||||||
|
*/
|
||||||
|
public function getModel()
|
||||||
|
{
|
||||||
|
return $this->model;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the FrameModel
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param FrameModel $frameModel FrameModel
|
* @param FrameModel $frameModel FrameModel
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setModel(FrameModel $frameModel) {
|
public function setModel(FrameModel $frameModel)
|
||||||
$this->model = $frameModel;
|
{
|
||||||
$this->modelId = null;
|
$this->modelId = null;
|
||||||
|
$this->model = $frameModel;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Controls\Control::getManiaScriptClass()
|
* @see Control::getTagName()
|
||||||
*/
|
*/
|
||||||
public function getManiaScriptClass() {
|
public function getTagName()
|
||||||
return 'CMlFrame';
|
{
|
||||||
|
return "frameinstance";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Renderable::render()
|
* @see Control::getManiaScriptClass()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function getManiaScriptClass()
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
|
return "CMlFrame";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Renderable::render()
|
||||||
|
*/
|
||||||
|
public function render(\DOMDocument $domDocument)
|
||||||
|
{
|
||||||
|
$domElement = parent::render($domDocument);
|
||||||
if ($this->model) {
|
if ($this->model) {
|
||||||
$this->model->checkId();
|
$this->model->checkId();
|
||||||
$xmlElement->setAttribute('modelid', $this->model->getId());
|
$domElement->setAttribute("modelid", $this->model->getId());
|
||||||
} else if ($this->modelId) {
|
} else if ($this->modelId) {
|
||||||
$xmlElement->setAttribute('modelid', $this->modelId);
|
$domElement->setAttribute("modelid", $this->modelId);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
* Constants
|
||||||
*/
|
*/
|
||||||
const STYLE_BgCard = 'BgCard';
|
const STYLE_BgCard = "BgCard";
|
||||||
const STYLE_EnergyBar = 'EnergyBar';
|
const STYLE_EnergyBar = "EnergyBar";
|
||||||
const STYLE_ProgressBar = 'ProgressBar';
|
const STYLE_ProgressBar = "ProgressBar";
|
||||||
const STYLE_ProgressBarSmall = 'ProgressBarSmall';
|
const STYLE_ProgressBarSmall = "ProgressBarSmall";
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var float $ratio Ratio
|
||||||
|
*/
|
||||||
|
protected $ratio = 0.0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float $grading Grading
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'gauge';
|
|
||||||
protected $ratio = 0.;
|
|
||||||
protected $grading = 1.;
|
protected $grading = 1.;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $color Color
|
||||||
|
*/
|
||||||
protected $color = null;
|
protected $color = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $centered Centered
|
||||||
|
*/
|
||||||
protected $centered = null;
|
protected $centered = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $clan Clan number
|
||||||
|
*/
|
||||||
protected $clan = null;
|
protected $clan = null;
|
||||||
protected $drawBg = 1;
|
|
||||||
protected $drawBlockBg = 1;
|
/**
|
||||||
|
* @var bool $drawBackground Draw background
|
||||||
|
*/
|
||||||
|
protected $drawBackground = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $drawBlockBackground Draw block background
|
||||||
|
*/
|
||||||
|
protected $drawBlockBackground = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $style Style
|
||||||
|
*/
|
||||||
protected $style = null;
|
protected $style = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Controls\Control::getManiaScriptClass()
|
* Get the ratio
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getManiaScriptClass() {
|
public function getRatio()
|
||||||
return 'CMlGauge';
|
{
|
||||||
|
return $this->ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ratio
|
* Set the ratio
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param float $ratio Ratio value
|
* @param float $ratio Ratio value
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setRatio($ratio) {
|
public function setRatio($ratio)
|
||||||
|
{
|
||||||
$this->ratio = (float)$ratio;
|
$this->ratio = (float)$ratio;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set grading
|
* Get the grading
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getGrading()
|
||||||
|
{
|
||||||
|
return $this->grading;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the grading
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param float $grading Grading value
|
* @param float $grading Grading value
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setGrading($grading) {
|
public function setGrading($grading)
|
||||||
|
{
|
||||||
$this->grading = (float)$grading;
|
$this->grading = (float)$grading;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set color
|
* @see Colorable::getColor
|
||||||
*
|
|
||||||
* @param string $color Gauge color
|
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function setColor($color) {
|
public function getColor()
|
||||||
|
{
|
||||||
|
return $this->color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Colorable::setColor
|
||||||
|
*/
|
||||||
|
public function setColor($color)
|
||||||
|
{
|
||||||
$this->color = (string)$color;
|
$this->color = (string)$color;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get centered
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getCentered()
|
||||||
|
{
|
||||||
|
return $this->centered;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set centered
|
* Set centered
|
||||||
*
|
*
|
||||||
* @param bool $centered Whether the Gauge is centered
|
* @api
|
||||||
|
* @param bool $centered If the Gauge should be centered
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setCentered($centered) {
|
public function setCentered($centered)
|
||||||
$this->centered = ($centered ? 1 : 0);
|
{
|
||||||
|
$this->centered = (bool)$centered;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set clan
|
* Get the clan
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getClan()
|
||||||
|
{
|
||||||
|
return $this->clan;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the clan
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param int $clan Clan number
|
* @param int $clan Clan number
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setClan($clan) {
|
public function setClan($clan)
|
||||||
|
{
|
||||||
$this->clan = (int)$clan;
|
$this->clan = (int)$clan;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get draw background
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getDrawBackground()
|
||||||
|
{
|
||||||
|
return $this->drawBackground;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set draw background
|
* Set draw background
|
||||||
*
|
*
|
||||||
* @param bool $drawBg Whether the Gauges background should be drawn
|
* @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
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setDrawBg($drawBg) {
|
public function setDrawBackground($drawBackground)
|
||||||
$this->drawBg = ($drawBg ? 1 : 0);
|
{
|
||||||
|
$this->drawBackground = (bool)$drawBackground;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get draw block background
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getDrawBlockBackground()
|
||||||
|
{
|
||||||
|
return $this->drawBlockBackground;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set draw block background
|
* Set draw block background
|
||||||
*
|
*
|
||||||
* @param bool $drawBlockBg Whether the Gauges block background should be drawn
|
* @api
|
||||||
|
* @param bool $drawBlockBackground If the Gauges block background should be drawn
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setDrawBlockBg($drawBlockBg) {
|
public function setDrawBlockBackground($drawBlockBackground)
|
||||||
$this->drawBlockBg = ($drawBlockBg ? 1 : 0);
|
{
|
||||||
|
$this->drawBlockBackground = (bool)$drawBlockBackground;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Styleable::setStyle()
|
* @see Styleable::getStyle()
|
||||||
*/
|
*/
|
||||||
public function setStyle($style) {
|
public function getStyle()
|
||||||
|
{
|
||||||
|
return $this->style;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Styleable::setStyle()
|
||||||
|
*/
|
||||||
|
public function setStyle($style)
|
||||||
|
{
|
||||||
$this->style = (string)$style;
|
$this->style = (string)$style;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Control::render()
|
* @see Control::getTagName()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function getTagName()
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
|
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) {
|
if ($this->ratio) {
|
||||||
$xmlElement->setAttribute('ratio', $this->ratio);
|
$domElement->setAttribute("ratio", $this->ratio);
|
||||||
}
|
}
|
||||||
if ($this->grading != 1.) {
|
if ($this->grading != 1.) {
|
||||||
$xmlElement->setAttribute('grading', $this->grading);
|
$domElement->setAttribute("grading", $this->grading);
|
||||||
}
|
}
|
||||||
if ($this->color) {
|
if ($this->color) {
|
||||||
$xmlElement->setAttribute('color', $this->color);
|
$domElement->setAttribute("color", $this->color);
|
||||||
}
|
}
|
||||||
if ($this->centered) {
|
if ($this->centered) {
|
||||||
$xmlElement->setAttribute('centered', $this->centered);
|
$domElement->setAttribute("centered", 1);
|
||||||
}
|
}
|
||||||
if ($this->clan) {
|
if ($this->clan) {
|
||||||
$xmlElement->setAttribute('clan', $this->clan);
|
$domElement->setAttribute("clan", $this->clan);
|
||||||
}
|
}
|
||||||
if (!$this->drawBg) {
|
if (!$this->drawBackground) {
|
||||||
$xmlElement->setAttribute('drawbg', $this->drawBg);
|
$domElement->setAttribute("drawbg", 0);
|
||||||
}
|
}
|
||||||
if (!$this->drawBlockBg) {
|
if (!$this->drawBlockBackground) {
|
||||||
$xmlElement->setAttribute('drawblockbg', $this->drawBlockBg);
|
$domElement->setAttribute("drawblockbg", 0);
|
||||||
}
|
}
|
||||||
if ($this->style) {
|
if ($this->style) {
|
||||||
$xmlElement->setAttribute('style', $this->style);
|
$domElement->setAttribute("style", $this->style);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
82
libs/FML/Controls/Graph.php
Normal file
82
libs/FML/Controls/Graph.php
Normal 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";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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';
|
|
||||||
|
/**
|
||||||
|
* @var string $textId Text ID
|
||||||
|
*/
|
||||||
|
protected $textId = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $textPrefix Text prefix
|
||||||
|
*/
|
||||||
|
protected $textPrefix = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $textEmboss Text emboss
|
||||||
|
*/
|
||||||
|
protected $textEmboss = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $translate Translate text
|
||||||
|
*/
|
||||||
|
protected $translate = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $maxLines Maximum lines
|
||||||
|
*/
|
||||||
|
protected $maxLines = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float $opacity Opacity
|
||||||
|
*/
|
||||||
|
protected $opacity = 1.;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $action Action
|
||||||
|
*/
|
||||||
|
protected $action = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $actionKey Action key
|
||||||
|
*/
|
||||||
|
protected $actionKey = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Url
|
||||||
|
*/
|
||||||
|
protected $url = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $urlId Url ID
|
||||||
|
*/
|
||||||
|
protected $urlId = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $manialink Manialink
|
||||||
|
*/
|
||||||
|
protected $manialink = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $manialinkId Manialink ID
|
||||||
|
*/
|
||||||
|
protected $manialinkId = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $autoNewLine Automatic new line
|
||||||
|
*/
|
||||||
|
protected $autoNewLine = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float $lineSpacing Line spacing
|
||||||
|
*/
|
||||||
|
protected $lineSpacing = -1.;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 int $textSize Text size
|
||||||
|
*/
|
||||||
|
protected $textSize = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $textFont Text font
|
||||||
|
*/
|
||||||
|
protected $textFont = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $textColor Text color
|
||||||
|
*/
|
||||||
|
protected $textColor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $areaColor Area color
|
||||||
|
*/
|
||||||
|
protected $areaColor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $focusAreaColor Focus area color
|
||||||
|
*/
|
||||||
|
protected $focusAreaColor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the text
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getText()
|
||||||
|
{
|
||||||
|
return $this->text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set text
|
* Set the text
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $text Text value
|
* @param string $text Text value
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setText($text) {
|
public function setText($text)
|
||||||
|
{
|
||||||
$this->text = (string)$text;
|
$this->text = (string)$text;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set text id to use from Dico
|
* 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
|
* @param string $textId Text id
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setTextId($textId) {
|
public function setTextId($textId)
|
||||||
|
{
|
||||||
$this->textId = (string)$textId;
|
$this->textId = (string)$textId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set text prefix
|
* Get the text prefix
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTextPrefix()
|
||||||
|
{
|
||||||
|
return $this->textPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text prefix
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $textPrefix Text prefix
|
* @param string $textPrefix Text prefix
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setTextPrefix($textPrefix) {
|
public function setTextPrefix($textPrefix)
|
||||||
|
{
|
||||||
$this->textPrefix = (string)$textPrefix;
|
$this->textPrefix = (string)$textPrefix;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get text emboss
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getTextEmboss()
|
||||||
|
{
|
||||||
|
return $this->textEmboss;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set text emboss
|
* Set text emboss
|
||||||
*
|
*
|
||||||
* @param bool $textEmboss Whether the text should be embossed
|
* @api
|
||||||
|
* @param bool $textEmboss If the text should be embossed
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setTextEmboss($textEmboss) {
|
public function setTextEmboss($textEmboss)
|
||||||
$this->textEmboss = ($textEmboss ? 1 : 0);
|
{
|
||||||
|
$this->textEmboss = (bool)$textEmboss;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get translate
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getTranslate()
|
||||||
|
{
|
||||||
|
return $this->translate;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set translate
|
* Set translate
|
||||||
*
|
*
|
||||||
* @param bool $translate Whether the text should be translated
|
* @api
|
||||||
|
* @param bool $translate If the text should be translated
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setTranslate($translate) {
|
public function setTranslate($translate)
|
||||||
$this->translate = ($translate ? 1 : 0);
|
{
|
||||||
|
$this->translate = (bool)$translate;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set max lines count
|
* Get the opacity
|
||||||
*
|
*
|
||||||
* @param int $maxLines Max lines count
|
* @api
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getOpacity()
|
||||||
|
{
|
||||||
|
return $this->opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the opacity
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param float $opacity Opacity
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setMaxLines($maxLines) {
|
public function setOpacity($opacity)
|
||||||
$this->maxLines = (int)$maxLines;
|
{
|
||||||
|
$this->opacity = (float)$opacity;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Actionable::getAction()
|
* @see Actionable::getAction()
|
||||||
*/
|
*/
|
||||||
public function getAction() {
|
public function getAction()
|
||||||
|
{
|
||||||
return $this->action;
|
return $this->action;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Actionable::setAction()
|
* @see Actionable::setAction()
|
||||||
*/
|
*/
|
||||||
public function setAction($action) {
|
public function setAction($action)
|
||||||
|
{
|
||||||
$this->action = (string)$action;
|
$this->action = (string)$action;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Actionable::setActionKey()
|
* @see Actionable::getActionKey()
|
||||||
*/
|
*/
|
||||||
public function setActionKey($actionKey) {
|
public function getActionKey()
|
||||||
|
{
|
||||||
|
return $this->actionKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Actionable::setActionKey()
|
||||||
|
*/
|
||||||
|
public function setActionKey($actionKey)
|
||||||
|
{
|
||||||
$this->actionKey = (int)$actionKey;
|
$this->actionKey = (int)$actionKey;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Linkable::setUrl()
|
* @see Linkable::getUrl()
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Linkable::setUrl()
|
||||||
|
*/
|
||||||
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Linkable::setUrlId()
|
* @see Linkable::getUrlId()
|
||||||
*/
|
*/
|
||||||
public function setUrlId($urlId) {
|
public function getUrlId()
|
||||||
|
{
|
||||||
|
return $this->urlId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Linkable::setUrlId()
|
||||||
|
*/
|
||||||
|
public function setUrlId($urlId)
|
||||||
|
{
|
||||||
$this->urlId = (string)$urlId;
|
$this->urlId = (string)$urlId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Linkable::setManialink()
|
* @see Linkable::getManialink()
|
||||||
*/
|
*/
|
||||||
public function setManialink($manialink) {
|
public function getManialink()
|
||||||
|
{
|
||||||
|
return $this->manialink;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Linkable::setManialink()
|
||||||
|
*/
|
||||||
|
public function setManialink($manialink)
|
||||||
|
{
|
||||||
$this->manialink = (string)$manialink;
|
$this->manialink = (string)$manialink;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Linkable::setManialinkId()
|
* @see Linkable::getManialinkId()
|
||||||
*/
|
*/
|
||||||
public function setManialinkId($manialinkId) {
|
public function getManialinkId()
|
||||||
|
{
|
||||||
|
return $this->manialinkId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Linkable::setManialinkId()
|
||||||
|
*/
|
||||||
|
public function setManialinkId($manialinkId)
|
||||||
|
{
|
||||||
$this->manialinkId = (string)$manialinkId;
|
$this->manialinkId = (string)$manialinkId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\NewLineable::setAutoNewLine()
|
* @see MultiLineable::getAutoNewLine()
|
||||||
*/
|
*/
|
||||||
public function setAutoNewLine($autoNewLine) {
|
public function getAutoNewLine()
|
||||||
$this->autoNewLine = ($autoNewLine ? 1 : 0);
|
{
|
||||||
|
return $this->autoNewLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see MultiLineable::setAutoNewLine()
|
||||||
|
*/
|
||||||
|
public function setAutoNewLine($autoNewLine)
|
||||||
|
{
|
||||||
|
$this->autoNewLine = (bool)$autoNewLine;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
* @see MultiLineable::getLineSpacing()
|
||||||
*/
|
*/
|
||||||
public function setScriptEvents($scriptEvents) {
|
public function getLineSpacing()
|
||||||
$this->scriptEvents = ($scriptEvents ? 1 : 0);
|
{
|
||||||
|
return $this->lineSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see MultiLineable::setLineSpacing()
|
||||||
|
*/
|
||||||
|
public function setLineSpacing($lineSpacing)
|
||||||
|
{
|
||||||
|
$this->lineSpacing = (float)$lineSpacing;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Styleable::setStyle()
|
* @see MultiLineable::getMaxLines()
|
||||||
*/
|
*/
|
||||||
public function setStyle($style) {
|
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;
|
$this->style = (string)$style;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setTextSize()
|
* @see TextFormatable::getTextSize()
|
||||||
*/
|
*/
|
||||||
public function setTextSize($textSize) {
|
public function getTextSize()
|
||||||
|
{
|
||||||
|
return $this->textSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setTextSize()
|
||||||
|
*/
|
||||||
|
public function setTextSize($textSize)
|
||||||
|
{
|
||||||
$this->textSize = (int)$textSize;
|
$this->textSize = (int)$textSize;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setTextFont()
|
* @see TextFormatable::getTextFont()
|
||||||
*/
|
*/
|
||||||
public function setTextFont($textFont) {
|
public function getTextFont()
|
||||||
|
{
|
||||||
|
return $this->textFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setTextFont()
|
||||||
|
*/
|
||||||
|
public function setTextFont($textFont)
|
||||||
|
{
|
||||||
$this->textFont = (string)$textFont;
|
$this->textFont = (string)$textFont;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setTextColor()
|
* @see TextFormatable::getTextColor()
|
||||||
*/
|
*/
|
||||||
public function setTextColor($textColor) {
|
public function getTextColor()
|
||||||
|
{
|
||||||
|
return $this->textColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setTextColor()
|
||||||
|
*/
|
||||||
|
public function setTextColor($textColor)
|
||||||
|
{
|
||||||
$this->textColor = (string)$textColor;
|
$this->textColor = (string)$textColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setAreaColor()
|
* @see TextFormatable::getAreaColor()
|
||||||
*/
|
*/
|
||||||
public function setAreaColor($areaColor) {
|
public function getAreaColor()
|
||||||
$this->focusAreaColor1 = (string)$areaColor;
|
{
|
||||||
|
return $this->areaColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setAreaColor()
|
||||||
|
*/
|
||||||
|
public function setAreaColor($areaColor)
|
||||||
|
{
|
||||||
|
$this->areaColor = (string)$areaColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setAreaFocusColor()
|
* @see TextFormatable::getAreaFocusColor()
|
||||||
*/
|
*/
|
||||||
public function setAreaFocusColor($areaFocusColor) {
|
public function getAreaFocusColor()
|
||||||
$this->focusAreaColor2 = (string)$areaFocusColor;
|
{
|
||||||
|
return $this->focusAreaColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setAreaFocusColor()
|
||||||
|
*/
|
||||||
|
public function setAreaFocusColor($areaFocusColor)
|
||||||
|
{
|
||||||
|
$this->focusAreaColor = (string)$areaFocusColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a dynamic Feature showing the current time
|
* Add a dynamic Feature showing the current time
|
||||||
*
|
*
|
||||||
* @param bool $showSeconds (optional) Whether the seconds should be shown
|
* @api
|
||||||
* @param bool $showFullDate (optional) Whether the date should be shown
|
* @param bool $showSeconds (optional) If the seconds should be shown
|
||||||
|
* @param bool $showFullDate (optional) If the date should be shown
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addClockFeature($showSeconds = true, $showFullDate = false) {
|
public function addClockFeature($showSeconds = true, $showFullDate = false)
|
||||||
|
{
|
||||||
$clock = new Clock($this, $showSeconds, $showFullDate);
|
$clock = new Clock($this, $showSeconds, $showFullDate);
|
||||||
$this->addScriptFeature($clock);
|
$this->addScriptFeature($clock);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Control::getTagName()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function getTagName()
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
if (strlen($this->text) > 0) {
|
return "label";
|
||||||
$xmlElement->setAttribute('text', $this->text);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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) {
|
if ($this->textId) {
|
||||||
$xmlElement->setAttribute('textid', $this->textId);
|
$domElement->setAttribute("textid", $this->textId);
|
||||||
}
|
}
|
||||||
if ($this->textPrefix) {
|
if ($this->textPrefix) {
|
||||||
$xmlElement->setAttribute('textprefix', $this->textPrefix);
|
$domElement->setAttribute("textprefix", $this->textPrefix);
|
||||||
}
|
}
|
||||||
if ($this->textEmboss) {
|
if ($this->textEmboss) {
|
||||||
$xmlElement->setAttribute('textemboss', $this->textEmboss);
|
$domElement->setAttribute("textemboss", $this->textEmboss);
|
||||||
}
|
}
|
||||||
if ($this->translate) {
|
if ($this->translate) {
|
||||||
$xmlElement->setAttribute('translate', $this->translate);
|
$domElement->setAttribute("translate", $this->translate);
|
||||||
}
|
|
||||||
if ($this->maxLines >= 0) {
|
|
||||||
$xmlElement->setAttribute('maxlines', $this->maxLines);
|
|
||||||
}
|
}
|
||||||
if ($this->opacity != 1.) {
|
if ($this->opacity != 1.) {
|
||||||
$xmlElement->setAttribute('opacity', $this->opacity);
|
$domElement->setAttribute("opacity", $this->opacity);
|
||||||
}
|
}
|
||||||
if (strlen($this->action) > 0) {
|
if ($this->action) {
|
||||||
$xmlElement->setAttribute('action', $this->action);
|
$domElement->setAttribute("action", $this->action);
|
||||||
}
|
}
|
||||||
if ($this->actionKey >= 0) {
|
if ($this->actionKey >= 0) {
|
||||||
$xmlElement->setAttribute('actionkey', $this->actionKey);
|
$domElement->setAttribute("actionkey", $this->actionKey);
|
||||||
}
|
}
|
||||||
if ($this->url) {
|
if ($this->url) {
|
||||||
$xmlElement->setAttribute('url', $this->url);
|
$domElement->setAttribute("url", $this->url);
|
||||||
|
}
|
||||||
|
if ($this->urlId) {
|
||||||
|
$domElement->setAttribute("urlid", $this->urlId);
|
||||||
}
|
}
|
||||||
if ($this->manialink) {
|
if ($this->manialink) {
|
||||||
$xmlElement->setAttribute('manialink', $this->manialink);
|
$domElement->setAttribute("manialink", $this->manialink);
|
||||||
|
}
|
||||||
|
if ($this->manialinkId) {
|
||||||
|
$domElement->setAttribute("manialinkid", $this->manialinkId);
|
||||||
}
|
}
|
||||||
if ($this->autoNewLine) {
|
if ($this->autoNewLine) {
|
||||||
$xmlElement->setAttribute('autonewline', $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) {
|
if ($this->scriptEvents) {
|
||||||
$xmlElement->setAttribute('scriptevents', $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) {
|
if ($this->style) {
|
||||||
$xmlElement->setAttribute('style', $this->style);
|
$domElement->setAttribute("style", $this->style);
|
||||||
}
|
}
|
||||||
if ($this->textSize >= 0) {
|
if ($this->textSize >= 0) {
|
||||||
$xmlElement->setAttribute('textsize', $this->textSize);
|
$domElement->setAttribute("textsize", $this->textSize);
|
||||||
}
|
}
|
||||||
if ($this->textFont) {
|
if ($this->textFont) {
|
||||||
$xmlElement->setAttribute('textfont', $this->textFont);
|
$domElement->setAttribute("textfont", $this->textFont);
|
||||||
}
|
}
|
||||||
if ($this->textColor) {
|
if ($this->textColor) {
|
||||||
$xmlElement->setAttribute('textcolor', $this->textColor);
|
$domElement->setAttribute("textcolor", $this->textColor);
|
||||||
}
|
}
|
||||||
if ($this->focusAreaColor1) {
|
if ($this->areaColor) {
|
||||||
$xmlElement->setAttribute('focusareacolor1', $this->focusAreaColor1);
|
$domElement->setAttribute("focusareacolor1", $this->areaColor);
|
||||||
}
|
}
|
||||||
if ($this->focusAreaColor2) {
|
if ($this->focusAreaColor) {
|
||||||
$xmlElement->setAttribute('focusareacolor2', $this->focusAreaColor2);
|
$domElement->setAttribute("focusareacolor2", $this->focusAreaColor);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -35,4 +37,5 @@ class Label_Button extends Label {
|
|||||||
const STYLE_CardMain_Tool = 'CardMain_Tool';
|
const STYLE_CardMain_Tool = 'CardMain_Tool';
|
||||||
const STYLE_CardMain_Tool_NoBg = 'CardMain_Tool_NoBg';
|
const STYLE_CardMain_Tool_NoBg = 'CardMain_Tool_NoBg';
|
||||||
const STYLE_CardMain_Tool_NoBg2 = 'CardMain_Tool_NoBg2';
|
const STYLE_CardMain_Tool_NoBg2 = 'CardMain_Tool_NoBg2';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -94,4 +96,5 @@ class Label_Text extends Label {
|
|||||||
const STYLE_UiDriving_BgBottom = 'UiDriving_BgBottom';
|
const STYLE_UiDriving_BgBottom = 'UiDriving_BgBottom';
|
||||||
const STYLE_UiDriving_BgCard = 'UiDriving_BgCard';
|
const STYLE_UiDriving_BgCard = 'UiDriving_BgCard';
|
||||||
const STYLE_UiDriving_BgCenter = 'UiDriving_BgCenter';
|
const STYLE_UiDriving_BgCenter = 'UiDriving_BgCenter';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace FML\Controls;
|
namespace FML\Controls;
|
||||||
|
|
||||||
use FML\Models\CheckBoxDesign;
|
|
||||||
use FML\Types\Actionable;
|
use FML\Types\Actionable;
|
||||||
use FML\Types\BgColorable;
|
use FML\Types\BackgroundColorable;
|
||||||
|
use FML\Types\Imageable;
|
||||||
use FML\Types\Linkable;
|
use FML\Types\Linkable;
|
||||||
use FML\Types\Scriptable;
|
use FML\Types\Scriptable;
|
||||||
use FML\Types\Styleable;
|
use FML\Types\Styleable;
|
||||||
@ -15,325 +15,716 @@ use FML\Types\SubStyleable;
|
|||||||
* (CMlQuad)
|
* (CMlQuad)
|
||||||
*
|
*
|
||||||
* @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 extends Control implements Actionable, BgColorable, Linkable, Scriptable, Styleable, SubStyleable {
|
class Quad extends Control implements Actionable, BackgroundColorable, Imageable, Linkable, Scriptable, Styleable, SubStyleable
|
||||||
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const KEEP_RATIO_INACTIVE = 'inactive';
|
const KEEP_RATIO_INACTIVE = "inactive";
|
||||||
const KEEP_RATIO_CLIP = 'Clip';
|
const KEEP_RATIO_CLIP = "Clip";
|
||||||
const KEEP_RATIO_FIT = 'Fit';
|
const KEEP_RATIO_FIT = "Fit";
|
||||||
|
|
||||||
/*
|
|
||||||
* Protected properties
|
|
||||||
*/
|
|
||||||
protected $tagName = 'quad';
|
|
||||||
protected $image = null;
|
|
||||||
protected $imageId = null;
|
|
||||||
protected $imageFocus = null;
|
|
||||||
protected $imageFocusId = null;
|
|
||||||
protected $colorize = null;
|
|
||||||
protected $modulizeColor = null;
|
|
||||||
protected $autoScale = 1;
|
|
||||||
protected $keepRatio = null;
|
|
||||||
protected $action = null;
|
|
||||||
protected $actionKey = -1;
|
|
||||||
protected $bgColor = null;
|
|
||||||
protected $url = null;
|
|
||||||
protected $urlId = null;
|
|
||||||
protected $manialink = null;
|
|
||||||
protected $manialinkId = null;
|
|
||||||
protected $scriptEvents = null;
|
|
||||||
protected $style = null;
|
|
||||||
protected $subStyle = null;
|
|
||||||
protected $styleSelected = null;
|
|
||||||
protected $opacity = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Controls\Control::getManiaScriptClass()
|
* @var string $imageUrl Image url
|
||||||
*/
|
*/
|
||||||
public function getManiaScriptClass() {
|
protected $imageUrl = null;
|
||||||
return 'CMlQuad';
|
|
||||||
|
/**
|
||||||
|
* @var string $imageId Image ID
|
||||||
|
*/
|
||||||
|
protected $imageId = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $imageFocusUrl Focus image url
|
||||||
|
*/
|
||||||
|
protected $imageFocusUrl = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $imageFocusId Focus image ID
|
||||||
|
*/
|
||||||
|
protected $imageFocusId = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $colorize Colorize value
|
||||||
|
*/
|
||||||
|
protected $colorize = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $modulizeColor Modulization color
|
||||||
|
*/
|
||||||
|
protected $modulizeColor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $autoScale Automatic scaling
|
||||||
|
*/
|
||||||
|
protected $autoScale = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float $autoScaleFixedWidth Fixed width for automatic scaling
|
||||||
|
*/
|
||||||
|
protected $autoScaleFixedWidth = -1.;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $keepRatio Keep ratio mode
|
||||||
|
*/
|
||||||
|
protected $keepRatio = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float $opacity Opacity
|
||||||
|
*/
|
||||||
|
protected $opacity = 1.;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $backgroundColor Background color
|
||||||
|
*/
|
||||||
|
protected $backgroundColor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $action Action name
|
||||||
|
*/
|
||||||
|
protected $action = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $actionKey Action key
|
||||||
|
*/
|
||||||
|
protected $actionKey = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Link url
|
||||||
|
*/
|
||||||
|
protected $url = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $urlId Link url ID
|
||||||
|
*/
|
||||||
|
protected $urlId = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $manialink Manialink
|
||||||
|
*/
|
||||||
|
protected $manialink = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $manialinkId Manialink ID
|
||||||
|
*/
|
||||||
|
protected $manialinkId = 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 $subStyle SubStyle
|
||||||
|
*/
|
||||||
|
protected $subStyle = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $styleSelected Style selected
|
||||||
|
*/
|
||||||
|
protected $styleSelected = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Imageable::getImageUrl()
|
||||||
|
*/
|
||||||
|
public function getImageUrl()
|
||||||
|
{
|
||||||
|
return $this->imageUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set image url
|
* @deprecated use setImageUrl() instead
|
||||||
*
|
|
||||||
* @param string $image Image url
|
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function setImage($image) {
|
public function setImage($imageUrl)
|
||||||
$this->image = (string)$image;
|
{
|
||||||
|
return $this->setImageUrl($imageUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Imageable::setImageUrl()
|
||||||
|
*/
|
||||||
|
public function setImageUrl($imageUrl)
|
||||||
|
{
|
||||||
|
$this->imageUrl = (string)$imageUrl;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set image id to use from Dico
|
* Get the image id to use from Dico
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getImageId()
|
||||||
|
{
|
||||||
|
return $this->imageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the image id to use from Dico
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $imageId Image id
|
* @param string $imageId Image id
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setImageId($imageId) {
|
public function setImageId($imageId)
|
||||||
|
{
|
||||||
$this->imageId = (string)$imageId;
|
$this->imageId = (string)$imageId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set focus image url
|
* Get the focus image url
|
||||||
*
|
*
|
||||||
* @param string $imageFocus Focus image url
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getImageFocusUrl()
|
||||||
|
{
|
||||||
|
return $this->imageFocusUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $imageFocusUrl
|
||||||
|
* @return \FML\Controls\Quad
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public function setImageFocus($imageFocusUrl)
|
||||||
|
{
|
||||||
|
return $this->setImageFocusUrl($imageFocusUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the focus image url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string $imageFocusUrl Focus image url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setImageFocus($imageFocus) {
|
public function setImageFocusUrl($imageFocusUrl)
|
||||||
$this->imageFocus = (string)$imageFocus;
|
{
|
||||||
|
$this->imageFocusUrl = (string)$imageFocusUrl;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set focus image id to use from Dico
|
* Get the focus image id to use from Dico
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getImageFocusId()
|
||||||
|
{
|
||||||
|
return $this->imageFocusId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the focus image id to use from Dico
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $imageFocusId Focus image id
|
* @param string $imageFocusId Focus image id
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setImageFocusId($imageFocusId) {
|
public function setImageFocusId($imageFocusId)
|
||||||
|
{
|
||||||
$this->imageFocusId = (string)$imageFocusId;
|
$this->imageFocusId = (string)$imageFocusId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set colorization
|
* Get the colorization
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getColorize()
|
||||||
|
{
|
||||||
|
return $this->colorize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the colorization
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $colorize Colorize value
|
* @param string $colorize Colorize value
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setColorize($colorize) {
|
public function setColorize($colorize)
|
||||||
|
{
|
||||||
$this->colorize = (string)$colorize;
|
$this->colorize = (string)$colorize;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set modulization
|
* Get the modulization color
|
||||||
*
|
*
|
||||||
* @param string $modulizeColor Modulize value
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModulizeColor()
|
||||||
|
{
|
||||||
|
return $this->modulizeColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the modulization color
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string $modulizeColor Modulization color
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setModulizeColor($modulizeColor) {
|
public function setModulizeColor($modulizeColor)
|
||||||
|
{
|
||||||
$this->modulizeColor = (string)$modulizeColor;
|
$this->modulizeColor = (string)$modulizeColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable the automatic image scaling
|
* Get the automatic image scaling
|
||||||
*
|
*
|
||||||
* @param bool $autoScale Whether the image should scale automatically
|
* @api
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getAutoScale()
|
||||||
|
{
|
||||||
|
return $this->autoScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the automatic image scaling
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param bool $autoScale If the image should scale automatically
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setAutoScale($autoScale) {
|
public function setAutoScale($autoScale)
|
||||||
$this->autoScale = ($autoScale ? 1 : 0);
|
{
|
||||||
|
$this->autoScale = (bool)$autoScale;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Keep Ratio Mode
|
* Get the fixed width for automatic image scaling
|
||||||
*
|
*
|
||||||
* @param string $keepRatio Keep Ratio Mode
|
* @api
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getAutoScaleFixedWidth()
|
||||||
|
{
|
||||||
|
return $this->autoScaleFixedWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the fixed width for automatic image scaling
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param float $autoScaleFixedWidth Fixed width for automatic image scaling
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setKeepRatio($keepRatio) {
|
public function setAutoScaleFixedWidth($autoScaleFixedWidth)
|
||||||
|
{
|
||||||
|
$this->autoScaleFixedWidth = (float)$autoScaleFixedWidth;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Keep Ratio mode
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getKeepRatio()
|
||||||
|
{
|
||||||
|
return $this->keepRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Keep Ratio mode
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string $keepRatio Keep Ratio mode
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setKeepRatio($keepRatio)
|
||||||
|
{
|
||||||
$this->keepRatio = (string)$keepRatio;
|
$this->keepRatio = (string)$keepRatio;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Actionable::getAction()
|
* Get the opacity
|
||||||
*/
|
|
||||||
public function getAction() {
|
|
||||||
return $this->action;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\Actionable::setAction()
|
|
||||||
*/
|
|
||||||
public function setAction($action) {
|
|
||||||
$this->action = (string)$action;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\Actionable::setActionKey()
|
|
||||||
*/
|
|
||||||
public function setActionKey($actionKey) {
|
|
||||||
$this->actionKey = (int)$actionKey;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\BgColorable::setBgColor()
|
|
||||||
*/
|
|
||||||
public function setBgColor($bgColor) {
|
|
||||||
$this->bgColor = (string)$bgColor;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\Linkable::setUrl()
|
|
||||||
*/
|
|
||||||
public function setUrl($url) {
|
|
||||||
$this->url = (string)$url;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\Linkable::setUrlId()
|
|
||||||
*/
|
|
||||||
public function setUrlId($urlId) {
|
|
||||||
$this->urlId = (string)$urlId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\Linkable::setManialink()
|
|
||||||
*/
|
|
||||||
public function setManialink($manialink) {
|
|
||||||
$this->manialink = (string)$manialink;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\Linkable::setManialinkId()
|
|
||||||
*/
|
|
||||||
public function setManialinkId($manialinkId) {
|
|
||||||
$this->manialinkId = (string)$manialinkId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
|
||||||
*/
|
|
||||||
public function setScriptEvents($scriptEvents) {
|
|
||||||
$this->scriptEvents = ($scriptEvents ? 1 : 0);
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\SubStyleable::setStyles()
|
|
||||||
*/
|
|
||||||
public function setStyles($style, $subStyle) {
|
|
||||||
$this->setStyle($style);
|
|
||||||
$this->setSubStyle($subStyle);
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\Styleable::setStyle()
|
|
||||||
*/
|
|
||||||
public function setStyle($style) {
|
|
||||||
$this->style = (string)$style;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \FML\Types\SubStyleable::setSubStyle()
|
|
||||||
*/
|
|
||||||
public function setSubStyle($subStyle) {
|
|
||||||
$this->subStyle = (string)$subStyle;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set selected mode
|
|
||||||
*
|
*
|
||||||
* @param bool $styleSelected
|
* @api
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function getOpacity()
|
||||||
|
{
|
||||||
|
return $this->opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the opacity
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param float $opacity Opacity value
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setStyleSelected($styleSelected) {
|
public function setOpacity($opacity)
|
||||||
$this->styleSelected = ($styleSelected ? 1 : 0);
|
{
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set opacity
|
|
||||||
*
|
|
||||||
* @param float $opacity
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setOpacity($opacity) {
|
|
||||||
$this->opacity = (float)$opacity;
|
$this->opacity = (float)$opacity;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply the given CheckBox Design
|
* @see BackgroundColorable::getBackgroundColor()
|
||||||
*
|
|
||||||
* @param CheckBoxDesign $checkBoxDesign CheckBox Design
|
|
||||||
* @return static
|
|
||||||
*/
|
*/
|
||||||
public function applyCheckBoxDesign(CheckBoxDesign $checkBoxDesign) {
|
public function getBackgroundColor()
|
||||||
$checkBoxDesign->applyToQuad($this);
|
{
|
||||||
|
return $this->backgroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see BackgroundColorable::setBgColor()
|
||||||
|
*/
|
||||||
|
public function setBackgroundColor($backgroundColor)
|
||||||
|
{
|
||||||
|
$this->backgroundColor = (string)$backgroundColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Actionable::getAction()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function getAction()
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
if ($this->image) {
|
return $this->action;
|
||||||
$xmlElement->setAttribute('image', $this->image);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 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 Styleable::getSubStyle()
|
||||||
|
*/
|
||||||
|
public function getSubStyle()
|
||||||
|
{
|
||||||
|
return $this->subStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SubStyleable::setSubStyle()
|
||||||
|
*/
|
||||||
|
public function setSubStyle($subStyle)
|
||||||
|
{
|
||||||
|
$this->subStyle = (string)$subStyle;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SubStyleable::setStyles()
|
||||||
|
*/
|
||||||
|
public function setStyles($style, $subStyle)
|
||||||
|
{
|
||||||
|
return $this->setStyle($style)
|
||||||
|
->setSubStyle($subStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get selected style
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getStyleSelected()
|
||||||
|
{
|
||||||
|
return $this->styleSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set selected style
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param bool $styleSelected If the quad should be styled selected
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setStyleSelected($styleSelected)
|
||||||
|
{
|
||||||
|
$this->styleSelected = (bool)$styleSelected;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Control::getTagName()
|
||||||
|
*/
|
||||||
|
public function getTagName()
|
||||||
|
{
|
||||||
|
return "quad";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Control::getManiaScriptClass()
|
||||||
|
*/
|
||||||
|
public function getManiaScriptClass()
|
||||||
|
{
|
||||||
|
return "CMlQuad";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Renderable::render()
|
||||||
|
*/
|
||||||
|
public function render(\DOMDocument $domDocument)
|
||||||
|
{
|
||||||
|
$domElement = parent::render($domDocument);
|
||||||
|
if ($this->imageUrl) {
|
||||||
|
$domElement->setAttribute("image", $this->imageUrl);
|
||||||
}
|
}
|
||||||
if ($this->imageId) {
|
if ($this->imageId) {
|
||||||
$xmlElement->setAttribute('imageid', $this->imageId);
|
$domElement->setAttribute("imageid", $this->imageId);
|
||||||
}
|
}
|
||||||
if ($this->imageFocus) {
|
if ($this->imageFocusUrl) {
|
||||||
$xmlElement->setAttribute('imagefocus', $this->imageFocus);
|
$domElement->setAttribute("imagefocus", $this->imageFocusUrl);
|
||||||
}
|
}
|
||||||
if ($this->imageFocusId) {
|
if ($this->imageFocusId) {
|
||||||
$xmlElement->setAttribute('imagefocusid', $this->imageFocusId);
|
$domElement->setAttribute("imagefocusid", $this->imageFocusId);
|
||||||
}
|
}
|
||||||
if ($this->colorize) {
|
if ($this->colorize) {
|
||||||
$xmlElement->setAttribute('colorize', $this->colorize);
|
$domElement->setAttribute("colorize", $this->colorize);
|
||||||
}
|
}
|
||||||
if ($this->modulizeColor) {
|
if ($this->modulizeColor) {
|
||||||
$xmlElement->setAttribute('modulizecolor', $this->modulizeColor);
|
$domElement->setAttribute("modulizecolor", $this->modulizeColor);
|
||||||
}
|
}
|
||||||
if (!$this->autoScale) {
|
if (!$this->autoScale) {
|
||||||
$xmlElement->setAttribute('autoscale', $this->autoScale);
|
$domElement->setAttribute("autoscale", 0);
|
||||||
|
}
|
||||||
|
if ($this->autoScaleFixedWidth > 0.) {
|
||||||
|
$domElement->setAttribute("autoscalefixedWidth", $this->autoScaleFixedWidth);
|
||||||
}
|
}
|
||||||
if ($this->keepRatio) {
|
if ($this->keepRatio) {
|
||||||
$xmlElement->setAttribute('keepratio', $this->keepRatio);
|
$domElement->setAttribute("keepratio", $this->keepRatio);
|
||||||
}
|
|
||||||
if (strlen($this->action) > 0) {
|
|
||||||
$xmlElement->setAttribute('action', $this->action);
|
|
||||||
}
|
|
||||||
if ($this->actionKey >= 0) {
|
|
||||||
$xmlElement->setAttribute('actionkey', $this->actionKey);
|
|
||||||
}
|
|
||||||
if ($this->bgColor) {
|
|
||||||
$xmlElement->setAttribute('bgcolor', $this->bgColor);
|
|
||||||
}
|
|
||||||
if ($this->url) {
|
|
||||||
$xmlElement->setAttribute('url', $this->url);
|
|
||||||
}
|
|
||||||
if ($this->manialink) {
|
|
||||||
$xmlElement->setAttribute('manialink', $this->manialink);
|
|
||||||
}
|
|
||||||
if ($this->scriptEvents) {
|
|
||||||
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
|
|
||||||
}
|
|
||||||
if ($this->style) {
|
|
||||||
$xmlElement->setAttribute('style', $this->style);
|
|
||||||
}
|
|
||||||
if ($this->subStyle) {
|
|
||||||
$xmlElement->setAttribute('substyle', $this->subStyle);
|
|
||||||
}
|
|
||||||
if ($this->styleSelected) {
|
|
||||||
$xmlElement->setAttribute('styleselected', $this->styleSelected);
|
|
||||||
}
|
}
|
||||||
if ($this->opacity !== 1.) {
|
if ($this->opacity !== 1.) {
|
||||||
$xmlElement->setAttribute('opacity', $this->opacity);
|
$domElement->setAttribute("opacity", $this->opacity);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
if ($this->backgroundColor) {
|
||||||
|
$domElement->setAttribute("bgcolor", $this->backgroundColor);
|
||||||
}
|
}
|
||||||
|
if ($this->action) {
|
||||||
|
$domElement->setAttribute("action", $this->action);
|
||||||
|
}
|
||||||
|
if ($this->actionKey) {
|
||||||
|
$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->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->subStyle) {
|
||||||
|
$domElement->setAttribute("substyle", $this->subStyle);
|
||||||
|
}
|
||||||
|
if ($this->styleSelected) {
|
||||||
|
$domElement->setAttribute("styleselected", 1);
|
||||||
|
}
|
||||||
|
return $domElement;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -21,8 +23,9 @@ class Quad_321Go extends Quad {
|
|||||||
const SUBSTYLE_1 = '1';
|
const SUBSTYLE_1 = '1';
|
||||||
const SUBSTYLE_Go = 'Go!';
|
const SUBSTYLE_Go = 'Go!';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -44,8 +46,9 @@ class Quad_BgRaceScore2 extends Quad {
|
|||||||
const SUBSTYLE_Tv = 'Tv';
|
const SUBSTYLE_Tv = 'Tv';
|
||||||
const SUBSTYLE_Warmup = 'Warmup';
|
const SUBSTYLE_Warmup = 'Warmup';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -86,8 +88,9 @@ class Quad_Bgs1 extends Quad {
|
|||||||
const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall';
|
const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall';
|
||||||
const SUBSTYLE_Shadow = 'Shadow';
|
const SUBSTYLE_Shadow = 'Shadow';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -86,8 +88,9 @@ class Quad_Bgs1InRace extends Quad {
|
|||||||
const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall';
|
const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall';
|
||||||
const SUBSTYLE_Shadow = 'Shadow';
|
const SUBSTYLE_Shadow = 'Shadow';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -24,8 +26,9 @@ class Quad_BgsButtons extends Quad {
|
|||||||
const SUBSTYLE_BgButtonSmall2 = 'BgButtonSmall2';
|
const SUBSTYLE_BgButtonSmall2 = 'BgButtonSmall2';
|
||||||
const SUBSTYLE_BgButtonXSmall = 'BgButtonXSmall';
|
const SUBSTYLE_BgButtonXSmall = 'BgButtonXSmall';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -23,8 +25,9 @@ class Quad_BgsChallengeMedals extends Quad {
|
|||||||
const SUBSTYLE_BgPlayed = 'BgPlayed';
|
const SUBSTYLE_BgPlayed = 'BgPlayed';
|
||||||
const SUBSTYLE_BgSilver = 'BgSilver';
|
const SUBSTYLE_BgSilver = 'BgSilver';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -31,8 +33,9 @@ class Quad_BgsPlayerCard extends Quad {
|
|||||||
const SUBSTYLE_BgRacePlayerName = 'BgRacePlayerName';
|
const SUBSTYLE_BgRacePlayerName = 'BgRacePlayerName';
|
||||||
const SUBSTYLE_ProgressBar = 'ProgressBar';
|
const SUBSTYLE_ProgressBar = 'ProgressBar';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -29,8 +31,9 @@ class Quad_Copilot extends Quad {
|
|||||||
const SUBSTYLE_UpGood = 'UpGood';
|
const SUBSTYLE_UpGood = 'UpGood';
|
||||||
const SUBSTYLE_UpWrong = 'UpWrong';
|
const SUBSTYLE_UpWrong = 'UpWrong';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -20,8 +22,9 @@ class Quad_Emblems extends Quad {
|
|||||||
const SUBSTYLE_1 = '#1';
|
const SUBSTYLE_1 = '#1';
|
||||||
const SUBSTYLE_2 = '#2';
|
const SUBSTYLE_2 = '#2';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -23,8 +25,9 @@ class Quad_EnergyBar extends Quad {
|
|||||||
const SUBSTYLE_HeaderGaugeLeft = 'HeaderGaugeLeft';
|
const SUBSTYLE_HeaderGaugeLeft = 'HeaderGaugeLeft';
|
||||||
const SUBSTYLE_HeaderGaugeRight = 'HeaderGaugeRight';
|
const SUBSTYLE_HeaderGaugeRight = 'HeaderGaugeRight';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -26,8 +28,9 @@ class Quad_Hud3dEchelons extends Quad {
|
|||||||
const SUBSTYLE_EchelonSilver2 = 'EchelonSilver2';
|
const SUBSTYLE_EchelonSilver2 = 'EchelonSilver2';
|
||||||
const SUBSTYLE_EchelonSilver3 = 'EchelonSilver3';
|
const SUBSTYLE_EchelonSilver3 = 'EchelonSilver3';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -25,8 +27,9 @@ class Quad_Hud3dIcons extends Quad {
|
|||||||
const SUBSTYLE_PointB = 'PointB';
|
const SUBSTYLE_PointB = 'PointB';
|
||||||
const SUBSTYLE_PointC = 'PointC';
|
const SUBSTYLE_PointC = 'PointC';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -81,8 +83,9 @@ class Quad_Icons128x128_1 extends Quad {
|
|||||||
const SUBSTYLE_Upload = 'Upload';
|
const SUBSTYLE_Upload = 'Upload';
|
||||||
const SUBSTYLE_Vehicles = 'Vehicles';
|
const SUBSTYLE_Vehicles = 'Vehicles';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -81,8 +83,9 @@ class Quad_Icons128x128_Blink extends Quad {
|
|||||||
const SUBSTYLE_Upload = 'Upload';
|
const SUBSTYLE_Upload = 'Upload';
|
||||||
const SUBSTYLE_Vehicles = 'Vehicles';
|
const SUBSTYLE_Vehicles = 'Vehicles';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -47,8 +49,9 @@ class Quad_Icons128x32_1 extends Quad {
|
|||||||
const SUBSTYLE_UrlBg = 'UrlBg';
|
const SUBSTYLE_UrlBg = 'UrlBg';
|
||||||
const SUBSTYLE_Windowed = 'Windowed';
|
const SUBSTYLE_Windowed = 'Windowed';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -103,8 +105,9 @@ class Quad_Icons64x64_1 extends Quad {
|
|||||||
const SUBSTYLE_YellowHigh = 'YellowHigh';
|
const SUBSTYLE_YellowHigh = 'YellowHigh';
|
||||||
const SUBSTYLE_YellowLow = 'YellowLow';
|
const SUBSTYLE_YellowLow = 'YellowLow';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -32,8 +34,9 @@ class Quad_Icons64x64_2 extends Quad {
|
|||||||
const SUBSTYLE_UnknownElimination = 'UnknownElimination';
|
const SUBSTYLE_UnknownElimination = 'UnknownElimination';
|
||||||
const SUBSTYLE_UnknownHit = 'UnknownHit';
|
const SUBSTYLE_UnknownHit = 'UnknownHit';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -24,8 +26,9 @@ class Quad_ManiaPlanetLogos extends Quad {
|
|||||||
const SUBSTYLE_ManiaPlanetLogoWhite = 'ManiaPlanetLogoWhite';
|
const SUBSTYLE_ManiaPlanetLogoWhite = 'ManiaPlanetLogoWhite';
|
||||||
const SUBSTYLE_ManiaPlanetLogoWhiteSmall = 'ManiaPlanetLogoWhiteSmall';
|
const SUBSTYLE_ManiaPlanetLogoWhiteSmall = 'ManiaPlanetLogoWhiteSmall';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -28,8 +30,9 @@ class Quad_ManiaPlanetMainMenu extends Quad {
|
|||||||
const SUBSTYLE_TitleBg = 'TitleBg';
|
const SUBSTYLE_TitleBg = 'TitleBg';
|
||||||
const SUBSTYLE_TopBar = 'TopBar';
|
const SUBSTYLE_TopBar = 'TopBar';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -23,8 +25,9 @@ class Quad_ManiaplanetSystem extends Quad {
|
|||||||
const SUBSTYLE_Medals = 'Medals';
|
const SUBSTYLE_Medals = 'Medals';
|
||||||
const SUBSTYLE_Statistics = 'Statistics';
|
const SUBSTYLE_Statistics = 'Statistics';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -24,8 +26,9 @@ class Quad_MedalsBig extends Quad {
|
|||||||
const SUBSTYLE_MedalSilver = 'MedalSilver';
|
const SUBSTYLE_MedalSilver = 'MedalSilver';
|
||||||
const SUBSTYLE_MedalSlot = 'MedalSlot';
|
const SUBSTYLE_MedalSlot = 'MedalSlot';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -21,8 +23,9 @@ class Quad_TitleLogos extends Quad {
|
|||||||
const SUBSTYLE_Icon = 'Icon';
|
const SUBSTYLE_Icon = 'Icon';
|
||||||
const SUBSTYLE_Title = 'Title';
|
const SUBSTYLE_Title = 'Title';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -40,8 +42,9 @@ class Quad_UIConstructionBullet_Buttons extends Quad {
|
|||||||
const SUBSTYLE_Trail = 'Trail';
|
const SUBSTYLE_Trail = 'Trail';
|
||||||
const SUBSTYLE_TrailFolder = 'TrailFolder';
|
const SUBSTYLE_TrailFolder = 'TrailFolder';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -74,8 +76,9 @@ class Quad_UIConstruction_Buttons extends Quad {
|
|||||||
const SUBSTYLE_Validate_Step2 = 'Validate_Step2';
|
const SUBSTYLE_Validate_Step2 = 'Validate_Step2';
|
||||||
const SUBSTYLE_Validate_Step3 = 'Validate_Step3';
|
const SUBSTYLE_Validate_Step3 = 'Validate_Step3';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -29,8 +31,9 @@ class Quad_UIConstruction_Buttons2 extends Quad {
|
|||||||
const SUBSTYLE_Open = 'Open';
|
const SUBSTYLE_Open = 'Open';
|
||||||
const SUBSTYLE_Symmetry = 'Symmetry';
|
const SUBSTYLE_Symmetry = 'Symmetry';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -38,8 +40,9 @@ class Quad_UiSMSpectatorScoreBig extends Quad {
|
|||||||
CONST SUBSTYLE_UIRange1Bg = 'UIRange1Bg';
|
CONST SUBSTYLE_UIRange1Bg = 'UIRange1Bg';
|
||||||
CONST SUBSTYLE_UIRange2Bg = 'UIRange2Bg';
|
CONST SUBSTYLE_UIRange2Bg = 'UIRange2Bg';
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $style Style
|
||||||
*/
|
*/
|
||||||
protected $style = self::STYLE;
|
protected $style = self::STYLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
452
libs/FML/Controls/TextEdit.php
Normal file
452
libs/FML/Controls/TextEdit.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $data Data url
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'video';
|
|
||||||
protected $data = null;
|
protected $data = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $dataId Data id
|
||||||
|
*/
|
||||||
protected $dataId = null;
|
protected $dataId = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $play Play automaticcaly
|
||||||
|
*/
|
||||||
protected $play = null;
|
protected $play = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $looping Looping
|
||||||
|
*/
|
||||||
protected $looping = true;
|
protected $looping = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $music Music type
|
||||||
|
*/
|
||||||
protected $music = null;
|
protected $music = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float $volume Volume
|
||||||
|
*/
|
||||||
protected $volume = 1.;
|
protected $volume = 1.;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $scriptEvents Script events usage
|
||||||
|
*/
|
||||||
protected $scriptEvents = null;
|
protected $scriptEvents = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Controls\Control::getManiaScriptClass()
|
* @var string $scriptAction Script action
|
||||||
*/
|
*/
|
||||||
public function getManiaScriptClass() {
|
protected $scriptAction = null;
|
||||||
return 'CMlMediaPlayer';
|
|
||||||
|
/**
|
||||||
|
* @var string[] $scriptActionParameters Script action parameters
|
||||||
|
*/
|
||||||
|
protected $scriptActionParameters = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::getData()
|
||||||
|
*/
|
||||||
|
public function getData()
|
||||||
|
{
|
||||||
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setData()
|
* @see Playable::setData()
|
||||||
*/
|
*/
|
||||||
public function setData($data) {
|
public function setData($data)
|
||||||
|
{
|
||||||
$this->data = (string)$data;
|
$this->data = (string)$data;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setDataId()
|
* @see Playable::getDataId()
|
||||||
*/
|
*/
|
||||||
public function setDataId($dataId) {
|
public function getDataId()
|
||||||
|
{
|
||||||
|
return $this->dataId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::setDataId()
|
||||||
|
*/
|
||||||
|
public function setDataId($dataId)
|
||||||
|
{
|
||||||
$this->dataId = (string)$dataId;
|
$this->dataId = (string)$dataId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setPlay()
|
* @see Playable::getPlay()
|
||||||
*/
|
*/
|
||||||
public function setPlay($play) {
|
public function getPlay()
|
||||||
$this->play = ($play ? 1 : 0);
|
{
|
||||||
|
return $this->play;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::setPlay()
|
||||||
|
*/
|
||||||
|
public function setPlay($play)
|
||||||
|
{
|
||||||
|
$this->play = (bool)$play;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setLooping()
|
* @see Playable::getLooping()
|
||||||
*/
|
*/
|
||||||
public function setLooping($looping) {
|
public function getLooping()
|
||||||
$this->looping = ($looping ? 1 : 0);
|
{
|
||||||
|
return $this->looping;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::setLooping()
|
||||||
|
*/
|
||||||
|
public function setLooping($looping)
|
||||||
|
{
|
||||||
|
$this->looping = (bool)$looping;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setMusic()
|
* @see Playable::getMusic()
|
||||||
*/
|
*/
|
||||||
public function setMusic($music) {
|
public function getMusic()
|
||||||
$this->music = ($music ? 1 : 0);
|
{
|
||||||
|
return $this->music;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::setMusic()
|
||||||
|
*/
|
||||||
|
public function setMusic($music)
|
||||||
|
{
|
||||||
|
$this->music = (bool)$music;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Playable::setVolume()
|
* @see Playable::getVolume()
|
||||||
*/
|
*/
|
||||||
public function setVolume($volume) {
|
public function getVolume()
|
||||||
|
{
|
||||||
|
return $this->volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Playable::setVolume()
|
||||||
|
*/
|
||||||
|
public function setVolume($volume)
|
||||||
|
{
|
||||||
$this->volume = (float)$volume;
|
$this->volume = (float)$volume;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Scriptable::setScriptEvents()
|
* @see Scriptable::getScriptEvents()
|
||||||
*/
|
*/
|
||||||
public function setScriptEvents($scriptEvents) {
|
public function getScriptEvents()
|
||||||
$this->scriptEvents = ($scriptEvents ? 1 : 0);
|
{
|
||||||
|
return $this->scriptEvents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Scriptable::setScriptEvents()
|
||||||
|
*/
|
||||||
|
public function setScriptEvents($scriptEvents)
|
||||||
|
{
|
||||||
|
$this->scriptEvents = (bool)$scriptEvents;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Scriptable::getScriptAction()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function getScriptAction()
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
|
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) {
|
if ($this->data) {
|
||||||
$xmlElement->setAttribute('data', $this->data);
|
$domElement->setAttribute("data", $this->data);
|
||||||
|
}
|
||||||
|
if ($this->dataId) {
|
||||||
|
$domElement->setAttribute("dataid", $this->dataId);
|
||||||
}
|
}
|
||||||
if ($this->play) {
|
if ($this->play) {
|
||||||
$xmlElement->setAttribute('play', $this->play);
|
$domElement->setAttribute("play", 1);
|
||||||
}
|
}
|
||||||
if (!$this->looping) {
|
if (!$this->looping) {
|
||||||
$xmlElement->setAttribute('looping', $this->looping);
|
$domElement->setAttribute("looping", 0);
|
||||||
}
|
}
|
||||||
if ($this->music) {
|
if ($this->music) {
|
||||||
$xmlElement->setAttribute('music', $this->music);
|
$domElement->setAttribute("music", 1);
|
||||||
}
|
}
|
||||||
if ($this->volume != 1.) {
|
if ($this->volume != 1.) {
|
||||||
$xmlElement->setAttribute('volume', $this->volume);
|
$domElement->setAttribute("volume", $this->volume);
|
||||||
}
|
}
|
||||||
if ($this->scriptEvents) {
|
if ($this->scriptEvents) {
|
||||||
$xmlElement->setAttribute('scriptevents', $this->scriptEvents);
|
$domElement->setAttribute("scriptevents", 1);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
if ($this->scriptAction) {
|
||||||
|
$scriptAction = array($this->scriptAction);
|
||||||
|
if ($this->scriptActionParameters) {
|
||||||
|
$scriptAction = array_merge($scriptAction, $this->scriptActionParameters);
|
||||||
}
|
}
|
||||||
|
$domElement->setAttribute("scriptaction", implode("'", $scriptAction));
|
||||||
|
}
|
||||||
|
return $domElement;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,161 +6,293 @@ 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
|
|
||||||
|
/**
|
||||||
|
* @var bool $globalVisible If the UI should be shown at all
|
||||||
*/
|
*/
|
||||||
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;
|
protected $globalVisible = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new CustomUI object
|
* @var bool $challengeInfoVisible If the challenge info should be shown
|
||||||
|
*/
|
||||||
|
protected $challengeInfoVisible = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $chatVisible If the chat should be shown
|
||||||
|
*/
|
||||||
|
protected $chatVisible = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $checkpointListVisible If the checkpoint list should be shown
|
||||||
|
*/
|
||||||
|
protected $checkpointListVisible = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $netInfosVisible If the net infos should be shown
|
||||||
|
*/
|
||||||
|
protected $netInfosVisible = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $noticeVisible If notices should be shown
|
||||||
|
*/
|
||||||
|
protected $noticeVisible = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $roundScoresVisible If round scores should be shown
|
||||||
|
*/
|
||||||
|
protected $roundScoresVisible = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $scoretableVisible If the score table should be shown
|
||||||
|
*/
|
||||||
|
protected $scoretableVisible = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new CustomUI
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create() {
|
public static function create()
|
||||||
|
{
|
||||||
return new static();
|
return new static();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set XML encoding
|
* Get global visibility
|
||||||
*
|
*
|
||||||
* @param string $encoding XML encoding
|
* @api
|
||||||
* @return static
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function setXMLEncoding($encoding) {
|
public function getGlobalVisible()
|
||||||
$this->encoding = (string)$encoding;
|
{
|
||||||
return $this;
|
return $this->globalVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set showing of notices
|
* Set global visibility
|
||||||
*
|
*
|
||||||
* @param bool $visible Whether notices should be shown
|
* @api
|
||||||
|
* @param bool $visible If the UI should be shown at all
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setNoticeVisible($visible) {
|
public function setGlobalVisible($visible)
|
||||||
$this->noticeVisible = $visible;
|
{
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set showing of the challenge info
|
|
||||||
*
|
|
||||||
* @param bool $visible Whether the challenge info should be shown
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setChallengeInfoVisible($visible) {
|
|
||||||
$this->challengeInfoVisible = $visible;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set showing of the net infos
|
|
||||||
*
|
|
||||||
* @param bool $visible Whether the net infos should be shown
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setNetInfosVisible($visible) {
|
|
||||||
$this->netInfosVisible = $visible;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set showing of the chat
|
|
||||||
*
|
|
||||||
* @param bool $visible Whether the chat should be shown
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setChatVisible($visible) {
|
|
||||||
$this->chatVisible = $visible;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set showing of the checkpoint list
|
|
||||||
*
|
|
||||||
* @param bool $visible Whether the checkpoint should be shown
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setCheckpointListVisible($visible) {
|
|
||||||
$this->checkpointListVisible = $visible;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set showing of round scores
|
|
||||||
*
|
|
||||||
* @param bool $visible Whether the round scores should be shown
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setRoundScoresVisible($visible) {
|
|
||||||
$this->roundScoresVisible = $visible;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set showing of the scoretable
|
|
||||||
*
|
|
||||||
* @param bool $visible Whether the scoretable should be shown
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setScoretableVisible($visible) {
|
|
||||||
$this->scoretableVisible = $visible;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set global showing
|
|
||||||
*
|
|
||||||
* @param bool $visible Whether the UI should be disabled completely
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setGlobalVisible($visible) {
|
|
||||||
$this->globalVisible = $visible;
|
$this->globalVisible = $visible;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the XML document
|
* Get showing of the challenge info
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
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
|
||||||
*
|
*
|
||||||
* @param \DOMDocument $domDocument (optional) DOMDocument for which the XML element should be rendered
|
|
||||||
* @return \DOMDocument
|
* @return \DOMDocument
|
||||||
*/
|
*/
|
||||||
public function render($domDocument = null) {
|
public function renderStandalone()
|
||||||
$isChild = (bool)$domDocument;
|
{
|
||||||
if (!$isChild) {
|
$domDocument = new \DOMDocument("1.0", "utf-8");
|
||||||
$domDocument = new \DOMDocument('1.0', $this->encoding);
|
|
||||||
$domDocument->xmlStandalone = true;
|
$domDocument->xmlStandalone = true;
|
||||||
|
|
||||||
|
$domElement = $this->render($domDocument);
|
||||||
|
$domDocument->appendChild($domElement);
|
||||||
|
|
||||||
|
return $domDocument;
|
||||||
}
|
}
|
||||||
$xmlElement = $domDocument->createElement($this->tagName);
|
|
||||||
if (!$isChild) {
|
/**
|
||||||
$domDocument->appendChild($xmlElement);
|
* 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();
|
$settings = $this->getSettings();
|
||||||
foreach ($settings as $setting => $value) {
|
foreach ($settings as $setting => $value) {
|
||||||
if ($value === null) {
|
if ($value === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$xmlSubElement = $domDocument->createElement($setting);
|
|
||||||
$xmlSubElement->setAttribute('visible', ($value ? 1 : 0));
|
$settingDomElement = $domDocument->createElement($setting);
|
||||||
$xmlElement->appendChild($xmlSubElement);
|
$settingDomElement->setAttribute("visible", ($value ? 1 : 0));
|
||||||
|
$domElement->appendChild($settingDomElement);
|
||||||
}
|
}
|
||||||
if ($isChild) {
|
|
||||||
return $xmlElement;
|
return $domElement;
|
||||||
}
|
|
||||||
return $domDocument;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,8 +300,10 @@ class CustomUI {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString() {
|
public function __toString()
|
||||||
return $this->render()->saveXML();
|
{
|
||||||
|
return $this->renderStandalone()
|
||||||
|
->saveXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -177,16 +311,18 @@ class CustomUI {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getSettings() {
|
protected function getSettings()
|
||||||
$settings = array();
|
{
|
||||||
$settings['challenge_info'] = $this->challengeInfoVisible;
|
return array(
|
||||||
$settings['chat'] = $this->chatVisible;
|
"global" => $this->globalVisible,
|
||||||
$settings['checkpoint_list'] = $this->checkpointListVisible;
|
"challenge_info" => $this->challengeInfoVisible,
|
||||||
$settings['global'] = $this->globalVisible;
|
"chat" => $this->chatVisible,
|
||||||
$settings['net_infos'] = $this->netInfosVisible;
|
"checkpoint_list" => $this->checkpointListVisible,
|
||||||
$settings['notice'] = $this->noticeVisible;
|
"net_infos" => $this->netInfosVisible,
|
||||||
$settings['round_scores'] = $this->roundScoresVisible;
|
"notice" => $this->noticeVisible,
|
||||||
$settings['scoretable'] = $this->scoretableVisible;
|
"round_scores" => $this->roundScoresVisible,
|
||||||
return $settings;
|
"scoretable" => $this->scoretableVisible
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,12 @@ 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
|
* Czech language
|
||||||
*
|
*
|
||||||
@ -153,27 +155,46 @@ class Dico {
|
|||||||
/*
|
/*
|
||||||
* Protected properties
|
* Protected properties
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'dico';
|
|
||||||
protected $entries = array();
|
protected $entries = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Dictionary object
|
* Create a new Dico
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create() {
|
public static function create()
|
||||||
|
{
|
||||||
return new static();
|
return new static();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the translatable entry
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string $language Language id
|
||||||
|
* @param string $entryId Entry id
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getEntry($language, $entryId)
|
||||||
|
{
|
||||||
|
if (isset($this->entries[$language]) && isset($this->entries[$language][$entryId])) {
|
||||||
|
return $this->entries[$language][$entryId];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the translatable entry for the specific language
|
* Set the translatable entry for the specific language
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $language Language id
|
* @param string $language Language id
|
||||||
* @param string $entryId Entry id
|
* @param string $entryId Entry id
|
||||||
* @param string $entryValue Translated entry value
|
* @param string $entryValue Translated entry value
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setEntry($language, $entryId, $entryValue) {
|
public function setEntry($language, $entryId, $entryValue)
|
||||||
|
{
|
||||||
$language = (string)$language;
|
$language = (string)$language;
|
||||||
$entryId = (string)$entryId;
|
$entryId = (string)$entryId;
|
||||||
$entryValue = (string)$entryValue;
|
$entryValue = (string)$entryValue;
|
||||||
@ -193,22 +214,16 @@ class Dico {
|
|||||||
/**
|
/**
|
||||||
* Remove entries of the given id
|
* Remove entries of the given id
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $entryId Entry id that should be removed
|
* @param string $entryId Entry id that should be removed
|
||||||
* @param string $language (optional) Only remove entries of the given language
|
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function removeEntry($entryId, $language = null) {
|
public function removeEntry($entryId)
|
||||||
|
{
|
||||||
$entryId = (string)$entryId;
|
$entryId = (string)$entryId;
|
||||||
if ($language) {
|
|
||||||
$language = (string)$language;
|
|
||||||
if (isset($this->entries[$language])) {
|
|
||||||
unset($this->entries[$language][$entryId]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
foreach ($this->entries as $language => $entries) {
|
foreach ($this->entries as $language => $entries) {
|
||||||
if (isset($entries[$entryId])) {
|
if (isset($this->entries[$language][$entryId])) {
|
||||||
unset($entries[$language][$entryId]);
|
unset($this->entries[$language][$entryId]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
@ -217,50 +232,50 @@ class Dico {
|
|||||||
/**
|
/**
|
||||||
* Remove entries of the given language
|
* Remove entries of the given language
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $language Language which entries should be removed
|
* @param string $language Language which entries should be removed
|
||||||
* @param string $entryId (optional) Only remove the given entry id
|
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function removeLanguage($language, $entryId = null) {
|
public function removeLanguage($language)
|
||||||
|
{
|
||||||
$language = (string)$language;
|
$language = (string)$language;
|
||||||
if (isset($this->entries[$language])) {
|
if (isset($this->entries[$language])) {
|
||||||
if ($entryId) {
|
|
||||||
$entryId = (string)$entryId;
|
|
||||||
unset($this->entries[$language][$entryId]);
|
|
||||||
} else {
|
|
||||||
unset($this->entries[$language]);
|
unset($this->entries[$language]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all entries from the Dictionary
|
* Remove all entries
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function removeEntries() {
|
public function removeAllEntries()
|
||||||
|
{
|
||||||
$this->entries = array();
|
$this->entries = array();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the Dico XML element
|
* Render the Dico
|
||||||
*
|
*
|
||||||
* @param \DOMDocument $domDocument DOMDocument for which the Dico XML element should be rendered
|
* @param \DOMDocument $domDocument DOMDocument for which the Dico should be rendered
|
||||||
* @return \DOMElement
|
* @return \DOMElement
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = $domDocument->createElement($this->tagName);
|
{
|
||||||
|
$domElement = $domDocument->createElement("dico");
|
||||||
foreach ($this->entries as $language => $entries) {
|
foreach ($this->entries as $language => $entries) {
|
||||||
$languageElement = $domDocument->createElement('language');
|
$languageElement = $domDocument->createElement("language");
|
||||||
$languageElement->setAttribute('id', $language);
|
$languageElement->setAttribute("id", $language);
|
||||||
foreach ($entries as $entryId => $entryValue) {
|
foreach ($entries as $entryId => $entryValue) {
|
||||||
$entryElement = $domDocument->createElement($entryId, $entryValue);
|
$entryElement = $domDocument->createElement($entryId, $entryValue);
|
||||||
$languageElement->appendChild($entryElement);
|
$languageElement->appendChild($entryElement);
|
||||||
}
|
}
|
||||||
$xmlElement->appendChild($languageElement);
|
$domElement->appendChild($languageElement);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
*/
|
||||||
|
protected $backgroundColor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $style Style
|
||||||
|
*/
|
||||||
|
protected $style = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $textSize Text size
|
||||||
|
*/
|
||||||
|
protected $textSize = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $textFont Text font
|
||||||
|
*/
|
||||||
|
protected $textFont = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $textColor Text color
|
||||||
|
*/
|
||||||
|
protected $textColor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $areaColor Area color
|
||||||
|
*/
|
||||||
|
protected $areaColor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $focusAreaColor Focus area color
|
||||||
|
*/
|
||||||
|
protected $focusAreaColor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Format
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create() {
|
public static function create()
|
||||||
|
{
|
||||||
return new static();
|
return new static();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\BgColorable::setBgColor()
|
* @see BgColorable::getBackgroundColor()
|
||||||
*/
|
*/
|
||||||
public function setBgColor($bgColor) {
|
public function getBackgroundColor()
|
||||||
$this->bgColor = (string)$bgColor;
|
{
|
||||||
|
return $this->backgroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see BgColorable::setBackgroundColor()
|
||||||
|
*/
|
||||||
|
public function setBackgroundColor($backgroundColor)
|
||||||
|
{
|
||||||
|
$this->backgroundColor = (string)$backgroundColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Styleable::setStyle()
|
* @see Styleable::getStyle()
|
||||||
*/
|
*/
|
||||||
public function setStyle($style) {
|
public function getStyle()
|
||||||
|
{
|
||||||
|
return $this->style;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Styleable::setStyle()
|
||||||
|
*/
|
||||||
|
public function setStyle($style)
|
||||||
|
{
|
||||||
$this->style = (string)$style;
|
$this->style = (string)$style;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setTextSize()
|
* @see TextFormatable::getTextSize()
|
||||||
*/
|
*/
|
||||||
public function setTextSize($textSize) {
|
public function getTextSize()
|
||||||
|
{
|
||||||
|
return $this->textSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setTextSize()
|
||||||
|
*/
|
||||||
|
public function setTextSize($textSize)
|
||||||
|
{
|
||||||
$this->textSize = (int)$textSize;
|
$this->textSize = (int)$textSize;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setTextFont()
|
* @see TextFormatable::getTextFont()
|
||||||
*/
|
*/
|
||||||
public function setTextFont($textFont) {
|
public function getTextFont()
|
||||||
|
{
|
||||||
|
return $this->textFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setTextFont()
|
||||||
|
*/
|
||||||
|
public function setTextFont($textFont)
|
||||||
|
{
|
||||||
$this->textFont = (string)$textFont;
|
$this->textFont = (string)$textFont;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setTextColor()
|
* @see TextFormatable::getTextColor()
|
||||||
*/
|
*/
|
||||||
public function setTextColor($textColor) {
|
public function getTextColor()
|
||||||
|
{
|
||||||
|
return $this->textColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setTextColor()
|
||||||
|
*/
|
||||||
|
public function setTextColor($textColor)
|
||||||
|
{
|
||||||
$this->textColor = (string)$textColor;
|
$this->textColor = (string)$textColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setAreaColor()
|
* @see TextFormatable::getAreaColor()
|
||||||
*/
|
*/
|
||||||
public function setAreaColor($areaColor) {
|
public function getAreaColor()
|
||||||
$this->focusAreaColor1 = (string)$areaColor;
|
{
|
||||||
|
return $this->areaColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setAreaColor()
|
||||||
|
*/
|
||||||
|
public function setAreaColor($areaColor)
|
||||||
|
{
|
||||||
|
$this->areaColor = (string)$areaColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\TextFormatable::setAreaFocusColor()
|
* @see TextFormatable::getAreaFocusColor()
|
||||||
*/
|
*/
|
||||||
public function setAreaFocusColor($areaFocusColor) {
|
public function getAreaFocusColor()
|
||||||
$this->focusAreaColor2 = (string)$areaFocusColor;
|
{
|
||||||
|
return $this->focusAreaColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TextFormatable::setAreaFocusColor()
|
||||||
|
*/
|
||||||
|
public function setAreaFocusColor($areaFocusColor)
|
||||||
|
{
|
||||||
|
$this->focusAreaColor = (string)$areaFocusColor;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Renderable::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$formatXmlElement = $domDocument->createElement($this->tagName);
|
{
|
||||||
if ($this->bgColor) {
|
$domElement = $domDocument->createElement("format");
|
||||||
$formatXmlElement->setAttribute('bgcolor', $this->bgColor);
|
if ($this->backgroundColor) {
|
||||||
|
$domElement->setAttribute("bgcolor", $this->backgroundColor);
|
||||||
}
|
}
|
||||||
if ($this->style) {
|
if ($this->style) {
|
||||||
$formatXmlElement->setAttribute('style', $this->style);
|
$domElement->setAttribute("style", $this->style);
|
||||||
}
|
}
|
||||||
if ($this->textSize >= 0) {
|
if ($this->textSize) {
|
||||||
$formatXmlElement->setAttribute('textsize', $this->textSize);
|
$domElement->setAttribute("textsize", $this->textSize);
|
||||||
}
|
}
|
||||||
if ($this->textFont) {
|
if ($this->textFont) {
|
||||||
$formatXmlElement->setAttribute('textfont', $this->textFont);
|
$domElement->setAttribute("textfont", $this->textFont);
|
||||||
}
|
}
|
||||||
if ($this->textColor) {
|
if ($this->textColor) {
|
||||||
$formatXmlElement->setAttribute('textcolor', $this->textColor);
|
$domElement->setAttribute("textcolor", $this->textColor);
|
||||||
}
|
}
|
||||||
if ($this->focusAreaColor1) {
|
if ($this->areaColor) {
|
||||||
$formatXmlElement->setAttribute('focusareacolor1', $this->focusAreaColor1);
|
$domElement->setAttribute("focusareacolor1", $this->areaColor);
|
||||||
}
|
}
|
||||||
if ($this->focusAreaColor2) {
|
if ($this->focusAreaColor) {
|
||||||
$formatXmlElement->setAttribute('focusareacolor2', $this->focusAreaColor2);
|
$domElement->setAttribute("focusareacolor2", $this->focusAreaColor);
|
||||||
}
|
}
|
||||||
return $formatXmlElement;
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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,56 +11,110 @@ 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
|
|
||||||
|
/**
|
||||||
|
* @var string $modelId Model id
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'framemodel';
|
|
||||||
protected $modelId = null;
|
protected $modelId = null;
|
||||||
/** @var Renderable[] $children */
|
|
||||||
|
/**
|
||||||
|
* @var Renderable[] $children Children
|
||||||
|
*/
|
||||||
protected $children = array();
|
protected $children = array();
|
||||||
/** @var Format $format */
|
|
||||||
|
/**
|
||||||
|
* @var Format $format Format
|
||||||
|
*/
|
||||||
protected $format = null;
|
protected $format = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Model id
|
* Create a new Frame Model
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $modelId Model id
|
* @param string $modelId Model id
|
||||||
|
* @param Renderable[] $children Children
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setId($modelId) {
|
public static function create($modelId = null, array $children = null)
|
||||||
|
{
|
||||||
|
return new static($modelId, $children);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new Frame Model
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string $modelId Model id
|
||||||
|
* @param Renderable[] $children Children
|
||||||
|
*/
|
||||||
|
public function __construct($modelId = null, array $children = null)
|
||||||
|
{
|
||||||
|
if ($modelId) {
|
||||||
|
$this->setId($modelId);
|
||||||
|
}
|
||||||
|
if ($children) {
|
||||||
|
$this->addChildren($children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Identifiable::getId()
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
if (!$this->modelId) {
|
||||||
|
return $this->createId();
|
||||||
|
}
|
||||||
|
return $this->modelId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Identifiable::setId()
|
||||||
|
*/
|
||||||
|
public function setId($modelId)
|
||||||
|
{
|
||||||
$this->modelId = (string)$modelId;
|
$this->modelId = (string)$modelId;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Model id
|
* @see Identifiable::checkId()
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function checkId()
|
||||||
return $this->modelId;
|
{
|
||||||
|
return UniqueID::check($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign an id if necessary
|
* Create a new model id
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function checkId() {
|
protected function createId()
|
||||||
if (!$this->modelId) {
|
{
|
||||||
$this->setId(UniqueID::create());
|
$modelId = UniqueID::create();
|
||||||
}
|
$this->setId($modelId);
|
||||||
return $this;
|
return $this->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Container::add()
|
* @see Container::getChildren()
|
||||||
*/
|
*/
|
||||||
public function add(Renderable $childElement) {
|
public function getChildren()
|
||||||
|
{
|
||||||
|
return $this->children;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Container::addChild()
|
||||||
|
*/
|
||||||
|
public function addChild(Renderable $childElement)
|
||||||
|
{
|
||||||
if (!in_array($childElement, $this->children, true)) {
|
if (!in_array($childElement, $this->children, true)) {
|
||||||
array_push($this->children, $childElement);
|
array_push($this->children, $childElement);
|
||||||
}
|
}
|
||||||
@ -67,46 +122,61 @@ class FrameModel implements Container, Renderable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Container::removeChildren()
|
* @see Container::addChildren()
|
||||||
*/
|
*/
|
||||||
public function removeChildren() {
|
public function addChildren(array $children)
|
||||||
|
{
|
||||||
|
foreach ($children as $child) {
|
||||||
|
$this->addChild($child);
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Container::removeAllChildren()
|
||||||
|
*/
|
||||||
|
public function removeAllChildren()
|
||||||
|
{
|
||||||
$this->children = array();
|
$this->children = array();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Container::setFormat()
|
* @see Container::getFormat()
|
||||||
*/
|
*/
|
||||||
public function setFormat(Format $format) {
|
public function getFormat()
|
||||||
|
{
|
||||||
|
return $this->format;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Container::setFormat()
|
||||||
|
*/
|
||||||
|
public function setFormat(Format $format = null)
|
||||||
|
{
|
||||||
$this->format = $format;
|
$this->format = $format;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Container::getFormat()
|
* @see Renderable::render()
|
||||||
*/
|
*/
|
||||||
public function getFormat($createIfEmpty = true) {
|
public function render(\DOMDocument $domDocument)
|
||||||
if (!$this->format && $createIfEmpty) {
|
{
|
||||||
$this->setFormat(new Format());
|
$domElement = $domDocument->createElement("framemodel");
|
||||||
}
|
$domElement->setAttribute("id", $this->getId());
|
||||||
return $this->format;
|
|
||||||
|
if ($this->format) {
|
||||||
|
$formatElement = $this->format->render($domDocument);
|
||||||
|
$domElement->appendChild($formatElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @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) {
|
foreach ($this->children as $child) {
|
||||||
$childElement = $child->render($domDocument);
|
$childElement = $child->render($domDocument);
|
||||||
$xmlElement->appendChild($childElement);
|
$domElement->appendChild($childElement);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $url Include url
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'include';
|
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Include object
|
* Create a new Include
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $url (optional) Include url
|
* @param string $url (optional) Include url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($url = null) {
|
public static function create($url = null)
|
||||||
|
{
|
||||||
return new static($url);
|
return new static($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Include object
|
* Construct a new Include
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $url (optional) Include url
|
* @param string $url (optional) Include url
|
||||||
*/
|
*/
|
||||||
public function __construct($url = null) {
|
public function __construct($url = null)
|
||||||
if ($url !== null) {
|
{
|
||||||
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set url
|
* Get the url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Include url
|
* @param string $url Include url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Renderable::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = $domDocument->createElement($this->tagName);
|
{
|
||||||
|
$domElement = $domDocument->createElement("include");
|
||||||
if ($this->url) {
|
if ($this->url) {
|
||||||
$xmlElement->setAttribute('url', $this->url);
|
$domElement->setAttribute("url", $this->url);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $data Media url
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'music';
|
|
||||||
protected $data = null;
|
protected $data = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Music object
|
* Create a new Music
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $data (optional) Media url
|
* @param string $data (optional) Media url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($data = null) {
|
public static function create($data = null)
|
||||||
|
{
|
||||||
return new static($data);
|
return new static($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Music object
|
* Construct a new Music
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $data (optional) Media url
|
* @param string $data (optional) Media url
|
||||||
*/
|
*/
|
||||||
public function __construct($data = null) {
|
public function __construct($data = null)
|
||||||
if ($data !== null) {
|
{
|
||||||
|
if ($data) {
|
||||||
$this->setData($data);
|
$this->setData($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set data url
|
* Get the media url
|
||||||
*
|
*
|
||||||
* @param string $data Data url
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getData()
|
||||||
|
{
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the media url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string $data Media url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setData($data) {
|
public function setData($data)
|
||||||
|
{
|
||||||
$this->data = (string)$data;
|
$this->data = (string)$data;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Renderable::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = $domDocument->createElement($this->tagName);
|
{
|
||||||
|
$domElement = $domDocument->createElement("music");
|
||||||
if ($this->data) {
|
if ($this->data) {
|
||||||
$xmlElement->setAttribute('data', $this->data);
|
$domElement->setAttribute("data", $this->data);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $text Script text
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'script';
|
|
||||||
protected $text = null;
|
protected $text = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new SimpleScript object
|
* Create a new SimpleScript
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $text (optional) Script text
|
* @param string $text (optional) Script text
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($text = null) {
|
public static function create($text = null)
|
||||||
|
{
|
||||||
return new static($text);
|
return new static($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new SimpleScript object
|
* Construct a new SimpleScript
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $text (optional) Script text
|
* @param string $text (optional) Script text
|
||||||
*/
|
*/
|
||||||
public function __construct($text = null) {
|
public function __construct($text = null)
|
||||||
if ($text !== null) {
|
{
|
||||||
|
if ($text) {
|
||||||
$this->setText($text);
|
$this->setText($text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set script 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
|
* @param string $text Complete script text
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setText($text) {
|
public function setText($text)
|
||||||
|
{
|
||||||
$this->text = (string)$text;
|
$this->text = (string)$text;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Types\Renderable::render()
|
* @see Renderable::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = $domDocument->createElement($this->tagName);
|
{
|
||||||
|
$domElement = $domDocument->createElement("script");
|
||||||
if ($this->text) {
|
if ($this->text) {
|
||||||
$scriptComment = $domDocument->createComment($this->text);
|
$scriptComment = $domDocument->createComment($this->text);
|
||||||
$xmlElement->appendChild($scriptComment);
|
$domElement->appendChild($scriptComment);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
32
libs/FML/Form/Parameters.php
Normal file
32
libs/FML/Form/Parameters.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var bool $disableConfirmation Disable the confirmation
|
||||||
|
*/
|
||||||
|
protected $disableConfirmation = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Element[] $elements ManiaCode Elements
|
||||||
*/
|
*/
|
||||||
protected $encoding = 'utf-8';
|
|
||||||
protected $tagName = 'maniacode';
|
|
||||||
protected $noConfirmation = null;
|
|
||||||
/** @var Element[] $elements */
|
|
||||||
protected $elements = array();
|
protected $elements = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ManiaCode object
|
* Create a new ManiaCode
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create() {
|
public static function create()
|
||||||
|
{
|
||||||
return new static();
|
return new static();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set XML encoding
|
* Get if the confirmation is disabled
|
||||||
*
|
*
|
||||||
* @param string $encoding XML encoding
|
* @api
|
||||||
* @return static
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function setXmlEncoding($encoding) {
|
public function getDisableConfirmation()
|
||||||
$this->encoding = (string)$encoding;
|
{
|
||||||
return $this;
|
return $this->disableConfirmation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable the showing of the confirmation at the end of the ManiaCode
|
* Disable the showing of the confirmation at the end of the ManiaCode
|
||||||
*
|
*
|
||||||
* @param bool $disable Whether the confirmation should be shown
|
* @api
|
||||||
|
* @param bool $disableConfirmation If the confirmation should be disabled
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function disableConfirmation($disable) {
|
public function setDisableConfirmation($disableConfirmation)
|
||||||
$this->noConfirmation = ($disable ? 1 : 0);
|
{
|
||||||
|
$this->disableConfirmation = (bool)$disableConfirmation;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a message
|
* Show a message
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $message Message text
|
* @param string $message Message text
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addShowMessage($message) {
|
public function addShowMessage($message)
|
||||||
|
{
|
||||||
$messageElement = new ShowMessage($message);
|
$messageElement = new ShowMessage($message);
|
||||||
$this->addElement($messageElement);
|
return $this->addElement($messageElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install a Macroblock
|
* Install a Macroblock
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Macroblock name
|
* @param string $name Macroblock name
|
||||||
* @param string $file Macroblock file
|
* @param string $file Macroblock file
|
||||||
* @param string $url Macroblock url
|
* @param string $url Macroblock url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addInstallMacroblock($name, $file, $url) {
|
public function addInstallMacroblock($name, $file, $url)
|
||||||
|
{
|
||||||
$macroblockElement = new InstallMacroblock($name, $file, $url);
|
$macroblockElement = new InstallMacroblock($name, $file, $url);
|
||||||
$this->addElement($macroblockElement);
|
return $this->addElement($macroblockElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install a map
|
* Install a map
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Map name
|
* @param string $name Map name
|
||||||
* @param string $url Map url
|
* @param string $url Map url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addInstallMap($name, $url) {
|
public function addInstallMap($name, $url)
|
||||||
|
{
|
||||||
$mapElement = new InstallMap($name, $url);
|
$mapElement = new InstallMap($name, $url);
|
||||||
$this->addElement($mapElement);
|
return $this->addElement($mapElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Play a map
|
* Play a map
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Map name
|
* @param string $name Map name
|
||||||
* @param string $url Map url
|
* @param string $url Map url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addPlayMap($name, $url) {
|
public function addPlayMap($name, $url)
|
||||||
|
{
|
||||||
$mapElement = new PlayMap($name, $url);
|
$mapElement = new PlayMap($name, $url);
|
||||||
$this->addElement($mapElement);
|
return $this->addElement($mapElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install a replay
|
* Install a replay
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Replay name
|
* @param string $name Replay name
|
||||||
* @param string $url Replay url
|
* @param string $url Replay url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addInstallReplay($name, $url) {
|
public function addInstallReplay($name, $url)
|
||||||
|
{
|
||||||
$replayElement = new InstallReplay($name, $url);
|
$replayElement = new InstallReplay($name, $url);
|
||||||
$this->addElement($replayElement);
|
return $this->addElement($replayElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View a replay
|
* View a replay
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Replay name
|
* @param string $name Replay name
|
||||||
* @param string $url Replay url
|
* @param string $url Replay url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addViewReplay($name, $url) {
|
public function addViewReplay($name, $url)
|
||||||
|
{
|
||||||
$replayElement = new ViewReplay($name, $url);
|
$replayElement = new ViewReplay($name, $url);
|
||||||
$this->addElement($replayElement);
|
return $this->addElement($replayElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Play a replay
|
* Play a replay
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Replay name
|
* @param string $name Replay name
|
||||||
* @param string $url Replay url
|
* @param string $url Replay url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addPlayReplay($name, $url) {
|
public function addPlayReplay($name, $url)
|
||||||
|
{
|
||||||
$replayElement = new PlayReplay($name, $url);
|
$replayElement = new PlayReplay($name, $url);
|
||||||
$this->addElement($replayElement);
|
return $this->addElement($replayElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install a skin
|
* Install a skin
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Skin name
|
* @param string $name Skin name
|
||||||
* @param string $file Skin file
|
* @param string $file Skin file
|
||||||
* @param string $url Skin url
|
* @param string $url Skin url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addInstallSkin($name, $file, $url) {
|
public function addInstallSkin($name, $file, $url)
|
||||||
|
{
|
||||||
$skinElement = new InstallSkin($name, $file, $url);
|
$skinElement = new InstallSkin($name, $file, $url);
|
||||||
$this->addElement($skinElement);
|
return $this->addElement($skinElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a skin
|
* Get a skin
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Skin name
|
* @param string $name Skin name
|
||||||
* @param string $file Skin file
|
* @param string $file Skin file
|
||||||
* @param string $url Skin url
|
* @param string $url Skin url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addGetSkin($name, $file, $url) {
|
public function addGetSkin($name, $file, $url)
|
||||||
|
{
|
||||||
$skinElement = new GetSkin($name, $file, $url);
|
$skinElement = new GetSkin($name, $file, $url);
|
||||||
$this->addElement($skinElement);
|
return $this->addElement($skinElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a buddy
|
* Add a buddy
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $login Buddy login
|
* @param string $login Buddy login
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addAddBuddy($login) {
|
public function addAddBuddy($login)
|
||||||
|
{
|
||||||
$buddyElement = new AddBuddy($login);
|
$buddyElement = new AddBuddy($login);
|
||||||
$this->addElement($buddyElement);
|
return $this->addElement($buddyElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Go to a link
|
* Go to a link
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $link Goto link
|
* @param string $link Goto link
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addGoto($link) {
|
public function addGoto($link)
|
||||||
|
{
|
||||||
$gotoElement = new Go_To($link);
|
$gotoElement = new Go_To($link);
|
||||||
$this->addElement($gotoElement);
|
return $this->addElement($gotoElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join a server
|
* Join a server
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $login Server login
|
* @param string $login Server login
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addJoinServer($login) {
|
public function addJoinServer($login)
|
||||||
|
{
|
||||||
$serverElement = new JoinServer($login);
|
$serverElement = new JoinServer($login);
|
||||||
$this->addElement($serverElement);
|
return $this->addElement($serverElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a server as favorite
|
* Add a server as favorite
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $login Server login
|
* @param string $login Server login
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addAddFavorite($login) {
|
public function addAddFavorite($login)
|
||||||
|
{
|
||||||
$favoriteElement = new AddFavorite($login);
|
$favoriteElement = new AddFavorite($login);
|
||||||
$this->addElement($favoriteElement);
|
return $this->addElement($favoriteElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install a script
|
* Install a script
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Script name
|
* @param string $name Script name
|
||||||
* @param string $file Script file
|
* @param string $file Script file
|
||||||
* @param string $url Script url
|
* @param string $url Script url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addInstallScript($name, $file, $url) {
|
public function addInstallScript($name, $file, $url)
|
||||||
|
{
|
||||||
$scriptElement = new InstallScript($name, $file, $url);
|
$scriptElement = new InstallScript($name, $file, $url);
|
||||||
$this->addElement($scriptElement);
|
return $this->addElement($scriptElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install a title pack
|
* Install a title pack
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Pack name
|
* @param string $name Pack name
|
||||||
* @param string $file Pack file
|
* @param string $file Pack file
|
||||||
* @param string $url Pack url
|
* @param string $url Pack url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addInstallPack($name, $file, $url) {
|
public function addInstallPack($name, $file, $url)
|
||||||
|
{
|
||||||
$packElement = new InstallPack($name, $file, $url);
|
$packElement = new InstallPack($name, $file, $url);
|
||||||
$this->addElement($packElement);
|
return $this->addElement($packElement);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a ManiaCode element
|
* Get all Elements
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return Element[]
|
||||||
|
*/
|
||||||
|
public function getElements()
|
||||||
|
{
|
||||||
|
return $this->elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a ManiaCode Element
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param Element $element Element to add
|
* @param Element $element Element to add
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addElement(Element $element) {
|
public function addElement(Element $element)
|
||||||
|
{
|
||||||
|
if (!in_array($element, $this->elements, true)) {
|
||||||
array_push($this->elements, $element);
|
array_push($this->elements, $element);
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all elements from the ManiaCode
|
* Remove all ManiaCode Elements
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return static
|
||||||
|
* @deprecated use removeAllElements() instead
|
||||||
|
*/
|
||||||
|
public function removeElements()
|
||||||
|
{
|
||||||
|
return $this->removeAllElements();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all ManiaCode Elements
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function removeElements() {
|
public function removeAllElements()
|
||||||
|
{
|
||||||
$this->elements = array();
|
$this->elements = array();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the XML document
|
* Render the ManiaCode
|
||||||
*
|
*
|
||||||
* @param bool $echo (optional) Whether the XML text should be echoed and the Content-Type header should be set
|
* @api
|
||||||
|
* @param bool $echo (optional) If the XML text should be echoed and the Content-Type header should be set
|
||||||
* @return \DOMDocument
|
* @return \DOMDocument
|
||||||
*/
|
*/
|
||||||
public function render($echo = false) {
|
public function render($echo = false)
|
||||||
$domDocument = new \DOMDocument('1.0', $this->encoding);
|
{
|
||||||
|
$domDocument = new \DOMDocument("1.0", "utf-8");
|
||||||
$domDocument->xmlStandalone = true;
|
$domDocument->xmlStandalone = true;
|
||||||
$maniaCode = $domDocument->createElement($this->tagName);
|
|
||||||
$domDocument->appendChild($maniaCode);
|
$domElement = $domDocument->createElement("maniacode");
|
||||||
if ($this->noConfirmation) {
|
$domDocument->appendChild($domElement);
|
||||||
$maniaCode->setAttribute('noconfirmation', $this->noConfirmation);
|
|
||||||
|
if ($this->disableConfirmation) {
|
||||||
|
$domElement->setAttribute("noconfirmation", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->elements as $element) {
|
foreach ($this->elements as $element) {
|
||||||
$xmlElement = $element->render($domDocument);
|
$childDomElement = $element->render($domDocument);
|
||||||
$maniaCode->appendChild($xmlElement);
|
$domElement->appendChild($childDomElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($echo) {
|
if ($echo) {
|
||||||
header('Content-Type: application/xml; charset=utf-8;');
|
header("Content-Type: application/xml; charset=utf-8;");
|
||||||
echo $domDocument->saveXML();
|
echo $domDocument->saveXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $domDocument;
|
return $domDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get string representation
|
* Get the string representation
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString() {
|
public function __toString()
|
||||||
return $this->render()->saveXML();
|
{
|
||||||
|
return $this->render()
|
||||||
|
->saveXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $login Buddy login
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'add_buddy';
|
|
||||||
protected $login = null;
|
protected $login = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new AddBuddy Element
|
* Create a new AddBuddy Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $login (optional) Buddy login
|
* @param string $login (optional) Buddy login
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($login = null) {
|
public static function create($login = null)
|
||||||
|
{
|
||||||
return new static($login);
|
return new static($login);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new AddBuddy Element
|
* Construct a new AddBuddy Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $login (optional) Buddy login
|
* @param string $login (optional) Buddy login
|
||||||
*/
|
*/
|
||||||
public function __construct($login = null) {
|
public function __construct($login = null)
|
||||||
if ($login !== null) {
|
{
|
||||||
|
if ($login) {
|
||||||
$this->setLogin($login);
|
$this->setLogin($login);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the buddy login
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLogin()
|
||||||
|
{
|
||||||
|
return $this->login;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the buddy login
|
* Set the buddy login
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $login Buddy login
|
* @param string $login Buddy login
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLogin($login) {
|
public function setLogin($login)
|
||||||
|
{
|
||||||
$this->login = (string)$login;
|
$this->login = (string)$login;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$loginElement = $domDocument->createElement('login', $this->login);
|
$domElement = $domDocument->createElement("add_buddy");
|
||||||
$xmlElement->appendChild($loginElement);
|
|
||||||
return $xmlElement;
|
$loginElement = $domDocument->createElement("login", $this->login);
|
||||||
|
$domElement->appendChild($loginElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
*/
|
||||||
|
protected $login = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $ip Server ip
|
||||||
|
*/
|
||||||
|
protected $ip = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $port Server port
|
||||||
|
*/
|
||||||
|
protected $port = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new AddFavorite Element
|
||||||
*
|
*
|
||||||
* @param string $login (optional) Server login
|
* @api
|
||||||
|
* @param string $loginOrIp (optional) Server login or ip
|
||||||
|
* @param int $port (optional) Server port
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($login = null) {
|
public static function create($loginOrIp = null, $port = null)
|
||||||
return new static($login);
|
{
|
||||||
|
return new static($loginOrIp, $port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new AddFavorite object
|
* Construct a new AddFavorite Element
|
||||||
*
|
*
|
||||||
* @param string $login (optional) Server login
|
* @api
|
||||||
|
* @param string $loginOrIp (optional) Server login or ip
|
||||||
|
* @param int $port (optional) Server port
|
||||||
*/
|
*/
|
||||||
public function __construct($login = null) {
|
public function __construct($loginOrIp = null, $port = null)
|
||||||
if ($login !== null) {
|
{
|
||||||
$this->setLogin($login);
|
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
|
* Set the server login
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $login Server login
|
* @param string $login Server login
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLogin($login) {
|
public function setLogin($login)
|
||||||
|
{
|
||||||
$this->login = (string)$login;
|
$this->login = (string)$login;
|
||||||
$this->serverIp = null;
|
$this->ip = null;
|
||||||
$this->serverPort = null;
|
$this->port = null;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the server ip
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getIp()
|
||||||
|
{
|
||||||
|
return $this->ip;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the server ip and port
|
* Set the server ip and port
|
||||||
*
|
*
|
||||||
* @param string $serverIp Server ip
|
* @api
|
||||||
* @param int $serverPort Server port
|
* @param string $ip Server ip
|
||||||
|
* @param int $port (optional) Server port
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setIp($serverIp, $serverPort) {
|
public function setIp($ip, $port = null)
|
||||||
$this->serverIp = (string)$serverIp;
|
{
|
||||||
$this->serverPort = (int)$serverPort;
|
|
||||||
$this->login = null;
|
$this->login = null;
|
||||||
|
$this->ip = (string)$ip;
|
||||||
|
if ($port) {
|
||||||
|
$this->setPort($port);
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* Get the server port
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function getPort()
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
if ($this->serverIp === null) {
|
return $this->port;
|
||||||
$loginElement = $domDocument->createElement('login', $this->login);
|
}
|
||||||
$xmlElement->appendChild($loginElement);
|
|
||||||
|
/**
|
||||||
|
* 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 {
|
} else {
|
||||||
$ipElement = $domDocument->createElement('ip', $this->serverIp . ':' . $this->serverPort);
|
$ipElement = $domDocument->createElement("ip", $this->ip . ":" . $this->port);
|
||||||
$xmlElement->appendChild($ipElement);
|
$domElement->appendChild($ipElement);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,11 @@ 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
|
* Render the ManiaCode Element
|
||||||
@ -21,8 +18,6 @@ abstract class Element {
|
|||||||
* @param \DOMDocument $domDocument The DOMDocument for which the Element should be rendered
|
* @param \DOMDocument $domDocument The DOMDocument for which the Element should be rendered
|
||||||
* @return \DOMElement
|
* @return \DOMElement
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument);
|
||||||
$xmlElement = $domDocument->createElement($this->tagName);
|
|
||||||
return $xmlElement;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $name Skin name
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'get_skin';
|
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $file Skin file
|
||||||
|
*/
|
||||||
protected $file = null;
|
protected $file = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Skin url
|
||||||
|
*/
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new GetSkin object
|
* Create a new GetSkin Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Skin name
|
* @param string $name (optional) Skin name
|
||||||
* @param string $file (optional) Skin file
|
* @param string $file (optional) Skin file
|
||||||
* @param string $url (optional) Skin url
|
* @param string $url (optional) Skin url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($name = null, $file = null, $url = null) {
|
public static function create($name = null, $file = null, $url = null)
|
||||||
|
{
|
||||||
return new static($name, $file, $url);
|
return new static($name, $file, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new GetSkin object
|
* Construct a new GetSkin Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Skin name
|
* @param string $name (optional) Skin name
|
||||||
* @param string $file (optional) Skin file
|
* @param string $file (optional) Skin file
|
||||||
* @param string $url (optional) Skin url
|
* @param string $url (optional) Skin url
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $file = null, $url = null) {
|
public function __construct($name = null, $file = null, $url = null)
|
||||||
if ($name !== null) {
|
{
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
}
|
}
|
||||||
if ($file !== null) {
|
if ($file) {
|
||||||
$this->setFile($file);
|
$this->setFile($file);
|
||||||
}
|
}
|
||||||
if ($url !== null) {
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the skin
|
* Get the skin name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the skin name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Skin name
|
* @param string $name Skin name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the file of the skin
|
* Get the skin file
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFile()
|
||||||
|
{
|
||||||
|
return $this->file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the skin file
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $file Skin file
|
* @param string $file Skin file
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setFile($file) {
|
public function setFile($file)
|
||||||
|
{
|
||||||
$this->file = (string)$file;
|
$this->file = (string)$file;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the url of the skin
|
* Get the skin url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the skin url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Skin url
|
* @param string $url Skin url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$nameElement = $domDocument->createElement('name', $this->name);
|
$domElement = $domDocument->createElement("get_skin");
|
||||||
$xmlElement->appendChild($nameElement);
|
|
||||||
$fileElement = $domDocument->createElement('file', $this->file);
|
$nameElement = $domDocument->createElement("name", $this->name);
|
||||||
$xmlElement->appendChild($fileElement);
|
$domElement->appendChild($nameElement);
|
||||||
$urlElement = $domDocument->createElement('url', $this->url);
|
|
||||||
$xmlElement->appendChild($urlElement);
|
$fileElement = $domDocument->createElement("file", $this->file);
|
||||||
return $xmlElement;
|
$domElement->appendChild($fileElement);
|
||||||
|
|
||||||
|
$urlElement = $domDocument->createElement("url", $this->url);
|
||||||
|
$domElement->appendChild($urlElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $link Link
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'goto';
|
|
||||||
protected $link = null;
|
protected $link = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Go_To object
|
* Create a new Go_To Element
|
||||||
*
|
*
|
||||||
* @param string $link (optional) Goto link
|
* @api
|
||||||
|
* @param string $link (optional) Link
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($link = null) {
|
public static function create($link = null)
|
||||||
|
{
|
||||||
return new static($link);
|
return new static($link);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Go_To object
|
* Construct a new Go_To Element
|
||||||
*
|
*
|
||||||
* @param string $link (optional) Goto link
|
* @api
|
||||||
|
* @param string $link (optional) Link
|
||||||
*/
|
*/
|
||||||
public function __construct($link = null) {
|
public function __construct($link = null)
|
||||||
if ($link !== null) {
|
{
|
||||||
|
if ($link) {
|
||||||
$this->setLink($link);
|
$this->setLink($link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set link
|
* Get the link
|
||||||
*
|
*
|
||||||
* @param string $link Goto link
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLink()
|
||||||
|
{
|
||||||
|
return $this->link;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the link
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string $link Link
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLink($link) {
|
public function setLink($link)
|
||||||
|
{
|
||||||
$this->link = (string)$link;
|
$this->link = (string)$link;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$linkElement = $domDocument->createElement('link', $this->link);
|
$domElement = $domDocument->createElement("goto");
|
||||||
$xmlElement->appendChild($linkElement);
|
|
||||||
return $xmlElement;
|
$linkElement = $domDocument->createElement("link", $this->link);
|
||||||
|
$domElement->appendChild($linkElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $name Macroblock name
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'install_macroblock';
|
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $file Macroblock file
|
||||||
|
*/
|
||||||
protected $file = null;
|
protected $file = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Macroblock url
|
||||||
|
*/
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new InstallMacroblock object
|
* Create a new InstallMacroblock Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Macroblock name
|
* @param string $name (optional) Macroblock name
|
||||||
|
* @param string $file (optional) Macroblock file
|
||||||
* @param string $url (optional) Macroblock url
|
* @param string $url (optional) Macroblock url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($name = null, $url = null) {
|
public static function create($name = null, $file = null, $url = null)
|
||||||
return new static($name, $url);
|
{
|
||||||
|
return new static($name, $file, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new InstallMacroblock object
|
* Construct a new InstallMacroblock Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Macroblock name
|
* @param string $name (optional) Macroblock name
|
||||||
* @param string $file (optional) Macroblock file
|
* @param string $file (optional) Macroblock file
|
||||||
* @param string $url (optional) Macroblock url
|
* @param string $url (optional) Macroblock url
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $file = null, $url = null) {
|
public function __construct($name = null, $file = null, $url = null)
|
||||||
if ($name !== null) {
|
{
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
}
|
}
|
||||||
if ($file !== null) {
|
if ($file) {
|
||||||
$this->setFile($file);
|
$this->setFile($file);
|
||||||
}
|
}
|
||||||
if ($url !== null) {
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the macroblock
|
* Get the macroblock name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the macroblock name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Macroblock name
|
* @param string $name Macroblock name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the file of the macroblock
|
* Get the macroblock file
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFile()
|
||||||
|
{
|
||||||
|
return $this->file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the macroblock file
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $file Macroblock file
|
* @param string $file Macroblock file
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setFile($file) {
|
public function setFile($file)
|
||||||
|
{
|
||||||
$this->file = (string)$file;
|
$this->file = (string)$file;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the url of the macroblock
|
* Get the macroblock url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the macroblock url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Macroblock url
|
* @param string $url Macroblock url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$nameElement = $domDocument->createElement('name', $this->name);
|
$domElement = $domDocument->createElement("install_macroblock");
|
||||||
$xmlElement->appendChild($nameElement);
|
|
||||||
$fileElement = $domDocument->createElement('file', $this->file);
|
$nameElement = $domDocument->createElement("name", $this->name);
|
||||||
$xmlElement->appendChild($fileElement);
|
$domElement->appendChild($nameElement);
|
||||||
$urlElement = $domDocument->createElement('url', $this->url);
|
|
||||||
$xmlElement->appendChild($urlElement);
|
$fileElement = $domDocument->createElement("file", $this->file);
|
||||||
return $xmlElement;
|
$domElement->appendChild($fileElement);
|
||||||
|
|
||||||
|
$urlElement = $domDocument->createElement("url", $this->url);
|
||||||
|
$domElement->appendChild($urlElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $name Map name
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'install_map';
|
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Map url
|
||||||
|
*/
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new InstallMap object
|
* Create a new InstallMap Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Map name
|
* @param string $name (optional) Map name
|
||||||
* @param string $url (optional) Map url
|
* @param string $url (optional) Map url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($name = null, $url = null) {
|
public static function create($name = null, $url = null)
|
||||||
|
{
|
||||||
return new static($name, $url);
|
return new static($name, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new InstallMap object
|
* Construct a new InstallMap Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Map name
|
* @param string $name (optional) Map name
|
||||||
* @param string $url (optional) Map url
|
* @param string $url (optional) Map url
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $url = null) {
|
public function __construct($name = null, $url = null)
|
||||||
if ($name !== null) {
|
{
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
}
|
}
|
||||||
if ($url !== null) {
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the map
|
* Get the map name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the map name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Map name
|
* @param string $name Map name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the url of the map
|
* Get the map url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the map url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Map url
|
* @param string $url Map url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$nameElement = $domDocument->createElement('name', $this->name);
|
$domElement = $domDocument->createElement("install_map");
|
||||||
$xmlElement->appendChild($nameElement);
|
|
||||||
$urlElement = $domDocument->createElement('url', $this->url);
|
$nameElement = $domDocument->createElement("name", $this->name);
|
||||||
$xmlElement->appendChild($urlElement);
|
$domElement->appendChild($nameElement);
|
||||||
return $xmlElement;
|
|
||||||
|
$urlElement = $domDocument->createElement("url", $this->url);
|
||||||
|
$domElement->appendChild($urlElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $name Pack name
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'install_pack';
|
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $file Pack file
|
||||||
|
*/
|
||||||
protected $file = null;
|
protected $file = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Pack url
|
||||||
|
*/
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new InstallPack object
|
* Create a new InstallPack Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Pack name
|
* @param string $name (optional) Pack name
|
||||||
* @param string $file (optional) Pack file
|
* @param string $file (optional) Pack file
|
||||||
* @param string $url (optional) Pack url
|
* @param string $url (optional) Pack url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($name = null, $file = null, $url = null) {
|
public static function create($name = null, $file = null, $url = null)
|
||||||
|
{
|
||||||
return new static($name, $file, $url);
|
return new static($name, $file, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new InstallPack object
|
* Construct a new InstallPack Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Pack name
|
* @param string $name (optional) Pack name
|
||||||
* @param string $file (optional) Pack file
|
* @param string $file (optional) Pack file
|
||||||
* @param string $url (optional) Pack url
|
* @param string $url (optional) Pack url
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $file = null, $url = null) {
|
public function __construct($name = null, $file = null, $url = null)
|
||||||
if ($name !== null) {
|
{
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
}
|
}
|
||||||
if ($file !== null) {
|
if ($file) {
|
||||||
$this->setFile($file);
|
$this->setFile($file);
|
||||||
}
|
}
|
||||||
if ($url !== null) {
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the pack
|
* Get the pack name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the pack name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Pack name
|
* @param string $name Pack name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the file of the pack
|
* Get the pack file
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFile()
|
||||||
|
{
|
||||||
|
return $this->file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the pack file
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $file Pack file
|
* @param string $file Pack file
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setFile($file) {
|
public function setFile($file)
|
||||||
|
{
|
||||||
$this->file = (string)$file;
|
$this->file = (string)$file;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the url of the pack
|
* Get the pack url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the pack url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Pack url
|
* @param string $url Pack url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$nameElement = $domDocument->createElement('name', $this->name);
|
$domElement = $domDocument->createElement("install_pack");
|
||||||
$xmlElement->appendChild($nameElement);
|
|
||||||
$fileElement = $domDocument->createElement('file', $this->file);
|
$nameElement = $domDocument->createElement("name", $this->name);
|
||||||
$xmlElement->appendChild($fileElement);
|
$domElement->appendChild($nameElement);
|
||||||
$urlElement = $domDocument->createElement('url', $this->url);
|
|
||||||
$xmlElement->appendChild($urlElement);
|
$fileElement = $domDocument->createElement("file", $this->file);
|
||||||
return $xmlElement;
|
$domElement->appendChild($fileElement);
|
||||||
|
|
||||||
|
$urlElement = $domDocument->createElement("url", $this->url);
|
||||||
|
$domElement->appendChild($urlElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $name Replay name
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'install_replay';
|
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Replay url
|
||||||
|
*/
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new InstallReplay object
|
* Create a new InstallReplay Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Replay name
|
* @param string $name (optional) Replay name
|
||||||
* @param string $url (optional) Replay url
|
* @param string $url (optional) Replay url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($name = null, $url = null) {
|
public static function create($name = null, $url = null)
|
||||||
|
{
|
||||||
return new static($name, $url);
|
return new static($name, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new InstallReplay object
|
* Construct a new InstallReplay Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Replay name
|
* @param string $name (optional) Replay name
|
||||||
* @param string $url (optional) Replay url
|
* @param string $url (optional) Replay url
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $url = null) {
|
public function __construct($name = null, $url = null)
|
||||||
if ($name!== null) {
|
{
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
}
|
}
|
||||||
if ($url!== null) {
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the replay
|
* Get the replay name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the replay name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Replay name
|
* @param string $name Replay name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the url of the replay
|
* Get the replay url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the replay url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Replay url
|
* @param string $url Replay url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$nameElement = $domDocument->createElement('name', $this->name);
|
$domElement = $domDocument->createElement("install_replay");
|
||||||
$xmlElement->appendChild($nameElement);
|
|
||||||
$urlElement = $domDocument->createElement('url', $this->url);
|
$nameElement = $domDocument->createElement("name", $this->name);
|
||||||
$xmlElement->appendChild($urlElement);
|
$domElement->appendChild($nameElement);
|
||||||
return $xmlElement;
|
|
||||||
|
$urlElement = $domDocument->createElement("url", $this->url);
|
||||||
|
$domElement->appendChild($urlElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $name Script name
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'install_script';
|
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $file Script file
|
||||||
|
*/
|
||||||
protected $file = null;
|
protected $file = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Script url
|
||||||
|
*/
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new InstallScript object
|
* Create a new InstallScript Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Script name
|
* @param string $name (optional) Script name
|
||||||
* @param string $file (optional) Script file
|
* @param string $file (optional) Script file
|
||||||
* @param string $url (optional) Script url
|
* @param string $url (optional) Script url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($name = null, $file = null, $url = null) {
|
public static function create($name = null, $file = null, $url = null)
|
||||||
|
{
|
||||||
return new static($name, $file, $url);
|
return new static($name, $file, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new InstallScript object
|
* Construct a new InstallScript Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Script name
|
* @param string $name (optional) Script name
|
||||||
* @param string $file (optional) Script file
|
* @param string $file (optional) Script file
|
||||||
* @param string $url (optional) Script url
|
* @param string $url (optional) Script url
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $file = null, $url = null) {
|
public function __construct($name = null, $file = null, $url = null)
|
||||||
if ($name !== null) {
|
{
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
}
|
}
|
||||||
if ($file !== null) {
|
if ($file) {
|
||||||
$this->setFile($file);
|
$this->setFile($file);
|
||||||
}
|
}
|
||||||
if ($url !== null) {
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the script
|
* Get the script name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the script name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Script name
|
* @param string $name Script name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the file of the script
|
* Get the script file
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFile()
|
||||||
|
{
|
||||||
|
return $this->file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the script file
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $file Script file
|
* @param string $file Script file
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setFile($file) {
|
public function setFile($file)
|
||||||
|
{
|
||||||
$this->file = (string)$file;
|
$this->file = (string)$file;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the url of the script
|
* Get the script url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the script url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Script url
|
* @param string $url Script url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$nameElement = $domDocument->createElement('name', $this->name);
|
$domElement = $domDocument->createElement("install_script");
|
||||||
$xmlElement->appendChild($nameElement);
|
|
||||||
$fileElement = $domDocument->createElement('file', $this->file);
|
$nameElement = $domDocument->createElement("name", $this->name);
|
||||||
$xmlElement->appendChild($fileElement);
|
$domElement->appendChild($nameElement);
|
||||||
$urlElement = $domDocument->createElement('url', $this->url);
|
|
||||||
$xmlElement->appendChild($urlElement);
|
$fileElement = $domDocument->createElement("file", $this->file);
|
||||||
return $xmlElement;
|
$domElement->appendChild($fileElement);
|
||||||
|
|
||||||
|
$urlElement = $domDocument->createElement("url", $this->url);
|
||||||
|
$domElement->appendChild($urlElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $name Skin name
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'install_skin';
|
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $file Skin file
|
||||||
|
*/
|
||||||
protected $file = null;
|
protected $file = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Skin url
|
||||||
|
*/
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new InstallSkin object
|
* Create a new InstallSkin Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Skin name
|
* @param string $name (optional) Skin name
|
||||||
* @param string $file (optional) Skin file
|
* @param string $file (optional) Skin file
|
||||||
* @param string $url (optional) Skin url
|
* @param string $url (optional) Skin url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($name = null, $file = null, $url = null) {
|
public static function create($name = null, $file = null, $url = null)
|
||||||
|
{
|
||||||
return new static($name, $file, $url);
|
return new static($name, $file, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new InstallSkin object
|
* Construct a new InstallSkin Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Skin name
|
* @param string $name (optional) Skin name
|
||||||
* @param string $file (optional) Skin file
|
* @param string $file (optional) Skin file
|
||||||
* @param string $url (optional) Skin url
|
* @param string $url (optional) Skin url
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $file = null, $url = null) {
|
public function __construct($name = null, $file = null, $url = null)
|
||||||
if ($name !== null) {
|
{
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
}
|
}
|
||||||
if ($file !== null) {
|
if ($file) {
|
||||||
$this->setFile($file);
|
$this->setFile($file);
|
||||||
}
|
}
|
||||||
if ($url !== null) {
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the skin
|
* Get the skin name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the skin name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Skin name
|
* @param string $name Skin name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the file of the skin
|
* Get the skin file
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFile()
|
||||||
|
{
|
||||||
|
return $this->file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the skin file
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $file Skin file
|
* @param string $file Skin file
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setFile($file) {
|
public function setFile($file)
|
||||||
|
{
|
||||||
$this->file = (string)$file;
|
$this->file = (string)$file;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the url of the skin
|
* Get the skin url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the skin url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Skin url
|
* @param string $url Skin url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$nameElement = $domDocument->createElement('name', $this->name);
|
$domElement = $domDocument->createElement("install_skin");
|
||||||
$xmlElement->appendChild($nameElement);
|
|
||||||
$fileElement = $domDocument->createElement('file', $this->file);
|
$nameElement = $domDocument->createElement("name", $this->name);
|
||||||
$xmlElement->appendChild($fileElement);
|
$domElement->appendChild($nameElement);
|
||||||
$urlElement = $domDocument->createElement('url', $this->url);
|
|
||||||
$xmlElement->appendChild($urlElement);
|
$fileElement = $domDocument->createElement("file", $this->file);
|
||||||
return $xmlElement;
|
$domElement->appendChild($fileElement);
|
||||||
|
|
||||||
|
$urlElement = $domDocument->createElement("url", $this->url);
|
||||||
|
$domElement->appendChild($urlElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
*/
|
||||||
|
protected $login = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $ip Server ip
|
||||||
|
*/
|
||||||
|
protected $ip = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $port Server port
|
||||||
|
*/
|
||||||
|
protected $port = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new JoinServer Element
|
||||||
*
|
*
|
||||||
* @param string $login (optional) Server login
|
* @api
|
||||||
|
* @param string $loginOrIp (optional) Server login or ip
|
||||||
|
* @param int $port (optional) Server port
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($login = null) {
|
public static function create($loginOrIp = null, $port = null)
|
||||||
return new static($login);
|
{
|
||||||
|
return new static($loginOrIp, $port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new JoinServer object
|
* Construct a new JoinServer Element
|
||||||
*
|
*
|
||||||
* @param string $login (optional) Server login
|
* @api
|
||||||
|
* @param string $loginOrIp (optional) Server login or ip
|
||||||
|
* @param int $port (optional) Server port
|
||||||
*/
|
*/
|
||||||
public function __construct($login = null) {
|
public function __construct($loginOrIp = null, $port = null)
|
||||||
if ($login !== null) {
|
{
|
||||||
$this->setLogin($login);
|
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
|
* Set the server login
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $login Server login
|
* @param string $login Server login
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLogin($login) {
|
public function setLogin($login)
|
||||||
|
{
|
||||||
$this->login = (string)$login;
|
$this->login = (string)$login;
|
||||||
$this->serverIp = null;
|
$this->ip = null;
|
||||||
$this->serverPort = null;
|
$this->port = null;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the server ip
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getIp()
|
||||||
|
{
|
||||||
|
return $this->ip;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the server ip and port
|
* Set the server ip and port
|
||||||
*
|
*
|
||||||
* @param string $serverIp Server ip
|
* @api
|
||||||
* @param int $serverPort Server port
|
* @param string $ip Server ip
|
||||||
|
* @param int $port (optional) Server port
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setIp($serverIp, $serverPort) {
|
public function setIp($ip, $port = null)
|
||||||
$this->serverIp = (string)$serverIp;
|
{
|
||||||
$this->serverPort = (int)$serverPort;
|
|
||||||
$this->login = null;
|
$this->login = null;
|
||||||
|
$this->ip = (string)$ip;
|
||||||
|
if ($port) {
|
||||||
|
$this->setPort($port);
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* Get the server port
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function getPort()
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
if ($this->serverIp === null) {
|
return $this->port;
|
||||||
$loginElement = $domDocument->createElement('login', $this->login);
|
}
|
||||||
$xmlElement->appendChild($loginElement);
|
|
||||||
|
/**
|
||||||
|
* 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 {
|
} else {
|
||||||
$ipElement = $domDocument->createElement('ip', $this->serverIp . ':' . $this->serverPort);
|
$ipElement = $domDocument->createElement("ip", $this->ip . ":" . $this->port);
|
||||||
$xmlElement->appendChild($ipElement);
|
$domElement->appendChild($ipElement);
|
||||||
}
|
}
|
||||||
return $xmlElement;
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/*+
|
||||||
|
* @var string $name Map name
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'play_map';
|
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Map url
|
||||||
|
*/
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PlayMap object
|
* Create a new PlayMap Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Map name
|
* @param string $name (optional) Map name
|
||||||
* @param string $url (optional) Map url
|
* @param string $url (optional) Map url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($name = null, $url = null) {
|
public static function create($name = null, $url = null)
|
||||||
|
{
|
||||||
return new static($name, $url);
|
return new static($name, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new PlayMap object
|
* Construct a new PlayMap Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Map name
|
* @param string $name (optional) Map name
|
||||||
* @param string $url (optional) Map url
|
* @param string $url (optional) Map url
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $url = null) {
|
public function __construct($name = null, $url = null)
|
||||||
if ($name !== null) {
|
{
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
}
|
}
|
||||||
if ($url !== null) {
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the map
|
* Get the map name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the map name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Map name
|
* @param string $name Map name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the url of the map
|
* Get the map url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the map url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Map url
|
* @param string $url Map url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$nameElement = $domDocument->createElement('name', $this->name);
|
$domElement = $domDocument->createElement("play_map");
|
||||||
$xmlElement->appendChild($nameElement);
|
|
||||||
$urlElement = $domDocument->createElement('url', $this->url);
|
$nameElement = $domDocument->createElement("name", $this->name);
|
||||||
$xmlElement->appendChild($urlElement);
|
$domElement->appendChild($nameElement);
|
||||||
return $xmlElement;
|
|
||||||
|
$urlElement = $domDocument->createElement("url", $this->url);
|
||||||
|
$domElement->appendChild($urlElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $name Replay name
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'play_replay';
|
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Replay url
|
||||||
|
*/
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PlayReplay object
|
* Create a new PlayReplay Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Replay name
|
* @param string $name (optional) Replay name
|
||||||
* @param string $url (optional) Replay url
|
* @param string $url (optional) Replay url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($name = null, $url = null) {
|
public static function create($name = null, $url = null)
|
||||||
|
{
|
||||||
return new static($name, $url);
|
return new static($name, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new PlayReplay object
|
* Construct a new PlayReplay Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Replay name
|
* @param string $name (optional) Replay name
|
||||||
* @param string $url (optional) Replay url
|
* @param string $url (optional) Replay url
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $url = null) {
|
public function __construct($name = null, $url = null)
|
||||||
if ($name !== null) {
|
{
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
}
|
}
|
||||||
if ($url !== null) {
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the replay
|
* Get the replay name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the replay name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Replay name
|
* @param string $name Replay name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the url of the replay
|
* Get the replay url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the replay url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Replay url
|
* @param string $url Replay url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$nameElement = $domDocument->createElement('name', $this->name);
|
$domElement = $domDocument->createElement("play_replay");
|
||||||
$xmlElement->appendChild($nameElement);
|
|
||||||
$urlElement = $domDocument->createElement('url', $this->url);
|
$nameElement = $domDocument->createElement("name", $this->name);
|
||||||
$xmlElement->appendChild($urlElement);
|
$domElement->appendChild($nameElement);
|
||||||
return $xmlElement;
|
|
||||||
|
$urlElement = $domDocument->createElement("url", $this->url);
|
||||||
|
$domElement->appendChild($urlElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $message Message text
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'show_message';
|
|
||||||
protected $message = null;
|
protected $message = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ShowMessage object
|
* Create a new ShowMessage Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $message (optional) Message text
|
* @param string $message (optional) Message text
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($message = null) {
|
public static function create($message = null)
|
||||||
|
{
|
||||||
return new static($message);
|
return new static($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new ShowMessage object
|
* Construct a new ShowMessage Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $message (optional) Message text
|
* @param string $message (optional) Message text
|
||||||
*/
|
*/
|
||||||
public function __construct($message = null) {
|
public function __construct($message = null)
|
||||||
if ($message !== null) {
|
{
|
||||||
|
if ($message) {
|
||||||
$this->setMessage($message);
|
$this->setMessage($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message text
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getMessage()
|
||||||
|
{
|
||||||
|
return $this->message;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the message text
|
* Set the message text
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $message Message text
|
* @param string $message Message text
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setMessage($message) {
|
public function setMessage($message)
|
||||||
|
{
|
||||||
$this->message = (string)$message;
|
$this->message = (string)$message;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$messageElement = $domDocument->createElement('message', $this->message);
|
$domElement = $domDocument->createElement("show_message");
|
||||||
$xmlElement->appendChild($messageElement);
|
|
||||||
return $xmlElement;
|
$messageElement = $domDocument->createElement("message", $this->message);
|
||||||
|
$domElement->appendChild($messageElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
|
/**
|
||||||
|
* @var string $name Replay name
|
||||||
*/
|
*/
|
||||||
protected $tagName = 'view_replay';
|
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Replay url
|
||||||
|
*/
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ViewReplay object
|
* Create a new ViewReplay Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Replay name
|
* @param string $name (optional) Replay name
|
||||||
* @param string $url (optional) Replay url
|
* @param string $url (optional) Replay url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($name = null, $url = null) {
|
public static function create($name = null, $url = null)
|
||||||
|
{
|
||||||
return new static($name, $url);
|
return new static($name, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new ViewReplay object
|
* Construct a new ViewReplay Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name (optional) Replay name
|
* @param string $name (optional) Replay name
|
||||||
* @param string $url (optional) Replay url
|
* @param string $url (optional) Replay url
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $url = null) {
|
public function __construct($name = null, $url = null)
|
||||||
if ($name !== null) {
|
{
|
||||||
|
if ($name) {
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
}
|
}
|
||||||
if ($url !== null) {
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the replay
|
* Get the replay name
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the replay name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Replay name
|
* @param string $name Replay name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the url of the replay
|
* Get the replay url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the replay url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Replay url
|
* @param string $url Replay url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\ManiaCode\Element::render()
|
* @see Element::render()
|
||||||
*/
|
*/
|
||||||
public function render(\DOMDocument $domDocument) {
|
public function render(\DOMDocument $domDocument)
|
||||||
$xmlElement = parent::render($domDocument);
|
{
|
||||||
$nameElement = $domDocument->createElement('name', $this->name);
|
$domElement = $domDocument->createElement("view_replay");
|
||||||
$xmlElement->appendChild($nameElement);
|
|
||||||
$urlElement = $domDocument->createElement('url', $this->url);
|
$nameElement = $domDocument->createElement("name", $this->name);
|
||||||
$xmlElement->appendChild($urlElement);
|
$domElement->appendChild($nameElement);
|
||||||
return $xmlElement;
|
|
||||||
|
$urlElement = $domDocument->createElement("url", $this->url);
|
||||||
|
$domElement->appendChild($urlElement);
|
||||||
|
|
||||||
|
return $domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,151 +12,300 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
const BACKGROUND_0 = '0';
|
const MANIALINK_VERSION = 3;
|
||||||
const BACKGROUND_1 = '1';
|
const BACKGROUND_0 = "0";
|
||||||
const BACKGROUND_STARS = 'stars';
|
const BACKGROUND_1 = "1";
|
||||||
const BACKGROUND_STATIONS = 'stations';
|
const BACKGROUND_STARS = "stars";
|
||||||
const BACKGROUND_TITLE = 'title';
|
const BACKGROUND_STATIONS = "stations";
|
||||||
|
const BACKGROUND_TITLE = "title";
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var string $maniaLinkId ManiaLink ID
|
||||||
*/
|
*/
|
||||||
protected $encoding = 'utf-8';
|
|
||||||
protected $tagName = 'manialink';
|
|
||||||
protected $maniaLinkId = null;
|
protected $maniaLinkId = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $version ManiaLink version
|
||||||
|
*/
|
||||||
protected $version = 1;
|
protected $version = 1;
|
||||||
protected $background = null;
|
|
||||||
protected $navigable3d = 1;
|
/**
|
||||||
|
* @var string $name ManiaLink name
|
||||||
|
*/
|
||||||
protected $name = null;
|
protected $name = null;
|
||||||
protected $timeout = 0;
|
|
||||||
/** @var Renderable[] $children */
|
/**
|
||||||
|
* @var string $background Background
|
||||||
|
*/
|
||||||
|
protected $background = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $navigable3d 3d navigable
|
||||||
|
*/
|
||||||
|
protected $navigable3d = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $timeout Timeout
|
||||||
|
*/
|
||||||
|
protected $timeout = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Renderable[] $children Children
|
||||||
|
*/
|
||||||
protected $children = array();
|
protected $children = array();
|
||||||
/** @var Dico $dico */
|
|
||||||
|
/**
|
||||||
|
* @var Dico $dico Dictionary
|
||||||
|
*/
|
||||||
protected $dico = null;
|
protected $dico = null;
|
||||||
/** @var Stylesheet $stylesheet */
|
|
||||||
|
/**
|
||||||
|
* @var Stylesheet $stylesheet Style sheet
|
||||||
|
*/
|
||||||
protected $stylesheet = null;
|
protected $stylesheet = null;
|
||||||
/** @var Script $script */
|
|
||||||
|
/**
|
||||||
|
* @var Script $script Script
|
||||||
|
*/
|
||||||
protected $script = null;
|
protected $script = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ManiaLink object
|
* Create a new ManiaLink
|
||||||
*
|
*
|
||||||
* @param string $maniaLinkId (optional) ManiaLink id
|
* @api
|
||||||
* @param string $maniaLinkName (optional) ManiaLink Name
|
* @param string $maniaLinkId (optional) ManiaLink ID
|
||||||
|
* @param int $version (optional) Version
|
||||||
|
* @param string $name (optional) Name
|
||||||
|
* @param Renderable[] $children (optional) Children
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create($maniaLinkId = null, $maniaLinkName = null) {
|
public static function create($maniaLinkId = null, $version = null, $name = null, array $children = null)
|
||||||
return new static($maniaLinkId, $maniaLinkName);
|
{
|
||||||
|
return new static($maniaLinkId, $version, $name, $children);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new ManiaLink object
|
* Construct a new ManiaLink
|
||||||
*
|
*
|
||||||
* @param string $maniaLinkId (optional) ManiaLink id
|
* @api
|
||||||
* @param string $maniaLinkName (optional) ManiaLink Name
|
* @param string $maniaLinkId (optional) ManiaLink ID
|
||||||
|
* @param int $version (optional) Version
|
||||||
|
* @param string $name (optional) Name
|
||||||
|
* @param Renderable[] $children (optional) Children
|
||||||
*/
|
*/
|
||||||
public function __construct($maniaLinkId = null, $maniaLinkName = null) {
|
public function __construct($maniaLinkId = null, $version = null, $name = null, array $children = null)
|
||||||
if ($maniaLinkId !== null) {
|
{
|
||||||
|
if (is_string($version)) {
|
||||||
|
// backwards-compatibility (version has been introduced later)
|
||||||
|
$children = $name;
|
||||||
|
$name = $version;
|
||||||
|
$version = null;
|
||||||
|
}
|
||||||
|
if ($maniaLinkId) {
|
||||||
$this->setId($maniaLinkId);
|
$this->setId($maniaLinkId);
|
||||||
}
|
}
|
||||||
if ($maniaLinkName !== false) {
|
$this->setVersion(self::MANIALINK_VERSION);
|
||||||
if ($maniaLinkName) {
|
if ($version) {
|
||||||
$this->setName($maniaLinkName);
|
$this->setVersion($version);
|
||||||
} else {
|
|
||||||
$this->setName($maniaLinkId);
|
|
||||||
}
|
}
|
||||||
|
if ($name) {
|
||||||
|
$this->setName($name);
|
||||||
}
|
}
|
||||||
|
if ($children) {
|
||||||
|
$this->setChildren($children);
|
||||||
|
}
|
||||||
|
$this->createScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set XML encoding
|
* Get the ID
|
||||||
*
|
|
||||||
* @param string $encoding XML encoding
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setXmlEncoding($encoding) {
|
|
||||||
$this->encoding = (string)$encoding;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set ManiaLink id
|
|
||||||
*
|
|
||||||
* @param string $maniaLinkId ManiaLink id
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setId($maniaLinkId) {
|
|
||||||
$this->maniaLinkId = (string)$maniaLinkId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get ManiaLink id
|
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId()
|
||||||
|
{
|
||||||
return $this->maniaLinkId;
|
return $this->maniaLinkId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set background
|
* Set the ID
|
||||||
*
|
*
|
||||||
* @param string $background Background value
|
* @api
|
||||||
|
* @param string $maniaLinkId ManiaLink ID
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setBackground($background) {
|
public function setId($maniaLinkId)
|
||||||
$this->background = (string)$background;
|
{
|
||||||
|
$this->maniaLinkId = (string)$maniaLinkId;
|
||||||
|
if ($this->maniaLinkId && !$this->name) {
|
||||||
|
$this->setName($this->maniaLinkId);
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set navigable3d
|
* Get the version
|
||||||
*
|
*
|
||||||
* @param bool $navigable3d Whether the manialink should be 3d navigable
|
* @api
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getVersion()
|
||||||
|
{
|
||||||
|
return $this->version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the version
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param int $version ManiaLink version
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setNavigable3d($navigable3d) {
|
public function setVersion($version)
|
||||||
$this->navigable3d = ($navigable3d ? 1 : 0);
|
{
|
||||||
|
$this->version = (int)$version;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the ManiaLink Name
|
* Get the name
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the name
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string $name ManiaLink Name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name)
|
||||||
|
{
|
||||||
$this->name = (string)$name;
|
$this->name = (string)$name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set timeout
|
* Get the background
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getBackground()
|
||||||
|
{
|
||||||
|
return $this->background;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the background
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string $background Background value
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setBackground($background)
|
||||||
|
{
|
||||||
|
$this->background = (string)$background;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get navigable3d
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getNavigable3d()
|
||||||
|
{
|
||||||
|
return $this->navigable3d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set navigable3d
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param bool $navigable3d If the ManiaLink should be 3d navigable
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setNavigable3d($navigable3d)
|
||||||
|
{
|
||||||
|
$this->navigable3d = (bool)$navigable3d;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the timeout
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getTimeout()
|
||||||
|
{
|
||||||
|
return $this->timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the timeout
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param int $timeout Timeout duration
|
* @param int $timeout Timeout duration
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setTimeout($timeout) {
|
public function setTimeout($timeout)
|
||||||
|
{
|
||||||
$this->timeout = (int)$timeout;
|
$this->timeout = (int)$timeout;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an element to the ManiaLink
|
* Get children
|
||||||
*
|
*
|
||||||
* @param Renderable $child Child element to add
|
* @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
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function add(Renderable $child) {
|
public function addChild(Renderable $child)
|
||||||
|
{
|
||||||
if (!in_array($child, $this->children, true)) {
|
if (!in_array($child, $this->children, true)) {
|
||||||
array_push($this->children, $child);
|
array_push($this->children, $child);
|
||||||
}
|
}
|
||||||
@ -164,142 +313,194 @@ class ManiaLink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all elements from the ManiaLink
|
* Set children
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @param Renderable[] $children Child Elements
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function removeChildren() {
|
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();
|
$this->children = array();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Dictionary of the ManiaLink
|
* Get the Dictionary
|
||||||
*
|
*
|
||||||
* @param Dico $dico Dictionary for the ManiaLink
|
* @api
|
||||||
|
* @return Dico
|
||||||
|
*/
|
||||||
|
public function getDico()
|
||||||
|
{
|
||||||
|
return $this->dico;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Dictionary
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param Dico $dico Dictionary
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setDico(Dico $dico) {
|
public function setDico(Dico $dico = null)
|
||||||
|
{
|
||||||
$this->dico = $dico;
|
$this->dico = $dico;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Dictionary of the ManiaLink
|
* Get the Stylesheet
|
||||||
*
|
*
|
||||||
* @param bool $createIfEmpty (optional) Whether the Dico object should be created if it's not set
|
* @api
|
||||||
* @return \FML\Elements\Dico
|
* @return Stylesheet
|
||||||
*/
|
*/
|
||||||
public function getDico($createIfEmpty = true) {
|
public function getStylesheet()
|
||||||
if (!$this->dico && $createIfEmpty) {
|
{
|
||||||
$this->setDico(new Dico());
|
return $this->stylesheet;
|
||||||
}
|
|
||||||
return $this->dico;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Stylesheet of the ManiaLink
|
* Set the Stylesheet
|
||||||
*
|
*
|
||||||
* @param Stylesheet $stylesheet Stylesheet for the ManiaLink
|
* @api
|
||||||
|
* @param Stylesheet $stylesheet Stylesheet
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setStylesheet(Stylesheet $stylesheet) {
|
public function setStylesheet(Stylesheet $stylesheet = null)
|
||||||
|
{
|
||||||
$this->stylesheet = $stylesheet;
|
$this->stylesheet = $stylesheet;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Stylesheet of the ManiaLink
|
* Get the Script
|
||||||
*
|
*
|
||||||
* @param bool $createIfEmpty (optional) Whether the Stylesheet object should be created if it's not set
|
* @api
|
||||||
* @return \FML\Stylesheet\Stylesheet
|
* @return Script
|
||||||
*/
|
*/
|
||||||
public function getStylesheet($createIfEmpty = true) {
|
public function getScript()
|
||||||
if (!$this->stylesheet && $createIfEmpty) {
|
{
|
||||||
$this->setStylesheet(new Stylesheet());
|
return $this->script;
|
||||||
}
|
|
||||||
return $this->stylesheet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Script of the ManiaLink
|
* Set the Script
|
||||||
*
|
*
|
||||||
* @param Script $script Script for the ManiaLink
|
* @api
|
||||||
|
* @param Script $script Script
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setScript(Script $script) {
|
public function setScript(Script $script = null)
|
||||||
|
{
|
||||||
$this->script = $script;
|
$this->script = $script;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current Script of the ManiaLink
|
* Create and assign a new Script if necessary
|
||||||
*
|
*
|
||||||
* @param bool $createIfEmpty (optional) Whether the Script object should be created if it's not set
|
* @api
|
||||||
* @return \FML\Script\Script
|
* @return Script
|
||||||
*/
|
*/
|
||||||
public function getScript($createIfEmpty = true) {
|
public function createScript()
|
||||||
if (!$this->script && $createIfEmpty) {
|
{
|
||||||
$this->setScript(new Script());
|
if ($this->script) {
|
||||||
|
return $this->script;
|
||||||
}
|
}
|
||||||
|
$script = new Script();
|
||||||
|
$this->setScript($script);
|
||||||
return $this->script;
|
return $this->script;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the XML document
|
* Render the ManiaLink
|
||||||
*
|
*
|
||||||
* @param bool $echo (optional) If the XML text should be echoed and the Content-Type header should be set
|
* @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 XML element should be created
|
* @param \DOMDocument $domDocument (optional) DOMDocument for which the ManiaLink should be rendered
|
||||||
* @return \DOMDocument
|
* @return \DOMDocument
|
||||||
*/
|
*/
|
||||||
public function render($echo = false, $domDocument = null) {
|
public function render($echo = false, $domDocument = null)
|
||||||
|
{
|
||||||
$isChild = (bool)$domDocument;
|
$isChild = (bool)$domDocument;
|
||||||
if (!$isChild) {
|
if (!$isChild) {
|
||||||
$domDocument = new \DOMDocument('1.0', $this->encoding);
|
$domDocument = new \DOMDocument("1.0", "utf-8");
|
||||||
$domDocument->xmlStandalone = true;
|
$domDocument->xmlStandalone = true;
|
||||||
}
|
}
|
||||||
$maniaLink = $domDocument->createElement($this->tagName);
|
$maniaLink = $domDocument->createElement("manialink");
|
||||||
if (!$isChild) {
|
if (!$isChild) {
|
||||||
$domDocument->appendChild($maniaLink);
|
$domDocument->appendChild($maniaLink);
|
||||||
}
|
}
|
||||||
if (strlen($this->maniaLinkId) > 0) {
|
|
||||||
$maniaLink->setAttribute('id', $this->maniaLinkId);
|
if ($this->maniaLinkId) {
|
||||||
|
$maniaLink->setAttribute("id", $this->maniaLinkId);
|
||||||
}
|
}
|
||||||
if ($this->version) {
|
if ($this->version > 0) {
|
||||||
$maniaLink->setAttribute('version', $this->version);
|
$maniaLink->setAttribute("version", $this->version);
|
||||||
}
|
|
||||||
if (strlen($this->background) > 0) {
|
|
||||||
$maniaLink->setAttribute('background', $this->background);
|
|
||||||
}
|
|
||||||
if (!$this->navigable3d) {
|
|
||||||
$maniaLink->setAttribute('navigable3d', $this->navigable3d);
|
|
||||||
}
|
}
|
||||||
if ($this->name) {
|
if ($this->name) {
|
||||||
$maniaLink->setAttribute('name', $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) {
|
if ($this->timeout) {
|
||||||
$timeoutXml = $domDocument->createElement('timeout', $this->timeout);
|
$timeoutXml = $domDocument->createElement("timeout", $this->timeout);
|
||||||
$maniaLink->appendChild($timeoutXml);
|
$maniaLink->appendChild($timeoutXml);
|
||||||
}
|
}
|
||||||
if ($this->dico) {
|
if ($this->dico) {
|
||||||
$dicoXml = $this->dico->render($domDocument);
|
$dicoXml = $this->dico->render($domDocument);
|
||||||
$maniaLink->appendChild($dicoXml);
|
$maniaLink->appendChild($dicoXml);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scriptFeatures = array();
|
$scriptFeatures = array();
|
||||||
foreach ($this->children as $child) {
|
foreach ($this->children as $child) {
|
||||||
$childXml = $child->render($domDocument, $this->getScript());
|
$childXml = $child->render($domDocument);
|
||||||
$maniaLink->appendChild($childXml);
|
$maniaLink->appendChild($childXml);
|
||||||
if ($child instanceof ScriptFeatureable) {
|
if ($child instanceof ScriptFeatureable) {
|
||||||
$scriptFeatures = array_merge($scriptFeatures, $child->getScriptFeatures());
|
$scriptFeatures = array_merge($scriptFeatures, $child->getScriptFeatures());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($scriptFeatures) {
|
|
||||||
$this->getScript()->loadFeatures($scriptFeatures);
|
|
||||||
}
|
|
||||||
if ($this->stylesheet) {
|
if ($this->stylesheet) {
|
||||||
$stylesheetXml = $this->stylesheet->render($domDocument);
|
$stylesheetXml = $this->stylesheet->render($domDocument);
|
||||||
$maniaLink->appendChild($stylesheetXml);
|
$maniaLink->appendChild($stylesheetXml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($scriptFeatures) {
|
||||||
|
$this->createScript()
|
||||||
|
->loadFeatures($scriptFeatures);
|
||||||
|
}
|
||||||
if ($this->script) {
|
if ($this->script) {
|
||||||
if ($this->script->needsRendering()) {
|
if ($this->script->needsRendering()) {
|
||||||
$scriptXml = $this->script->render($domDocument);
|
$scriptXml = $this->script->render($domDocument);
|
||||||
@ -307,22 +508,26 @@ class ManiaLink {
|
|||||||
}
|
}
|
||||||
$this->script->resetGenericScriptLabels();
|
$this->script->resetGenericScriptLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isChild) {
|
if ($isChild) {
|
||||||
return $maniaLink;
|
return $maniaLink;
|
||||||
}
|
}
|
||||||
if ($echo) {
|
if ($echo) {
|
||||||
header('Content-Type: application/xml; charset=utf-8;');
|
header("Content-Type: application/xml; charset=utf-8;");
|
||||||
echo $domDocument->saveXML();
|
echo $domDocument->saveXML();
|
||||||
}
|
}
|
||||||
return $domDocument;
|
return $domDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get string representation
|
* Get the string representation
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString() {
|
public function __toString()
|
||||||
return $this->render()->saveXML();
|
{
|
||||||
|
return $this->render()
|
||||||
|
->saveXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,47 +6,80 @@ 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
|
|
||||||
|
/**
|
||||||
|
* @var ManiaLink[] $children ManiaLinks children
|
||||||
*/
|
*/
|
||||||
protected $encoding = 'utf-8';
|
|
||||||
protected $tagName = 'manialinks';
|
|
||||||
/** @var ManiaLink[] $children */
|
|
||||||
protected $children = array();
|
protected $children = array();
|
||||||
/** @var CustomUI $customUI */
|
|
||||||
|
/**
|
||||||
|
* @var CustomUI $customUI Custom UI
|
||||||
|
*/
|
||||||
protected $customUI = null;
|
protected $customUI = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ManiaLinks object
|
* Create a new ManiaLinks object
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @param ManiaLink[] $children ManiaLink children
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create() {
|
public static function create(array $children = null)
|
||||||
return new static();
|
{
|
||||||
|
return new static($children);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set XML encoding
|
* Construct a new ManiaLinks object
|
||||||
*
|
*
|
||||||
* @param string $encoding XML encoding
|
* @api
|
||||||
* @return static
|
* @param ManiaLink[] $children ManiaLink children
|
||||||
*/
|
*/
|
||||||
public function setXmlEncoding($encoding) {
|
public function __construct(array $children = null)
|
||||||
$this->encoding = (string)$encoding;
|
{
|
||||||
return $this;
|
if ($children) {
|
||||||
|
$this->setChildren($children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all child ManiaLinks
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return ManiaLink[]
|
||||||
|
*/
|
||||||
|
public function getChildren()
|
||||||
|
{
|
||||||
|
return $this->children;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a child ManiaLink
|
* Add a child ManiaLink
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @param ManiaLink $child Child ManiaLink
|
||||||
|
* @return static
|
||||||
|
* @deprecated use addChild() instead
|
||||||
|
*/
|
||||||
|
public function add(ManiaLink $child)
|
||||||
|
{
|
||||||
|
return $this->addChild($child);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a child ManiaLink
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param ManiaLink $child Child ManiaLink
|
* @param ManiaLink $child Child ManiaLink
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function add(ManiaLink $child) {
|
public function addChild(ManiaLink $child)
|
||||||
|
{
|
||||||
if (!in_array($child, $this->children, true)) {
|
if (!in_array($child, $this->children, true)) {
|
||||||
array_push($this->children, $child);
|
array_push($this->children, $child);
|
||||||
}
|
}
|
||||||
@ -54,62 +87,97 @@ class ManiaLinks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all child ManiaLinks
|
* Set ManiaLink children
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @param ManiaLink[] $children ManiaLink children
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function removeChildren() {
|
public function setChildren(array $children)
|
||||||
|
{
|
||||||
$this->children = array();
|
$this->children = array();
|
||||||
|
foreach ($children as $child) {
|
||||||
|
$this->addChild($child);
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the CustomUI
|
* Remove all child ManiaLinks
|
||||||
*
|
*
|
||||||
* @param CustomUI $customUI CustomUI object
|
* @api
|
||||||
|
* @return static
|
||||||
|
* @deprecated use removeAllChildren instead
|
||||||
|
*/
|
||||||
|
public function removeChildren()
|
||||||
|
{
|
||||||
|
return $this->removeAllChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all child ManiaLinks
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setCustomUI(CustomUI $customUI) {
|
public function removeAllChildren()
|
||||||
$this->customUI = $customUI;
|
{
|
||||||
|
$this->children = array();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the CustomUI
|
* Get the CustomUI
|
||||||
*
|
*
|
||||||
* @param bool $createIfEmpty (optional) Whether the CustomUI object should be created if it's not set
|
* @api
|
||||||
* @return \FML\CustomUI
|
* @return CustomUI
|
||||||
*/
|
*/
|
||||||
public function getCustomUI($createIfEmpty = true) {
|
public function getCustomUI()
|
||||||
if (!$this->customUI && $createIfEmpty) {
|
{
|
||||||
$this->setCustomUI(new CustomUI());
|
|
||||||
}
|
|
||||||
return $this->customUI;
|
return $this->customUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the XML document
|
* Set the CustomUI
|
||||||
*
|
*
|
||||||
* @param bool (optional) $echo Whether the XML text should be echoed and the Content-Type header should be set
|
* @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
|
* @return \DOMDocument
|
||||||
*/
|
*/
|
||||||
public function render($echo = false) {
|
public function render($echo = false)
|
||||||
$domDocument = new \DOMDocument('1.0', $this->encoding);
|
{
|
||||||
|
$domDocument = new \DOMDocument("1.0", "utf-8");
|
||||||
$domDocument->xmlStandalone = true;
|
$domDocument->xmlStandalone = true;
|
||||||
$maniaLinks = $domDocument->createElement($this->tagName);
|
$maniaLinks = $domDocument->createElement("manialinks");
|
||||||
$domDocument->appendChild($maniaLinks);
|
$domDocument->appendChild($maniaLinks);
|
||||||
|
|
||||||
foreach ($this->children as $child) {
|
foreach ($this->children as $child) {
|
||||||
$childXml = $child->render(false, $domDocument);
|
$childXml = $child->render(false, $domDocument);
|
||||||
$maniaLinks->appendChild($childXml);
|
$maniaLinks->appendChild($childXml);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->customUI) {
|
if ($this->customUI) {
|
||||||
$customUIXml = $this->customUI->render($domDocument);
|
$customUIElement = $this->customUI->render($domDocument);
|
||||||
$maniaLinks->appendChild($customUIXml);
|
$maniaLinks->appendChild($customUIElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($echo) {
|
if ($echo) {
|
||||||
header('Content-Type: application/xml; charset=utf-8;');
|
header("Content-Type: application/xml; charset=utf-8;");
|
||||||
echo $domDocument->saveXML();
|
echo $domDocument->saveXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $domDocument;
|
return $domDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +186,10 @@ class ManiaLinks {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString() {
|
public function __toString()
|
||||||
return $this->render()->saveXML();
|
{
|
||||||
|
return $this->render()
|
||||||
|
->saveXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,43 +2,53 @@
|
|||||||
|
|
||||||
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
|
* Constants
|
||||||
*/
|
*/
|
||||||
const EMPTY_STRING = '""';
|
const EMPTY_STRING = '""';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a label implementation block
|
* Build a script label implementation block
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $labelName Name of the label
|
* @param string $labelName Name of the label
|
||||||
* @param string $implementationCode Label implementation coding (without declaration)
|
* @param string $implementationCode Label implementation coding (without declaration)
|
||||||
* @param bool $isolate Whether the code should be isolated in an own block
|
* @param bool $isolate (optional) If the code should be isolated in an own block
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getLabelImplementationBlock($labelName, $implementationCode, $isolate = true) {
|
public static function getLabelImplementationBlock($labelName, $implementationCode, $isolate = true)
|
||||||
|
{
|
||||||
if ($isolate) {
|
if ($isolate) {
|
||||||
$implementationCode = 'if(True){' . $implementationCode . '}';
|
$implementationCode = "if(True){{$implementationCode}}";
|
||||||
}
|
}
|
||||||
$labelText = PHP_EOL . "***{$labelName}***" . PHP_EOL . "***{$implementationCode}***" . PHP_EOL;
|
return "
|
||||||
return $labelText;
|
***{$labelName}***
|
||||||
|
***{$implementationCode}***
|
||||||
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escape dangerous characters in the given text
|
* Escape dangerous characters in the given text
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $text Text to escape
|
* @param string $text Text to escape
|
||||||
* @param bool $addApostrophes (optional) Whether to add apostrophes before and after the text
|
* @param bool $addApostrophes (optional) Add apostrophes before and after the text
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function escapeText($text, $addApostrophes = false) {
|
public static function escapeText($text, $addApostrophes = true)
|
||||||
|
{
|
||||||
$dangers = array('\\', '"', "\n");
|
$dangers = array('\\', '"', "\n");
|
||||||
$replacements = array('\\\\', '\\"', '\\n');
|
$replacements = array('\\\\', '\\"', '\\n');
|
||||||
$escapedText = str_ireplace($dangers, $replacements, $text);
|
$escapedText = str_ireplace($dangers, $replacements, $text);
|
||||||
@ -48,17 +58,30 @@ abstract class Builder {
|
|||||||
return $escapedText;
|
return $escapedText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the escaped Id of the given Element
|
||||||
|
*
|
||||||
|
* @param Identifiable $element Element
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getId(Identifiable $element)
|
||||||
|
{
|
||||||
|
return static::escapeText($element->getId(), false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the 'Real' string representation of the given value
|
* Get the 'Real' string representation of the given value
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param float $value Float value to convert to a ManiaScript 'Real'
|
* @param float $value Float value to convert to a ManiaScript 'Real'
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getReal($value) {
|
public static function getReal($value)
|
||||||
|
{
|
||||||
$value = (float)$value;
|
$value = (float)$value;
|
||||||
$stringVal = (string)$value;
|
$stringVal = (string)$value;
|
||||||
if (!fmod($value, 1)) {
|
if (!fmod($value, 1)) {
|
||||||
$stringVal .= '.';
|
$stringVal .= ".";
|
||||||
}
|
}
|
||||||
return $stringVal;
|
return $stringVal;
|
||||||
}
|
}
|
||||||
@ -66,85 +89,135 @@ abstract class Builder {
|
|||||||
/**
|
/**
|
||||||
* Get the 'Boolean' string representation of the given value
|
* Get the 'Boolean' string representation of the given value
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param bool $value Value to convert to a ManiaScript 'Boolean'
|
* @param bool $value Value to convert to a ManiaScript 'Boolean'
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getBoolean($value) {
|
public static function getBoolean($value)
|
||||||
|
{
|
||||||
$bool = (bool)$value;
|
$bool = (bool)$value;
|
||||||
if ($bool) {
|
if ($bool) {
|
||||||
return 'True';
|
return "True";
|
||||||
}
|
}
|
||||||
return 'False';
|
return "False";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Get the string representation of the given array
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param array $array Array to convert to a ManiaScript array
|
* @param array $array Array to convert to a ManiaScript array
|
||||||
* @param bool $associative (optional) Whether the array should be associative
|
* @param bool $associative (optional) Whether the array should be associative
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getArray(array $array, $associative = false) {
|
public static function getArray(array $array, $associative = false)
|
||||||
$arrayText = '[';
|
{
|
||||||
|
$arrayText = "[";
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$count = count($array);
|
$count = count($array);
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $key => $value) {
|
||||||
if ($associative) {
|
if ($associative) {
|
||||||
if (is_string($key)) {
|
$arrayText .= static::getValue($key);
|
||||||
$arrayText .= '"' . static::escapeText($key) . '"';
|
$arrayText .= " => ";
|
||||||
} else {
|
|
||||||
$arrayText .= $key;
|
|
||||||
}
|
|
||||||
$arrayText .= ' => ';
|
|
||||||
}
|
|
||||||
if (is_string($value)) {
|
|
||||||
$arrayText .= '"' . static::escapeText($value) . '"';
|
|
||||||
} else {
|
|
||||||
$arrayText .= $value;
|
|
||||||
}
|
}
|
||||||
|
$arrayText .= static::getValue($value);
|
||||||
if ($index < $count - 1) {
|
if ($index < $count - 1) {
|
||||||
$arrayText .= ', ';
|
$arrayText .= ", ";
|
||||||
$index++;
|
$index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$arrayText .= ']';
|
return $arrayText . "]";
|
||||||
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
|
* Get the include command for the given file and namespace
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $file Include file
|
* @param string $file Include file
|
||||||
* @param string $namespace (optional) Include namespace
|
* @param string $namespace (optional) Include namespace
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getInclude($file, $namespace = null) {
|
public static function getInclude($file, $namespace = null)
|
||||||
if (!$namespace && stripos($file, '.') === false) {
|
{
|
||||||
|
if (!$namespace && stripos($file, ".") === false) {
|
||||||
$namespace = $file;
|
$namespace = $file;
|
||||||
}
|
}
|
||||||
$file = static::escapeText($file, true);
|
$file = static::escapeText($file);
|
||||||
$includeText = "#Include {$file}";
|
$includeText = "#Include {$file}";
|
||||||
if ($namespace) {
|
if ($namespace) {
|
||||||
$includeText .= " as {$namespace}";
|
$includeText .= " as {$namespace}";
|
||||||
}
|
}
|
||||||
$includeText .= PHP_EOL;
|
return $includeText . "
|
||||||
return $includeText;
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the constant command for the given name and value
|
* Get the constant command for the given name and value
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $name Constant name
|
* @param string $name Constant name
|
||||||
* @param string $value Constant value
|
* @param string $value Constant value
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getConstant($name, $value) {
|
public static function getConstant($name, $value)
|
||||||
if (is_string($value)) {
|
{
|
||||||
$value = static::escapeText($value, true);
|
$value = static::getValue($value);
|
||||||
} else if (is_bool($value)) {
|
return "#Const {$name} {$value}
|
||||||
$value = static::getBoolean($value);
|
";
|
||||||
}
|
|
||||||
$constantText = "#Const {$name} {$value}" . PHP_EOL;
|
|
||||||
return $constantText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,81 +9,134 @@ 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
|
|
||||||
|
/**
|
||||||
|
* @var string $actionName Triggered action
|
||||||
*/
|
*/
|
||||||
protected $actionName = null;
|
protected $actionName = null;
|
||||||
/** @var Control $control */
|
|
||||||
|
/**
|
||||||
|
* @var Control $control Action Control
|
||||||
|
*/
|
||||||
protected $control = null;
|
protected $control = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $labelName Script label name
|
||||||
|
*/
|
||||||
protected $labelName = null;
|
protected $labelName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Action Trigger Feature
|
* Construct a new Action Trigger
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $actionName (optional) Triggered action
|
* @param string $actionName (optional) Triggered action
|
||||||
* @param Control $control (optional) Action Control
|
* @param Control $control (optional) Action Control
|
||||||
* @param string $labelName (optional) Script Label name
|
* @param string $labelName (optional) Script label name
|
||||||
*/
|
*/
|
||||||
public function __construct($actionName = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK) {
|
public function __construct($actionName = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK)
|
||||||
if ($actionName !== null) {
|
{
|
||||||
|
if ($actionName) {
|
||||||
$this->setActionName($actionName);
|
$this->setActionName($actionName);
|
||||||
}
|
}
|
||||||
if ($control !== null) {
|
if ($control) {
|
||||||
$this->setControl($control);
|
$this->setControl($control);
|
||||||
}
|
}
|
||||||
if ($labelName !== null) {
|
if ($labelName) {
|
||||||
$this->setLabelName($labelName);
|
$this->setLabelName($labelName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the action to trigger
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getActionName()
|
||||||
|
{
|
||||||
|
return $this->actionName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the action to trigger
|
* Set the action to trigger
|
||||||
*
|
*
|
||||||
* @param string $actionName
|
* @api
|
||||||
|
* @param string $actionName Action name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setActionName($actionName) {
|
public function setActionName($actionName)
|
||||||
|
{
|
||||||
$this->actionName = (string)$actionName;
|
$this->actionName = (string)$actionName;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Control
|
* 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
|
* @param Control $control Action Control
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setControl(Control $control) {
|
public function setControl(Control $control = null)
|
||||||
|
{
|
||||||
|
if ($control) {
|
||||||
$control->checkId();
|
$control->checkId();
|
||||||
if ($control instanceof Scriptable) {
|
if ($control instanceof Scriptable) {
|
||||||
$control->setScriptEvents(true);
|
$control->setScriptEvents(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$this->control = $control;
|
$this->control = $control;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the label name
|
* 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
|
* @param string $labelName Script Label name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLabelName($labelName) {
|
public function setLabelName($labelName)
|
||||||
|
{
|
||||||
$this->labelName = (string)$labelName;
|
$this->labelName = (string)$labelName;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script)
|
||||||
|
{
|
||||||
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText());
|
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText());
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -93,11 +146,12 @@ class ActionTrigger extends ScriptFeature {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getScriptText() {
|
protected function getScriptText()
|
||||||
$actionName = Builder::escapeText($this->actionName, true);
|
{
|
||||||
|
$actionName = Builder::escapeText($this->actionName);
|
||||||
if ($this->control) {
|
if ($this->control) {
|
||||||
// Control event
|
// Control event
|
||||||
$controlId = Builder::escapeText($this->control->getId(), true);
|
$controlId = Builder::escapeText($this->control->getId());
|
||||||
$scriptText = "
|
$scriptText = "
|
||||||
if (Event.Control.ControlId == {$controlId}) {
|
if (Event.Control.ControlId == {$controlId}) {
|
||||||
TriggerPageAction({$actionName});
|
TriggerPageAction({$actionName});
|
||||||
@ -109,4 +163,5 @@ TriggerPageAction({$actionName});";
|
|||||||
}
|
}
|
||||||
return $scriptText;
|
return $scriptText;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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,129 +14,196 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
const FUNCTION_UPDATE_QUAD_DESIGN = 'FML_UpdateQuadDesign';
|
const FUNCTION_UPDATE_QUAD_DESIGN = "FML_UpdateQuadDesign";
|
||||||
const VAR_CHECKBOX_ENABLED = 'FML_CheckBox_Enabled';
|
const VAR_CHECKBOX_ENABLED = "FML_CheckBox_Enabled";
|
||||||
const VAR_CHECKBOX_DESIGNS = 'FML_CheckBox_Designs';
|
const VAR_CHECKBOX_DESIGNS = "FML_CheckBox_Designs";
|
||||||
const VAR_CHECKBOX_ENTRY_ID = 'FML_CheckBox_EntryId';
|
const VAR_CHECKBOX_ENTRY_ID = "FML_CheckBox_EntryId";
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var Quad $quad CheckBox Quad
|
||||||
*/
|
*/
|
||||||
/** @var Quad $quad */
|
|
||||||
protected $quad = null;
|
protected $quad = null;
|
||||||
/** @var Entry $entry */
|
|
||||||
|
/**
|
||||||
|
* @var Entry $entry Hidden Entry for submitting the value
|
||||||
|
*/
|
||||||
protected $entry = null;
|
protected $entry = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $default Default value
|
||||||
|
*/
|
||||||
protected $default = null;
|
protected $default = null;
|
||||||
/** @var CheckBoxDesign $enabledDesign */
|
|
||||||
|
/**
|
||||||
|
* @var CheckBoxDesign $enabledDesign Enabled Design
|
||||||
|
*/
|
||||||
protected $enabledDesign = null;
|
protected $enabledDesign = null;
|
||||||
/** @var CheckBoxDesign $disabledDesign */
|
|
||||||
|
/**
|
||||||
|
* @var CheckBoxDesign $disabledDesign Disabled Design
|
||||||
|
*/
|
||||||
protected $disabledDesign = null;
|
protected $disabledDesign = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new CheckBox Feature
|
* Construct a new CheckBox Feature
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Quad $quad (optional) CheckBox Quad
|
* @param Quad $quad (optional) CheckBox Quad
|
||||||
* @param Entry $entry (optional) Hidden Entry
|
* @param Entry $entry (optional) Hidden Entry
|
||||||
* @param bool $default (optional) Default value
|
* @param bool $default (optional) Default value
|
||||||
*/
|
*/
|
||||||
public function __construct(Quad $quad = null, Entry $entry = null, $default = null) {
|
public function __construct(Quad $quad = null, Entry $entry = null, $default = null)
|
||||||
if ($quad !== null) {
|
{
|
||||||
|
if ($quad) {
|
||||||
$this->setQuad($quad);
|
$this->setQuad($quad);
|
||||||
}
|
}
|
||||||
if ($entry !== null) {
|
if ($entry) {
|
||||||
$this->setEntry($entry);
|
$this->setEntry($entry);
|
||||||
}
|
}
|
||||||
if ($default !== null) {
|
if ($default !== null) {
|
||||||
$this->setDefault($default);
|
$this->setDefault($default);
|
||||||
}
|
}
|
||||||
$this->setEnabledDesign(CheckBoxDesign::defaultEnabledDesign());
|
$this->setEnabledDesign(CheckBoxDesign::defaultDesign());
|
||||||
$this->setDisabledDesign(CheckBoxDesign::defaultDisabledDesign());
|
$this->setDisabledDesign(CheckBoxDesign::defaultDesign());
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the CheckBox Quad
|
|
||||||
*
|
|
||||||
* @param Quad $quad CheckBox Quad
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setQuad(Quad $quad) {
|
|
||||||
$this->quad = $quad->checkId()->setScriptEvents(true);
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the CheckBox Quad
|
* Get the CheckBox Quad
|
||||||
*
|
*
|
||||||
* @return \FML\Controls\Quad
|
* @api
|
||||||
|
* @return Quad
|
||||||
*/
|
*/
|
||||||
public function getQuad() {
|
public function getQuad()
|
||||||
|
{
|
||||||
return $this->quad;
|
return $this->quad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the CheckBox Entry
|
* Set the CheckBox Quad
|
||||||
*
|
*
|
||||||
* @param Entry $entry CheckBox Entry
|
* @api
|
||||||
|
* @param Quad $quad CheckBox Quad
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setEntry(Entry $entry) {
|
public function setQuad(Quad $quad)
|
||||||
$this->entry = $entry->checkId();
|
{
|
||||||
|
$quad->checkId();
|
||||||
|
$quad->setScriptEvents(true);
|
||||||
|
$this->quad = $quad;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the managed Entry
|
* Get the hidden Entry
|
||||||
*
|
*
|
||||||
* @return \FML\Controls\Entry
|
* @api
|
||||||
|
* @return Entry
|
||||||
*/
|
*/
|
||||||
public function getEntry() {
|
public function getEntry()
|
||||||
|
{
|
||||||
return $this->entry;
|
return $this->entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the hidden Entry
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param Entry $entry Hidden Entry
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
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
|
* Set the default value
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param bool $default Default value
|
* @param bool $default Default value
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setDefault($default) {
|
public function setDefault($default)
|
||||||
|
{
|
||||||
$this->default = (bool)$default;
|
$this->default = (bool)$default;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the enabled Design
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return CheckBoxDesign
|
||||||
|
*/
|
||||||
|
public function getEnabledDesign()
|
||||||
|
{
|
||||||
|
return $this->enabledDesign;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the enabled Design
|
* Set the enabled Design
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param CheckBoxDesign $checkBoxDesign Enabled CheckBox Design
|
* @param CheckBoxDesign $checkBoxDesign Enabled CheckBox Design
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setEnabledDesign(CheckBoxDesign $checkBoxDesign) {
|
public function setEnabledDesign(CheckBoxDesign $checkBoxDesign)
|
||||||
|
{
|
||||||
$this->enabledDesign = $checkBoxDesign;
|
$this->enabledDesign = $checkBoxDesign;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the disabled Design
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return CheckBoxDesign
|
||||||
|
*/
|
||||||
|
public function getDisabledDesign()
|
||||||
|
{
|
||||||
|
return $this->disabledDesign;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the disabled Design
|
* Set the disabled Design
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param CheckBoxDesign $checkBoxDesign Disabled CheckBox Design
|
* @param CheckBoxDesign $checkBoxDesign Disabled CheckBox Design
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setDisabledDesign(CheckBoxDesign $checkBoxDesign) {
|
public function setDisabledDesign(CheckBoxDesign $checkBoxDesign)
|
||||||
|
{
|
||||||
$this->disabledDesign = $checkBoxDesign;
|
$this->disabledDesign = $checkBoxDesign;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script)
|
||||||
|
{
|
||||||
if ($this->getQuad()) {
|
if ($this->getQuad()) {
|
||||||
$script->setScriptInclude(ScriptInclude::TEXTLIB);
|
$script->setScriptInclude(ScriptInclude::TEXTLIB);
|
||||||
$script->addScriptFunction(self::FUNCTION_UPDATE_QUAD_DESIGN, $this->buildUpdateQuadDesignFunction());
|
$script->addScriptFunction(self::FUNCTION_UPDATE_QUAD_DESIGN, $this->buildUpdateQuadDesignFunction());
|
||||||
@ -151,7 +218,8 @@ class CheckBoxFeature extends ScriptFeature {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function buildUpdateQuadDesignFunction() {
|
protected function buildUpdateQuadDesignFunction()
|
||||||
|
{
|
||||||
return "
|
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;
|
||||||
@ -160,20 +228,22 @@ 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\";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}";
|
}";
|
||||||
}
|
}
|
||||||
@ -183,24 +253,27 @@ Void " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(CMlQuad _Quad) {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function buildInitScriptText() {
|
protected function buildInitScriptText()
|
||||||
$quadId = $this->getQuad()->getId(true, true);
|
{
|
||||||
$entryId = '""';
|
$quadId = Builder::getId($this->getQuad());
|
||||||
|
$entryId = Builder::EMPTY_STRING;
|
||||||
if ($this->entry) {
|
if ($this->entry) {
|
||||||
$entryId = $this->entry->getId(true, true);
|
$entryId = Builder::getId($this->getEntry());
|
||||||
}
|
}
|
||||||
|
|
||||||
$default = Builder::getBoolean($this->default);
|
$default = Builder::getBoolean($this->default);
|
||||||
$enabledDesignString = $this->enabledDesign->getDesignString();
|
$enabledDesignString = $this->enabledDesign->getDesignString();
|
||||||
$disabledDesignString = $this->disabledDesign->getDesignString();
|
$disabledDesignString = $this->disabledDesign->getDesignString();
|
||||||
|
|
||||||
return "
|
return "
|
||||||
declare Quad_CheckBox <=> (Page.GetFirstChild({$quadId}) as CMlQuad);
|
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);
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
@ -210,12 +283,14 @@ EntryId = {$entryId};
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function buildClickScriptText() {
|
protected function buildClickScriptText()
|
||||||
$quadId = $this->getQuad()->getId(true, true);
|
{
|
||||||
|
$quadId = Builder::getId($this->getQuad());
|
||||||
return "
|
return "
|
||||||
if (Event.ControlId == {$quadId}) {
|
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);
|
||||||
}";
|
}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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,72 +12,124 @@ 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 Clock Label
|
||||||
*/
|
*/
|
||||||
/** @var Label $label */
|
|
||||||
protected $label = null;
|
protected $label = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $showSeconds Show the seconds
|
||||||
|
*/
|
||||||
protected $showSeconds = null;
|
protected $showSeconds = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $showFullDate Show the date
|
||||||
|
*/
|
||||||
protected $showFullDate = null;
|
protected $showFullDate = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Clock Feature
|
* Construct a new Clock
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Label $label (optional) Clock Label
|
* @param Label $label (optional) Clock Label
|
||||||
* @param bool $showSeconds (optional) Whether the seconds should be shown
|
* @param bool $showSeconds (optional) Show the seconds
|
||||||
* @param bool $showFullDate (optional) Whether the date should be shown
|
* @param bool $showFullDate (optional) Show the date
|
||||||
*/
|
*/
|
||||||
public function __construct(Label $label = null, $showSeconds = true, $showFullDate = false) {
|
public function __construct(Label $label = null, $showSeconds = true, $showFullDate = false)
|
||||||
if ($label !== null) {
|
{
|
||||||
|
if ($label) {
|
||||||
$this->setLabel($label);
|
$this->setLabel($label);
|
||||||
}
|
}
|
||||||
$this->setShowSeconds($showSeconds);
|
$this->setShowSeconds($showSeconds)
|
||||||
$this->setShowFullDate($showFullDate);
|
->setShowFullDate($showFullDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Label
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return Label
|
||||||
|
*/
|
||||||
|
public function getLabel()
|
||||||
|
{
|
||||||
|
return $this->label;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Label
|
* Set the Label
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Label $label Clock Label
|
* @param Label $label Clock Label
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLabel(Label $label) {
|
public function setLabel(Label $label)
|
||||||
$this->label = $label->checkId();
|
{
|
||||||
|
$label->checkId();
|
||||||
|
$this->label = $label;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether seconds should be shown
|
* Get if seconds should be shown
|
||||||
*
|
*
|
||||||
* @param bool $showSeconds Whether 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
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setShowSeconds($showSeconds) {
|
public function setShowSeconds($showSeconds)
|
||||||
|
{
|
||||||
$this->showSeconds = (bool)$showSeconds;
|
$this->showSeconds = (bool)$showSeconds;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether the full date should be shown
|
* Get if the full date should be shown
|
||||||
*
|
*
|
||||||
* @param bool $showFullDate Whether 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
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setShowFullDate($showFullDate) {
|
public function setShowFullDate($showFullDate)
|
||||||
|
{
|
||||||
$this->showFullDate = (bool)$showFullDate;
|
$this->showFullDate = (bool)$showFullDate;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script)
|
||||||
$script->setScriptInclude(ScriptInclude::TEXTLIB);
|
{
|
||||||
$script->appendGenericScriptLabel(ScriptLabel::TICK, $this->getScriptText(), true);
|
$script->setScriptInclude(ScriptInclude::TEXTLIB)
|
||||||
|
->appendGenericScriptLabel(ScriptLabel::TICK, $this->getScriptText(), true);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,8 +138,9 @@ class Clock extends ScriptFeature {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getScriptText() {
|
protected function getScriptText()
|
||||||
$controlId = $this->label->getId(true, true);
|
{
|
||||||
|
$controlId = Builder::escapeText($this->label->getId());
|
||||||
$scriptText = "
|
$scriptText = "
|
||||||
declare ClockLabel <=> (Page.GetFirstChild({$controlId}) as CMlLabel);
|
declare ClockLabel <=> (Page.GetFirstChild({$controlId}) as CMlLabel);
|
||||||
declare TimeText = CurrentLocalDateText;";
|
declare TimeText = CurrentLocalDateText;";
|
||||||
@ -102,4 +156,5 @@ TimeText = TextLib::SubText(TimeText, 11, 9);";
|
|||||||
ClockLabel.Value = TimeText;";
|
ClockLabel.Value = TimeText;";
|
||||||
return $scriptText;
|
return $scriptText;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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,61 +12,118 @@ 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 Control
|
||||||
*/
|
*/
|
||||||
/** @var Control $control */
|
|
||||||
protected $control = null;
|
protected $control = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $labelName Script Label name
|
||||||
|
*/
|
||||||
protected $labelName = null;
|
protected $labelName = null;
|
||||||
protected $text = null;
|
|
||||||
|
/**
|
||||||
|
* @var string $scriptText Script text
|
||||||
|
*/
|
||||||
|
protected $scriptText = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Control Script
|
* Construct a new Control Script
|
||||||
*
|
*
|
||||||
* @param Control $control Event Control
|
* @api
|
||||||
* @param string $text Script text
|
* @param Control $control (optional) Control
|
||||||
|
* @param string $scriptText (optional) Script text
|
||||||
* @param string $labelName (optional) Script Label name
|
* @param string $labelName (optional) Script Label name
|
||||||
*/
|
*/
|
||||||
public function __construct(Control $control, $text, $labelName = ScriptLabel::MOUSECLICK) {
|
public function __construct(Control $control = null, $scriptText = null, $labelName = ScriptLabel::MOUSECLICK)
|
||||||
|
{
|
||||||
|
if ($control) {
|
||||||
$this->setControl($control);
|
$this->setControl($control);
|
||||||
$this->setText($text);
|
}
|
||||||
|
if ($scriptText) {
|
||||||
|
$this->setScriptText($scriptText);
|
||||||
|
}
|
||||||
|
if ($labelName) {
|
||||||
$this->setLabelName($labelName);
|
$this->setLabelName($labelName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Control
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return Control
|
||||||
|
*/
|
||||||
|
public function getControl()
|
||||||
|
{
|
||||||
|
return $this->control;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Control
|
* Set the Control
|
||||||
*
|
*
|
||||||
* @param Control $control Event Control
|
* @api
|
||||||
|
* @param Control $control Control
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setControl(Control $control) {
|
public function setControl(Control $control)
|
||||||
$this->control = $control->checkId();
|
{
|
||||||
|
$control->checkId();
|
||||||
|
$this->control = $control;
|
||||||
$this->updateScriptEvents();
|
$this->updateScriptEvents();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the script text
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getScriptText()
|
||||||
|
{
|
||||||
|
return $this->scriptText;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the script text
|
* Set the script text
|
||||||
*
|
*
|
||||||
* @param string $text Script text
|
* @api
|
||||||
|
* @param string $scriptText Script text
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setText($text) {
|
public function setScriptText($scriptText)
|
||||||
$this->text = (string)$text;
|
{
|
||||||
|
$this->scriptText = (string)$scriptText;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the label name
|
* 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
|
* @param string $labelName Script Label name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLabelName($labelName) {
|
public function setLabelName($labelName)
|
||||||
|
{
|
||||||
$this->labelName = (string)$labelName;
|
$this->labelName = (string)$labelName;
|
||||||
$this->updateScriptEvents();
|
$this->updateScriptEvents();
|
||||||
return $this;
|
return $this;
|
||||||
@ -73,20 +131,25 @@ class ControlScript extends ScriptFeature {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable Script Events on the Control if needed
|
* Enable Script Events on the Control if needed
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
*/
|
*/
|
||||||
protected function updateScriptEvents() {
|
protected function updateScriptEvents()
|
||||||
|
{
|
||||||
if (!$this->control || !ScriptLabel::isEventLabel($this->labelName)) {
|
if (!$this->control || !ScriptLabel::isEventLabel($this->labelName)) {
|
||||||
return;
|
return $this;
|
||||||
}
|
}
|
||||||
if ($this->control instanceof Scriptable) {
|
if ($this->control instanceof Scriptable) {
|
||||||
$this->control->setScriptEvents(true);
|
$this->control->setScriptEvents(true);
|
||||||
}
|
}
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script)
|
||||||
|
{
|
||||||
$isolated = !ScriptLabel::isEventLabel($this->labelName);
|
$isolated = !ScriptLabel::isEventLabel($this->labelName);
|
||||||
$script->appendGenericScriptLabel($this->labelName, $this->buildScriptText(), $isolated);
|
$script->appendGenericScriptLabel($this->labelName, $this->buildScriptText(), $isolated);
|
||||||
return $this;
|
return $this;
|
||||||
@ -97,29 +160,31 @@ class ControlScript extends ScriptFeature {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function buildScriptText() {
|
protected function buildScriptText()
|
||||||
$controlId = $this->control->getId(true);
|
{
|
||||||
|
$controlId = Builder::escapeText($this->control->getId());
|
||||||
$scriptText = '';
|
$scriptText = '';
|
||||||
$closeBlock = false;
|
$closeBlock = false;
|
||||||
if (ScriptLabel::isEventLabel($this->labelName)) {
|
if (ScriptLabel::isEventLabel($this->labelName)) {
|
||||||
$scriptText .= '
|
$scriptText .= "
|
||||||
if (Event.ControlId == "' . $controlId . '") {
|
if (Event.ControlId == {$controlId}) {
|
||||||
declare Control <=> Event.Control;';
|
declare Control <=> Event.Control;";
|
||||||
$closeBlock = true;
|
$closeBlock = true;
|
||||||
} else {
|
} else {
|
||||||
$scriptText .= '
|
$scriptText .= "
|
||||||
declare Control <=> Page.GetFirstChild("' . $controlId . '");';
|
declare Control <=> Page.GetFirstChild({$controlId});";
|
||||||
}
|
}
|
||||||
$class = $this->control->getManiaScriptClass();
|
$class = $this->control->getManiaScriptClass();
|
||||||
$name = preg_replace('/^CMl/', '', $class, 1);
|
$name = preg_replace('/^CMl/', '', $class, 1);
|
||||||
$scriptText .= '
|
$scriptText .= "
|
||||||
declare ' . $name . ' <=> (Control as ' . $class . ');
|
declare {$name} <=> (Control as {$class});
|
||||||
';
|
";
|
||||||
$scriptText .= $this->text . '
|
$scriptText .= $this->scriptText . "
|
||||||
';
|
";
|
||||||
if ($closeBlock) {
|
if ($closeBlock) {
|
||||||
$scriptText .= '}';
|
$scriptText .= "}";
|
||||||
}
|
}
|
||||||
return $scriptText;
|
return $scriptText;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,56 +12,94 @@ 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 Entry
|
||||||
*/
|
*/
|
||||||
/** @var Entry $entry */
|
|
||||||
protected $entry = null;
|
protected $entry = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $url Sumit url
|
||||||
|
*/
|
||||||
protected $url = null;
|
protected $url = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Entry Submit Feature
|
* Construct a new Entry Submit
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Entry $entry (optional) Entry Control
|
* @param Entry $entry (optional) Entry Control
|
||||||
* @param string $url (optional) Submit url
|
* @param string $url (optional) Submit url
|
||||||
*/
|
*/
|
||||||
public function __construct(Entry $entry = null, $url = null) {
|
public function __construct(Entry $entry = null, $url = null)
|
||||||
if ($entry !== null) {
|
{
|
||||||
|
if ($entry) {
|
||||||
$this->setEntry($entry);
|
$this->setEntry($entry);
|
||||||
}
|
}
|
||||||
|
if ($url) {
|
||||||
$this->setUrl($url);
|
$this->setUrl($url);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Entry
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return Entry
|
||||||
|
*/
|
||||||
|
public function getEntry()
|
||||||
|
{
|
||||||
|
return $this->entry;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Entry
|
* Set the Entry
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Entry $entry Entry Control
|
* @param Entry $entry Entry Control
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setEntry(Entry $entry) {
|
public function setEntry(Entry $entry)
|
||||||
$this->entry = $entry->checkId()->setScriptEvents(true);
|
{
|
||||||
|
$entry->setScriptEvents(true)
|
||||||
|
->checkId();
|
||||||
|
$this->entry = $entry;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the submit url
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the submit url
|
* Set the submit url
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $url Submit url
|
* @param string $url Submit url
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setUrl($url) {
|
public function setUrl($url)
|
||||||
|
{
|
||||||
$this->url = (string)$url;
|
$this->url = (string)$url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script)
|
||||||
|
{
|
||||||
$script->setScriptInclude(ScriptInclude::TEXTLIB);
|
$script->setScriptInclude(ScriptInclude::TEXTLIB);
|
||||||
$controlScript = new ControlScript($this->entry, $this->getScriptText(), ScriptLabel::ENTRYSUBMIT);
|
$controlScript = new ControlScript($this->entry, $this->getScriptText(), ScriptLabel::ENTRYSUBMIT);
|
||||||
$controlScript->prepare($script);
|
$controlScript->prepare($script);
|
||||||
@ -73,10 +111,11 @@ class EntrySubmit extends ScriptFeature {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getScriptText() {
|
protected function getScriptText()
|
||||||
|
{
|
||||||
$url = $this->buildCompatibleUrl();
|
$url = $this->buildCompatibleUrl();
|
||||||
$entryName = $this->entry->getName();
|
$entryName = $this->entry->getName();
|
||||||
$link = Builder::escapeText($entryName . $url . '=', true);
|
$link = Builder::escapeText($entryName . $url . "=");
|
||||||
return "
|
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);
|
||||||
@ -88,7 +127,8 @@ OpenLink({$link}^Value, CMlScript::LinkType::Goto);
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function buildCompatibleUrl() {
|
protected function buildCompatibleUrl()
|
||||||
|
{
|
||||||
$url = $this->url;
|
$url = $this->url;
|
||||||
$paramsBegin = stripos($url, '?');
|
$paramsBegin = stripos($url, '?');
|
||||||
if (!is_int($paramsBegin) || $paramsBegin < 0) {
|
if (!is_int($paramsBegin) || $paramsBegin < 0) {
|
||||||
@ -98,4 +138,5 @@ OpenLink({$link}^Value, CMlScript::LinkType::Goto);
|
|||||||
}
|
}
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
303
libs/FML/Script/Features/GraphCurve.php
Normal file
303
libs/FML/Script/Features/GraphCurve.php
Normal 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 . "
|
||||||
|
}";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -11,87 +11,156 @@ 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
|
|
||||||
|
/**
|
||||||
|
* @var string $actionName Action name
|
||||||
*/
|
*/
|
||||||
protected $actionName = null;
|
protected $actionName = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $keyName Key name
|
||||||
|
*/
|
||||||
protected $keyName = null;
|
protected $keyName = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $keyCode Key code
|
||||||
|
*/
|
||||||
protected $keyCode = null;
|
protected $keyCode = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $charPressed Pressed character
|
||||||
|
*/
|
||||||
protected $charPressed = null;
|
protected $charPressed = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Key Action Feature
|
* Construct a new Key Action
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $actionName (optional) Triggered action
|
* @param string $actionName (optional) Triggered action
|
||||||
* @param string $keyName (optional) Key name
|
* @param string $keyName (optional) Key name
|
||||||
*/
|
*/
|
||||||
public function __construct($actionName = null, $keyName = null) {
|
public function __construct($actionName = null, $keyName = null)
|
||||||
if ($actionName !== null) {
|
{
|
||||||
|
if ($actionName) {
|
||||||
$this->setActionName($actionName);
|
$this->setActionName($actionName);
|
||||||
}
|
}
|
||||||
if ($keyName !== null) {
|
if ($keyName) {
|
||||||
$this->setKeyName($keyName);
|
$this->setKeyName($keyName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the action to trigger
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getActionName()
|
||||||
|
{
|
||||||
|
return $this->actionName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the action to trigger
|
* Set the action to trigger
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $actionName Triggered action
|
* @param string $actionName Triggered action
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setActionName($actionName) {
|
public function setActionName($actionName)
|
||||||
|
{
|
||||||
$this->actionName = (string)$actionName;
|
$this->actionName = (string)$actionName;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the key name for triggering the action
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getKeyName()
|
||||||
|
{
|
||||||
|
return $this->keyName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the key name for triggering the action
|
* Set the key name for triggering the action
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $keyName Key Name
|
* @param string $keyName Key Name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setKeyName($keyName) {
|
public function setKeyName($keyName)
|
||||||
|
{
|
||||||
$this->keyName = (string)$keyName;
|
$this->keyName = (string)$keyName;
|
||||||
$this->keyCode = null;
|
$this->keyCode = null;
|
||||||
$this->charPressed = null;
|
$this->charPressed = null;
|
||||||
return $this;
|
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
|
* Set the key code for triggering the action
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param int $keyCode Key Code
|
* @param int $keyCode Key Code
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setKeyCode($keyCode) {
|
public function setKeyCode($keyCode)
|
||||||
$this->keyCode = (int)$keyCode;
|
{
|
||||||
$this->keyName = null;
|
$this->keyName = null;
|
||||||
|
$this->keyCode = (int)$keyCode;
|
||||||
$this->charPressed = null;
|
$this->charPressed = null;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the char to press for triggering the action
|
* Get the character to press for triggering the action
|
||||||
*
|
*
|
||||||
* @param string $charPressed Pressed char
|
* @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
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setCharPressed($charPressed) {
|
public function setCharPressed($charPressed)
|
||||||
$this->charPressed = (string)$charPressed;
|
{
|
||||||
$this->keyName = null;
|
$this->keyName = null;
|
||||||
$this->keyCode = null;
|
$this->keyCode = null;
|
||||||
|
$this->charPressed = (string)$charPressed;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script)
|
||||||
|
{
|
||||||
$script->appendGenericScriptLabel(ScriptLabel::KEYPRESS, $this->getScriptText());
|
$script->appendGenericScriptLabel(ScriptLabel::KEYPRESS, $this->getScriptText());
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -101,24 +170,26 @@ class KeyAction extends ScriptFeature {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getScriptText() {
|
protected function getScriptText()
|
||||||
$actionName = Builder::escapeText($this->actionName, true);
|
{
|
||||||
|
$actionName = Builder::escapeText($this->actionName);
|
||||||
$key = null;
|
$key = null;
|
||||||
$value = null;
|
$value = null;
|
||||||
if ($this->keyName !== null) {
|
if ($this->keyName !== null) {
|
||||||
$key = 'KeyName';
|
$key = "KeyName";
|
||||||
$value = $this->keyName;
|
$value = $this->keyName;
|
||||||
} else if ($this->keyCode !== null) {
|
} else if ($this->keyCode !== null) {
|
||||||
$key = 'KeyCode';
|
$key = "KeyCode";
|
||||||
$value = $this->keyCode;
|
$value = $this->keyCode;
|
||||||
} else if ($this->charPressed !== null) {
|
} else if ($this->charPressed !== null) {
|
||||||
$key = 'CharPressed';
|
$key = "CharPressed";
|
||||||
$value = $this->charPressed;
|
$value = $this->charPressed;
|
||||||
}
|
}
|
||||||
$value = Builder::escapeText($value, true);
|
$value = Builder::escapeText($value);
|
||||||
return "
|
return "
|
||||||
if (Event.{$key} == {$value}) {
|
if (Event.{$key} == {$value}) {
|
||||||
TriggerPageAction({$actionName});
|
TriggerPageAction({$actionName});
|
||||||
}";
|
}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,35 +12,59 @@ 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 Map Info Control
|
||||||
*/
|
*/
|
||||||
/** @var Control $control */
|
|
||||||
protected $control = null;
|
protected $control = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $labelName Script Label name
|
||||||
|
*/
|
||||||
protected $labelName = null;
|
protected $labelName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Map Info Feature
|
* Construct a new Map Info
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Control $control (optional) Map Info Control
|
* @param Control $control (optional) Map Info Control
|
||||||
* @param string $labelName (optional) Script Label name
|
* @param string $labelName (optional) Script Label name
|
||||||
*/
|
*/
|
||||||
public function __construct(Control $control, $labelName = ScriptLabel::MOUSECLICK) {
|
public function __construct(Control $control = null, $labelName = ScriptLabel::MOUSECLICK)
|
||||||
|
{
|
||||||
|
if ($control) {
|
||||||
$this->setControl($control);
|
$this->setControl($control);
|
||||||
|
}
|
||||||
|
if ($labelName) {
|
||||||
$this->setLabelName($labelName);
|
$this->setLabelName($labelName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Control
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return Control
|
||||||
|
*/
|
||||||
|
public function getControl()
|
||||||
|
{
|
||||||
|
return $this->control;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Control
|
* Set the Control
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Control $control Map Info Control
|
* @param Control $control Map Info Control
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setControl(Control $control) {
|
public function setControl(Control $control)
|
||||||
|
{
|
||||||
$control->checkId();
|
$control->checkId();
|
||||||
if ($control instanceof Scriptable) {
|
if ($control instanceof Scriptable) {
|
||||||
$control->setScriptEvents(true);
|
$control->setScriptEvents(true);
|
||||||
@ -50,20 +74,34 @@ class MapInfo extends ScriptFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the label name
|
* 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
|
* @param string $labelName Script Label name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLabelName($labelName) {
|
public function setLabelName($labelName)
|
||||||
|
{
|
||||||
$this->labelName = (string)$labelName;
|
$this->labelName = (string)$labelName;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script)
|
||||||
|
{
|
||||||
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText());
|
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText());
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -73,19 +111,20 @@ class MapInfo extends ScriptFeature {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getScriptText() {
|
protected function getScriptText()
|
||||||
|
{
|
||||||
if ($this->control) {
|
if ($this->control) {
|
||||||
// Control event
|
// Control event
|
||||||
$controlId = Builder::escapeText($this->control->getId(), true);
|
$controlId = Builder::escapeText($this->control->getId());
|
||||||
$scriptText = "
|
return "
|
||||||
if (Event.Control.ControlId == {$controlId}) {
|
if (Event.Control.ControlId == {$controlId}) {
|
||||||
ShowCurChallengeCard();
|
ShowCurChallengeCard();
|
||||||
}";
|
}";
|
||||||
} else {
|
}
|
||||||
// Other
|
|
||||||
$scriptText = "
|
// Other events
|
||||||
|
return "
|
||||||
ShowCurChallengeCard();";
|
ShowCurChallengeCard();";
|
||||||
}
|
}
|
||||||
return $scriptText;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -11,92 +11,131 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
const FUNCTION_UPDATE_MENU = 'FML_UpdateMenu';
|
const FUNCTION_UPDATE_MENU = "FML_UpdateMenu";
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var MenuElement[] $elements Menu Elements
|
||||||
*/
|
*/
|
||||||
/** @var MenuElement[] $elements */
|
|
||||||
protected $elements = array();
|
protected $elements = array();
|
||||||
/** @var MenuElement $startElement */
|
|
||||||
|
/**
|
||||||
|
* @var MenuElement $startElement Start Element
|
||||||
|
*/
|
||||||
protected $startElement = null;
|
protected $startElement = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Menu Feature
|
* Construct a new Menu
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Control $item (optional) Item Control in the Menu bar
|
* @param Control $item (optional) Item Control in the Menu bar
|
||||||
* @param Control $control (optional) Toggled Menu Control
|
* @param Control $control (optional) Toggled Menu Control
|
||||||
|
* @param bool $isStartElement (optional) Whether the Menu should start with the given Element
|
||||||
*/
|
*/
|
||||||
public function __construct(Control $item = null, Control $control = null) {
|
public function __construct(Control $item = null, Control $control = null, $isStartElement = true)
|
||||||
|
{
|
||||||
if ($item && $control) {
|
if ($item && $control) {
|
||||||
$this->addElement($item, $control);
|
$this->addItem($item, $control, $isStartElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new Element to the Menu
|
* Get the Menu Elements
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return MenuElement[]
|
||||||
|
*/
|
||||||
|
public function getElements()
|
||||||
|
{
|
||||||
|
return $this->elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a Menu item
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param Control $item Item Control in the Menu bar
|
* @param Control $item Item Control in the Menu bar
|
||||||
* @param Control $control Toggled Menu Control
|
* @param Control $control Toggled Menu Control
|
||||||
* @param bool $isStartElement (optional) Whether the Menu should start with this Element
|
* @param bool $isStartElement (optional) Whether the Menu should start with this Element
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addElement(Control $item, Control $control, $isStartElement = false) {
|
public function addItem(Control $item, Control $control, $isStartElement = false)
|
||||||
|
{
|
||||||
$menuElement = new MenuElement($item, $control);
|
$menuElement = new MenuElement($item, $control);
|
||||||
$this->appendElement($menuElement, $isStartElement);
|
$this->addElement($menuElement, $isStartElement);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append an Element to the Menu
|
* Add a Menu Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param MenuElement $menuElement Menu Element
|
* @param MenuElement $menuElement Menu Element
|
||||||
* @param bool $isStartElement (optional) Whether the Menu should start with this Element
|
* @param bool $isStartElement (optional) Whether the Menu should start with this Element
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function appendElement(MenuElement $menuElement, $isStartElement = false) {
|
public function addElement(MenuElement $menuElement, $isStartElement = false)
|
||||||
|
{
|
||||||
if (!in_array($menuElement, $this->elements, true)) {
|
if (!in_array($menuElement, $this->elements, true)) {
|
||||||
array_push($this->elements, $menuElement);
|
array_push($this->elements, $menuElement);
|
||||||
if ($isStartElement) {
|
if ($isStartElement) {
|
||||||
|
// new start element
|
||||||
$this->setStartElement($menuElement);
|
$this->setStartElement($menuElement);
|
||||||
} else if (count($this->elements) > 1) {
|
} else {
|
||||||
$menuElement->getControl()->setVisible(false);
|
// additional element - set invisible
|
||||||
|
$menuElement->getControl()
|
||||||
|
->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Element to start with
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return MenuElement
|
||||||
|
*/
|
||||||
|
public function getStartElement()
|
||||||
|
{
|
||||||
|
return $this->startElement;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Element to start with
|
* Set the Element to start with
|
||||||
*
|
*
|
||||||
* @param MenuElement $startElement Starting Element
|
* @api
|
||||||
|
* @param MenuElement $startElement Start Element
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setStartElement(MenuElement $startElement) {
|
public function setStartElement(MenuElement $startElement = null)
|
||||||
|
{
|
||||||
$this->startElement = $startElement;
|
$this->startElement = $startElement;
|
||||||
if (!in_array($startElement, $this->elements, true)) {
|
if ($startElement && !in_array($startElement, $this->elements, true)) {
|
||||||
array_push($this->elements, $startElement);
|
array_push($this->elements, $startElement);
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script)
|
||||||
|
{
|
||||||
$updateFunctionName = self::FUNCTION_UPDATE_MENU;
|
$updateFunctionName = self::FUNCTION_UPDATE_MENU;
|
||||||
$elementsArrayText = $this->getElementsArrayText();
|
$elementsArrayText = $this->getElementsArrayText();
|
||||||
|
|
||||||
// OnInit
|
// OnInit
|
||||||
if ($this->startElement) {
|
if ($this->startElement) {
|
||||||
$startControlId = $this->startElement->getControl()->getId(true, true);
|
$startControlId = Builder::escapeText($this->startElement->getControl()->getId());
|
||||||
$initScriptText = "
|
$initScriptText = "
|
||||||
{$updateFunctionName}({$elementsArrayText}, {$startControlId});";
|
{$updateFunctionName}({$elementsArrayText}, {$startControlId});";
|
||||||
$script->appendGenericScriptLabel(ScriptLabel::ONINIT, $initScriptText, true);
|
$script->appendGenericScriptLabel(ScriptLabel::ONINIT, $initScriptText, true);
|
||||||
@ -129,12 +168,16 @@ Void {$updateFunctionName}(Text[Text] _Elements, Text _ShownControlId) {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getElementsArrayText() {
|
protected function getElementsArrayText()
|
||||||
|
{
|
||||||
$elements = array();
|
$elements = array();
|
||||||
foreach ($this->elements as $element) {
|
foreach ($this->elements as $element) {
|
||||||
$elementId = $element->getItem()->getId();
|
$elementId = $element->getItem()
|
||||||
$elements[$elementId] = $element->getControl()->getId();
|
->getId();
|
||||||
|
$elements[$elementId] = $element->getControl()
|
||||||
|
->getId();
|
||||||
}
|
}
|
||||||
return Builder::getArray($elements, true);
|
return Builder::getArray($elements, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,38 +9,59 @@ 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
|
|
||||||
|
/**
|
||||||
|
* @var Control $item Menu Item
|
||||||
*/
|
*/
|
||||||
protected $item = null;
|
protected $item = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Control $control Menu Control
|
||||||
|
*/
|
||||||
protected $control = null;
|
protected $control = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Menu Element
|
* Create a new Menu Element
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Control $item (optional) Item Control in the Menu bar
|
* @param Control $item (optional) Item Control in the Menu bar
|
||||||
* @param Control $control (optional) Toggled Menu Control
|
* @param Control $control (optional) Toggled Menu Control
|
||||||
*/
|
*/
|
||||||
public function __construct(Control $item = null, Control $control = null) {
|
public function __construct(Control $item = null, Control $control = null)
|
||||||
if ($item !== null) {
|
{
|
||||||
|
if ($item) {
|
||||||
$this->setItem($item);
|
$this->setItem($item);
|
||||||
}
|
}
|
||||||
if ($control !== null) {
|
if ($control) {
|
||||||
$this->setControl($control);
|
$this->setControl($control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Item Control
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return Control
|
||||||
|
*/
|
||||||
|
public function getItem()
|
||||||
|
{
|
||||||
|
return $this->item;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Item Control
|
* Set the Item Control
|
||||||
*
|
*
|
||||||
* @param Control $item Item Control in the Menu bar
|
* @api
|
||||||
|
* @param Control $item Item Control
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setItem(Control $item) {
|
public function setItem(Control $item)
|
||||||
|
{
|
||||||
$item->checkId();
|
$item->checkId();
|
||||||
if ($item instanceof Scriptable) {
|
if ($item instanceof Scriptable) {
|
||||||
$item->setScriptEvents(true);
|
$item->setScriptEvents(true);
|
||||||
@ -50,31 +71,28 @@ class MenuElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Item Control
|
* Get the Menu Control
|
||||||
*
|
*
|
||||||
* @return \FML\Controls\Control
|
* @api
|
||||||
|
* @return Control
|
||||||
*/
|
*/
|
||||||
public function getItem() {
|
public function getControl()
|
||||||
return $this->item;
|
{
|
||||||
|
return $this->control;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Menu Control
|
* Set the Menu Control
|
||||||
*
|
*
|
||||||
* @param Control $control Toggled Menu Control
|
* @api
|
||||||
|
* @param Control $control Menu Control
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setControl(Control $control) {
|
public function setControl(Control $control)
|
||||||
$this->control = $control->checkId();
|
{
|
||||||
|
$control->checkId();
|
||||||
|
$this->control = $control;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Menu Control
|
|
||||||
*
|
|
||||||
* @return \FML\Controls\Control
|
|
||||||
*/
|
|
||||||
public function getControl() {
|
|
||||||
return $this->control;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -10,68 +10,144 @@ 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
|
* Constants
|
||||||
*/
|
*/
|
||||||
const VAR_CURRENT_PAGE = 'FML_Paging_CurrentPage';
|
const VAR_CURRENT_PAGE = "FML_Paging_CurrentPage";
|
||||||
const FUNCTION_UPDATE_CURRENT_PAGE = 'FML_UpdateCurrentPage';
|
const FUNCTION_UPDATE_CURRENT_PAGE = "FML_UpdateCurrentPage";
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Protected properties
|
* @var Label $label Page number Label
|
||||||
*/
|
*/
|
||||||
/** @var PagingPage[] $pages */
|
|
||||||
protected $pages = array();
|
|
||||||
/** @var PagingButton[] $buttons */
|
|
||||||
protected $buttons = array();
|
|
||||||
/** @var Label $label */
|
|
||||||
protected $label = null;
|
protected $label = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PagingPage[] $pages Pages
|
||||||
|
*/
|
||||||
|
protected $pages = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PagingButton[] $buttons Paging Buttons
|
||||||
|
*/
|
||||||
|
protected $buttons = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $startPageNumber Start Page number
|
||||||
|
*/
|
||||||
protected $startPageNumber = null;
|
protected $startPageNumber = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $customMaxPageNumber Custom maximum page number
|
||||||
|
*/
|
||||||
protected $customMaxPageNumber = null;
|
protected $customMaxPageNumber = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $previousChunkAction Previous chunk action name
|
||||||
|
*/
|
||||||
protected $previousChunkAction = null;
|
protected $previousChunkAction = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $nextChunkAction Next chunk action name
|
||||||
|
*/
|
||||||
protected $nextChunkAction = null;
|
protected $nextChunkAction = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $chunkActionAppendsPageNumber Chunk action appended with Page number
|
||||||
|
*/
|
||||||
protected $chunkActionAppendsPageNumber = null;
|
protected $chunkActionAppendsPageNumber = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Paging Script Feature
|
* Construct a new Paging
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Label $label (optional) Page number Label
|
* @param Label $label (optional) Page number Label
|
||||||
|
* @param PagingPage[] $pages (optional) Pages
|
||||||
|
* @param PagingButton[] $buttons (optional) Pageing Buttons
|
||||||
*/
|
*/
|
||||||
public function __construct(Label $label = null) {
|
public function __construct(Label $label = null, array $pages = null, array $buttons = null)
|
||||||
if ($label !== null) {
|
{
|
||||||
|
if ($label) {
|
||||||
$this->setLabel($label);
|
$this->setLabel($label);
|
||||||
}
|
}
|
||||||
|
if ($pages) {
|
||||||
|
$this->setPages($pages);
|
||||||
|
}
|
||||||
|
if ($buttons) {
|
||||||
|
$this->setButtons($buttons);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Label showing the Page number
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return Label
|
||||||
|
*/
|
||||||
|
public function getLabel()
|
||||||
|
{
|
||||||
|
return $this->label;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Label showing the Page number
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param Label $label Page number Label
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setLabel(Label $label)
|
||||||
|
{
|
||||||
|
$label->checkId();
|
||||||
|
$this->label = $label;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Pages
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return PagingPage[]
|
||||||
|
*/
|
||||||
|
public function getPages()
|
||||||
|
{
|
||||||
|
return $this->pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new Page Control
|
* Add a new Page Control
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Control $pageControl Page Control
|
* @param Control $pageControl Page Control
|
||||||
* @param string $pageNumber (optional) Page number
|
* @param string $pageNumber (optional) Page number
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addPage(Control $pageControl, $pageNumber = null) {
|
public function addPageControl(Control $pageControl, $pageNumber = null)
|
||||||
|
{
|
||||||
if ($pageNumber === null) {
|
if ($pageNumber === null) {
|
||||||
$pageNumber = count($this->pages) + 1;
|
$pageNumber = count($this->pages) + 1;
|
||||||
}
|
}
|
||||||
$page = new PagingPage($pageControl, $pageNumber);
|
$page = new PagingPage($pageControl, $pageNumber);
|
||||||
$this->appendPage($page);
|
return $this->addPage($page);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a Page
|
* Add a new Page
|
||||||
*
|
*
|
||||||
* @param PagingPage $page Paging Page
|
* @api
|
||||||
|
* @param PagingPage $page Page
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function appendPage(PagingPage $page) {
|
public function addPage(PagingPage $page)
|
||||||
|
{
|
||||||
if (!in_array($page, $this->pages, true)) {
|
if (!in_array($page, $this->pages, true)) {
|
||||||
array_push($this->pages, $page);
|
array_push($this->pages, $page);
|
||||||
}
|
}
|
||||||
@ -79,13 +155,42 @@ class Paging extends ScriptFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new Button to browse through the Pages
|
* Add new Pages
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @param PagingPage[] $pages Pages
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setPages(array $pages)
|
||||||
|
{
|
||||||
|
$this->pages = array();
|
||||||
|
foreach ($pages as $page) {
|
||||||
|
$this->addPage($page);
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Buttons
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return PagingButton[]
|
||||||
|
*/
|
||||||
|
public function getButtons()
|
||||||
|
{
|
||||||
|
return $this->buttons;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new Button Control to browse through the Pages
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param Control $buttonControl Button used for browsing
|
* @param Control $buttonControl Button used for browsing
|
||||||
* @param int $browseAction (optional) Number of browsed Pages per click
|
* @param int $browseAction (optional) Number of browsed Pages per click
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function addButton(Control $buttonControl, $browseAction = null) {
|
public function addButtonControl(Control $buttonControl, $browseAction = null)
|
||||||
|
{
|
||||||
if ($browseAction === null) {
|
if ($browseAction === null) {
|
||||||
$buttonCount = count($this->buttons);
|
$buttonCount = count($this->buttons);
|
||||||
if ($buttonCount % 2 === 0) {
|
if ($buttonCount % 2 === 0) {
|
||||||
@ -95,17 +200,18 @@ class Paging extends ScriptFeature {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$button = new PagingButton($buttonControl, $browseAction);
|
$button = new PagingButton($buttonControl, $browseAction);
|
||||||
$this->appendButton($button);
|
return $this->addButton($button);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a Button to browse through Pages
|
* Add a new Button to browse through Pages
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param PagingButton $button Paging Button
|
* @param PagingButton $button Paging Button
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function appendButton(PagingButton $button) {
|
public function addButton(PagingButton $button)
|
||||||
|
{
|
||||||
if (!in_array($button, $this->buttons, true)) {
|
if (!in_array($button, $this->buttons, true)) {
|
||||||
array_push($this->buttons, $button);
|
array_push($this->buttons, $button);
|
||||||
}
|
}
|
||||||
@ -113,55 +219,113 @@ class Paging extends ScriptFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Label showing the Page number
|
* Set the Paging Buttons
|
||||||
*
|
*
|
||||||
* @param Label $label Page number Label
|
* @api
|
||||||
|
* @param PagingButton[] $buttons Paging Buttons
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLabel(Label $label) {
|
public function setButtons(array $buttons)
|
||||||
$this->label = $label->checkId();
|
{
|
||||||
|
$this->buttons = array();
|
||||||
|
foreach ($buttons as $button) {
|
||||||
|
$this->addButton($button);
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Start Page number
|
* 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
|
* @param int $startPageNumber Page number to start with
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setStartPageNumber($startPageNumber) {
|
public function setStartPageNumber($startPageNumber)
|
||||||
|
{
|
||||||
$this->startPageNumber = (int)$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
|
* Set a custom maximum Page number for using chunks
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param int $maxPageNumber Custom maximum Page number
|
* @param int $maxPageNumber Custom maximum Page number
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setCustomMaxPageNumber($maxPageNumber) {
|
public function setCustomMaxPageNumber($maxPageNumber)
|
||||||
|
{
|
||||||
$this->customMaxPageNumber = (int)$maxPageNumber;
|
$this->customMaxPageNumber = (int)$maxPageNumber;
|
||||||
return $this;
|
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
|
* Set the action triggered when the previous chunk is needed
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $previousChunkAction Triggered action
|
* @param string $previousChunkAction Triggered action
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setPreviousChunkAction($previousChunkAction) {
|
public function setPreviousChunkAction($previousChunkAction)
|
||||||
|
{
|
||||||
$this->previousChunkAction = (string)$previousChunkAction;
|
$this->previousChunkAction = (string)$previousChunkAction;
|
||||||
return $this;
|
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
|
* Set the action triggered when the next chunk is needed
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $nextChunkAction Triggered action
|
* @param string $nextChunkAction Triggered action
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setNextChunkAction($nextChunkAction) {
|
public function setNextChunkAction($nextChunkAction)
|
||||||
|
{
|
||||||
$this->nextChunkAction = (string)$nextChunkAction;
|
$this->nextChunkAction = (string)$nextChunkAction;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -169,30 +333,45 @@ class Paging extends ScriptFeature {
|
|||||||
/**
|
/**
|
||||||
* Set the actions triggered when another chunk is needed
|
* Set the actions triggered when another chunk is needed
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $chunkAction Triggered action
|
* @param string $chunkAction Triggered action
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setChunkActions($chunkAction) {
|
public function setChunkActions($chunkAction)
|
||||||
$this->setNextChunkAction($chunkAction);
|
{
|
||||||
$this->setPreviousChunkAction($chunkAction);
|
return $this->setNextChunkAction($chunkAction)
|
||||||
return $this;
|
->setPreviousChunkAction($chunkAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set if the chunk action should get the needed Page number appended
|
* Get if the chunk action should append the needed Page number
|
||||||
*
|
*
|
||||||
* @param bool $appendPageNumber Whether to 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
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setChunkActionAppendsPageNumber($appendPageNumber) {
|
public function setChunkActionAppendsPageNumber($appendPageNumber)
|
||||||
|
{
|
||||||
$this->chunkActionAppendsPageNumber = (bool)$appendPageNumber;
|
$this->chunkActionAppendsPageNumber = (bool)$appendPageNumber;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script)
|
||||||
|
{
|
||||||
if (empty($this->pages)) {
|
if (empty($this->pages)) {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -209,16 +388,20 @@ class Paging extends ScriptFeature {
|
|||||||
$maxPageNumber = $maxPage->getPageNumber();
|
$maxPageNumber = $maxPage->getPageNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
$pagingId = $maxPage->getControl()->getId(true, true);
|
$pagingId = $maxPage->getControl()
|
||||||
$pageLabelId = '""';
|
->getId(true, true);
|
||||||
|
$pagingId = Builder::escapeText($maxPage->getControl()
|
||||||
|
->getId());
|
||||||
|
$pageLabelId = Builder::EMPTY_STRING;
|
||||||
if ($this->label) {
|
if ($this->label) {
|
||||||
$pageLabelId = $this->label->getId(true, true);
|
$pageLabelId = Builder::escapeText($this->label->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$pagesArrayText = $this->getPagesArrayText();
|
$pagesArrayText = $this->getPagesArrayText();
|
||||||
$pageButtonsArrayText = $this->getPageButtonsArrayText();
|
$pageButtonsArrayText = $this->getPageButtonsArrayText();
|
||||||
|
|
||||||
$previousChunkAction = Builder::escapeText($this->previousChunkAction, true);
|
$previousChunkAction = Builder::escapeText($this->previousChunkAction);
|
||||||
$nextChunkAction = Builder::escapeText($this->nextChunkAction, true);
|
$nextChunkAction = Builder::escapeText($this->nextChunkAction);
|
||||||
$chunkActionAppendsPageNumber = Builder::getBoolean($this->chunkActionAppendsPageNumber);
|
$chunkActionAppendsPageNumber = Builder::getBoolean($this->chunkActionAppendsPageNumber);
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
@ -281,9 +464,10 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct
|
|||||||
/**
|
/**
|
||||||
* Get the minimum Page
|
* Get the minimum Page
|
||||||
*
|
*
|
||||||
* @return \FML\Script\Features\PagingPage
|
* @return PagingPage
|
||||||
*/
|
*/
|
||||||
protected function getMinPage() {
|
protected function getMinPage()
|
||||||
|
{
|
||||||
$minPageNumber = null;
|
$minPageNumber = null;
|
||||||
$minPage = null;
|
$minPage = null;
|
||||||
foreach ($this->pages as $page) {
|
foreach ($this->pages as $page) {
|
||||||
@ -299,9 +483,10 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct
|
|||||||
/**
|
/**
|
||||||
* Get the maximum Page
|
* Get the maximum Page
|
||||||
*
|
*
|
||||||
* @return \FML\Script\Features\PagingPage
|
* @return PagingPage
|
||||||
*/
|
*/
|
||||||
protected function getMaxPage() {
|
protected function getMaxPage()
|
||||||
|
{
|
||||||
$maxPageNumber = null;
|
$maxPageNumber = null;
|
||||||
$maxPage = null;
|
$maxPage = null;
|
||||||
foreach ($this->pages as $page) {
|
foreach ($this->pages as $page) {
|
||||||
@ -319,13 +504,15 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getPagesArrayText() {
|
protected function getPagesArrayText()
|
||||||
|
{
|
||||||
if (empty($this->pages)) {
|
if (empty($this->pages)) {
|
||||||
return Builder::getArray(array(0 => ''), true);
|
return Builder::getArray(array(0 => ''), true);
|
||||||
}
|
}
|
||||||
$pages = array();
|
$pages = array();
|
||||||
foreach ($this->pages as $page) {
|
foreach ($this->pages as $page) {
|
||||||
$pages[$page->getPageNumber()] = $page->getControl()->getId();
|
$pages[$page->getPageNumber()] = $page->getControl()
|
||||||
|
->getId();
|
||||||
}
|
}
|
||||||
return Builder::getArray($pages, true);
|
return Builder::getArray($pages, true);
|
||||||
}
|
}
|
||||||
@ -335,14 +522,17 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getPageButtonsArrayText() {
|
protected function getPageButtonsArrayText()
|
||||||
|
{
|
||||||
if (empty($this->buttons)) {
|
if (empty($this->buttons)) {
|
||||||
return Builder::getArray(array('' => 0), true);
|
return Builder::getArray(array('' => 0), true);
|
||||||
}
|
}
|
||||||
$pageButtons = array();
|
$pageButtons = array();
|
||||||
foreach ($this->buttons as $pageButton) {
|
foreach ($this->buttons as $pageButton) {
|
||||||
$pageButtons[$pageButton->getControl()->getId()] = $pageButton->getBrowseAction();
|
$pageButtons[$pageButton->getControl()
|
||||||
|
->getId()] = $pageButton->getPagingCount();
|
||||||
}
|
}
|
||||||
return Builder::getArray($pageButtons, true);
|
return Builder::getArray($pageButtons, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,39 +9,59 @@ 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 Paging Control
|
||||||
*/
|
*/
|
||||||
/** @var Control $control */
|
|
||||||
protected $control = null;
|
protected $control = null;
|
||||||
protected $browseAction = null;
|
|
||||||
|
/**
|
||||||
|
* @var int Paging count
|
||||||
|
*/
|
||||||
|
protected $pagingCount = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Paging Button
|
* Construct a new Paging Button
|
||||||
*
|
*
|
||||||
* @param Control $control (optional) Browse Control
|
* @api
|
||||||
* @param int $browseAction (optional) Number of browsed Pages per Click
|
* @param Control $control (optional) Paging Control
|
||||||
|
* @param int $pagingCount (optional) Number of browsed pages per click
|
||||||
*/
|
*/
|
||||||
public function __construct(Control $control = null, $browseAction = null) {
|
public function __construct(Control $control = null, $pagingCount = 1)
|
||||||
if ($control !== null) {
|
{
|
||||||
|
if ($control) {
|
||||||
$this->setControl($control);
|
$this->setControl($control);
|
||||||
}
|
}
|
||||||
if ($browseAction !== null) {
|
if ($pagingCount) {
|
||||||
$this->setBrowseAction($browseAction);
|
$this->setPagingCount($pagingCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Button Control
|
* Get the paging Control
|
||||||
*
|
*
|
||||||
* @param Control $control Browse Control
|
* @api
|
||||||
|
* @return Control
|
||||||
|
*/
|
||||||
|
public function getControl()
|
||||||
|
{
|
||||||
|
return $this->control;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the paging Control
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param Control $control Paging Control
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setControl(Control $control) {
|
public function setControl(Control $control)
|
||||||
|
{
|
||||||
$control->checkId();
|
$control->checkId();
|
||||||
if ($control instanceof Scriptable) {
|
if ($control instanceof Scriptable) {
|
||||||
$control->setScriptEvents(true);
|
$control->setScriptEvents(true);
|
||||||
@ -51,31 +71,27 @@ class PagingButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Button Control
|
* Get the paging count
|
||||||
*
|
*
|
||||||
* @return \FML\Controls\Control
|
* @api
|
||||||
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getControl() {
|
public function getPagingCount()
|
||||||
return $this->control;
|
{
|
||||||
|
return $this->pagingCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the browse action
|
* Set the paging count
|
||||||
*
|
*
|
||||||
* @param int $browseAction Number of browsed Pages per click
|
* @api
|
||||||
|
* @param int $pagingCount Number of browsed pages per click
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setBrowseAction($browseAction) {
|
public function setPagingCount($pagingCount)
|
||||||
$this->browseAction = (int)$browseAction;
|
{
|
||||||
|
$this->pagingCount = (int)$pagingCount;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the browse action
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getBrowseAction() {
|
|
||||||
return $this->browseAction;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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 Page Control
|
||||||
*/
|
*/
|
||||||
/** @var Control $control */
|
|
||||||
protected $control = null;
|
protected $control = null;
|
||||||
protected $number = null;
|
|
||||||
|
/**
|
||||||
|
* @var int $pageNumber Page number
|
||||||
|
*/
|
||||||
|
protected $pageNumber = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Paging Page
|
* Construct a new Paging Page
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param Control $control (optional) Page Control
|
* @param Control $control (optional) Page Control
|
||||||
* @param int $pageNumber (optional) Number of the Page
|
* @param int $pageNumber (optional) Number of the Page
|
||||||
*/
|
*/
|
||||||
public function __construct(Control $control = null, $pageNumber = 1) {
|
public function __construct(Control $control = null, $pageNumber = null)
|
||||||
if ($control !== null) {
|
{
|
||||||
|
if ($control) {
|
||||||
$this->setControl($control);
|
$this->setControl($control);
|
||||||
}
|
}
|
||||||
|
if ($pageNumber) {
|
||||||
$this->setPageNumber($pageNumber);
|
$this->setPageNumber($pageNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the Page Control
|
|
||||||
*
|
|
||||||
* @param Control $control Page Control
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setControl(Control $control) {
|
|
||||||
$this->control = $control->checkId();
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Page Control
|
* Get the Page Control
|
||||||
*
|
*
|
||||||
* @return \FML\Controls\Control
|
* @api
|
||||||
|
* @return Control
|
||||||
*/
|
*/
|
||||||
public function getControl() {
|
public function getControl()
|
||||||
|
{
|
||||||
return $this->control;
|
return $this->control;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Page number
|
* Set the Page Control
|
||||||
*
|
*
|
||||||
* @param int $pageNumber Number of the Page
|
* @api
|
||||||
|
* @param Control $control Page Control
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setPageNumber($pageNumber) {
|
public function setControl(Control $control)
|
||||||
$this->number = (int)$pageNumber;
|
{
|
||||||
|
$control->checkId();
|
||||||
|
$this->control = $control;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Page number
|
* Get the Page number
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getPageNumber() {
|
public function getPageNumber()
|
||||||
return $this->number;
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,51 +12,92 @@ 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
|
|
||||||
|
/**
|
||||||
|
* @var string $login Player login
|
||||||
*/
|
*/
|
||||||
protected $login = null;
|
protected $login = null;
|
||||||
/** @var Control $control */
|
|
||||||
|
/**
|
||||||
|
* @var Control $control Profile Control
|
||||||
|
*/
|
||||||
protected $control = null;
|
protected $control = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $labelName Script Label name
|
||||||
|
*/
|
||||||
protected $labelName = null;
|
protected $labelName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Player Profile Feature
|
* Construct a new Player Profile
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $login (optional) Player login
|
* @param string $login (optional) Player login
|
||||||
* @param Control $control (optional) Action Control
|
* @param Control $control (optional) Profile Control
|
||||||
* @param string $labelName (optional) Script Label name
|
* @param string $labelName (optional) Script Label name
|
||||||
*/
|
*/
|
||||||
public function __construct($login = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK) {
|
public function __construct($login = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK)
|
||||||
|
{
|
||||||
|
if ($login) {
|
||||||
$this->setLogin($login);
|
$this->setLogin($login);
|
||||||
if ($control !== null) {
|
}
|
||||||
|
if ($control) {
|
||||||
$this->setControl($control);
|
$this->setControl($control);
|
||||||
}
|
}
|
||||||
|
if ($labelName) {
|
||||||
$this->setLabelName($labelName);
|
$this->setLabelName($labelName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the login of the opened player
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLogin()
|
||||||
|
{
|
||||||
|
return $this->login;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the login of the opened player
|
* Set the login of the opened player
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
* @param string $login Player login
|
* @param string $login Player login
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLogin($login) {
|
public function setLogin($login)
|
||||||
$this->login = $login;
|
{
|
||||||
|
$this->login = (string)$login;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Control
|
* Get the Profile Control
|
||||||
*
|
*
|
||||||
|
* @api
|
||||||
|
* @return Control
|
||||||
|
*/
|
||||||
|
public function getControl()
|
||||||
|
{
|
||||||
|
return $this->control;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Profile Control
|
||||||
|
*
|
||||||
|
* @api
|
||||||
* @param Control $control Profile Control
|
* @param Control $control Profile Control
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setControl(Control $control) {
|
public function setControl(Control $control)
|
||||||
|
{
|
||||||
$control->checkId();
|
$control->checkId();
|
||||||
if ($control instanceof Scriptable) {
|
if ($control instanceof Scriptable) {
|
||||||
$control->setScriptEvents(true);
|
$control->setScriptEvents(true);
|
||||||
@ -66,20 +107,34 @@ class PlayerProfile extends ScriptFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the label name
|
* 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
|
* @param string $labelName Script Label name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setLabelName($labelName) {
|
public function setLabelName($labelName)
|
||||||
|
{
|
||||||
$this->labelName = (string)$labelName;
|
$this->labelName = (string)$labelName;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \FML\Script\Features\ScriptFeature::prepare()
|
* @see ScriptFeature::prepare()
|
||||||
*/
|
*/
|
||||||
public function prepare(Script $script) {
|
public function prepare(Script $script)
|
||||||
|
{
|
||||||
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText());
|
$script->appendGenericScriptLabel($this->labelName, $this->getScriptText());
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -89,20 +144,22 @@ class PlayerProfile extends ScriptFeature {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getScriptText() {
|
protected function getScriptText()
|
||||||
$login = Builder::escapeText($this->login, true);
|
{
|
||||||
|
$login = Builder::escapeText($this->login);
|
||||||
|
|
||||||
if ($this->control) {
|
if ($this->control) {
|
||||||
// Control event
|
// Control event
|
||||||
$controlId = Builder::escapeText($this->control->getId(), true);
|
$controlId = Builder::escapeText($this->control->getId());
|
||||||
$scriptText = "
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
113
libs/FML/Script/Features/Preload.php
Normal file
113
libs/FML/Script/Features/Preload.php
Normal 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
Loading…
Reference in New Issue
Block a user