Use template for getHtmlForImportOptions

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
Maurício Meneghini Fauth 2017-11-23 18:44:13 -02:00
parent 6e5fbd7403
commit dfd8abaae6
2 changed files with 21 additions and 27 deletions

View File

@ -105,37 +105,19 @@ class Import
/**
* Prints Html For Display Export options
*
* @param String $import_type Import type: server, database, table
* @param String $db Selected DB
* @param String $table Selected Table
* @param String $importType Import type: server, database, table
* @param String $db Selected DB
* @param String $table Selected Table
*
* @return string
*/
public static function getHtmlForImportOptions($import_type, $db, $table)
public static function getHtmlForImportOptions($importType, $db, $table)
{
$html = ' <div class="exportoptions" id="header">';
$html .= ' <h2>';
$html .= Util::getImage('b_import.png', __('Import'));
if ($import_type == 'server') {
$html .= __('Importing into the current server');
} elseif ($import_type == 'database') {
$import_str = sprintf(
__('Importing into the database "%s"'),
htmlspecialchars($db)
);
$html .= $import_str;
} else {
$import_str = sprintf(
__('Importing into the table "%s"'),
htmlspecialchars($table)
);
$html .= $import_str;
}
$html .= ' </h2>';
$html .= ' </div>';
return $html;
return Template::get('display/import/options')->render([
'import_type' => $importType,
'db' => $db,
'table' => $table,
]);
}
/**

View File

@ -0,0 +1,12 @@
<div class="exportoptions" id="header">
<h2>
{{ Util_getImage('b_import.png', 'Import'|trans) }}
{% if import_type == 'server' %}
{% trans 'Importing into the current server' %}
{% elseif import_type == 'database' %}
{{ 'Importing into the database "%s"'|trans|format(db) }}
{% else %}
{{ 'Importing into the table "%s"'|trans|format(table) }}
{% endif %}
</h2>
</div>