PHP_AdminTool_Projekt/public/views/users_search.php

49 lines
2.0 KiB
PHP

<?php
declare(strict_types=1);
/**
* Platzhalter-View: Benutzer suchen
*/
?>
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Benutzer suchen</h6>
</div>
<div class="card-body">
<form method="get" action="index.php">
<input type="hidden" name="route" value="users.search">
<div class="form-group">
<label for="q">Suche</label>
<input id="q" name="q" class="form-control" value="<?= htmlspecialchars($query ?? '', ENT_QUOTES, 'UTF-8') ?>" placeholder="Namen, Benutzername oder E-Mail">
</div>
<button type="submit" class="btn btn-primary">Suchen</button>
<a href="index.php?route=users" class="btn btn-secondary">Zurück zur Liste</a>
</form>
<?php if (!empty($query)): ?>
<h6 class="mt-4">Ergebnisse für "<?= htmlspecialchars($query, ENT_QUOTES, 'UTF-8') ?>"</h6>
<?php if (!empty($results) && is_array($results)): ?>
<div class="table-responsive">
<table class="table table-sm">
<thead>
<tr><th>Benutzername</th><th>Name</th><th>E-Mail</th></tr>
</thead>
<tbody>
<?php foreach ($results as $r): ?>
<tr>
<td><?= htmlspecialchars($r['samaccountname'] ?? '', ENT_QUOTES, 'UTF-8') ?></td>
<td><?= htmlspecialchars($r['displayname'] ?? '', ENT_QUOTES, 'UTF-8') ?></td>
<td><?= htmlspecialchars($r['mail'] ?? '', ENT_QUOTES, 'UTF-8') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<div class="alert alert-info mt-3">Keine Treffer gefunden.</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>