Ongoing webgui work
This commit is contained in:
+73
-18
@@ -26,57 +26,112 @@ echo "<h1>$pagetitle</h1>\n";
|
||||
<label for="remarks">Bemerkungsfelder berücksichtigen</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" name="submit[search]"><?=_('Search')?></button>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
if ($g_referrer != $g_scriptname) {
|
||||
echo '<a class="btn btn-secondary" href="', $g_referrer, '">', _('Back'), "</a>\n";
|
||||
}
|
||||
|
||||
echo "</form>\n";
|
||||
|
||||
if (isset($needle)) {
|
||||
$sqlneedle = '%'.$needle.'%';
|
||||
$remarks = isset($_POST['ck_remarks']) ? ' OR remarks LIKE :needle' : '';
|
||||
|
||||
// equipment
|
||||
$remarks = isset($_POST['ck_remarks']) ? ' OR remarks LIKE :needle' : '';
|
||||
$sql = "SELECT eid, ename, model, remarks "
|
||||
. "FROM equipment "
|
||||
. "WHERE ename LIKE :needle OR model LIKE :needle" . $remarks;
|
||||
. "WHERE vid=:vid AND (ename LIKE :needle OR model LIKE :needle)" . $remarks;
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([':needle' => $sqlneedle]);
|
||||
$sth->execute([':vid' => $user->vid, ':needle' => $sqlneedle]);
|
||||
if ($sth->rowCount() > 0) {
|
||||
echo '<h3>', _('Equipment'), "</h3>\n";
|
||||
foreach ($sth->fetchAll() as $row) {
|
||||
$out = $row['ename'] . ' ' . $row['model'];
|
||||
// mark needle in result
|
||||
$p0 = strpos($out, $needle);
|
||||
if ($p0 > 0) {
|
||||
$p0 = stripos($out, $needle);
|
||||
if ($p0 >= 0) {
|
||||
$out = substr_replace($out, '</span>', $p0 + strlen($needle), 0);
|
||||
$out = substr_replace($out, '<span style="background:#ffef00;">', $p0, 0);
|
||||
}
|
||||
echo '<p>', $out;
|
||||
echo '';
|
||||
echo '<p>', $out, ' ';
|
||||
echo '<a href="equipment.php?f=view&id=', $row['eid'], '"><i class="bi-eye"></i></a>';
|
||||
echo "</p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// inventory
|
||||
$sql = "SELECT invid, invname, remarks "
|
||||
. "FROM inventory "
|
||||
. "WHERE invname LIKE :needle" . $remarks;
|
||||
$remarks = isset($_POST['ck_remarks']) ? 'OR i.remarks LIKE :needle ' : '';
|
||||
$sql = "SELECT invid, invname, i.remarks "
|
||||
. "FROM inventory AS i JOIN storage AS s ON (i.conttype='storage' AND i.sid=s.sid) "
|
||||
. "WHERE s.vid=:vid AND i.invname LIKE :needle " . $remarks
|
||||
. "UNION "
|
||||
. "SELECT invid, invname, i.remarks "
|
||||
. "FROM inventory AS i JOIN box AS b ON (i.conttype='box' AND i.boxid=b.boxid) "
|
||||
. " JOIN storage AS s ON (i.sid=s.sid) "
|
||||
. "WHERE s.vid=:vid AND i.invname LIKE :needle " . $remarks;
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([':needle' => $sqlneedle]);
|
||||
$sth->execute([':vid' => $user->vid, ':needle' => $sqlneedle]);
|
||||
if ($sth->rowCount() > 0) {
|
||||
echo '<h3>', _('Inventory'), "</h3>\n";
|
||||
foreach ($sth->fetchAll() as $row) {
|
||||
$out = $row['invname'] . ' ' . $row['model'];
|
||||
$out = rtrim($row['invname'] . ' ' . $row['model']);
|
||||
// mark needle in result
|
||||
$p0 = strpos($out, $needle);
|
||||
if ($p0 > 0) {
|
||||
$p0 = stripos($out, $needle);
|
||||
if ($p0 >= 0) {
|
||||
$out = substr_replace($out, '</span>', $p0 + strlen($needle), 0);
|
||||
$out = substr_replace($out, '<span style="background:#ffef00;">', $p0, 0);
|
||||
}
|
||||
echo '<p>', $out;
|
||||
echo '';
|
||||
echo '<p>', $out, ' ';
|
||||
echo '<a href="inventory.php?f=view&id=', $row['invid'], '"><i class="bi-eye"></i></a>';
|
||||
echo "</p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// notes
|
||||
$sql = "SELECT taskid, taskname "
|
||||
. "FROM task "
|
||||
. "WHERE taskname LIKE :needle AND (vid IS NULL OR vid=:vid)";
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([':needle' => $sqlneedle, ':vid' => $user->vid]);
|
||||
if ($sth->rowCount() > 0) {
|
||||
echo '<h3>', _('Tasks'), "</h3>\n";
|
||||
foreach ($sth->fetchAll() as $row) {
|
||||
// mark needle in result
|
||||
$out = $row['taskname'];
|
||||
$p0 = stripos($out, $needle);
|
||||
if ($p0 >= 0) {
|
||||
$out = substr_replace($out, '</span>', $p0 + strlen($needle), 0);
|
||||
$out = substr_replace($out, '<span style="background:#ffef00;">', $p0, 0);
|
||||
}
|
||||
echo '<p>', $out, ' ';
|
||||
echo '<a href="task.php?f=view&id=', $row['taskid'], '"><i class="bi-eye"></i></a>';
|
||||
echo "</p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// notes
|
||||
$sql = "SELECT noteid, annotation "
|
||||
. "FROM note "
|
||||
. "WHERE annotation LIKE :needle";
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([':needle' => $sqlneedle]);
|
||||
if ($sth->rowCount() > 0) {
|
||||
echo '<h3>', _('Annotations'), "</h3>\n";
|
||||
foreach ($sth->fetchAll() as $row) {
|
||||
// mark needle in result
|
||||
$out = $row['annotation'];
|
||||
$p0 = stripos($out, $needle);
|
||||
if ($p0 >= 0) {
|
||||
$out = substr_replace($out, '</span>', $p0 + strlen($needle), 0);
|
||||
$out = substr_replace($out, '<span style="background:#ffef00;">', $p0, 0);
|
||||
}
|
||||
echo '<p>', $out, ' ';
|
||||
echo '<a href="note.php?f=view&id=', $row['noteid'], '"><i class="bi-eye"></i></a>';
|
||||
echo "</p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
include 'footer.php';
|
||||
|
||||
Reference in New Issue
Block a user