Beispiel #1
0
 /**
  * Set the current database name.
  */
 private function _set_database()
 {
     try {
         $this->database = $this->dbms->get_database();
     } catch (Exception $e) {
         $this->add_template_message($e->getMessage(), 'notice');
     }
     if (!$this->database) {
         $message = count($this->dbms->list_dbs()) > 0 ? 'Please select a database from the tabs above.' : 'No databases are available.';
         $this->add_template_message($message, 'info');
     }
     $this->template->set_global('database', $this->database);
     return TRUE;
 }
Beispiel #2
0
 public function before()
 {
     $this->dbms = new WebDB_DBMS();
     $this->dbms->connect();
     $dbname = $this->request->param('dbname');
     $this->database = $this->dbms->get_database($dbname);
     $this->selected_tables = array();
     foreach ($this->database->get_tables() as $table) {
         // If any tables are requested, only show them
         if (count($_GET) > 0) {
             if (isset($_GET[$table->get_name()])) {
                 $this->selected_tables[] = $table->get_name();
             }
         } else {
             $referenced = count($table->get_referencing_tables()) > 0;
             $referencing = count($table->get_referenced_tables()) > 0;
             if ($referenced or $referencing) {
                 $this->selected_tables[] = $table->get_name();
             }
         }
     }
 }
Beispiel #3
0
 /**
  * Set the current database name.
  */
 private function _set_database()
 {
     try {
         $this->database = $this->dbms->get_database();
     } catch (Exception $e) {
         $this->add_template_message($e->getMessage(), 'notice');
     }
     if (!$this->database) {
         $this->add_template_message('Please select a database from the tabs above.', 'info');
         // If only one DB, redirect to that one.
         $dbs = $this->dbms->list_dbs();
         if (count($dbs) == 1) {
             //$this->request->redirect('index/'.$dbs[0]);
         }
     }
     $this->template->set_global('database', $this->database);
     return TRUE;
 }