Misc cleanup

This commit is contained in:
Timothy Warren 2012-03-28 11:23:08 -04:00
parent d86fa948a9
commit bde8f0f179
9 changed files with 220 additions and 205 deletions

View File

@ -70,7 +70,12 @@ if( ! class_exists('pdo'))
// --------------------------------------------------------------------------
// Bulk loading wrapper workaround for PHP < 5.4
/**
* Alias for require_once for array_map
*
* @param string $path
* @return void
*/
function do_include($path)
{
require_once($path);
@ -80,8 +85,8 @@ function do_include($path)
{
array_map('do_include', glob(BASE_DIR . "/common/*.php"));
array_map('do_include', glob(BASE_DIR . "/db/*.php"));
array_map('do_include', glob(BASE_DIR . "/windows/widgets/*.php"));
array_map('do_include', glob(BASE_DIR . "/windows/*.php"));
array_map('do_include', glob(BASE_DIR . "/windows/widgets/*.php"));
array_map('do_include', glob(BASE_DIR . "/windows/*.php"));
}
// --------------------------------------------------------------------------
@ -113,6 +118,8 @@ if(function_exists('fbird_connect'))
require_once("{$path}firebird_sql.php");
}
// --------------------------------------------------------------------------
// ! Global Functions
// --------------------------------------------------------------------------
/**

View File

@ -76,7 +76,7 @@ class Settings {
* Magic method to simplify isset checking for config options
*
* @param string $key
* @return $mixed
* @return mixed
*/
public function __get($key)
{
@ -91,7 +91,7 @@ class Settings {
* Magic method to simplify setting config options
*
* @param string $key
* @param mixed $val
* @param mixed
*/
public function __set($key, $val)
{
@ -101,7 +101,7 @@ class Settings {
return FALSE;
}
$this->current->{$key} = $val;
return $this->current->{$key} = $val;
}
// --------------------------------------------------------------------------
@ -194,7 +194,9 @@ class Settings {
*/
public function get_db($name)
{
return (isset($this->current->dbs->{$name})) ? $this->current->dbs->{$name} : FALSE;
return (isset($this->current->dbs->{$name}))
? $this->current->dbs->{$name}
: FALSE;
}
}

View File

@ -16,6 +16,8 @@
* Base Database class
*
* Extends PDO to simplify cross-database issues
*
* @abstract
*/
abstract class DB_PDO extends PDO {
@ -252,6 +254,7 @@ abstract class DB_SQL {
/**
* Get database-specific sql to create a new table
*
* @abstract
* @param string $name
* @param array $columns
* @param array $constraints
@ -263,6 +266,7 @@ abstract class DB_SQL {
/**
* Get database-specific sql to drop a table
*
* @abstract
* @param string $name
* @return string
*/
@ -271,6 +275,7 @@ abstract class DB_SQL {
/**
* Get database specific sql for limit clause
*
* @abstract
* @param string $sql
* @param int $limiit
* @param int $offset
@ -281,6 +286,7 @@ abstract class DB_SQL {
/**
* Get the sql for random ordering
*
* @abstract
* @return string
*/
abstract public function random();

View File

@ -46,7 +46,7 @@ class firebird extends DB_PDO {
// --------------------------------------------------------------------------
/**
* Close the link to the database
* Close the link to the database and any existing results
*/
public function __destruct()
{

View File

@ -77,7 +77,7 @@ class ODBC extends DB_PDO {
*/
public function num_rows()
{
// TODO: Implement
// @TODO: Implement
}
// --------------------------------------------------------------------------

View File

@ -13,7 +13,7 @@
// --------------------------------------------------------------------------
/**
* Window controlling addtion of database connections
* Window controlling addition of database connections
*/
class Add_DB extends GtkWindow {

36
sys/windows/edit_db.php Normal file
View File

@ -0,0 +1,36 @@
<?php
/**
* OpenSQLManager
*
* Free Database manager for Open Source Databases
*
* @author Timothy J. Warren
* @copyright Copyright (c) 2012
* @link https://github.com/aviat4ion/OpenSQLManager
* @license http://philsturgeon.co.uk/code/dbad-license
*/
// --------------------------------------------------------------------------
/**
* Window controlling modifications of database connections
*/
class Edit_DB extends GtkWindow {
public function __construct()
{
parent::__construct();
$this->set_position(Gtk::WIN_POS_CENTER);
$this->set_title("Edit Database Connection");
// Create the layout table
$connection_form = new DB_Info_Widget();
// Add the Vbox, and show the window
$this->add($connection_form);
$this->show_all();
}
}
// End of edit_db.php

View File

@ -79,6 +79,8 @@ class Main extends GtkWindow {
/**
* Display About menu with version information
*
* @return void
*/
public function about()
{
@ -123,8 +125,9 @@ class Main extends GtkWindow {
/**
* Layout the main interface
*
* Create menus, hboxes, vboxs and other widgets
*
* @return void
*/
private function _main_layout()
{
@ -214,5 +217,4 @@ class Main extends GtkWindow {
return $menu_bar;
}
}
// End of main.php

View File

@ -1,38 +0,0 @@
<?php
/**
* OpenSQLManager
*
* Free Database manager for Open Source Databases
*
* @author Timothy J. Warren
* @copyright Copyright (c) 2012
* @link https://github.com/aviat4ion/OpenSQLManager
* @license http://philsturgeon.co.uk/code/dbad-license
*/
// --------------------------------------------------------------------------
/**
* Class for controlling database views
*/
class DataGrid extends GtkTreeView{
protected $model, $settings;
function __construct()
{
$this->settings =& Settings::get_instance();
$this->model = new GtkTreeStore(GObject::TYPE_PHP_VALUE, GObject::TYPE_STRING);
parent::__construct($this->model);
}
function __get($key)
{
}
function __set($key, $val)
{
}
}