if ($tbl_is_view) { $response->addHTML(PMA_getHtmlForEditView($url_params)); } $response->addHTML(PMA_getHtmlForOptionalActionLinks($url_query, $tbl_is_view, $db_is_system_schema)); $response->addHTML('</div>'); if (!$tbl_is_view && !$db_is_system_schema) { $response->addHTML('<br />'); $response->addHTML(PMA_getHtmlForAddColumn($columns_list)); } /** * Displays indexes */ if (!$tbl_is_view && !$db_is_system_schema && 'ARCHIVE' != $tbl_storage_engine) { //return the list of index $response->addJSON('indexes_list', PMA_Index::getHtmlForIndexes($GLOBALS['table'], $GLOBALS['db'])); $response->addHTML(PMA_getHtmlForDisplayIndexes()); } /** * Displays Space usage and row statistics */ // BEGIN - Calc Table Space // Get valid statistics whatever is the table type if ($cfg['ShowStats']) { //get table stats in HTML format $tablestats = PMA_getHtmlForDisplayTableStats($showtable, $table_info_num_rows, $tbl_is_view, $db_is_system_schema, $tbl_storage_engine, $url_query, $tbl_collation); //returning the response in JSON format to be used by Ajax $response->addJSON('tableStat', $tablestats); $response->addHTML($tablestats); } // END - Calc Table Space $response->addHTML('<div class="clearfloat"></div>');
} // end if isset($destination_foreign) // U p d a t e s f o r d i s p l a y f i e l d if ($cfgRelation['displaywork'] && isset($_POST['display_field'])) { $html_output .= PMA_handleUpdateForDisplayField($disp, $_POST['display_field'], $db, $table, $cfgRelation); } // end if // If we did an update, refresh our data if (isset($_POST['destination_db']) && $cfgRelation['relwork']) { $existrel = PMA_getForeigners($db, $table, '', 'internal'); } if (isset($_POST['destination_foreign_db']) && PMA_Util::isForeignKeySupported($tbl_storage_engine)) { $existrel_foreign = PMA_getForeigners($db, $table, '', 'foreign'); } if ($cfgRelation['displaywork']) { $disp = PMA_getDisplayField($db, $table); } /** * Dialog */ // Now find out the columns of our $table // need to use PMA_DatabaseInterface::QUERY_STORE with $GLOBALS['dbi']->numRows() // in mysqli $columns = $GLOBALS['dbi']->getColumns($db, $table); // common form $html_output .= PMA_getHtmlForCommonForm($db, $table, $columns, $cfgRelation, $tbl_storage_engine, isset($existrel) ? $existrel : array(), isset($existrel_foreign) ? $existrel_foreign['foreign_keys_data'] : array(), $options_array); if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) { $html_output .= PMA_getHtmlForDisplayIndexes(); } // Render HTML output PMA_Response::getInstance()->addHTML($html_output);
/** * Index * * @return void */ public function indexAction() { // Send table of column names to populate corresponding dropdowns depending // on the current selection if (isset($_REQUEST['getDropdownValues']) && $_REQUEST['getDropdownValues'] === 'true') { // if both db and table are selected if (isset($_REQUEST['foreignTable'])) { $this->getDropdownValueForTableAction(); } else { // if only the db is selected $this->getDropdownValueForDbAction(); } return; } $this->response->getHeader()->getScripts()->addFiles(array('tbl_relation.js', 'indexes.js')); // Gets tables information include_once 'libraries/tbl_info.inc.php'; // updates for Internal relations if (isset($_POST['destination_db']) && $this->cfgRelation['relwork']) { $this->updateForInternalRelationAction(); } // updates for foreign keys if (isset($_POST['destination_foreign_db'])) { $this->updateForForeignKeysAction(); } // Updates for display field if ($this->cfgRelation['displaywork'] && isset($_POST['display_field'])) { $this->updateForDisplayField(); } // If we did an update, refresh our data if (isset($_POST['destination_db']) && $this->cfgRelation['relwork']) { $this->existrel = PMA_getForeigners($this->db, $this->table, '', 'internal'); } if (isset($_POST['destination_foreign_db']) && PMA_Util::isForeignKeySupported($this->tbl_storage_engine)) { $this->existrel_foreign = PMA_getForeigners($this->db, $this->table, '', 'foreign'); } if ($this->cfgRelation['displaywork']) { $this->disp = PMA_getDisplayField($this->db, $this->table); } // display secondary level tabs if necessary $engine = $this->dbi->getTable($this->db, $this->table)->sGetStatusInfo('ENGINE'); $this->response->addHTML(Template::get('structure/secondary_tabs')->render(array('url_params' => array('db' => $GLOBALS['db'], 'table' => $GLOBALS['table']), 'engine' => $engine))); $this->response->addHTML('<div id="structure_content">'); /** * Dialog */ // Now find out the columns of our $table // need to use PMA_DatabaseInterface::QUERY_STORE with $this->dbi->numRows() // in mysqli $columns = $this->dbi->getColumns($this->db, $this->table); // common form $this->response->addHTML(Template::get('tbl_relation/common_form')->render(array('db' => $this->db, 'table' => $this->table, 'columns' => $columns, 'cfgRelation' => $this->cfgRelation, 'tbl_storage_engine' => $this->tbl_storage_engine, 'existrel' => isset($this->existrel) ? $this->existrel : array(), 'existrel_foreign' => isset($this->existrel_foreign) ? $this->existrel_foreign['foreign_keys_data'] : array(), 'options_array' => $this->options_array))); if (PMA_Util::isForeignKeySupported($this->tbl_storage_engine)) { $this->response->addHTML(PMA_getHtmlForDisplayIndexes()); } $this->response->addHTML('</div>'); }
foreach ($save_row as $row) { $html_output .= '<option value="' . htmlspecialchars($row['Field']) . '"'; if (isset($disp) && $row['Field'] == $disp) { $html_output .= ' selected="selected"'; } $html_output .= '>' . htmlspecialchars($row['Field']) . '</option>' . "\n"; } // end while $html_output .= '</select>' . '</fieldset>'; } // end if (displayworks) $html_output .= '<fieldset class="tblFooters">' . '<input type="submit" value="' . __('Save') . '" />' . '</fieldset>' . '</form>'; } // end if (we have columns in this table) if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) { $html_output .= '<div id="index_div" class="ajax" >' . PMA_getHtmlForDisplayIndexes(); } // Render HTML output PMA_Response::getInstance()->addHTML($html_output); /** * Generate dropdown choices * * @param string $dropdown_question Message to display * @param string $select_name Name of the <select> field * @param array $choices Choices for dropdown * @param string $selected_value Selected value * * @return string The html code for existing value (for selected) * * @access public */