X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=index.php;h=c7e12e8368c8627bb447642514fc94a15a8ec7e9;hb=80457ef3c29400e0d14524884e3114caf8f926c0;hp=dcdb56d07e4b57602271e9c31ce8433447d2d154;hpb=958f1e84ff76c36bdcdde8e4702643c532fee070;p=mirrors%2FSokoMan.git
diff --git a/index.php b/index.php
index dcdb56d..c7e12e8 100755
--- a/index.php
+++ b/index.php
@@ -35,11 +35,11 @@ require_once('Fortune.php');
* @author Tomas Mudrunka
*/
class HTML {
- function row($row,$type=false,$class=false) {
+ function row($row,$type=false,$class=false,$parameters='') {
$html = '';
$class = $class ? $class=" class='$class' " : '';
if($type) $html.="<$type>";
- $html.="
";
+ $html.="
";
$td = $type == 'thead' ? 'th' : 'td';
foreach($row as $var) {
if(trim($var) == '') $var = ' ';
@@ -50,17 +50,19 @@ class HTML {
return $html;
}
- function table(&$table, $parity_class=array('tr_odd','tr_even'), $params='border=1') {
+ function table(&$table, $parity_class=array('tr_odd','tr_even'), $params='border=1', $row_params_field='_row_parameters') {
$html="";
$header=true;
$even=false;
foreach($table as $row) {
+ $params = isset($row[$row_params_field]) ? $row[$row_params_field] : '';
+ unset($row[$row_params_field]);
if($header) {
$html.=$this->row(array_keys($row),'thead');
$header=false;
}
$class = $parity_class ? $parity_class[$even] : false;
- $html.=$this->row($row,false,$class);
+ $html.=$this->row($row,false,$class.$params);
$even = !$even;
}
$html.='
';
@@ -204,6 +206,9 @@ table { background-color: orange; border: orange; }
a, a img { text-decoration:none; color: darkblue; border:none; }
li a, a:hover { text-decoration:underline; }
.tr_even td { background-color: lemonchiffon; }
+.item_status_stored td { font-weight:bold; }
+.item_status_deleted td { text-decoration:line-through; }
+.item_status_destroyed td { font-style:italic; }
.menu li {
float: left;
@@ -325,6 +330,15 @@ EOF;
}
}
+ function table_add_row_parameters(&$table, $param_col='_row_parameters') { //TODO: rename to table_add_row_classes()
+ $image = array('status_name' => ' item_status_');
+ foreach($table as $id => $row) {
+ foreach($image as $column => $param) if(isset($table[$id][$column])) {
+ @$table[$id][$param_col] .= $param.$table[$id][$column];
+ }
+ }
+ }
+
function table_add_relations(&$table, $class, $suffix_relations='_relations') {
$where_url = '%d/?where[%c]==%v';
$relations = array( //TODO: Autodetect???
@@ -426,6 +440,7 @@ EOF;
function render_item_table($table,$class=false) {
if(empty($table)) return ''.T('holy primordial emptiness is all you can find here...').'
';
+ $this->table_add_row_parameters($table);
$this->table_add_images($table);
if($class) $this->table_add_relations($table,$class);
$this->table_add_barcodes($table);