/** * get the html of the form to add the new column to given table * * @param integer $num_fields number of columns to add * @param string $db current database * @param string $table current table * @param array $columnMeta array containing default values for the fields * * @return HTML */ function PMA_getHtmlForCreateNewColumn($num_fields, $db, $table, $columnMeta = array()) { $cfgRelation = PMA_getRelationsParam(); $content_cells = array(); $available_mime = array(); $mime_map = array(); $header_cells = PMA_getHeaderCells(true, null, $cfgRelation['mimework'], $db, $table); if ($cfgRelation['mimework'] && $GLOBALS['cfg']['BrowseMIME']) { $mime_map = PMA_getMIME($db, $table); $available_mime = PMA_getAvailableMIMEtypes(); } $comments_map = PMA_getComments($db, $table); for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) { $content_cells[$columnNumber] = PMA_getHtmlForColumnAttributes($columnNumber, $columnMeta, '', 8, '', null, array(), null, null, null, $comments_map, null, true, array(), $cfgRelation, isset($available_mime) ? $available_mime : array(), $mime_map); } return PMA_getHtmlForTableFieldDefinitions($header_cells, $content_cells); }
/** @var PMA_String $pmaString */ $pmaString = $GLOBALS['PMA_String']; $length_values_input_size = 8; $_form_params = PMA_getFormsParameters($server, $db, $table, $action, isset($num_fields) ? $num_fields : null, isset($selected) ? $selected : null); $is_backup = $action != 'tbl_create.php' && $action != 'tbl_addfield.php'; require_once './libraries/transformations.lib.php'; $cfgRelation = PMA_getRelationsParam(); $comments_map = PMA_getComments($db, $table); if (isset($fields_meta)) { $move_columns = PMA_getMoveColumns($db, $table); } if ($cfgRelation['mimework'] && $GLOBALS['cfg']['BrowseMIME']) { $mime_map = PMA_getMIME($db, $table); $available_mime = PMA_getAvailableMIMEtypes(); } $header_cells = PMA_getHeaderCells($is_backup, isset($fields_meta) ? $fields_meta : null, $cfgRelation['mimework'], $db, $table); // workaround for field_fulltext, because its submitted indices contain // the index as a value, not a key. Inserted here for easier maintenance // and less code to change in existing files. if (isset($field_fulltext) && is_array($field_fulltext)) { foreach ($field_fulltext as $fulltext_nr => $fulltext_indexkey) { $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey; } } if (isset($_REQUEST['submit_num_fields'])) { //if adding new fields, set regenerate to keep the original values $regenerate = 1; } $foreigners = PMA_getForeigners($db, $table, '', 'foreign'); $child_references = PMA_getChildReferences($db, $table); for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
/** * Test for PMA_getHeaderCells * * @return void */ public function testGetHeaderCells() { $GLOBALS['cfg']['BrowseMIME'] = true; $GLOBALS['cfg']['ShowHint'] = false; $result = PMA_getHeaderCells(false, array(), true, 'db', 'table'); $this->assertContains('Index', $result); $this->assertContains('Move column', $result); $this->assertContains('MIME type', $result); }
/** * Test for PMA_getHeaderCells * * @return void */ public function testGetHeaderCells() { $GLOBALS['cfg']['BrowseMIME'] = true; $GLOBALS['cfg']['ShowHint'] = false; $result = PMA_getHeaderCells(false, true, true, 'db', 'table'); $this->assertContains( 'Index', $result ); $this->assertContains( 'Move column', $result ); $this->assertContains( 'MIME type', $result ); $this->assertContains( 'transformation_overview.php?db=db&table=table', $result[count($result)-1] ); }