X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=index.php;h=525c272194317093b5c48285ae19e62a2777fd76;hb=HEAD;hp=b37ab51d93f729142d5a1274cd1d818aa6ef1587;hpb=6f7943a08cc115d137c5777408259009433ea8ca;p=mirrors%2FSokoMan.git diff --git a/index.php b/index.php index b37ab51..525c272 100755 --- a/index.php +++ b/index.php @@ -1,7 +1,7 @@ "; - $html.=''; + $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 title='$id'>$var"; + if(in_array($id,$break_after,true)) $html.=''.""; } $html.=''; if($type) $html.=""; return $html; } - function table(&$table, $params='border=1') { + function table(&$table,$colspan=array(),$rowspan=array(),$break_after=array(),$orderby=false,$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) { - $html.=$this->row(array_keys($row),'thead'); + $keys = array(); foreach($row as $key => $val) { + $order= $orderby ? ' '. + $this->link('↑', $orderby."[$key]=ASC"). + $this->link('↓', $orderby."[$key]=DESC") : ''; + $keys[$key]=T($key).$order; + } + $html.=$this->row($keys,'thead',false,'',$colspan,$rowspan,$break_after); $header=false; } - $html.=$this->row($row); + $class = $parity_class ? $parity_class[$even] : false; + $html.=$this->row($row,false,$class.$params,'',$colspan,$rowspan,$break_after); + $even = !$even; } $html.='
'; return $html; @@ -68,16 +87,29 @@ 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); } + function textarea($name=false, $value='', $placeholder=false, $options=false, $prefix='') { + $html = T($prefix)."textarea($name, $value, $placeholder, $options, $prefix); + if($type == 'select') return $this->select($name, $placeholder, $value, $prefix); + //select(vendor, $selectbox ,false, prefix:); $html = T($prefix)."'); print_r($selectbox); - $html = ""; - if($default) { + if(!is_bool($default)) { $value=$default; $title=$selectbox[$value]; - $html .= ""; + $html .= ""; unset($selectbox[$value]); } foreach($selectbox as $value => $title) { - $html .= ""; + $html .= ""; } $html .= ""; return $html; @@ -137,10 +169,16 @@ class HTML { return "$html"; } + function favicon($url='/favicon.ico') { + return ''; + + } + function head($title=false,$charset='UTF-8',$more='') { $title = $title ? "\n$title" : ''; $html= ''; $html.= ''.$title.$more; + $html.= $this->favicon(dirname($_SERVER['SCRIPT_NAME']).'/favicon.ico'); $html.= ''; return $html; } @@ -155,11 +193,12 @@ 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'])); - $message = strip_tags(@trim($_GET['message']),''); + $message = strip_tags(@trim($_GET['message']),'
'); + $fortune = fortune(); $instance = INSTANCE_ID != '' ? '/'.INSTANCE_ID : ''; $user_id = htmlspecialchars($user['id']); $user_gid = htmlspecialchars($user['gid']); @@ -177,11 +216,28 @@ class Sklad_HTML extends HTML { //TODO: Split into few more methods