diff options
author | Philip Häusler <msquare@notrademark.de> | 2011-07-19 21:08:19 +0200 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2011-07-19 21:08:19 +0200 |
commit | 24e402c6e0c2717d296eff7c95dba45110511465 (patch) | |
tree | c7a34a4d4d1bb7d3f0c82165cd4aab38d586910e /includes | |
parent | fb15edc6059113c179fa5d45a418f5584002b63b (diff) |
#2 mark angels as arrived
Diffstat (limited to 'includes')
-rw-r--r-- | includes/pages/admin_arrive.php | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php index ff73fb95..2a6791e8 100644 --- a/includes/pages/admin_arrive.php +++ b/includes/pages/admin_arrive.php @@ -1,5 +1,33 @@ <?php function admin_arrive() { - return "bla"; + $msg = ""; + + if (isset ($_REQUEST['reset']) && preg_match("/^[0-9]*$/", $_REQUEST['reset'])) { + $id = $_REQUEST['reset']; + sql_query("UPDATE `User` SET `Gekommen`=0 WHERE `UID`=" . sql_escape($id) . " LIMIT 1"); + $msg = success("Reset done. Angel has not arrived."); + } + elseif (isset ($_REQUEST['arrived']) && preg_match("/^[0-9]*$/", $_REQUEST['arrived'])) { + $id = $_REQUEST['arrived']; + sql_query("UPDATE `User` SET `Gekommen`=1 WHERE `UID`=" . sql_escape($id) . " LIMIT 1"); + $msg = success("Angel has been marked as arrived."); + } + + $users = sql_select("SELECT * FROM `User` ORDER BY `Nick`"); + $table = ""; + foreach ($users as $usr) { + $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>'; + else + $table .= '<td></td><td><a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '">arrived</a></td>'; + $table .= '</tr>'; + } + return template_render('../templates/admin_arrive.html', array ( + 'search' => "", + 'table' => $table, + 'msg' => $msg + )); } ?>
\ No newline at end of file |