Пример #1
0
             * if $submit_mult == 'change', execution will have stopped
             * at this point
             */
            if (empty($message)) {
                $message = PMA_Message::success();
            }
        }
    } else {
        $response = PMA_Response::getInstance();
        $response->isSuccess(false);
        $response->addJSON('message', __('No column selected.'));
    }
}
// display secondary level tabs if necessary
$engine = $GLOBALS['dbi']->getTable($db, $table)->sGetStatusInfo('ENGINE');
$response->addHTML(PMA_getStructureSecondaryTabs($engine));
$response->addHTML('<div id="structure_content">');
/**
 * Modifications have been submitted -> updates the table
 */
if (isset($_REQUEST['do_save_data'])) {
    $regenerate = PMA_updateColumns($db, $table);
    if ($regenerate) {
        // This happens when updating failed
        // @todo: do something appropriate
    } else {
        // continue to show the table's structure
        unset($_REQUEST['selected']);
    }
}
/**
 /**
  * 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 = $GLOBALS['dbi']->getTable($this->db, $this->table)->sGetStatusInfo('ENGINE');
     $this->response->addHTML(PMA_getStructureSecondaryTabs($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>');
 }