From: Nicolas Boisselier Date: Fri, 16 Dec 2016 13:23:45 +0000 (+0000) Subject: table_html_add X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=1fc839a763b48bb443fcdae00ffb653afca3dbc7;p=nb.git table_html_add --- diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 2d791bd9..a0b09033 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -400,23 +400,24 @@ Class Table extends nb { public static function form_hidden($ignore=[]) { $h = ''; + foreach (array_diff(self::$params,$ignore) as $p) { - if ($v=self::p($p)) { + if (($v=self::p($p)) or $p=='action') { if (self::p('debug')) $h .= ""; $h .= ''.NB_EOL; } } + return $h; } - public function html_edit($values = null,$form_action='?') { + public function html_edit($values = null,$form_action='?',$add=false) { if ($values === null) $values = $this->p(); if (!is_array($values)) $values = [$values]; $fields = array_filter($this->fields(),function($v){return empty($v->extra);}); #$fields = $this->fields(); #debug($fields); - $add = false; $where = $this->where($fields,$values); if (empty($where)) { $where = ' WHERE 1=0'; @@ -929,7 +930,7 @@ Class Table extends nb { #debug($this->db()->name); if ($opt['is_html'] and !empty(self::$params) and !$this->p('action') and !$this->p('inc')) { - echo $this->html_menu(); + echo $this->html_menu($opt); } if ($opt['is_html']) { @@ -1722,7 +1723,10 @@ Class Table extends nb { self::bye(join(' | ',$err)); } - public function html_menu() { + public function html_menu($opt=[]) { + + $buttons = ''; + if (!empty($opt['buttons'])) $buttons = $opt['buttons']; $r = '