X-Git-Url: https://git.llucax.com/software/bife/bife-all.git/blobdiff_plain/ef3115fcba3b2589f2819538dc53e597822716d5..2ca13aad316873633c3fd9ba59ee2f5579d90272:/src/BIFE/Container.php?ds=sidebyside diff --git a/src/BIFE/Container.php b/src/BIFE/Container.php index d1ea194..7c138ac 100644 --- a/src/BIFE/Container.php +++ b/src/BIFE/Container.php @@ -38,22 +38,85 @@ require_once 'BIFE/Widget.php'; * @abstract */ class BIFE_Container extends BIFE_Widget { + /** + * @var array $contents + * @access public + */ + var $contents; + // ~X2C + // +X2C Operation 48 + /** + * Constructor. + * + * @param array $attrs Attributes. + * + * @return void + * @access public + */ + function BIFE_Container($attrs) // ~X2C + { + $this->__construct($attrs); + } + // -X2C + + // +X2C Operation 50 + /** + * Constructor. + * + * @param array $attrs Attributes. + * + * @return void + * @access public + */ + function __construct($attrs) // ~X2C + { + parent::__construct($attrs); + $this->contents = array(); + } + // -X2C + // +X2C Operation 6 /** * Adds contents to the container. * - * @param string $contents Contents to add to the container. + * @param mixed &$contents Contents to add to the container. * * @return void * @access public - * @abstract */ - function addContents($contents) // ~X2C + function addContents(&$contents) // ~X2C + { + if (is_object($contents)) { + $this->contents[] =& $contents; + } else { + $this->contents[] = $contents; + } + } + // -X2C + + // +X2C Operation 59 + /** + * Renders the widget using a template returning a string with the results. + * + * @param HTML_Template_Sigma &$template Template object to render the widget. + * + * @return string + * @access public + */ + function render(&$template) // ~X2C { - trigger_error('Method not implemented '.get_class($this). - '::addContents().', E_USER_ERROR); + $c = count($this->contents); + $o = ''; + for ($i = 0; $i < $c; $i++) { + if (is_object($this->contents[$i])) { + $o .= $this->contents[$i]->render($template); + } else { + $o .= $this->contents[$i]; + } + } + return $o; } // -X2C