/**
  * Test for PMA_getCentralColumnsTableHeader
  *
  * @return void
  */
 public function testPMAGetCentralColumnsTableHeader()
 {
     $this->assertContains('<thead', PMA_getCentralColumnsTableHeader('column_heading', __('Click to sort'), 2));
 }
/**
 * build html for adding a new user defined column to central list
 *
 * @param string $db current database
 *
 * @return string html of the form to let user add a new user defined column to the
 *                list
 */
function PMA_getHTMLforAddNewColumn($db)
{
    $addNewColumn = '<div id="add_col_div"><a href="#">' . '<span>+</span> ' . __('Add new column') . '</a>' . '<form id="add_new" style="min-width:100%;display:none" ' . 'method="post" action="db_central_columns.php">' . PMA_URL_getHiddenInputs($db) . '<input type="hidden" name="add_new_column" value="add_new_column">' . '<table>';
    $addNewColumn .= PMA_getCentralColumnsTableHeader();
    $addNewColumn .= '<tr>' . '<td></td>' . '<td name="col_name" class="nowrap">' . PMA\libraries\Template::get('columns_definitions/column_name')->render(array('columnNumber' => 0, 'ci' => 0, 'ci_offset' => 0, 'columnMeta' => array(), 'cfgRelation' => array('centralcolumnswork' => false))) . '</td>' . '<td name = "col_type" class="nowrap">' . PMA\libraries\Template::get('columns_definitions/column_type')->render(array('columnNumber' => 0, 'ci' => 1, 'ci_offset' => 0, 'type_upper' => '', 'columnMeta' => array())) . '</td>' . '<td class="nowrap" name="col_length">' . PMA\libraries\Template::get('columns_definitions/column_length')->render(array('columnNumber' => 0, 'ci' => 2, 'ci_offset' => 0, 'length_values_input_size' => 8, 'length_to_display' => '')) . '</td>' . '<td class="nowrap" name="col_default">' . PMA\libraries\Template::get('columns_definitions/column_default')->render(array('columnNumber' => 0, 'ci' => 3, 'ci_offset' => 0, 'type_upper' => '', 'columnMeta' => array())) . '</td>' . '<td name="collation" class="nowrap">' . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'field_collation[0]', 'field_0_4', null, false) . '</td>' . '<td class="nowrap" name="col_attribute">' . PMA\libraries\Template::get('columns_definitions/column_attribute')->render(array('columnNumber' => 0, 'ci' => 5, 'ci_offset' => 0, 'extracted_columnspec' => array(), 'columnMeta' => array(), 'submit_attribute' => false)) . '</td>' . '<td class="nowrap" name="col_isNull">' . PMA\libraries\Template::get('columns_definitions/column_null')->render(array('columnNumber' => 0, 'ci' => 6, 'ci_offset' => 0, 'columnMeta' => array())) . '</td>' . '<td class="nowrap" name="col_extra">' . PMA\libraries\Template::get('columns_definitions/column_extra')->render(array('columnNumber' => 0, 'ci' => 7, 'ci_offset' => 0, 'columnMeta' => array())) . '</td>' . ' <td>' . '<input id="add_column_save" type="submit" ' . ' value="Save"/></td>' . '</tr>';
    $addNewColumn .= '</table></form></div>';
    return $addNewColumn;
}
/**
 * build html for adding a new user defined column to central list
 *
 * @param string $db current database
 *
 * @return html of the form to let user add a new user defined column to the list
 */
