* * -------------------------------------------- * * 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 hash_table($rows,$head='',$obj, $frtn) { global $phpgw; $html = ''; $edittable =$head['_edittable']; if (isset($edittable)) { if ($edittable) { // Generate the customization table... return $this->edit_table($rows,$head,$obj,$frtn); } else { $html .= "
link('/admin/log.php') . "&editable=true\">\n"; $html .= ""; } } $params = $head['_table_parms']; if ($head == '') { $frow = $rows[0]; $cnam = array_keys($frow); while(list(,$fn)=each($cnam)) { $head[$fn] = array(); } }; if ( gettype($head['_cols'])=="NULL") { $cols = array_keys($rows[0]); } else { $cols = $head['_cols']; }; $html .= "\n"; // Build Header Row... $html .= "\t "; reset($cols); while (list(,$name) = each($cols)) { $values = $head[$name]; $title = $values['title']; if ($title == '') { $title = $name; } $html .= "\t\t\n"; } $html .= "\t\n"; reset($rows); while(list($rno,$r)=each($rows)) { $row = $obj->$frtn($rno,$r); $rparms = $row['_rparms']; $html .= "\t "; reset($cols); while (list(,$name) = each($cols)) { $values = $head[$name]; $parms = $values['parms']; $fparms = $row['_'.$name]; $html .= "\t\t\n"; } $html .= "\t\n"; } $html .= "
".$title."
".$row[$name]."
\n"; $html .= "
"; return $html; } function edit_table($rows,$head='',$obj, $frtn) { global $phpgw, $nocols; $html = ''; $html .= "
link('/admin/log.php') . "&editable=true" . "\">\n"; $params = $head['_table_parms']; $frow = $rows[0]; $cnam = array_keys($frow); if ($head == '') { while(list(,$fn)=each($cnam)) { $head[$fn] = array(); } }; if ( gettype($head['_cols'])=="NULL") { $cols = array_keys($rows[0]); } else { $cols = $head['_cols']; }; if (!isset($nocols)) { $nocols = count($cols); } // Build Header Row... $html .= "

Number of Columns: "; $html .= ""; $html .= ""; $html .= "

\n"; $html .= "\t "; $html .= "\n"; $html .= "\t\t\n"; $html .= "\t\t\n"; $html .= "\t\t\n"; $html .= "\t\n"; // Add Table Rows... reset($cols); // while (list($cno,$name) = each($cols)) for ($cno=0;$cno<$nocols;$cno++) { $name = $cols[$cno]; $values = $head[$name]; $title = $values['title']; if ($title == '') { $title = $name; } $html .= "\t\n"; $html .= "\t\t\n"; $html .= "\t\t\n"; $value = $rows[0][$name]; $html .= "\t\t\n"; $html .= "\t\n"; } $html .= "
DelColumnValue
".$this->dropdown($cnam,'_cols[]',$name)."$value
\n"; $html .= ""; $html .= "
"; return $html; } function dropdown($opts,$name='',$sel='') { $items = $opts; $html = '\n"; return $html; } }