]> git.llucax.com Git - software/bife/bife-all.git/blob - core/BIFE/Container.php
Core and Basic modules are now much more like they should. Huge code clean:
[software/bife/bife-all.git] / core / BIFE / Container.php
1 <?php
2 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
3 // +--------------------------------------------------------------------+
4 // |                       BIFE - Buil It FastEr                        |
5 // +--------------------------------------------------------------------+
6 // | This file is part of BIFE.                                         |
7 // |                                                                    |
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.                                |
12 // |                                                                    |
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.                           |
17 // |                                                                    |
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 // +--------------------------------------------------------------------+
25 //
26 // $Id$
27 //
28
29 // +X2C includes
30 require_once 'BIFE/Widget.php';
31 // ~X2C
32
33 // +X2C Class 5 :Container
34 /**
35  * Base container widget class.
36  *
37  * @access public
38  * @abstract
39  */
40 class BIFE_Container extends BIFE_Widget {
41     /**
42      * Widget contents.
43      *
44      * @var    array $contents
45      * @access public
46      */
47     var $contents = array();
48
49     // ~X2C
50
51     // +X2C Operation 6
52     /**
53      * Adds contents to the container.
54      *
55      * @param  mixed &$contents Contents to add to the container.
56      *
57      * @return void
58      * @access public
59      */
60     function addContents(&$contents) // ~X2C
61     {
62         if (is_object($contents)) {
63             $this->contents[] =& $contents;
64         } else {
65             $this->contents[] = $contents;
66         }
67     }
68     // -X2C
69
70     // +X2C Operation 59
71     /**
72      * Renders the widget using a template returning a string with the results.
73      *
74      * @param  HTML_Template_HIT &$template Template object to render the widget.
75      *
76      * @return string
77      * @access public
78      */
79     function renderContents(&$template) // ~X2C
80     {
81         $c = count($this->contents);
82         $o = '';
83         for ($i = 0; $i < $c; $i++) {
84             if (is_object($this->contents[$i])) {
85                 $o .= $this->contents[$i]->render($template);
86             } else {
87                 $o .= $this->contents[$i];
88             }
89         }
90         return $o;
91     }
92     // -X2C
93
94
95 } // -X2C Class :Container
96
97 ?>