X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;ds=sidebyside;f=index.php;h=a131b22c886159f6f73e5d543a649793dcb6c4d5;hb=8b9a8edbddb77aae7af7988ad79e2e65d47f0242;hp=4d6310053272aabefce57f90252b77b36f073d20;hpb=842cb193f9485c4cbd2014c11099300bed81ec91;p=mirrors%2FSokoMan.git
diff --git a/index.php b/index.php
index 4d63100..a131b22 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 $id => $var) {
$tdclass = " class='cell_$id'";
if(trim($var) == '') $var = ' ';
- $html.="<$td$tdclass>$var$td>";
+ $rs = isset($rowspan[$id]) ? " rowspan='$rowspan[$id]'" : '';
+ $cs = isset($colspan[$id]) ? " colspan='$colspan[$id]'" : '';
+ $html.="<$td$rs$cs$tdclass>$var$td>";
+ if(in_array($id,$break_after,true)) $html.='
'."";
}
$html.='
';
if($type) $html.="$type>";
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_params_field]) ? $row[$row_params_field] : '';
- unset($row[$row_params_field]);
+ $params = isset($row[$row_classes_field]) ? $row[$row_classes_field] : '';
+ unset($row[$row_classes_field]);
if($header) {
- $html.=$this->row(T(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;
- $html.=$this->row($row,false,$class.$params);
+ $html.=$this->row($row,false,$class.$params,'',$colspan,$rowspan,$break_after);
$even = !$even;
}
$html.='
';
@@ -76,12 +81,12 @@ class HTML {
return "".$title."";
}
- function img($src='#void', $title='img', $options='width=64') {
+ function img($src='#void', $title='img', $options='height=64') {
$options = $options ? " $options" : '';
return "
";
}
- 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);
}
@@ -202,16 +207,20 @@ class Sklad_HTML extends HTML { //TODO: Split into few more methods