/**
* Index action
*
* @return void
*/
public function indexAction()
{
// Add/Remove favorite tables using Ajax request.
if ($GLOBALS['is_ajax_request'] && !empty($_REQUEST['favorite_table'])) {
$this->addRemoveFavoriteTablesAction();
return;
}
// If there is an Ajax request for real row count of a table.
if ($GLOBALS['is_ajax_request'] && isset($_REQUEST['real_row_count']) && $_REQUEST['real_row_count'] == true) {
$this->handleRealRowCountRequestAction();
return;
}
// Drops/deletes/etc. multiple tables if required
if (!empty($_POST['submit_mult']) && isset($_POST['selected_tbl']) || isset($_POST['mult_btn'])) {
$this->multiSubmitAction();
}
$this->response->getHeader()->getScripts()->addFiles(array('db_structure.js', 'tbl_change.js', 'jquery/jquery-ui-timepicker-addon.js'));
$this->_url_query .= '&goto=db_structure.php';
// Gets the database structure
$sub_part = '_structure';
list($tables, $num_tables, $total_num_tables, , $is_show_stats, $db_is_system_schema, , , $pos) = Util::getDbInfo($GLOBALS['db'], $sub_part);
$this->_tables = $tables;
// updating $tables seems enough for #11376, but updating other
// variables too in case they may cause some other problem.
$this->_num_tables = $num_tables;
$this->_pos = $pos;
$this->_db_is_system_schema = $db_is_system_schema;
$this->_total_num_tables = $total_num_tables;
$this->_is_show_stats = $is_show_stats;
include_once 'libraries/replication.inc.php';
PageSettings::showGroup('DbStructure');
// 1. No tables
if ($this->_num_tables == 0) {
$this->response->addHTML(Message::notice(__('No tables found in database.')));
if (empty($db_is_system_schema)) {
$this->response->addHTML(PMA_getHtmlForCreateTable($this->db));
}
return;
}
// else
// 2. Shows table information
/**
* Displays the tables list
*/
$this->response->addHTML('<div id="tableslistcontainer">');
$_url_params = array('pos' => $this->_pos, 'db' => $this->db);
// Add the sort options if they exists
if (isset($_REQUEST['sort'])) {
$_url_params['sort'] = $_REQUEST['sort'];
}
if (isset($_REQUEST['sort_order'])) {
$_url_params['sort_order'] = $_REQUEST['sort_order'];
}
$this->response->addHTML(Util::getListNavigator($this->_total_num_tables, $this->_pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList']));
$this->displayTableList();
// display again the table list navigator
$this->response->addHTML(Util::getListNavigator($this->_total_num_tables, $this->_pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList']));
$this->response->addHTML('</div><hr />');
/**
* Work on the database
*/
/* DATABASE WORK */
/* Printable view of a table */
$this->response->addHTML(Template::get('database/structure/print_view_data_dictionary_link')->render(array('url_query' => $this->_url_query)));
if (empty($this->_db_is_system_schema)) {
$this->response->addHTML(PMA_getHtmlForCreateTable($this->db));
}
}