2012-03-28 16:10:39 -04:00
|
|
|
<?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
|
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tabbed Container for database properties
|
|
|
|
*/
|
|
|
|
class DB_tabs extends GTKNotebook {
|
|
|
|
|
2012-03-29 16:26:50 -04:00
|
|
|
private static $instance;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the db tabs object if it exists, or create and return
|
|
|
|
*
|
|
|
|
* @return DB_tabs
|
|
|
|
*/
|
|
|
|
public static function &get_instance()
|
|
|
|
{
|
|
|
|
if (empty(self::$instance))
|
|
|
|
{
|
|
|
|
self::$instance = new DB_tabs();
|
|
|
|
}
|
|
|
|
|
|
|
|
return self::$instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2012-03-28 16:10:39 -04:00
|
|
|
/**
|
|
|
|
* Create the object
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
// Move the tab bar to the bottom
|
|
|
|
$this->set_tab_pos(Gtk::POS_BOTTOM);
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a new tab with the provided label
|
|
|
|
*
|
|
|
|
* @param string $label
|
|
|
|
* @param GObject $widget
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function add_tab($label, $widget = NULL)
|
|
|
|
{
|
|
|
|
if (is_null($widget))
|
|
|
|
{
|
|
|
|
$widget = new Data_Grid();
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->append_page($widget, new GtkLabel($label));
|
|
|
|
}
|
|
|
|
|
2012-03-29 16:26:50 -04:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a new instance of this class, and destroys the existing
|
|
|
|
* instance
|
|
|
|
*
|
|
|
|
* @return DB_tabs
|
|
|
|
*/
|
|
|
|
public function reset()
|
|
|
|
{
|
|
|
|
unset(self::$instance);
|
|
|
|
return self::get_instance();
|
|
|
|
}
|
|
|
|
|
2012-04-02 09:47:13 -04:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create tabs for database aspects
|
|
|
|
*
|
|
|
|
* @param Query_Builder $conn
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function get_db_tabs(&$conn)
|
|
|
|
{
|
|
|
|
print_r($conn->get_tables());
|
|
|
|
}
|
2012-03-28 16:10:39 -04:00
|
|
|
}
|
|
|
|
// End of db_tabs.php
|