]> git.llucax.com Git - software/bife/bife-all.git/blobdiff - BIFE/Container.php
- Improved example.
[software/bife/bife-all.git] / BIFE / Container.php
index e87f813786879508e362e4f79ab79d5293a3ea45..2ddc24d12975076e671987ea72da8291affcce8d 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
 // +--------------------------------------------------------------------+
 <?php
 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
 // +--------------------------------------------------------------------+
-// |                      BIFE - Buil It Fast & Easy                    |
+// |                       BIFE - Buil It FastEr                        |
 // +--------------------------------------------------------------------+
 // | This file is part of BIFE.                                         |
 // |                                                                    |
 // +--------------------------------------------------------------------+
 // | This file is part of BIFE.                                         |
 // |                                                                    |
@@ -19,8 +19,8 @@
 // | along with Hooks; if not, write to the Free Software Foundation,   |
 // | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA      |
 // +--------------------------------------------------------------------+
 // | along with Hooks; if not, write to the Free Software Foundation,   |
 // | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA      |
 // +--------------------------------------------------------------------+
-// | Created: @date
-// | Authors: @author
+// | Created: Wed May 17 18:16:54 ART 2003                              |
+// | Authors: Leandro Lucarella <luca@lugmen.org.ar>                    |
 // +--------------------------------------------------------------------+
 //
 // $Id$
 // +--------------------------------------------------------------------+
 //
 // $Id$
@@ -38,25 +38,60 @@ require_once 'BIFE/Widget.php';
  * @abstract
  */
 class BIFE_Container extends BIFE_Widget {
  * @abstract
  */
 class BIFE_Container extends BIFE_Widget {
+    /**
+     * Widget contents.
+     *
+     * @var    array $contents
+     * @access public
+     */
+    var $contents = array();
+
     // ~X2C
 
     // +X2C Operation 6
     /**
      * Adds contents to the container.
      *
     // ~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
      *
      * @return void
      * @access public
-     * @abstract
      */
      */
-    function addContents($contents) // ~X2C
+    function addContents(&$contents) // ~X2C
     {
     {
-        trigger_error('Method not implemented '.get_class($this).
-            '::addContents().', E_USER_ERROR);
+        if (is_object($contents)) {
+            $this->contents[] =& $contents;
+        } else {
+            $this->contents[] = $contents;
+        }
     }
     // -X2C
 
     }
     // -X2C
 
+    // +X2C Operation 59
+    /**
+     * Renders the widget using a template returning a string with the results.
+     *
+     * @param  HTML_Template_HIT &$template Template object to render the widget.
+     *
+     * @return string
+     * @access public
+     */
+    function renderContents(&$template) // ~X2C
+    {
+        $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
+
+
 } // -X2C Class :Container
 
 ?>
\ No newline at end of file
 } // -X2C Class :Container
 
 ?>
\ No newline at end of file