X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=index.php;h=f1744a4a17fe63cb429b2efaa180ee23df26bc74;hb=1e0a73dc3e7bf25709b497eb8c98a572264bcdd1;hp=cc4d22a55bd142c4c8221502cd31ad01a727b21a;hpb=7df1effb9830b6554d0b8854eff36926455bae12;p=mirrors%2FSokoMan.git diff --git a/index.php b/index.php index cc4d22a..f1744a4 100755 --- a/index.php +++ b/index.php @@ -35,35 +35,40 @@ require_once('Fortune.php'); * @author Tomas Mudrunka */ class HTML { - function row($row,$type=false,$class=false,$parameters='') { + function row($row,$type=false,$class=false,$parameters='',$colspan=array(),$rowspan=array(),$break_after=array()) { $html = ''; - $class = $class ? $class=" class='$class' " : ''; + $class_br = $class ? " class='$class' " : ''; + $class = $class ? " class='$class tr_nobr' " : ''; if($type) $html.="<$type>"; $html.=""; $td = $type == 'thead' ? 'th' : 'td'; - foreach($row as $var) { + foreach($row as $id => $var) { + $tdclass = " class='cell_$id'"; if(trim($var) == '') $var = ' '; - $html.="<$td>$var"; + $rs = isset($rowspan[$id]) ? " rowspan='$rowspan[$id]'" : ''; + $cs = isset($colspan[$id]) ? " colspan='$colspan[$id]'" : ''; + $html.="<$td$rs$cs$tdclass>$var"; + if(in_array($id,$break_after,true)) $html.=''.""; } $html.=''; if($type) $html.=""; return $html; } - function table(&$table, $parity_class=array('tr_odd','tr_even'), $params='border=1', $row_params_field='_row_parameters') { + function table(&$table,$colspan=array(),$rowspan=array(),$break_after=array(),$parity_class=array('tr_odd','tr_even'),$params='border=1',$row_classes_field='_row_classes') { $html=""; $header=true; $even=false; foreach($table as $row) { + $params = isset($row[$row_classes_field]) ? $row[$row_classes_field] : ''; + unset($row[$row_classes_field]); if($header) { - unset($row[$row_params_field]); - $html.=$this->row(array_keys($row),'thead'); + $keys = array(); foreach($row as $key => $val) $keys[$key]=$key; + $html.=$this->row(T($keys),'thead',false,'',$colspan,$rowspan,$break_after); $header=false; } $class = $parity_class ? $parity_class[$even] : false; - $params = isset($row[$row_params_field]) ? $row[$row_params_field] : ''; - unset($row[$row_params_field]); - $html.=$this->row($row,false,$class.$params); + $html.=$this->row($row,false,$class.$params,'',$colspan,$rowspan,$break_after); $even = !$even; } $html.='
'; @@ -76,12 +81,13 @@ class HTML { return "".$title.""; } - function img($src='#void', $title='img', $options='width=64') { + function img($src='#void', $title='img', $options='height=64') { + if(isset($_GET['noimgs'])) return "".basename($src).''; $options = $options ? " $options" : ''; return "$title"; } - function img_link($src, $link='#void', $title='img_link', $internal=true, $translate=true, $options='width=64') { + function img_link($src, $link='#void', $title='img_link', $internal=true, $translate=true, $options='height=64') { return $this->link($this->img($src,$title,$options),$link,$internal,$translate); } @@ -124,11 +130,11 @@ class HTML { if(!is_bool($default)) { $value=$default; $title=$selectbox[$value]; - $html .= ""; + $html .= ""; unset($selectbox[$value]); } foreach($selectbox as $value => $title) { - $html .= ""; + $html .= ""; } $html .= ""; return $html; @@ -179,7 +185,7 @@ class HTML { * @author Tomas Mudrunka */ class Sklad_HTML extends HTML { //TODO: Split into few more methods - function header($title='', $user=array()) { + function header($title='', $user=array(), $headerhtml) { $home = URL_HOME; $script = $_SERVER['SCRIPT_NAME']; $search = htmlspecialchars(@trim($_GET['q'])); @@ -202,13 +208,23 @@ class Sklad_HTML extends HTML { //TODO: Split into few more methods