]> git.nbdom.net Git - nb.git/commitdiff
lib/php/functions.php
authorDevops <sys@15gifts.com>
Mon, 15 May 2017 16:19:53 +0000 (17:19 +0100)
committerDevops <sys@15gifts.com>
Mon, 15 May 2017 16:19:53 +0000 (17:19 +0100)
lib/php/db/table.php
lib/php/functions.php
www/dbq/dbq.php

index d720fb840ac6232c5cb2ed22a0966fc6c65e8b00..29f408bcf60d3bf2ed7424dfd30aa985b2ff9939 100644 (file)
@@ -1995,6 +1995,7 @@ Class Table extends nb {
           'selected'   => $this->p('limit'),
           'prettyText' => true,
           'sort' => 'sort',
+          'default_value' => $this->db()->limits[0],
         ]);
         $r .= '</span>';
       }
index d63ecbaa10ced0b150d0bb758518c5476eedabba..3886fda58fbfb163b449485550098163723913d7 100644 (file)
@@ -188,7 +188,7 @@ function cmd2str($cmd,$write=null) {
 
 function argv2request($args=null) { return nb::argv2request($args); }
 
-function html_select_array($data,$opt=array()) {
+function html_select_array($data,$opt=[]) {
 
   $html = '<select';
   if (!empty($opt['html'])) $html .= ' '.preg_replace('/^\s+/','',$opt['html']);
@@ -207,6 +207,9 @@ function html_select_array($data,$opt=array()) {
     else $opt['sort']($data);
   }
 
+  $default = '';
+  if (!empty($opt['default_value'])) $default = $opt['default_value'];
+
   foreach ($data as $d) {
 
     if (is_array($d)) {
@@ -219,7 +222,7 @@ function html_select_array($data,$opt=array()) {
     $lib = htmlentities($lib);
     if (!empty($opt['prettyText'])) $lib = prettyText($lib);
 
-    $html .= '<option value="'.$val.'"'
+    $html .= '<option value="'.($default == $val ? '' : $val).'"'
       .( ($opt['selected']!==NULL and strcmp((string)$opt['selected'],$val)===0) ?' selected="selected"':'')
     .'>'.$lib.'</option>'.NB_EOL;
 
index 4e1935f51f075264e56bcd8daed15519a18f85c8..0d0466d79aa6dac3bdb44662dad974179b397910 100644 (file)
@@ -128,7 +128,7 @@ class DbQ extends nb {
   }
 
   public function limit($set=false) {
-    static $limit=false;
+    static $limit = false;
     if ($set !== false) return ($limit = $set);
 
     if ($limit !== false) return $limit;