+/**
+* Trida poskytuje vseobecne funkce pro generovani HTML kodu
+*
+* Tato trida by nemela sama nic vypisovat (vyjma chybovych a debugovacich hlasek)!
+*
+* @package HTML
+* @author Tomas Mudrunka
+*/
+class HTML {
+ function row($row) {
+ $html='<tr>';
+ foreach($row as $var) {
+ if(trim($var) == '') $var = ' ';
+ $html.="<td>$var</td>";
+ }
+ $html.='</tr>';
+ return $html;
+ }
+
+ function table(&$table, $params='border=1') {
+ $html="<table $params>";
+ $header=true;
+ foreach($table as $row) {
+ if($header) {
+ $html.=$this->row(array_keys($row));
+ $header=false;
+ }
+ $html.=$this->row($row);
+ }
+ $html.='</table>';
+ return $html;
+ }
+
+ function link($title='n/a', $link='#void', $internal=true) {
+ if($internal) $link = $this->internal_url($link);
+ return "<a href='$link'>$title</a>";
+ }
+
+ function img($src='#void', $title='img') {
+ return "<img src='$src' alt='$title' title='$title' width=64 />";
+ }
+
+ function input($name=false, $value=false, $type='text', $placeholder=false, $options=false) {
+ $html = "<input type='$type' ";
+ if($name) $html.= "name='$name' ";
+ if(!is_bool($value)) $html.= "value='$value' ";
+ if($options) $html.= "$options ";
+ if($placeholder) $html.= "placeholder='$placeholder' ";
+ $html .= '/>';
+ return $html;
+ }
+
+ function select($name, $selectbox, $default=false) {
+ //echo('<pre>'); print_r($selectbox);
+ $html = "<select name='$name'>";
+
+ if($default) {
+ $value=$default; $title=$selectbox[$value];
+ $html .= "<option value='$value'>$value :: $title</option>";
+ unset($selectbox[$value]);
+ }
+ foreach($selectbox as $value => $title) {
+ $html .= "<option value='$value'>$value :: $title</option>";
+ }
+ $html .= "</select>";
+ return $html;
+ }
+}
+