From: Nicolas Boisselier Date: Thu, 7 Apr 2016 11:34:54 +0000 (+0100) Subject: buttons in functiopn X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=3937e57ba1c201fda8b76b382b6a18a2f3ea343d;p=nb.git buttons in functiopn --- diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 920452c3..d4950d4c 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -223,7 +223,7 @@ Class Table extends nb { } foreach (self::$params as $p) if ($v=self::p($p)) $url[] = $p.'='.urlencode($v); - return $url ? '?'.$sep.join($sep,$url) : ''; + return $url ? '?'.join($sep,$url) : ''; } public function fields_keys(&$others=array()) { @@ -887,22 +887,18 @@ Class Table extends nb { public function rows_rec_table(&$row) { + $buttons = $this->html_row_buttons($row); + $html = ''.NB_EOL; - if ($this->p('buttons')!=='0') $html .= - ''.DB_HTML_EDIT.''.NB_EOL; + if ($this->p('buttons')!=='0') $html .= ''.$buttons[0].''.NB_EOL; foreach ($row as $k => $v) { if (isset($this->extras[$k])) $k .= " extra"; $html .= ''.$v.''.NB_EOL; } - if ($this->p('buttons')!=='0') $html .= - ''.DB_HTML_DELETE.''.NB_EOL; + if ($this->p('buttons')!=='0') $html .= ''.$buttons[1].''.NB_EOL; $html .= ''.NB_EOL; @@ -931,8 +927,7 @@ Class Table extends nb { if ($this->p('buttons')!=='0') { $html .= '
  • '.NB_EOL; - $html .= ''.DB_HTML_EDIT.''.NB_EOL; - $html .= ''.DB_HTML_DELETE.''.NB_EOL; + $html .= join('',$this->html_row_buttons($row)); $html .= '
  • '.NB_EOL; } @@ -1203,6 +1198,13 @@ Class Table extends nb { return false; } + public function html_row_buttons(&$row) { + return array( + ''.DB_HTML_EDIT.''.NB_EOL, + ''.DB_HTML_DELETE.''.NB_EOL, + ); + } + public function html_rows_top() { if (self::p('replace') === '0') return ''; $html = ''; @@ -1220,7 +1222,7 @@ Class Table extends nb { } public function count() { - + if (isset($this->count)) return $this->count; $sql_count = $this->name;