generic filter (dc 2.20) uses generic filter

This commit is contained in:
Jean-Christian Paul Denis 2021-10-09 17:18:04 +02:00
parent 65d40e6d37
commit 3c731bab05
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

@ -190,32 +190,13 @@ if ($part == 'links') {
$log = new kutrlLog($core); $log = new kutrlLog($core);
$kUtRL_filter = new adminGenericFilter($core, 'kUtRL'); $kUtRL_filter = new adminGenericFilter($core, 'kUtRL');
$kUtRL_filter->add('part', 'links');
$kUtRL_filter->add(dcAdminFilters::getPageFilter());
$kUtRL_filter->add(dcAdminFilters::getSelectFilter(
'urlsrv', __('Service:'), $lst_services_combo, 'kut_type'
));
$sortby = $kUtRL_filter->getFilter('sortby'); $params = $kUtRL_filter->params();
$order = $kUtRL_filter->getFilter('order');
$nb = $kUtRL_filter->getFilter('nb');
$page = !empty($_GET['page']) ? max(1, (integer) $_GET['page']) : 1;
$kUtRL_filter->setFilter('page', $page);
$kUtRL_filter->setFilter('part', 'links');
$params = [];
$params['limit'] = [(($page-1)*$nb), $nb];
$params['order'] = $sortby . ' ' . $order;
$urlsrv = !empty($_GET['urlsrv']) ? $_GET['urlsrv'] : '';
if ($urlsrv === '' || !in_array($urlsrv, $lst_services_combo)) {
$urlsrv = '';
}
$urlsrv = $kUtRL_filter->setFilter([
'id' => 'urlsrv',
'value' => $urlsrv,
'title' => __('Service:'),
'combo' => $lst_services_combo
]);
if ($urlsrv != '') {
$params['kut_type'] = $urlsrv;
}
try { try {
$list_all = $log->getLogs($params); $list_all = $log->getLogs($params);
@ -243,8 +224,7 @@ if ($part == 'links') {
dcPage::addSuccessNotice( dcPage::addSuccessNotice(
__('Links successfully deleted') __('Links successfully deleted')
); );
$core->adminurl->redirect('admin.plugin.kUtRL', $kUtRL_filter->values());
http::redirect($p_url . '&part=links&urlsrv=' . $urlsrv . '&sortby=' . $sortby . '&order=' . $order . '&nb=' . $nb . '&page=' . $page);
} catch (Exception $e) { } catch (Exception $e) {
$core->error->add($e->getMessage()); $core->error->add($e->getMessage());
} }
@ -473,8 +453,8 @@ if ($part == 'links') {
$kUtRL_filter->display('admin.plugin.kUtRL', form::hidden('p', 'kUtRL') . form::hidden('part', 'links')); $kUtRL_filter->display('admin.plugin.kUtRL', form::hidden('p', 'kUtRL') . form::hidden('part', 'links'));
$list_current->display( $list_current->display(
$page, $kUtRL_filter->value('page'),
$nb, $kUtRL_filter->nb,
'<form action="' . $p_url . '&amp;part=links" method="post" id="form-entries"> '<form action="' . $p_url . '&amp;part=links" method="post" id="form-entries">
%s %s
@ -485,7 +465,7 @@ if ($part == 'links') {
</div> </div>
<p class="col right"> <p class="col right">
<input id="do-action" type="submit" value="' . __('Delete selected short links') . '" /></p>' . <input id="do-action" type="submit" value="' . __('Delete selected short links') . '" /></p>' .
$core->adminurl->getHiddenFormFields('admin.plugin.kUtRL', array_merge(['deletelinks' => 1], $kUtRL_filter->getFilters(true))) . $core->adminurl->getHiddenFormFields('admin.plugin.kUtRL', array_merge(['deletelinks' => 1], $kUtRL_filter->values(true))) .
$core->formNonce() . ' $core->formNonce() . '
</p> </p>
</div> </div>