]> git.llucax.com Git - mecon/intranet.git/blob - sistema/local_lib/HTML_DietMarco.php
Se realizan correcciones varias derivadas del primer testing.
[mecon/intranet.git] / sistema / local_lib / HTML_DietMarco.php
1 <?php
2 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
3 // +--------------------------------------------------------------------+
4 // |                      Ministerio de Econom�                        |
5 // |                             Intranet                              |
6 // +--------------------------------------------------------------------+
7 // | This file is part of Intranet.                                    |
8 // |                                                                    |
9 // | Intranet is free software; you can redistribute it and/or modify  |
10 // | it under the terms of the GNU General Public License as published  |
11 // | by the Free Software Foundation; either version 2 of the License,  |
12 // | or (at your option) any later version.                             |
13 // |                                                                    |
14 // | Intranet is distributed in the hope that it will be useful, but   |
15 // | WITHOUT ANY WARRANTY; without even the implied warranty of         |
16 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   |
17 // | General Public License for more details.                           |
18 // |                                                                    |
19 // | You should have received a copy of the GNU General Public License  |
20 // | along with Hooks; if not, write to the Free Software Foundation,   |
21 // | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA      |
22 // +--------------------------------------------------------------------+
23 // | Creado: Thu Jul 10 15:03:36 2003                                   |
24 // | Autor:  Gonzalo Merayo <gmeray@mecon.gov.ar>                                                    |
25 // +--------------------------------------------------------------------+
26 //
27 // $Id: xmi2code.tpl.php 1 2003-06-23 18:29:20Z gmeray $
28 //
29
30 define('PATH_RAIZ','/sistemas/intranet/');
31
32 require_once 'HTML_Copete.php';
33 require_once 'HTML/Page.php';
34
35 /**
36  * @access public
37  */
38 class HTML_DietMarco extends HTML_Page {
39
40     var $_copete_seccion;
41     var $_copete_titulo;
42     var $_cuerpo = array();
43
44     /**
45      * @param  int $title 
46      *
47      * @return void
48      * @access public
49      */
50     function addTitle($title)
51     {
52         $this->setTitle($this->getTitle() . ' - ' . $title);
53     }
54
55     /**
56      * @param  string $seccion 
57      * @param  string $titulo 
58      *
59      * @return void
60      * @access public
61      */
62     function HTML_DietMarco($seccion, $titulo)
63     {
64         parent::HTML_Page(array ('doctype'=>'HTML 4.01 Transitional',
65                                  'charset'  => 'iso-8859-1',
66                                  'lineend'  => 'unix',
67                                  'language' => 'es',
68                                  'cache'    => 'false',
69                                  'simple'   => 'true'));
70         $this->setTitle('Intranet');
71         $this->_copete_titulo = $titulo;
72         $this->_copete_seccion = $seccion;
73         $this->addStyleSheet(PATH_RAIZ.'css/dietmarco');
74     }
75
76     /**
77      * @param  int $content 
78      *
79      * @return void
80      * @access public
81      */
82     function addBodyContent($content)
83     {
84         if(method_exists($content, 'getcss'))
85             $this->addStyleSheet($content->getCSS());
86         $this->_cuerpo[] = $content;
87     }
88
89     function toHtml()
90     {
91         $table = new HTML_Table(array('border' => 0, 'cellspacing' => 0, 'cellpadding' => 0));
92         $copete =& new HTML_Copete($this->_copete_seccion);
93         $copete->setTitulo($this->_copete_titulo);
94         $this->addStyleSheet($copete->getCSS());
95         $table->addRow(array($copete));
96         $table->addRow(array('&nbsp;'));
97         $table->addRow(array($this->_arrayToHtml($this->_cuerpo)));
98         parent::addBodyContent($table);
99         return parent::toHtml();
100     }
101
102     function _arrayToHtml(&$array)
103     {
104         // Robado de HTML_Page.
105         $lnEnd = $this->_getLineEnd();
106         $tab = $this->_getTab();
107         $strHtml = '';
108         foreach ($array as $element) {
109             if (is_object($element)) {
110                 if (is_subclass_of($element, 'html_common')) {
111                     $element->setTabOffset(1);
112                     $element->setTab($tab);
113                     $element->setLineEnd($lnEnd);
114                 }
115                 if (is_object($element)) {
116                     if (method_exists($element, 'toHtml')) {
117                         $strHtml .= $element->toHtml() . $lnEnd;
118                     } elseif (method_exists($element, 'toString')) {
119                         $strHtml .= $element->toString() . $lnEnd;
120                     }
121                 } else {
122                     $strHtml .= $tab . $element . $lnEnd;
123                 }
124             } elseif (is_array($element)) {
125                 $strHtml .= $this->_arrayToHtml($element);
126             } else {
127                 $strHtml .= $tab . $element . $lnEnd;
128             }
129         }
130         return $strHtml;
131     }
132
133 }
134 ?>