1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-14 11:35:33 +02:00

[ticket/16737] Move template logic to template

PHPBB3-16737
This commit is contained in:
rubencm 2021-03-24 22:25:36 +01:00
parent 381cf4b9f1
commit b78efaadc1
2 changed files with 18 additions and 40 deletions

View File

@ -113,7 +113,7 @@
<!-- BEGIN backend -->
<!-- IF backend.S_STATS -->
{% if backend.S_STATS is not empty %}
<form id="acp_search_index_{backend.NAME}" method="post" action="{U_ACTION}">
@ -135,18 +135,23 @@
</tr>
</thead>
<tbody>
<!-- BEGIN data -->
{% for stat in backend.S_STATS | batch(2, '') %}
<tr>
<td>{backend.data.STATISTIC_1}{L_COLON}</td>
<td>{backend.data.VALUE_1}</td>
<td>{backend.data.STATISTIC_2}<!-- IF backend.data.STATISTIC_2 -->{L_COLON}<!-- ENDIF --></td>
<td>{backend.data.VALUE_2}</td>
{% for key, value in stat %}
{% if value is not empty %}
<td>{{ key }}{L_COLON}</td>
<td>{{ value }}</td>
{% else %}
<td></td>
<td></td>
{% endif %}
{% endfor %}
</tr>
<!-- END data -->
{% endfor %}
</tbody>
</table>
<!-- ENDIF -->
{% endif %}
<p class="quick">
<!-- IF backend.S_INDEXED -->

View File

@ -189,7 +189,7 @@ class acp_search
}
unset($cfg_array);
$this->tpl_name = 'acp_search';
$this->tpl_name = 'acp_search_settings';
$this->page_title = 'ACP_SEARCH_SETTINGS';
$template->assign_vars([
@ -340,45 +340,18 @@ class acp_search
$name = $search->get_name();
$data = $search->index_stats();
$statistics = array();
foreach ($data as $statistic => $value)
{
$n = count($statistics);
if ($n && count($statistics[$n - 1]) < 3)
{
$statistics[$n - 1] += array('statistic_2' => $statistic, 'value_2' => $value);
}
else
{
$statistics[] = array('statistic_1' => $statistic, 'value_1' => $value);
}
}
$template->assign_block_vars('backend', array(
'L_NAME' => $name,
'NAME' => $type,
'S_ACTIVE' => ($type == $config['search_type']) ? true : false,
'S_ACTIVE' => $type == $config['search_type'],
'S_HIDDEN_FIELDS' => build_hidden_fields(array('search_type' => $type)),
'S_INDEXED' => (bool) $search->index_created(),
'S_STATS' => (bool) count($statistics))
);
foreach ($statistics as $statistic)
{
$template->assign_block_vars('backend.data', array(
'STATISTIC_1' => $statistic['statistic_1'],
'VALUE_1' => $statistic['value_1'],
'STATISTIC_2' => (isset($statistic['statistic_2'])) ? $statistic['statistic_2'] : '',
'VALUE_2' => (isset($statistic['value_2'])) ? $statistic['value_2'] : '')
);
}
'S_STATS' => $data,
));
}
unset($search);
unset($statistics);
unset($data);
$this->tpl_name = 'acp_search';
$this->tpl_name = 'acp_search_index';
$this->page_title = 'ACP_SEARCH_INDEX';
$template->assign_vars(array(