function PMA_getHTMLforAddNewColumn($db)
{
    $addNewColumn = '<div id="add_col_div"><a href="#">' . '<span>+</span> ' . __('Add new column') . '</a>' . '<form id="add_new" style="min-width:100%;display:none" ' . 'method="post" action="db_central_columns.php">' . PMA_URL_getHiddenInputs($db) . '<input type="hidden" name="add_new_column" value="add_new_column">' . '<table>';
    $addNewColumn .= PMA_getCentralColumnsTableHeader();
    $addNewColumn .= '<tr>' . '<td></td>' . '<td name="col_name" class="nowrap">' . PMA_getHtmlForColumnName(0, 0, 0, array(), array('central_columnswork' => false)) . '</td>' . '<td name = "col_type" class="nowrap">' . PMA_getHtmlForColumnType(0, 1, 0, '', array()) . '</td>' . '<td class="nowrap" name="col_length">' . PMA_getHtmlForColumnLength(0, 2, 0, 8, '') . '</td>' . '<td class="nowrap" name="col_default">' . PMA_getHtmlForColumnDefault(0, 3, 0, '', '', array()) . '</td>' . '<td name="collation" class="nowrap">' . PMA_getHtmlForColumnCollation(0, 4, 0, array()) . '</td>' . '<td class="nowrap" name="col_attribute">' . PMA_getHtmlForColumnAttribute(0, 5, 0, array(), array(), false, null) . '</td>' . '<td class="nowrap" name="col_isNull">' . PMA_getHtmlForColumnNull(0, 6, 0, array()) . '</td>' . '<td class="nowrap" name="col_extra">' . PMA_getHtmlForColumnExtra(0, 7, 0, array()) . '</td>' . ' <td>' . '<input id="add_column_save" type="submit" ' . ' value="Save"/></td>' . '</tr>';
    $addNewColumn .= '</table></form></div>';
    return $addNewColumn;
}
$response->addHTML($addNewColumn);
if ($total_rows <= 0) {
    $response->addHTML('<fieldset>' . __('The central list of columns for the current database is empty.') . '</fieldset>');
    $columnAdd = PMA_getHTMLforAddCentralColumn($total_rows, $pos, $db);
    $response->addHTML($columnAdd);
    exit;
}
$table_navigation_html = PMA_getHTMLforTableNavigation($total_rows, $pos, $db);
$response->addHTML($table_navigation_html);
$columnAdd = PMA_getHTMLforAddCentralColumn($total_rows, $pos, $db);
$response->addHTML($columnAdd);
$deleteRowForm = '<form method="post" id="del_form" action="db_central_columns.php">' . PMA_URL_getHiddenInputs($db) . '<input id="del_col_name" type="hidden" name="col_name" value="">' . '<input type="hidden" name="pos" value="' . $pos . '">' . '<input type="hidden" name="delete_save" value="delete"></form>';
$response->addHTML($deleteRowForm);
$table_struct = '<div id="tableslistcontainer">' . '<form name="tableslistcontainer">' . '<table id="table_columns" class="tablesorter" ' . 'style="min-width:100%" class="data">';
$response->addHTML($table_struct);
$tableheader = PMA_getCentralColumnsTableHeader('column_heading', __('Click to sort.'), 2);
$response->addHTML($tableheader);
$result = PMA_getColumnsList($db, $pos, $max_rows);
$odd_row = true;
$row_num = 0;
foreach ($result as $row) {
    $tableHtmlRow = PMA_getHTMLforCentralColumnsTableRow($row, $odd_row, $row_num, $db);
    $response->addHTML($tableHtmlRow);
    $odd_row = !$odd_row;
    $row_num++;
}
$response->addHTML('</table>');
$tablefooter = PMA_getCentralColumnsTableFooter($pmaThemeImage, $text_dir);
$response->addHTML($tablefooter);
$response->addHTML('</form></div>');
$message = PMA_Message::success(sprintf(__('Showing rows %1$s - %2$s.'), $pos + 1, $pos + count($result)));
 /**
  * Test for PMA_getCentralColumnsTableHeader
  *
  * @return void
  */
 public function testPMAGetCentralColumnsTableHeader()
 {
     $this->assertTag(array('tag' => 'thead'), PMA_getCentralColumnsTableHeader('column_heading', __('Click to sort'), 2));
 }