$this->json = [
'db.base' => ( empty($this->db) ? '' : $this->db->base ),
'table.base' => ( empty($this->table) ? '' : $this->table->base ),
+ 'table.rw' => $this->table_rw(),
'default.format' => $this->format_html,
'default.limit' => $this->default_limit,
'param.format' => $this->params['format'],
$this->table->html_edit(array_combine($keys,$values),$this->table->base.($add ? 'insert' : 'update').'/'.$this->params['args'],$add);
}
+ public function table_rw() {
+ return 1
+ and ($this->perm >= self::VIEW)
+ and !empty($this->table)
+ and ( strpos('table view',$this->table->type()) !== false )
+ ;
+ }
public function table_rows($fct=null) {
$this->db->limit = $this->limit();
$opt = ($this->page->is('html')
- and ($this->perm >= self::VIEW)
- and $this->table->type() != 'sql'
- and strpos(' table view',$this->table->type())
+ and $this->table_rw()
+ #and ($this->perm >= self::VIEW)
+ #and strpos('table view',$this->table->type()) !== false
) ? [
'row_parse_pre' => function(&$r){
$GLOBALS['dbq_args'] = urlencode( join($this->param_args_sep,$this->table->fields_keys_values($r)) );
},
- 'row_parse_post' => $this->table->type() ? 0 : function(&$r){
+ 'row_parse_post' => function(&$r){
$args = $GLOBALS['dbq_args'];
if (empty($this->db->conn)) $this->db(true);
if (empty($this->table)) $this->table();
- $this->table->base = '';
+ #$this->table->base = '';
$this->page($this,'table_rows');
+' <input type="button" class="clear '+e.className+'" onclick="form_clean(this.form)"'
+' value="'+window._dbq['text.clear']+'"'
+' />'
- +( window._dbq['table.base']
+ +( window._dbq['table.rw']
? ' <input type="button" class="add '+e.className+'"'
+' onclick="window.location=\''+window._dbq['table.base']+'add/\'"'
+' value="'+window._dbq['text.add']+'"/>'