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;
}
# 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);
}
$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())) {
}
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'])) {
: 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);
}
$r .= ''
.'<span class="label '.$k.'">'
- . '<label>'.prettyText($k)
- .'</label>'
+ . '<label>'.prettyText($k).'</label>'
. '<input type="text" id="'.$k.'" name="'.$k.'" value="'.$v.'" />'
.'</span>'
;
}
],
- # 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) {
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);
$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;