2013-11-25 00:02:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FML\Controls;
|
|
|
|
|
|
|
|
use FML\Types\Container;
|
|
|
|
use FML\Types\Renderable;
|
|
|
|
|
|
|
|
/**
|
2014-01-12 00:51:46 +01:00
|
|
|
* Frame Element
|
|
|
|
* (CMlFrame)
|
2013-11-25 00:02:07 +01:00
|
|
|
*
|
|
|
|
* @author steeffeen
|
|
|
|
*/
|
|
|
|
class Frame extends Control implements Container {
|
|
|
|
/**
|
2013-12-31 02:55:19 +01:00
|
|
|
* Protected Properties
|
2013-11-25 00:02:07 +01:00
|
|
|
*/
|
|
|
|
protected $children = array();
|
|
|
|
|
|
|
|
/**
|
2013-12-31 02:55:19 +01:00
|
|
|
* Construct a new Frame Control
|
2013-11-25 00:02:07 +01:00
|
|
|
*
|
2014-01-12 00:51:46 +01:00
|
|
|
* @param string $id (optional) Control Id
|
2013-11-25 00:02:07 +01:00
|
|
|
*/
|
|
|
|
public function __construct($id = null) {
|
|
|
|
parent::__construct($id);
|
|
|
|
$this->tagName = 'frame';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @see \FML\Types\Container::add()
|
|
|
|
* @return \FML\Controls\Frame
|
|
|
|
*/
|
|
|
|
public function add(Renderable $child) {
|
2014-01-12 00:51:46 +01:00
|
|
|
if (!in_array($child, $this->children)) {
|
|
|
|
array_push($this->children, $child);
|
|
|
|
}
|
2013-11-25 00:02:07 +01:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @see \FML\Types\Container::removeChildren()
|
|
|
|
* @return \FML\Controls\Frame
|
|
|
|
*/
|
|
|
|
public function removeChildren() {
|
|
|
|
$this->children = array();
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @see \FML\Renderable::render()
|
|
|
|
*/
|
|
|
|
public function render(\DOMDocument $domDocument) {
|
2014-01-12 00:51:46 +01:00
|
|
|
$xmlElement = parent::render($domDocument);
|
2013-11-25 00:02:07 +01:00
|
|
|
foreach ($this->children as $child) {
|
2014-01-12 00:51:46 +01:00
|
|
|
$childXmlElement = $child->render($domDocument);
|
|
|
|
$xmlElement->appendChild($childXmlElement);
|
2013-11-25 00:02:07 +01:00
|
|
|
}
|
2014-01-12 00:51:46 +01:00
|
|
|
return $xmlElement;
|
2013-11-25 00:02:07 +01:00
|
|
|
}
|
|
|
|
}
|