summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2011-07-19 21:18:14 +0200
committerPhilip Häusler <msquare@notrademark.de>2011-07-19 21:18:14 +0200
commitc3a9e66c323035d989aca0e4ded08df7f86bbd32 (patch)
treefaddff14f154e1cf58b072b354c76158fbadb422
parent24e402c6e0c2717d296eff7c95dba45110511465 (diff)
#2 search function for arrived angels
-rw-r--r--includes/pages/admin_arrive.php27
-rw-r--r--templates/admin_arrive.html5
2 files changed, 25 insertions, 7 deletions
diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php
index 2a6791e8..e55a2e6f 100644
--- a/includes/pages/admin_arrive.php
+++ b/includes/pages/admin_arrive.php
@@ -1,6 +1,9 @@
<?php
function admin_arrive() {
$msg = "";
+ $search = "";
+ if (isset ($_REQUEST['search']))
+ $search = strip_request_item('search');
if (isset ($_REQUEST['reset']) && preg_match("/^[0-9]*$/", $_REQUEST['reset'])) {
$id = $_REQUEST['reset'];
@@ -15,19 +18,35 @@ function admin_arrive() {
$users = sql_select("SELECT * FROM `User` ORDER BY `Nick`");
$table = "";
+ if ($search == "")
+ $tokens = array ();
+ else
+ $tokens = explode(" ", $search);
foreach ($users as $usr) {
+ if (count($tokens) > 0) {
+ $match = false;
+ $index = join("", $usr);
+ foreach ($tokens as $t)
+ if (strstr($index, trim($t))) {
+ $match = true;
+ break;
+ }
+ if (!$match)
+ continue;
+ }
$table .= '<tr>';
$table .= '<td>' . $usr['Nick'] . '</td>';
if ($usr['Gekommen'] == 1)
- $table .= '<td>yes</td><td><a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '">reset</a></td>';
+ $table .= '<td>yes</td><td><a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">reset</a></td>';
else
- $table .= '<td></td><td><a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '">arrived</a></td>';
+ $table .= '<td></td><td><a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">arrived</a></td>';
$table .= '</tr>';
}
return template_render('../templates/admin_arrive.html', array (
- 'search' => "",
+ 'search' => $search,
'table' => $table,
- 'msg' => $msg
+ 'msg' => $msg,
+ 'link' => page_link_to('admin_arrive')
));
}
?> \ No newline at end of file
diff --git a/templates/admin_arrive.html b/templates/admin_arrive.html
index 2711371d..5bc8c32b 100644
--- a/templates/admin_arrive.html
+++ b/templates/admin_arrive.html
@@ -1,9 +1,8 @@
-<form action="" method="post">
+<form action="%link%" method="post">
<p>
<input type="text" name="search" value="%search%" /><input type="submit" name="submit" value="Search" />
</p>
-</form>
-%msg%
+</form>%msg%
<table>
<thead>
<tr>