Port table/search/search_and_replace to Twig
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
9b38ea8ca3
commit
fe4f6148c2
@ -27,6 +27,7 @@ class PhpFunctionsExtension extends Twig_Extension
|
||||
return array(
|
||||
new Twig_SimpleFunction('array_search', 'array_search'),
|
||||
new Twig_SimpleFunction('md5', 'md5'),
|
||||
new Twig_SimpleFunction('preg_replace', 'preg_replace'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
<?= __('Find:'); ?>
|
||||
<input type="text" value="" name="find" required />
|
||||
<?= __('Replace with:'); ?>
|
||||
<input type="text" value="" name="replaceWith" />
|
||||
|
||||
<?= __('Column:'); ?>
|
||||
<select name="columnIndex">
|
||||
<?php for ($i = 0, $nb = count($columnNames); $i < $nb; $i++): ?>
|
||||
<?php $type = preg_replace('@\(.*@s', '', $columnTypes[$i]); ?>
|
||||
<?php if ($GLOBALS['PMA_Types']->getTypeClass($type) == 'CHAR'): ?>
|
||||
<?php $column = $columnNames[$i]; ?>
|
||||
<option value="<?= $i; ?>">
|
||||
<?= htmlspecialchars($column); ?>
|
||||
</option>
|
||||
<?php endif; ?>
|
||||
<?php endfor; ?>
|
||||
</select>
|
||||
|
||||
<br>
|
||||
<?= PhpMyAdmin\Template::get('checkbox')
|
||||
->render(
|
||||
array(
|
||||
'html_field_name' => 'useRegex',
|
||||
'label' => __('Use regular expression'),
|
||||
'checked' => false,
|
||||
'onclick' => false,
|
||||
'html_field_id' => 'useRegex',
|
||||
)
|
||||
); ?>
|
||||
25
templates/table/search/search_and_replace.twig
Normal file
25
templates/table/search/search_and_replace.twig
Normal file
@ -0,0 +1,25 @@
|
||||
{% trans 'Find:' %}
|
||||
<input type="text" value="" name="find" required />
|
||||
{% trans 'Replace with:' %}
|
||||
<input type="text" value="" name="replaceWith" />
|
||||
|
||||
{% trans 'Column:' %}
|
||||
<select name="columnIndex">
|
||||
{% for i in 0..column_names|length - 1 %}
|
||||
{% set type = preg_replace('@\(.*@s', '', column_types[i]) %}
|
||||
{% if sql_types.getTypeClass(type) == 'CHAR' %}
|
||||
{% set column = column_names[i] %}
|
||||
<option value="{{ i }}">
|
||||
{{ column }}
|
||||
</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
{% include 'checkbox.twig' with {
|
||||
'html_field_id': 'useRegex',
|
||||
'html_field_name': 'useRegex',
|
||||
'label': 'Use regular expression'|trans,
|
||||
'checked': false,
|
||||
'onclick': false
|
||||
} only %}
|
||||
@ -90,8 +90,9 @@ switch ($searchType) {
|
||||
</legend>
|
||||
<?= PhpMyAdmin\Template::get('table/search/search_and_replace')
|
||||
->render(array(
|
||||
'columnNames' => $columnNames,
|
||||
'columnTypes' => $columnTypes
|
||||
'column_names' => $columnNames,
|
||||
'column_types' => $columnTypes,
|
||||
'sql_types' => $GLOBALS['PMA_Types'],
|
||||
)); ?>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user