#2 mark angels as arrived

This commit is contained in:
Philip Häusler 2011-07-19 21:08:19 +02:00
parent fb15edc605
commit 24e402c6e0
4 changed files with 65 additions and 15 deletions

View File

@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net -- http://www.phpmyadmin.net
-- --
-- Host: localhost -- Host: localhost
-- Erstellungszeit: 19. Juli 2011 um 17:30 -- Erstellungszeit: 19. Juli 2011 um 19:07
-- Server Version: 5.1.44 -- Server Version: 5.1.44
-- PHP-Version: 5.3.1 -- PHP-Version: 5.3.1
@ -70,32 +70,32 @@ CREATE TABLE IF NOT EXISTS `Counter` (
-- --
INSERT INTO `Counter` (`URL`, `Anz`) VALUES INSERT INTO `Counter` (`URL`, `Anz`) VALUES
('news', 242), ('news', 243),
('login', 85), ('login', 85),
('logout', 22), ('logout', 22),
('start', 59), ('start', 59),
('faq', 35), ('faq', 35),
('credits', 12), ('credits', 12),
('register', 24), ('register', 24),
('admin_rooms', 116), ('admin_rooms', 117),
('admin_angel_types', 84), ('admin_angel_types', 84),
('user_settings', 163), ('user_settings', 163),
('user_messages', 124), ('user_messages', 124),
('admin_groups', 187), ('admin_groups', 188),
('user_questions', 63), ('user_questions', 63),
('admin_questions', 51), ('admin_questions', 51),
('admin_faq', 60), ('admin_faq', 60),
('admin_news', 35), ('admin_news', 35),
('news_comments', 157), ('news_comments', 158),
('admin_user', 219), ('admin_user', 219),
('user_meetings', 13), ('user_meetings', 15),
('admin_language', 37), ('admin_language', 37),
('admin_log', 19), ('admin_log', 19),
('user_wakeup', 70), ('user_wakeup', 70),
('admin_import', 241), ('admin_import', 241),
('user_shifts', 368), ('user_shifts', 371),
('user_myshifts', 52), ('user_myshifts', 94),
('admin_arrive', 3); ('admin_arrive', 44);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -416,8 +416,6 @@ CREATE TABLE IF NOT EXISTS `ShiftEntry` (
-- Daten für Tabelle `ShiftEntry` -- Daten für Tabelle `ShiftEntry`
-- --
INSERT INTO `ShiftEntry` (`id`, `SID`, `TID`, `UID`, `Comment`) VALUES
(13, 130, 4, 1, 'asdfasdfasdf');
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -1194,8 +1192,8 @@ CREATE TABLE IF NOT EXISTS `User` (
-- --
INSERT INTO `User` (`UID`, `Nick`, `Name`, `Vorname`, `Alter`, `Telefon`, `DECT`, `Handy`, `email`, `ICQ`, `jabber`, `Size`, `Passwort`, `Gekommen`, `Aktiv`, `Tshirt`, `color`, `Sprache`, `Avatar`, `Menu`, `lastLogIn`, `CreateDate`, `Art`, `kommentar`, `Hometown`) VALUES INSERT INTO `User` (`UID`, `Nick`, `Name`, `Vorname`, `Alter`, `Telefon`, `DECT`, `Handy`, `email`, `ICQ`, `jabber`, `Size`, `Passwort`, `Gekommen`, `Aktiv`, `Tshirt`, `color`, `Sprache`, `Avatar`, `Menu`, `lastLogIn`, `CreateDate`, `Art`, `kommentar`, `Hometown`) VALUES
(1, 'admin', 'Gates', 'Bill', 42, '', '', '', '', '', '', '', '21232f297a57a5a743894a0e4a801fc3', 1, 1, 0, 10, 'DE', 115, 'L', 1311096594, '0000-00-00 00:00:00', '', '', ''), (1, 'admin', 'Gates', 'Bill', 42, '', '', '', '', '', '', '', '21232f297a57a5a743894a0e4a801fc3', 0, 1, 0, 10, 'DE', 115, 'L', 1311102448, '0000-00-00 00:00:00', '', '', ''),
(148, 'msquare', '', '', 23, '', '', '', 'msquare@notrademark.de', '', '', '', '4297f44b13955235245b2497399d7a93', 0, 1, 1, 10, 'DE', 0, 'L', 1307110798, '2011-06-03 07:55:24', 'AudioEngel', '', ''); (148, 'msquare', '', '', 23, '', '', '', 'msquare@notrademark.de', '', '', '', '4297f44b13955235245b2497399d7a93', 1, 1, 1, 10, 'DE', 0, 'L', 1307110798, '2011-06-03 07:55:24', 'AudioEngel', '', '');
-- -------------------------------------------------------- -- --------------------------------------------------------

View File

@ -1,5 +1,33 @@
<?php <?php
function admin_arrive() { 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
));
} }
?> ?>

View File

@ -58,7 +58,7 @@ a {
color: #000; color: #000;
} }
td, dt, dd { th, td, dt, dd {
padding: 4px; padding: 4px;
vertical-align: top; vertical-align: top;
} }

View File

@ -0,0 +1,24 @@
<form action="" method="post">
<p>
<input type="text" name="search" value="%search%" /><input type="submit" name="submit" value="Search" />
</p>
</form>
%msg%
<table>
<thead>
<tr>
<th>
Nickname
</th>
<th>
Arrived?
</th>
<th>
Action
</th>
</tr>
</thead>
<tbody>
%table%
</tbody>
</table>