public $tables = array();
# Web
+ public $dbs; // others databases keys
public $table;
public $help_criterias = array(
' * or % for wildcar',
}
#if (empty($this->name)) $this->name = preg_replace('/^(?:(?:sqlite:.*(.*?)(\.\w+)?)|(?:.*?dbname=([^;]+).*?))$/','\1',$this->pdo);
- if (empty($this->name) and preg_match('/(?:sqlite:|dbname=)([^;\.]+)/',$this->pdo,$m)) {
+# NB 22.12.15 if (empty($this->name) and preg_match('/(?:sqlite:|dbname=)([^;\.]+)/',$this->pdo,$m)) {
+ if (empty($this->name) and preg_match('/(?:sqlite:(?:.*\/)?|dbname=)([^;\.]+)/',$this->pdo,$m)) {
$this->name = $m[1];
}
if (empty($this->title)) $this->title = prettyText($this->name);
'10','20','50','100','500','1000'
),array(
'html' => 'class="limit" name="limit" id="limit"',
- 'selected' => $this->p('table'),
+ 'selected' => $this->p('limit'),
'prettyText' => true,
));
$r .= '</span>';
+ // Dbs
+ if (!empty($this->dbs) and count($this->dbs)>1) {
+ $r .= '<span class="label">';
+ $r .= '<label for="db">Db</label>'.html_select_array($this->dbs,array(
+ 'html' => 'class="dbs" onchange="document.location=\''.preg_replace('/\?.*$/','',$_SERVER['REQUEST_URI']).'?db=\'+this.value"',
+ 'selected' => $this->name,
+ 'prettyText' => true,
+ ));
+ $r .= '</span>';
+ }
+
// Buttons
$r .= DB_HTML_FORM_BUTTONS;
.'</div>'.PHP_EOL
.'<input type="hidden" name="table" value="'.$this->name.'"/>'
.'<input type="hidden" name="action" value="update"/>'
- .'<input type="hidden" name="db" value="'.$this->db->name.'"/>'
+ .'<input type="hidden" name="db" value="'.$this->p('db').'"/>'
.'<input type="hidden" name="debug" value="'.$this->p('debug').'"/>'
.'<input type="hidden" name="referer" value="'.urlencode(@$_SERVER['HTTP_REFERER']).'"/>'
.'</form>'.PHP_EOL;
'html' => 'name="format"',
'selected' => $this->p('format'),
));
- $criteria[] = '<input type="submit" class="button" value="GO"/>';
+ $criteria[] = '<input type="submit" class="button" value="GO"/>';
echo join(''.PHP_EOL,$criteria);
-
echo '</form>'.PHP_EOL;
}
if ($this->p('referer')) {
header('Location: '.urldecode($this->p('referer')));
} else {
- header('Location: ?table=' . $this->name . ($this->p('db') ? '&db='.$this->db->name : ''));
+ header('Location: ?table=' . $this->name . ($this->p('db') ? '&db='.$this->p('db') : ''));
}
#header('Location: '.str_replace('&','&',$this->url_list()));
return true;
if ($this->p('referer')) {
header('Location: '.urldecode($this->p('referer')));
} else {
- header('Location: ?table=' . $this->name . ($this->p('db') ? '&db='.$this->db->name : ''));
+ header('Location: ?table=' . $this->name . ($this->p('db') ? '&db='.$this->p('db') : ''));
}
#header('Location: '.str_replace('&','&',$this->url_list()));
return true;