add search filter on cinecturlink list

This commit is contained in:
Jean-Christian 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']) . "' "; $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'])) { if (!empty($params['sql'])) {
$strReq .= $params['sql'] . ' '; $strReq .= $params['sql'] . ' ';
} }

View file

@ -91,18 +91,16 @@ class adminlistCinecturlink2
'</table>' . '</table>' .
'%s</div>'; '%s</div>';
if ($enclose_block) { $enclose_blocks = explode('%s', $enclose_block);
$html_block = sprintf($enclose_block, $html_block);
}
$blocks = explode('%s', $html_block); $blocks = explode('%s', $html_block);
echo $pager->getLinks() . $blocks[0]; echo $enclose_blocks[0] . $pager->getLinks() . $blocks[0];
while ($this->rs->fetch()) { while ($this->rs->fetch()) {
echo $this->linkLine(isset($links[$this->rs->link_id])); 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 = new adminGenericFilter($core, 'c2link');
$c2link_filter->add('part', 'links'); $c2link_filter->add('part', 'links');
$c2link_filter->add(dcAdminFilters::getPageFilter()); $c2link_filter->add(dcAdminFilters::getPageFilter());
$c2link_filter->add(dcAdminFilters::getSearchFilter());
$c2link_filter->add(dcAdminFilters::getSelectFilter( $c2link_filter->add(dcAdminFilters::getSelectFilter(
'catid', 'catid',
__('Category:'), __('Category:'),
@ -507,7 +508,7 @@ if ($part == 'links') {
'<p class="col right"><label for="action" class="classic">' . __('Selected links action:') . '</label> ' . '<p class="col right"><label for="action" class="classic">' . __('Selected links action:') . '</label> ' .
form::combo('part', $action_combo) . form::combo('part', $action_combo) .
'<input id="do-action" type="submit" value="' . __('ok') . '" disabled /></p>' . '<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) . form::hidden(['redir'], $links_redir) .
$core->formNonce() . $core->formNonce() .
'</div>' . '</div>' .