* * originaly based on todo written by Joseph Engo * * -------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * \**************************************************************************/ /* $Id$ */ class html { function html() { } function input_hidden($vars,$value='') { if (!is_array($vars)) { $vars = array( $vars => $value ); } while (list($name,$value) = each($vars)) { if ($value && !($name == 'filter' && $value == 'none')) // dont need to send all the empty vars { $html .= "\n"; } } return $html; } function input($name,$value='',$type='',$options='' ) { if ($type) $type = "type=$type"; return "\n"; } function submit_button($name,$lang,$onClick='') { return $this->input($name,lang($lang),'submit',$onClick ? "onClick=\"$onClick\"" : ''); } /* * create absolute link: $url: phpgw-relative link, may include query * $vars: query or array with query */ function link($url,$vars='') { if (is_array( $vars )) { $v = array( ); while(list($name,$value) = each($vars)) { if ($value && !($name == 'filter' && $value == 'none')) // dont need to send all the empty vars { $v[] = "$name=$value"; } } $vars = implode('&',$v); } list($url,$v) = explode('?',$url); // url may contain additional vars if ($v) $vars .= ($vars ? '&' : '') . $v; return $GLOBALS['phpgw']->link($url,$vars); } function checkbox($name,$value='') { return "\n"; } function form($content,$hidden_vars,$url,$url_vars='',$method='POST') { $html = "
link($url,$url_vars)."\">\n"; $html .= $this->input_hidden($hidden_vars); if ($content) { $html .= $content; $html .= "
\n"; } return $html; } function form_1button($name,$lang,$hidden_vars,$url,$url_vars='', $method='POST') { return $this->form($this->submit_button($name,$lang), $hidden_vars,$url,$url_vars,$method); } /* * Example: $rows = array ( '1' => array( 1 => 'cell1', '.1' => 'colspan=3', * 2 => 'cell2', * 3 => '3,, '.3' => 'width="10%"' ), * '.1' => 'bgcolor="#0000FF"' ); * table($rows,'width="100%"'); */ function table($rows,$params = '') { $html = "\n"; while (list($key,$row) = each($rows)) { if (!is_array($row)) continue; // parameter $html .= "\t\n"; while (list($key,$cell) = each($row)) { if ($key[0] == '.') continue; // parameter $html .= "\t\t\n"; } $html .= "\t\n"; } $html .= "
$cell
\n"; return $html; } function sbox_submit( $sbox,$no_script=0 ) { $html = str_replace('submit_button('send','>').''; } return $html; } function image( $app,$name,$title='',$opts='' ) { $html = ''; } function a_href( $content,$url,$vars='',$options='') { return ''.$content.''; } function bold($content) { return ''.$content.''; } }