Port server/binlog/log_selector template to Twig

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
Maurício Meneghini Fauth 2017-10-07 18:32:40 -03:00
parent cab11ee447
commit d8906b8236
3 changed files with 30 additions and 27 deletions

View File

@ -85,6 +85,7 @@ class ServerBinlogController extends Controller
array(
'url_params' => $url_params,
'binary_logs' => $this->binary_logs,
'log' => $_REQUEST['log'],
)
);
}

View File

@ -1,27 +0,0 @@
<form action="server_binlog.php" method="get">
<?= PhpMyAdmin\Url::getHiddenInputs($url_params); ?>
<fieldset>
<legend>
<?= __('Select binary log to view'); ?>
</legend>
<?php $full_size = 0; ?>
<select name="log">
<?php foreach ($binary_logs as $each_log): ?>
<option value="<?= htmlspecialchars($each_log['Log_name']); ?>"<?= ($each_log['Log_name'] == $_REQUEST['log'] ? ' selected="selected"' : ''); ?>>
<?= htmlspecialchars($each_log['Log_name']); ?>
<?php if (isset($each_log['File_size'])): ?>
(<?= implode(' ', \PhpMyAdmin\Util::formatByteDown($each_log['File_size'], 3, 2)); ?>)
<?php $full_size += $each_log['File_size']; ?>
<?php endif; ?>
</option>
<?php endforeach; ?>
</select>
<?= count($binary_logs) . ' ' . __('Files') . ', '; ?>
<?php if ($full_size > 0): ?>
<?= implode(' ', \PhpMyAdmin\Util::formatByteDown($full_size)); ?>
<?php endif; ?>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" value="<?= __('Go'); ?>" />
</fieldset>
</form>

View File

@ -0,0 +1,29 @@
<form action="server_binlog.php" method="get">
{{ Url_getHiddenInputs(url_params) }}
<fieldset>
<legend>
{% trans 'Select binary log to view' %}
</legend>
{% set full_size = 0 %}
<select name="log">
{% for each_log in binary_logs %}
<option value="{{ each_log['Log_name'] }}"
{{- each_log['Log_name'] == log ? ' selected="selected"' }}>
{{ each_log['Log_name'] }}
{% if each_log['File_size'] is defined %}
({{ Util_formatByteDown(each_log['File_size'], 3, 2)|join(' ') }})
{% set full_size = full_size + each_log['File_size'] %}
{% endif %}
</option>
{% endfor %}
</select>
{{ binary_logs|length }}
{% trans 'Files' %},
{% if full_size > 0 %}
{{ Util_formatByteDown(full_size)|join(' ') }}
{% endif %}
</fieldset>
<fieldset class="tblFooters">
<input type="submit" value="{% trans 'Go' %}" />
</fieldset>
</form>