Extract HTML from MultSubmits::getHtmlForCopyMultipleTables

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2020-03-02 22:01:16 -03:00
parent a916c75547
commit 1395cdc1d0
2 changed files with 64 additions and 27 deletions

View File

@ -31,12 +31,16 @@ class MultSubmits
/** @var Operations */
private $operations;
/** @var Template */
private $template;
public function __construct()
{
$this->transformations = new Transformations();
$relation = new Relation($GLOBALS['dbi']);
$this->relationCleanup = new RelationCleanup($GLOBALS['dbi'], $relation);
$this->operations = new Operations($GLOBALS['dbi'], $relation);
$this->template = new Template();
}
/**
@ -393,9 +397,6 @@ class MultSubmits
*/
public function getHtmlForCopyMultipleTables($action, array $urlParams)
{
$html = '<form id="ajax_form" action="' . $action . '" method="post">';
$html .= Url::getHiddenInputs($urlParams);
$html .= '<fieldset class = "input">';
$databasesList = $GLOBALS['dblist']->databases;
foreach ($databasesList as $key => $databaseName) {
if ($databaseName == $GLOBALS['db']) {
@ -403,30 +404,12 @@ class MultSubmits
break;
}
}
$html .= '<strong><label for="db_name_dropdown">' . __('Database') . ':</label></strong>';
$html .= '<select id="db_name_dropdown" class="halfWidth" name="target_db" >'
. $databasesList->getHtmlOptions(true, false)
. '</select>';
$html .= '<br><br>';
$html .= '<strong><label>' . __('Options') . ':</label></strong><br>';
$html .= '<input type="radio" id ="what_structure" value="structure" name="what">';
$html .= '<label for="what_structure">' . __('Structure only') . '</label><br>';
$html .= '<input type="radio" id ="what_data" value="data" name="what" checked="checked">';
$html .= '<label for="what_data">' . __('Structure and data') . '</label><br>';
$html .= '<input type="radio" id ="what_dataonly" value="dataonly" name="what">';
$html .= '<label for="what_dataonly">' . __('Data only') . '</label><br><br>';
$html .= '<input type="checkbox" id="checkbox_drop" value="true" name="drop_if_exists">';
$html .= '<label for="checkbox_drop">' . __('Add DROP TABLE') . '</label><br>';
$html .= '<input type="checkbox" id="checkbox_auto_increment_cp" value="1" name="sql_auto_increment">';
$html .= '<label for="checkbox_auto_increment_cp">' . __('Add AUTO INCREMENT value') . '</label><br>';
$html .= '<input type="checkbox" id="checkbox_constraints" value="1" name="sql_auto_increment" checked="checked">';
$html .= '<label for="checkbox_constraints">' . __('Add constraints') . '</label><br><br>';
$html .= '<input name="adjust_privileges" value="1" id="checkbox_adjust_privileges" checked="checked" type="checkbox">';
$html .= '<label for="checkbox_adjust_privileges">' . __('Adjust privileges') . '<a href="./doc/html/faq.html#faq6-39" target="documentation"><img src="themes/dot.gif" title="Documentation" alt="Documentation" class="icon ic_b_help"></a></label>';
$html .= '</fieldset>';
$html .= '<input type="hidden" name="mult_btn" value="' . __('Yes') . '">';
$html .= '</form>';
return $html;
return $this->template->render('mult_submits/copy_multiple_tables', [
'action' => $action,
'url_params' => $urlParams,
'options' => $databasesList->getHtmlOptions(true, false),
]);
}
/**

View File

@ -0,0 +1,54 @@
<form id="ajax_form" action="{{ action|raw }}" method="post">
{{ get_hidden_inputs(url_params) }}
<fieldset>
<strong><label for="db_name_dropdown">{% trans 'Database:' %}</label></strong>
<select id="db_name_dropdown" name="target_db">
{{ options|raw }}
</select>
<br><br>
<strong><label>{% trans 'Options:' %}</label></strong>
<br>
<input type="radio" id="what_structure" value="structure" name="what">
<label for="what_structure">{% trans 'Structure only' %}</label>
<br>
<input type="radio" id="what_data" value="data" name="what" checked>
<label for="what_data">{% trans 'Structure and data' %}</label>
<br>
<input type="radio" id="what_dataonly" value="dataonly" name="what">
<label for="what_dataonly">{% trans 'Data only' %}</label>
<br><br>
<input type="checkbox" id="checkbox_drop" value="true" name="drop_if_exists">
<label for="checkbox_drop">{% trans 'Add DROP TABLE' %}</label>
<br>
<input type="checkbox" id="checkbox_auto_increment_cp" value="1" name="sql_auto_increment">
<label for="checkbox_auto_increment_cp">{% trans 'Add AUTO INCREMENT value' %}</label>
<br>
<input type="checkbox" id="checkbox_constraints" value="1" name="sql_auto_increment" checked>
<label for="checkbox_constraints">{% trans 'Add constraints' %}</label>
<br><br>
<input type="checkbox" name="adjust_privileges" value="1" id="checkbox_adjust_privileges" checked>
<label for="checkbox_adjust_privileges">
{% trans 'Adjust privileges' %}
{{ show_docu('faq', 'faq6-39') }}
</label>
</fieldset>
<input type="hidden" name="mult_btn" value="{% trans 'Yes' %}">
</form>