Port table/search/options_zoom to Twig

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
Maurício Meneghini Fauth 2017-10-06 12:03:20 -03:00
parent ec9404a276
commit 326c0781d5
3 changed files with 48 additions and 50 deletions

View File

@ -1,48 +0,0 @@
<table class="data">
<!-- Select options for data label -->
<tr>
<td>
<label for="dataLabel">
<?= __("Use this column to label each point"); ?>
</label>
</td>
<td>
<select name="dataLabel" id="dataLabel" >
<option value = "">
<?= __('None'); ?>
</option>
<?php for ($j = 0, $nb = count($columnNames); $j < $nb; $j++): ?>
<?php if (isset($dataLabel)
&& $dataLabel == htmlspecialchars($columnNames[$j])
): ?>
<option value="<?= htmlspecialchars($columnNames[$j]); ?>"
selected="selected">
<?= htmlspecialchars($columnNames[$j]); ?>
</option>
<?php else: ?>
<option value="<?= htmlspecialchars($columnNames[$j]); ?>" >
<?= htmlspecialchars($columnNames[$j]); ?>
</option>
<?php endif; ?>
<?php endfor; ?>
</select>
</td>
</tr>
<!-- Inputbox for changing default maximum rows to plot -->
<tr>
<td>
<label for="maxRowPlotLimit">
<?= __("Maximum rows to plot"); ?>
</label>
</td>
<td>
<input type="number"
name="maxPlotLimit"
id="maxRowPlotLimit"
required="required"
value="<?= ((! empty($_POST['maxPlotLimit']))
? intval($_POST['maxPlotLimit'])
: intval($GLOBALS['cfg']['maxRowPlotLimit'])); ?>" />
</td>
</tr>
</table>

View File

@ -0,0 +1,43 @@
<table class="data">
{# Select options for data label #}
<tr>
<td>
<label for="dataLabel">
{% trans 'Use this column to label each point' %}
</label>
</td>
<td>
<select name="dataLabel" id="dataLabel" >
<option value = "">
{% trans 'None' %}
</option>
{% for i in 0..column_names|lenght - 1 %}
{% if data_label is defined and data_label == column_names[i]|e %}
<option value="{{ column_names[i] }}" selected="selected">
{{ column_names[i] }}
</option>
{% else %}
<option value="{{ column_names[i] }}" >
{{ column_names[i] }}
</option>
{% endif %}
{% endfor %}
</select>
</td>
</tr>
{# Inputbox for changing default maximum rows to plot #}
<tr>
<td>
<label for="maxRowPlotLimit">
{% trans 'Maximum rows to plot' %}
</label>
</td>
<td>
<input type="number"
name="maxPlotLimit"
id="maxRowPlotLimit"
required="required"
value="{{ max_plot_limit }}" />
</td>
</tr>
</table>

View File

@ -42,8 +42,11 @@ switch ($searchType) {
?>
<?= PhpMyAdmin\Template::get('table/search/options_zoom')
->render(array(
'dataLabel' => $dataLabel,
'columnNames' => $columnNames
'data_label' => $dataLabel,
'column_names' => $columnNames,
'max_plot_limit' => ((! empty($_POST['maxPlotLimit']))
? intval($_POST['maxPlotLimit'])
: intval($GLOBALS['cfg']['maxRowPlotLimit'])),
)) ?>
</fieldset>
</fieldset>