Huge FML Update
This commit is contained in:
@ -1,147 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Elements;
|
||||
|
||||
use FML\Types\Renderable;
|
||||
|
||||
/**
|
||||
* Class representing the Custom_UI
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
class CustomUI implements Renderable {
|
||||
/**
|
||||
* Protected Properties
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* Set Showing of Notices
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
*/
|
||||
public function setNoticeVisible($visible) {
|
||||
$this->noticeVisible = $visible;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Showing of the Challenge Info
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
*/
|
||||
public function setChallengeInfoVisible($visible) {
|
||||
$this->challengeInfoVisible = $visible;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Showing of the Net Infos
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
*/
|
||||
public function setNetInfosVisible($visible) {
|
||||
$this->netInfosVisible = $visible;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Showing of the Chat
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
*/
|
||||
public function setChatVisible($visible) {
|
||||
$this->chatVisible = $visible;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Showing of the Checkpoint List
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
*/
|
||||
public function setCheckpointListVisible($visible) {
|
||||
$this->checkpointListVisible = $visible;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Showing of Round Scores
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
*/
|
||||
public function setRoundScoresVisible($visible) {
|
||||
$this->roundScoresVisible = $visible;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Showing of the Scoretable
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
*/
|
||||
public function setScoretableVisible($visible) {
|
||||
$this->scoretableVisible = $visible;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Global Showing
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
*/
|
||||
public function setGlobalVisible($visible) {
|
||||
$this->globalVisible = $visible;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Renderable::render()
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$settings = $this->getSettings();
|
||||
$xml = $domDocument->createElement($this->tagName);
|
||||
foreach ($settings as $setting => $value) {
|
||||
if ($value === null) continue;
|
||||
$xmlElement = $domDocument->createElement($setting);
|
||||
$xmlElement->setAttribute('visible', ($value ? 'true' : 'false'));
|
||||
$xml->appendChild($xmlElement);
|
||||
}
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get associative Array of all CustomUI Settings
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getSettings() {
|
||||
$settings = array();
|
||||
$settings['challenge_info'] = $this->challengeInfoVisible;
|
||||
$settings['chat'] = $this->chatVisible;
|
||||
$settings['checkpoint_list'] = $this->checkpointListVisible;
|
||||
$settings['global'] = $this->globalVisible;
|
||||
$settings['net_infos'] = $this->netInfosVisible;
|
||||
$settings['notice'] = $this->noticeVisible;
|
||||
$settings['round_scores'] = $this->roundScoresVisible;
|
||||
$settings['scoretable'] = $this->scoretableVisible;
|
||||
return $settings;
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ namespace FML\Elements;
|
||||
*/
|
||||
class Format implements BgColorable, Renderable, Styleable, TextFormatable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $tagName = 'format';
|
||||
|
||||
|
@ -9,15 +9,16 @@ namespace FML\Elements;
|
||||
*/
|
||||
class Including implements Renderable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $url = '';
|
||||
protected $tagName = 'include';
|
||||
|
||||
/**
|
||||
* Set url
|
||||
* Set Url
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $url
|
||||
* Include Url
|
||||
*/
|
||||
public function setUrl($url) {
|
||||
$this->url = $url;
|
||||
@ -29,7 +30,9 @@ class Including implements Renderable {
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$xml = $domDocument->createElement($this->tagName);
|
||||
$xml->setAttribute('url', $this->url);
|
||||
if ($this->url) {
|
||||
$xml->setAttribute('url', $this->url);
|
||||
}
|
||||
return $xml;
|
||||
}
|
||||
}
|
||||
|
@ -9,15 +9,16 @@ namespace FML\Elements;
|
||||
*/
|
||||
class Music implements Renderable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $data = '';
|
||||
protected $tagName = 'music';
|
||||
|
||||
/**
|
||||
* Set data
|
||||
* Set Data Url
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $data
|
||||
* Media Url
|
||||
* @return \FML\Elements\Music
|
||||
*/
|
||||
public function setData($data) {
|
||||
|
@ -11,13 +11,13 @@ use FML\Types\Renderable;
|
||||
*/
|
||||
class SimpleScript implements Renderable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $tagName = 'script';
|
||||
protected $text = '';
|
||||
|
||||
/**
|
||||
* Set script text
|
||||
* Set Script Text
|
||||
*
|
||||
* @param string $text
|
||||
* @return \FML\Script\Script
|
||||
|
Reference in New Issue
Block a user