Webgui improve filter functions

This commit is contained in:
thooge committed 2026-10-24 10:47:44 +02:00
1 parent b3825cb1b3
commit 9d09b1e120
17 files changed
+435 -458

No files matched your search

+18 -4
View File
@@ -95,7 +95,17 @@ if ($action == ACT_DEFAULT):
// ========== VARIANT: default behavior =======================================
// load filter from db
$flt = db_get_filter($user->id, 211);
$flt = db_get_filter($user->id, 211, ['txt']);
$w = array('vid=:vid');
$p = array(':vid' => $user->vid);
if (strlen($flt->txt) > 1) {
$w[] = 'cablename LIKE :txt OR remarks LIKE :txt';
$p[':txt'] = '%'.$flt->txt.'%';
}
$where = join(' AND ', $w);
$order = ' ORDER BY cablename';
echo "<h1>$pagetitle</h1>\n";
@@ -119,10 +129,14 @@ echo "<h1>$pagetitle</h1>\n";
<?php
$sql = "SELECT cableid, cablename, conductors, length, xsection, color, cablecond "
. "FROM cable "
. "ORDER BY cablename";
$sth = $pdo->query($sql);
. "FROM cable ";
$sql .= ' WHERE ' . $where;
$sql .= $order;
$sth = $pdo->prepare($sql);
$sth->execute($p);
$res = $sth->fetchAll();
echo '<table class="table table-striped">', "\n";
echo "<thead>\n";
echo "<tr>\n";