-
-
-
-
-
-
-
+EOF;
+
+ $assistants=array();
+ foreach(scandir(DIR_ASSISTANTS) as $item) {
+ if($item == '.' || $item == '..') continue;
+ $item = preg_replace('/\.inc\.php$/','',$item);
+ $assistants[$item] = "assistant/$item";
+ }
+
+ $tables=array('item','model','category','producer','vendor','room','status');
+
+ foreach($tables as $table) {
+ $listable[$table] = $table;
+ $insertable[$table] = "$table/new";
+ }
+
+ $html .= $this->ul(array(
+ 'Home' => '',
+ 'Logout' => '?logout',
+ 0 => $this->ul($assistants,'menu',$this->link('Assistants','#')),
+ 1 => $this->ul($insertable,'menu',$this->link('New','#')),
+ 2 => $this->ul($listable,'menu',$this->link('List','#'))
+ ),'menu', '', 'menu');
+
+ $html .= '
';
+
+ $html .= $this->form("$script/assistant/go", 'GET', array(
+ array('q','','text','smart id...', 'autofocus'),
+ array(false,'go','submit')
+ ), 'style="float: left;"');
+
+ $html .= $this->form('?', 'GET', array(
+ array('q',$search,'text','regexp...'),
+ array(false,'filter','submit')
+ ), 'style="float: left;"');
+
+ $html .= '
';
+
+ $html .= <<
$message
EOF;
+
+ return $html;
}
function internal_url($link) {
@@ -217,6 +274,19 @@ EOF;
}
}
+ function render_barcode($barcode,$opts=false) {
+ return $this->link($this->img($this->internal_url("barcode/$barcode"),$barcode,$opts),"barcode/$barcode",true,false);
+ }
+
+ function table_add_barcodes(&$table) {
+ $image = array('model_barcode', 'item_serial');
+ foreach($table as $id => $row) {
+ foreach($image as $column) if(isset($table[$id][$column])) {
+ $table[$id][$column]=$this->render_barcode($table[$id][$column]);
+ }
+ }
+ }
+
function table_collapse(&$table) {
$collapse = array(
'item_id' => 'item_id',
@@ -243,38 +313,27 @@ EOF;
foreach($table as $id => $row) {
$table_sorted[$id] = array();
foreach($precedence as $column) if(isset($table[$id][$column])) {
- $table_sorted[$id][$column]=$table[$id][$column];
+ $table_sorted[$id][T($column)]=$table[$id][$column];
unset($table[$id][$column]);
}
- $table_sorted[$id]=array_merge($table_sorted[$id],$table[$id]);
+ //$table_sorted[$id]=array_merge($table_sorted[$id],$table[$id]);
+ foreach($table[$id] as $key => $val) $table_sorted[$id][T($key)] = $val; //array_merge with T() translating
}
$table = $table_sorted;
}
function render_item_table($table) {
$this->table_add_images($table);
+ $this->table_add_barcodes($table);
$this->table_collapse($table);
$this->table_sort($table);
return $this->table($table);
}
- function render_insert_form($class, $columns, $selectbox=array(), $current=false, $hidecols=false, $action=false, $multi_insert=true) {
- //echo(''); print_r($selectbox);
- //echo(''); print_r($current);
- $update = false;
- if(is_array($current)) {
- $update = true;
- $current = array_shift($current);
- }
-
- if(!is_array($hidecols)) $hidecols = array('item_author', 'item_valid_from', 'item_valid_till'); //TODO Autodetect
-
- $action = $action ? " action='$action'" : false;
- $html="