5 * Copyright (c) 2002 The SquirrelMail Project Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This contains functions needed to generate html output.
16 var $tag, $text, $style, $class,
17 $id, $html_el = array(), $javascript, $xtr_prop;
19 function html($tag='', $text='', $style ='', $class='', $id='',
20 $xtr_prop = '', $javascript = '') {
23 $this->style = $style;
24 $this->class = $class;
26 $this->xtr_prop = $xtr_prop;
27 $this->javascript = $javascript;
30 function htmlAdd($el) {
31 $this->html_el[] = $el;
35 function echoHtml( $usecss=false, $indent='') {
38 $class = $this->class;
40 $style = $this->style;
41 $javascript = $this->javascript;
42 $xtr_prop = $this->xtr_prop;
45 foreach ($xtr_prop as $k => $v) {
47 $prop.=' '.$k.'="'.$v.'"';
55 foreach ($javascript as $k => $v) { /* here we put the onclick, onmouseover etc entries */
56 $js.=' '.$k.'="'.$v.'";';
60 echo $indent . '<' . $tag;
62 echo ' class="'.$class.'"';
70 if ($style && !$usecss) {
71 echo ' style="'.$style.'"';
78 if ($style && !$usecss) { /* if use css then fallback to stylesheet for layout */
79 foreach ($style as $k => $v) {
83 foreach ($style as $k => $v) { /* if value of key value = true close the tag */
92 $cnt = count($this->html_el);
96 for($i = 0;$i<$cnt;$i++) {
97 $el = $this->html_el[$i];
98 $el->echoHtml($usecss,$indent);
101 echo '</'.$tag.'>'."\n";