Skip to content

Commit

Permalink
Remove controller object from table/zoom_search/index template
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Mar 9, 2024
1 parent 21fc3a4 commit decde7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 4 additions & 6 deletions resources/templates/table/zoom_search/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,10 @@
</select>
</th>
{% if criteria_column_names[i] is defined and criteria_column_names[i] != 'pma_null' %}
{% set key = keys[criteria_column_names[i]] %}
{% set properties = self.getColumnProperties(i, key) %}
{% set type = type|merge({(i): properties['type']}) %}
{% set collation = collation|merge({(i): properties['collation']}) %}
{% set func = func|merge({(i): properties['func']}) %}
{% set value = value|merge({(i): properties['value']}) %}
{% set type = type|merge({(i): properties[i]['type']}) %}
{% set collation = collation|merge({(i): properties[i]['collation']}) %}
{% set func = func|merge({(i): properties[i]['func']}) %}
{% set value = value|merge({(i): properties[i]['value']}) %}
{% endif %}
{# Column type #}
<td dir="ltr">
Expand Down
12 changes: 7 additions & 5 deletions src/Controllers/Table/ZoomSearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function displaySelectionFormAction(string $dataLabel): void
}

$criteriaColumnNames = $_POST['criteriaColumnNames'] ?? null;
$keys = [];
$properties = [];
/** @infection-ignore-all */
for ($i = 0; $i < 4; $i++) {
if (! isset($criteriaColumnNames[$i])) {
Expand All @@ -262,18 +262,20 @@ public function displaySelectionFormAction(string $dataLabel): void
continue;
}

$keys[$criteriaColumnNames[$i]] = array_search($criteriaColumnNames[$i], $this->columnNames);
$properties[$i] = $this->getColumnProperties(
$i,
(int) array_search($criteriaColumnNames[$i], $this->columnNames),
);
}

$this->render('table/zoom_search/index', [
'db' => Current::$database,
'table' => Current::$table,
'goto' => $GLOBALS['goto'],
'self' => $this,
'properties' => $properties,
'geom_column_flag' => $this->geomColumnFlag,
'column_names' => $this->columnNames,
'data_label' => $dataLabel,
'keys' => $keys,
'criteria_column_names' => $criteriaColumnNames,
'criteria_column_types' => $_POST['criteriaColumnTypes'] ?? null,
'max_plot_limit' => ! empty($_POST['maxPlotLimit'])
Expand Down Expand Up @@ -438,7 +440,7 @@ public function zoomSubmitAction(string $dataLabel, string $goto): void
*
* @return mixed[] Array containing column's properties
*/
public function getColumnProperties(int $searchIndex, int $columnIndex): array
private function getColumnProperties(int $searchIndex, int $columnIndex): array
{
$selectedOperator = $_POST['criteriaColumnOperators'][$searchIndex] ?? '';
$enteredValue = $_POST['criteriaValues'] ?? '';
Expand Down

0 comments on commit decde7f

Please sign in to comment.