2 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
3 // +--------------------------------------------------------------------+
4 // | BIFE - Buil It FastEr |
5 // +--------------------------------------------------------------------+
6 // | This file is part of BIFE. |
8 // | BIFE is free software; you can redistribute it and/or modify it |
9 // | under the terms of the GNU General Public License as published by |
10 // | the Free Software Foundation; either version 2 of the License, or |
11 // | (at your option) any later version. |
13 // | BIFE is distributed in the hope that it will be useful, but |
14 // | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 // | General Public License for more details. |
18 // | You should have received a copy of the GNU General Public License |
19 // | along with Hooks; if not, write to the Free Software Foundation, |
20 // | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 // +--------------------------------------------------------------------+
22 // | Created: Wed May 17 18:16:54 ART 2003 |
23 // | Authors: Leandro Lucarella <luca@lugmen.org.ar> |
24 // +--------------------------------------------------------------------+
30 require_once 'BIFE/Widget.php';
33 // +X2C Class 5 :Container
35 * Base container widget class.
40 class BIFE_Container extends BIFE_Widget {
42 * @var array $contents
53 * @param array $attrs Attributes.
58 function BIFE_Container($attrs) // ~X2C
60 $this->__construct($attrs);
68 * @param array $attrs Attributes.
73 function __construct($attrs) // ~X2C
75 parent::__construct($attrs);
76 $this->contents = array();
82 * Adds contents to the container.
84 * @param mixed &$contents Contents to add to the container.
89 function addContents(&$contents) // ~X2C
91 if (is_object($contents)) {
92 $this->contents[] =& $contents;
94 $this->contents[] = $contents;
101 * Renders the widget using a template returning a string with the results.
103 * @param HTML_Template_HIT &$template Template object to render the widget.
108 function render(&$template) // ~X2C
110 $c = count($this->contents);
112 for ($i = 0; $i < $c; $i++) {
113 if (is_object($this->contents[$i])) {
114 $o .= $this->contents[$i]->render($template);
116 $o .= $this->contents[$i];
123 } // -X2C Class :Container