/** * Process the data from the edit/create index form, * run the query to build the new index * and moves back to "tbl_sql.php" * * @return void */ public function doSaveDataAction() { $error = false; $sql_query = $this->dbi->getTable($this->db, $this->table)->getSqlQueryForIndexCreateOrEdit($this->index, $error); // If there is a request for SQL previewing. if (isset($_REQUEST['preview_sql'])) { $this->response->addJSON('sql_data', Template::get('preview_sql')->render(array('query_data' => $sql_query))); } elseif (!$error) { $this->dbi->query($sql_query); if ($GLOBALS['is_ajax_request'] == true) { $message = Message::success(__('Table %1$s has been altered successfully.')); $message->addParam($this->table); $this->response->addJSON('message', Util::getMessage($message, $sql_query, 'success')); $this->response->addJSON('index_table', Index::getHtmlForIndexes($this->table, $this->db)); } else { include 'tbl_structure.php'; } } else { $this->response->setRequestStatus(false); $this->response->addJSON('message', $error); } }