Esempio n. 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;
 }
Esempio n. 2
0
 public function action_html()
 {
     $view = View::factory('webdb/erd/html');
     $view->database = $this->database;
     $view->selected_tables = $this->selected_tables;
     // Template
     $template = View::factory('template');
     $template->database = $this->database;
     $template->databases = $this->dbms->list_dbs();
     $template->tables = $this->database->get_tables(TRUE);
     $template->table = '';
     $template->controller = 'ERD';
     $template->action = 'ERD';
     $template->content = $view->render();
     // Response
     $this->response->body($template->render());
 }
Esempio n. 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;
 }