public $sort;
public $extras;
public $format = 'json';
- public $formats = [ 'table','div','csv','xml','json','yaml','sh' ];
+ public $formats = [ 'table','div','csv','xml','json','yaml','sh','sql' ];
public $limits = ['10','20','50','100','500','1000'];
# Classes
public $out;
-# NB 21.09.16 public $_no_connect;
function __construct($opt = '') {
# Tables
if (isset($opt['tables'])) {
- #debug($opt['tables']);
- #foreach ($opt['tables'] as $name=>$param) debug($name);
foreach ($opt['tables'] as $name=>$param) $this->table($name,$param);
unset($opt['tables']);
}
- # Encoding
-# NB 22.09.16 if (isset($opt['encoding'])) {
-# NB 22.09.16 self::$encoding = $opt['encoding'];
-# NB 22.09.16 unset($opt['encoding']);
-# NB 22.09.16 }
-
# Args into this
foreach ($opt as $k=>$v) $this->$k = $v;
#parent::__construct($opt);
# Out Class
- #if(!is_scalar($opt['type'])) debug($opt['type']);
if (empty($this->out)) $this->out = new Out(['charset'=>$this->charset]);
# Format
}
# Add formats from module out
- foreach($this->out->types('_web_') as $t=>$v) if (!in_array($t,$this->formats)) $this->formats[] = $t;
+# 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();
'html' => 'class="tables" name="table" id="table"',
'selected' => $this->name,
'prettyText' => true,
- 'sort' => 'natcasesort',
+ 'sort' => 'natcasesort',
]);
$r .= '</span>';
// Format
$r .= '<span class="label">';
-
+ #debug($this->db()->formats);
$r .= '<label for="format">Format</label>'.html_select_array($this->db()->formats,[
'html' => 'class="format" name="format" id="format"',
'selected' => $this->db()->format,
'prettyText' => true,
- 'sort' => 'natcasesort',
+ 'sort' => 'natcasesort',
]);
$r .= '</span>';
const VIEW = 1;
public $title = 'Dbq';
- public $sep = ' / ';
+ public $sep_title = ' / ';
const HTML_FORMAT = 'table';
const CLI_FORMAT = 'human';
public $human_ua_exp = '/^\S+\s+.Windows|iPhone|Android|Macintosh|Linux/';
- public $formats = [
- 'table',
- 'csv',
- 'json',
- 'yaml',
- 'sh',
- ];
+ public $formats = [];
const PARAM_ARGS_SEP = '|';
'action' => 'ls',
'args' => '',
];
- public $params_deep = [];
-
- public $run = false; # call run() when __contruct
+# NB 23.12.16 public $params_deep = [];
public $css = '/default.css';
public $js = '/default.js';
//
// Init
$this->uri_params();
+ $run = isset($opt['run']) ? $opt['run'] : false;
+ unset($opt['run']);
+
parent::__construct($opt);
if (!$this->params['db']) $this->not_implemented('Db missing');
$this->page = new Page([
'css' => $this->css,
- 'sep' => $this->sep,
+ 'sep' => $this->sep_title,
]);
- if ($this->run) $this->run();
+ if ($run) $this->run();
}
public function page($obj,$meth=null,$head=[],$fct=null) {
$values = explode(self::PARAM_ARGS_SEP,$this->params['args']);
- #if (!$keys) return; #$this->not_implemented('Table has no fields');
- #bye(array_combine($keys,$values));
$this->table->html_edit(array_combine($keys,$values),$this->table->base.($add ? 'insert/' : 'update/').$this->params['args'],$add);
}
}
$i++;
- $this->params_deep[$p] = $i;
+# NB 23.12.16 $this->params_deep[$p] = $i;
}
return $this->params;
if (empty($this->ext)) $this->ext = $format;
list($title,$nav) = $this->title_nav();
- $this->page->title = join($this->sep,$title);
+ $this->page->title = join($this->sep_title,$title);
$this->page->nav = $nav;
if (!empty($this->formats)) $this->db->formats = $this->formats;