]> git.nbdom.net Git - nb.git/commitdiff
lib/php/db/table.php
authorDevops <sys@15gifts.com>
Thu, 6 Apr 2017 14:15:30 +0000 (15:15 +0100)
committerDevops <sys@15gifts.com>
Thu, 6 Apr 2017 14:15:30 +0000 (15:15 +0100)
lib/php/db.php
lib/php/db/table.php
lib/php/out.php
www/dbq/dbq.php

index f250393f0a7b97036bf0f96e4002a487df676705..ac1a6bcca3e2c90c5df118f76a3ab895fc3e6221 100644 (file)
@@ -171,32 +171,12 @@ class Db extends nb {
     if (!isset($opt['format'])) {
       if ($this->out->client_type()) $this->format = $this->out->client_type();
       if (self::p('format')) $this->format = self::p('format');
-      # NB 05.12.16: Should be the single point for caling ::p() 
-      #$this->format = self::p('format');
     }
 
-    # Add formats from module out
-# NB 23.12.16     foreach($this->out->types('_web_') as $t=>$v) if (!in_array($t,$this->formats)) $this->formats[] = $t;
-
     # Pdo
     $this->connect_init();
     if ($connect) $this->connect();
 
-    # Params
-    /*
-    if (empty($this->limit) and !empty($this->limits)) {
-      $this->limit = $this->limits[0];
-    }
-    if (empty($this->limit)) {
-      if ($this->p('paged')) {
-        $this->limit = ($this->limit * $this->p('paged')).','.$this->limit;
-      } elseif ($this->limit=$this->p('limit')) {
-      } else {
-        $this->limit = $this->limits[0];
-      }
-    }
-    */
-
     # Extras must disapear - NB 29.03.16
     if (!empty($this->extras)) self::bye($this->extras);
     return true;
index 71a0065fbadf7f81e1e180a536507c95355f66f0..8fcdac86249d8187cc1e352afe27bed9ab80c9b2 100644 (file)
@@ -105,10 +105,16 @@ Class Table extends nb {
     }
 
     # NB 22.12.16: TODEL 
-    $this->show_header = (bool)$this->p('header',$this->show_header);
+    #$this->show_header = (bool)$this->p('header',$this->show_header);
+    #$this->pdef('header',$this->show_header);
 
-    # TODEL WHEN NOT NEEDED ????
+    if (isset($_GET['rows.header'])) $this->show_header = $_GET['rows.header'];
+    $this->show_header = (bool)$this->p('header',$this->show_header);
     $this->pdef('header',$this->show_header);
+
+    # TODO no more pdef !!!
+    #$this->db()->out->header($this->show_header);
+    #debug($this->db()->out->header());
     #bye((int)$this->show_header);
 
   }
@@ -145,11 +151,10 @@ Class Table extends nb {
     $this->_fields = 1;
 
     foreach ($this->rows as $row) {
+
       foreach ($row as $k=>$v) {
         $field = $this->fields($k);
-        #debug("$v:$k");
         $field->bindParam($query,$v,":$k");
-        #$query->bindParam($k, $v, $this->type2pdo('text'));
       }
 
       if (!($execute = $query->execute())) {
@@ -959,20 +964,11 @@ Class Table extends nb {
   }
 
   public function rows(&$opt=[],$opt_by_val=null) {
-# NB 25.12.16     if (empty($this->db()->limit)) {
-# NB 25.12.16       $this->db()->limit = $this->db()->limits[0];
-# NB 25.12.16     }
-
     #
     # Run query
     #
     $this->create_temporary();
 
-    $this->show_header = (bool)$this->p('rows.header',$this->show_header);
-    $this->db()->out->header($this->show_header);
-    # TODEL WHEN NOT NEEDED ????
-    $this->pdef('header',$this->show_header);
-
     if ($opt_by_val !== null) $opt = $opt_by_val;
 
     #if (isset($opt['format']) and empty($opt['format'])) {
@@ -1045,7 +1041,6 @@ Class Table extends nb {
       : false
     ;
 
-#debug($this->db()->name);
     if ($opt['is_html'] and !empty(self::$params) and !$this->p('action') and !$this->p('inc')) {
       echo $this->html_menu($opt);
     }
@@ -2041,8 +2036,7 @@ Class Table extends nb {
 
       $r .= ''
         .'<span class="label '.$k.'">'
-        . '<label>'.prettyText($k)
-        .'</label>'
+        . '<label>'.prettyText($k).'</label>'
         . '<input type="text" id="'.$k.'" name="'.$k.'" value="'.$v.'" />'
         .'</span>'
       ;
index 8bc0fa3120f2627d380ec3798ba77dabd322c31e..0f3ce0657027b6ca17c90d34858d121ad09292e3 100644 (file)
@@ -78,20 +78,6 @@ Class Out extends Nb {
         }
       ],
 
-    # NB 01.04.17: Stil used, sh should be enought 
-# NB 01.04.17       'shell' => [
-# NB 01.04.17         'preff' => self::p('preff',''),
-# NB 01.04.17         'suff' => self::p('suff',''),
-# NB 01.04.17         'row' => function(&$o,&$r) {
-# NB 01.04.17           $line = [];
-# NB 01.04.17           foreach ($r as $k=>$v) {
-# NB 01.04.17             $v = str_replace('"','\\"',$v);
-# NB 01.04.17             $line[] = $o['preff']."$k=\"$v\"".$o['suff'];
-# NB 01.04.17           }
-# NB 01.04.17           if ($line) echo join(' ',$line)."\n";
-# NB 01.04.17         }
-# NB 01.04.17       ],
-
       'sh' => array(
         'preff' => self::p('preff',""),
         'row' => function(&$o,&$r) {
@@ -560,7 +546,7 @@ Class Out extends Nb {
       if (!empty($o['quote'])) $v = $o['quote'] .
         str_replace($o['quote'],$o['quote_escape'].$o['quote'],$v)
       . $o['quote'];
-      $values[] = str_replace("\n",'\\n',self::scalar($v));
+      $values[] = str_replace("\n",'\\n',str_replace("\r","",self::scalar($v)));
     }
 
     if (!empty($o['return'])) return join($o['sep'],$values);
index f5b314cc9fe0bd4643fe895064c4772dd157d71b..a3bd76087a385f45be1925822425beb7c796b846 100644 (file)
@@ -211,7 +211,6 @@ class DbQ extends nb {
       $connect['id'] = $this->params['db'];
 
       $this->db->__construct($connect);
-      #$this->id = $this->params['db'];
       $this->db->connect();
       $this->db->base = '/'.$this->db->id;
       return $this->db;