* @author Tomas Mudrunka
*/
class HTML {
- function row($row) {
- $html='<tr>';
+ function row($row,$type=false) {
+ $html = '';
+ if($type) $html.="<$type>";
+ $html.='<tr>';
+ $td = $type == 'thead' ? 'th' : 'td';
foreach($row as $var) {
if(trim($var) == '') $var = ' ';
- $html.="<td>$var</td>";
+ $html.="<$td>$var</$td>";
}
$html.='</tr>';
+ if($type) $html.="</$type>";
return $html;
}
$header=true;
foreach($table as $row) {
if($header) {
- $html.=$this->row(array_keys($row));
+ $html.=$this->row(array_keys($row),'thead');
$header=false;
}
$html.=$this->row($row);
<style type="text/css">
* { font-family: arial; }
+td,body { background-color: white; }
+table { background-color: orange; border: orange; }
+a { text-decoration:none; color: darkblue; }
+li a, a:hover { text-decoration:underline; }
.menu li {
float: left;
$action = $action ? " action='$action'" : false;
$html="<form$action method='POST'>"; //TODO: use $this->form()
- if($multi_insert) $html.='<div name="input_set" style="float:left; border:1px solid grey;">';
+ if($multi_insert) $html.='<span><div name="input_set" style="float:left; border:1px solid grey; padding: 1px; margin: 1px;">';
//$html.=$this->input('table', $class, 'hidden');
foreach($columns as $column) {
$html.=T($class).':<b>'.T($column['Field']).'</b>: ';
$html.='<br />';
}
- if($multi_insert) {
- //TODO, move to separate JS file
+ if($multi_insert) { //TODO, move to separate JS file
$html.=<<<EOF
- </div>
- <span name="input_set_next"></span><br style="clear:both" />
+ </div></span>
+ <br style="clear:both" />
<script>
function duplicate_element(what, where) {
- document.getElementsByName(where)[0].outerHTML =
- document.getElementsByName(what)[0].outerHTML
- + document.getElementsByName(where)[0].outerHTML;
+ var node = document.getElementsByName(what)[0];
+ node.parentNode.appendChild(node.cloneNode(true));
}
</script>
- <a href='#' onClick="duplicate_element('input_set', 'input_set_next')">+</a>
+ <a href='#' onClick="duplicate_element('input_set')">+</a>
EOF;
}
$html.= '-';
$html.= $this->html->link('>>', "$class/$id_next/");
$html.= '<br />';
+ $html.='<span style="float:right;">'.$this->html->render_barcode(BARCODE_PREFIX.strtoupper("$class/$id")).'</span>';
$html.= $this->html->link('edit', "$class/$id/edit/");
if($this->db->contains_history($class)) $html.= ' ][ '.$this->html->link('history', "$class/$id/history/");
- $html.='<br />'.$this->html->render_barcode(BARCODE_PREFIX.strtoupper("$class/$id"));
return $html;
}
$sklad = new Sklad_UI();
$sklad->process_http_request();
-echo("<hr/>");
+echo('<br style="clear:both;" /><hr />');