add search filter on cinecturlink list

This commit is contained in:
Jean-Christian Paul Denis 2021-11-04 02:03:49 +01:00
parent d8ae3d698c
commit 55c8200039
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
3 changed files with 15 additions and 7 deletions

View File

@ -121,6 +121,15 @@ class cinecturlink2
$strReq .= "AND L.link_lang = '" . $this->con->escape($params['link_lang']) . "' ";
}
if (!empty($params['q'])) {
$q = $this->con->escape(str_replace('*', '%', strtolower($params['q'])));
$strReq .= "AND LOWER(L.link_title) LIKE '%" . $q . "%' ";
}
if (!empty($params['where'])) {
$strReq .= $params['where'] . ' ';
}
if (!empty($params['sql'])) {
$strReq .= $params['sql'] . ' ';
}

View File

@ -91,18 +91,16 @@ class adminlistCinecturlink2
'</table>' .
'%s</div>';
if ($enclose_block) {
$html_block = sprintf($enclose_block, $html_block);
}
$blocks = explode('%s', $html_block);
$enclose_blocks = explode('%s', $enclose_block);
$blocks = explode('%s', $html_block);
echo $pager->getLinks() . $blocks[0];
echo $enclose_blocks[0] . $pager->getLinks() . $blocks[0];
while ($this->rs->fetch()) {
echo $this->linkLine(isset($links[$this->rs->link_id]));
}
echo $blocks[1] . $blocks[2] . $pager->getLinks();
echo $blocks[1] . $blocks[2] . $pager->getLinks() . $enclose_blocks[1];
}
}

View File

@ -144,6 +144,7 @@ if ($part == 'links') {
$c2link_filter = new adminGenericFilter($core, 'c2link');
$c2link_filter->add('part', 'links');
$c2link_filter->add(dcAdminFilters::getPageFilter());
$c2link_filter->add(dcAdminFilters::getSearchFilter());
$c2link_filter->add(dcAdminFilters::getSelectFilter(
'catid',
__('Category:'),
@ -507,7 +508,7 @@ if ($part == 'links') {
'<p class="col right"><label for="action" class="classic">' . __('Selected links action:') . '</label> ' .
form::combo('part', $action_combo) .
'<input id="do-action" type="submit" value="' . __('ok') . '" disabled /></p>' .
$core->adminurl->getHiddenFormFields('admin.plugin.cinecturlink2', array_diff_key($c2link_filter->values(true), ['part' => ''])) .
$core->adminurl->getHiddenFormFields('admin.plugin.cinecturlink2', array_diff_key($c2link_filter->values(), ['part' => ''])) .
form::hidden(['redir'], $links_redir) .
$core->formNonce() .
'</div>' .