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 action_logout()
 {
     Session::instance()->destroy();
     $this->dbms->username(NULL);
     $this->add_flash_message('You are now logged out.', 'info');
     $this->request->redirect('login');
 }
Beispiel #3
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());
 }