/**
* Get HTML div for copy table
*
* @return string $html_output
*/
function PMA_getHtmlForCopytable()
{
$html_output = '<div class="operations_half_width">';
$html_output .= '<form method="post" action="tbl_operations.php" ' . 'name="copyTable" ' . 'id="copyTable" ' . ' class="ajax" ' . 'onsubmit="return emptyCheckTheField(this, \'new_name\')">' . PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']) . '<input type="hidden" name="reload" value="1" />';
$html_output .= '<fieldset>';
$html_output .= '<legend>' . __('Copy table to (database<b>.</b>table)') . '</legend>';
if (count($GLOBALS['pma']->databases) > $GLOBALS['cfg']['MaxDbList']) {
$html_output .= '<input class="halfWidth" type="text" maxlength="100" ' . 'size="30" name="target_db" ' . 'value="' . htmlspecialchars($GLOBALS['db']) . '"/>';
} else {
$html_output .= '<select class="halfWidth" name="target_db">' . $GLOBALS['pma']->databases->getHtmlOptions(true, false) . '</select>';
}
$html_output .= ' <strong>.</strong> ';
$html_output .= '<input class="halfWidth" type="text" required="required" ' . 'size="20" name="new_name" maxlength="64" ' . 'value="' . htmlspecialchars($GLOBALS['table']) . '"/><br />';
$choices = array('structure' => __('Structure only'), 'data' => __('Structure and data'), 'dataonly' => __('Data only'));
$html_output .= PMA\libraries\Util::getRadioFields('what', $choices, 'data', true);
$html_output .= '<br />';
$html_output .= '<input type="checkbox" name="drop_if_exists" ' . 'value="true" id="checkbox_drop" />' . '<label for="checkbox_drop">' . sprintf(__('Add %s'), 'DROP TABLE') . '</label><br />' . '<input type="checkbox" name="sql_auto_increment" ' . 'value="1" id="checkbox_auto_increment_cp" />' . '<label for="checkbox_auto_increment_cp">' . __('Add AUTO_INCREMENT value') . '</label><br />';
// display "Add constraints" choice only if there are
// foreign keys
if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
$html_output .= '<input type="checkbox" name="add_constraints" ' . 'value="1" id="checkbox_constraints" checked="checked"/>';
$html_output .= '<label for="checkbox_constraints">' . __('Add constraints') . '</label><br />';
}
// endif
$html_output .= '<br />';
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv'] && isset($GLOBALS['col_priv']) && $GLOBALS['col_priv'] && isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']) {
$html_output .= '<input type="checkbox" name="adjust_privileges" ' . 'value="1" id="checkbox_adjust_privileges" checked="checked" />';
} else {
$html_output .= '<input type="checkbox" name="adjust_privileges" ' . 'value="1" id="checkbox_adjust_privileges" title="' . __('You don\'t have sufficient privileges to perform this ' . 'operation; Please refer to the documentation for more details') . '" disabled/>';
}
$html_output .= '<label for="checkbox_adjust_privileges">' . __('Adjust privileges') . Util::showDocu('faq', 'faq6-39') . '</label><br />';
if (isset($_COOKIE['pma_switch_to_new']) && $_COOKIE['pma_switch_to_new'] == 'true') {
$pma_switch_to_new = 'true';
}
$html_output .= '<input type="checkbox" name="switch_to_new" value="true"' . 'id="checkbox_switch"' . (isset($pma_switch_to_new) && $pma_switch_to_new == 'true' ? ' checked="checked"' : '' . '/>');
$html_output .= '<label for="checkbox_switch">' . __('Switch to copied table') . '</label>' . '</fieldset>';
$html_output .= '<fieldset class="tblFooters">' . '<input type="submit" name="submit_copy" value="' . __('Go') . '" />' . '</fieldset>' . '</form>' . '</div>';
return $html_output;
}