force active function

This commit is contained in:
Philip Häusler 2013-12-28 03:02:51 +01:00
parent af47aae69a
commit a9fb05b128
3 changed files with 151 additions and 171 deletions

View File

@ -1,3 +1,6 @@
/* force active */
ALTER TABLE `User` ADD `force_active` BOOLEAN NOT NULL AFTER `Aktiv`, ADD INDEX ( `force_active` );
/* freeloader */ /* freeloader */
ALTER TABLE `ShiftEntry` ADD `freeloaded` BOOLEAN NOT NULL, ADD INDEX ( `freeloaded` ); ALTER TABLE `ShiftEntry` ADD `freeloaded` BOOLEAN NOT NULL, ADD INDEX ( `freeloaded` );
ALTER TABLE `ShiftEntry` ADD `freeload_comment` TEXT NULL DEFAULT NULL; ALTER TABLE `ShiftEntry` ADD `freeload_comment` TEXT NULL DEFAULT NULL;

View File

@ -8,7 +8,8 @@ function admin_active() {
$msg = ""; $msg = "";
$search = ""; $search = "";
$count = 0; $forced_count = sql_num_query("SELECT * FROM `User` WHERE `force_active`=1");
$count = $forced_count;
$limit = ""; $limit = "";
$set_active = ""; $set_active = "";
if (isset($_REQUEST['search'])) if (isset($_REQUEST['search']))
@ -16,9 +17,13 @@ function admin_active() {
if (isset($_REQUEST['set_active'])) { if (isset($_REQUEST['set_active'])) {
$ok = true; $ok = true;
if (isset($_REQUEST['count']) && preg_match("/^[0-9]+$/", $_REQUEST['count'])) if (isset($_REQUEST['count']) && preg_match("/^[0-9]+$/", $_REQUEST['count'])) {
$count = strip_request_item('count'); $count = strip_request_item('count');
else { if ($count < $forced_count) {
error(sprintf(_("At least %s angels are forced to be active. The number has to be greater."), $forced_count));
redirect(page_link_to('admin_active'));
}
} else {
$ok = false; $ok = false;
$msg .= error(_("Please enter a number of angels to be marked as active."), true); $msg .= error(_("Please enter a number of angels to be marked as active."), true);
} }
@ -27,7 +32,7 @@ function admin_active() {
$limit = " LIMIT " . $count; $limit = " LIMIT " . $count;
if (isset($_REQUEST['ack'])) { if (isset($_REQUEST['ack'])) {
sql_query("UPDATE `User` SET `Aktiv` = 0 WHERE `Tshirt` = 0"); sql_query("UPDATE `User` SET `Aktiv` = 0 WHERE `Tshirt` = 0");
$users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, ${shift_sum_formula} as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 GROUP BY `User`.`UID` ORDER BY `shift_length` DESC" . $limit); $users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, ${shift_sum_formula} as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 AND `User`.`force_active`=0 GROUP BY `User`.`UID` ORDER BY `force_active` DESC, `shift_length` DESC" . $limit);
$user_nicks = array(); $user_nicks = array();
foreach ($users as $usr) { foreach ($users as $usr) {
sql_query("UPDATE `User` SET `Aktiv` = 1 WHERE `UID`=" . sql_escape($usr['UID'])); sql_query("UPDATE `User` SET `Aktiv` = 1 WHERE `UID`=" . sql_escape($usr['UID']));
@ -80,7 +85,7 @@ function admin_active() {
$msg = error(_("Angel not found."), true); $msg = error(_("Angel not found."), true);
} }
$users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, ${shift_sum_formula} as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 GROUP BY `User`.`UID` ORDER BY `shift_length` DESC" . $limit); $users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, ${shift_sum_formula} as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 GROUP BY `User`.`UID` ORDER BY `force_active` DESC, `shift_length` DESC" . $limit);
$matched_users = array(); $matched_users = array();
if ($search == "") if ($search == "")
@ -102,8 +107,9 @@ function admin_active() {
$usr['nick'] = User_Nick_render($usr); $usr['nick'] = User_Nick_render($usr);
$usr['shirt_size'] = $tshirt_sizes[$usr['Size']]; $usr['shirt_size'] = $tshirt_sizes[$usr['Size']];
$usr['work_time'] = round($usr['shift_length'] / 60) . ' min (' . round($usr['shift_length'] / 3600) . ' h)'; $usr['work_time'] = round($usr['shift_length'] / 60) . ' min (' . round($usr['shift_length'] / 3600) . ' h)';
$usr['active'] = $usr['Aktiv'] == 1 ? _("yes") : ""; $usr['active'] = '<img src="pic/icons/' . ($usr['Aktiv'] == 1 ? 'tick' : 'cross') . '.png" alt="' . $usr['Aktiv'] . '">';
$usr['tshirt'] = $usr['Tshirt'] == 1 ? _("yes") : ""; $usr['force_active'] = '<img src="pic/icons/' . ($usr['force_active'] == 1 ? 'tick' : 'cross') . '.png" alt="' . $usr['force_active'] . '">';
$usr['tshirt'] = '<img src="pic/icons/' . ($usr['Tshirt'] == 1 ? 'tick' : 'cross') . '.png" alt="' . $usr['Tshirt'] . '">';
$actions = array(); $actions = array();
if ($usr['Aktiv'] == 0) if ($usr['Aktiv'] == 0)
@ -135,6 +141,7 @@ function admin_active() {
'shift_count' => _("Shifts"), 'shift_count' => _("Shifts"),
'work_time' => _("Length"), 'work_time' => _("Length"),
'active' => _("Active?"), 'active' => _("Active?"),
'force_active' => _("Forced"),
'tshirt' => _("T-shirt?"), 'tshirt' => _("T-shirt?"),
'actions' => "" 'actions' => ""
), $matched_users) ), $matched_users)

View File

@ -11,12 +11,7 @@ function admin_user() {
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['id']) && sql_num_query("SELECT * FROM `User` WHERE `UID`=" . sql_escape($_REQUEST['id'])) > 0) { if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['id']) && sql_num_query("SELECT * FROM `User` WHERE `UID`=" . sql_escape($_REQUEST['id'])) > 0) {
$id = $_REQUEST['id']; $id = $_REQUEST['id'];
if (! isset($_REQUEST['action'])) { if (! isset($_REQUEST['action'])) {
$html .= "Hallo,<br />" . $html .= "Hallo,<br />" . "hier kannst du den Eintrag &auml;ndern. Unter dem Punkt 'Gekommen' " . "wird der Engel als anwesend markiert, ein Ja bei Aktiv bedeutet, " . "dass der Engel aktiv war und damit ein Anspruch auf ein T-Shirt hat. " . "Wenn T-Shirt ein 'Ja' enth&auml;lt, bedeutet dies, dass der Engel " . "bereits sein T-Shirt erhalten hat.<br /><br />\n";
"hier kannst du den Eintrag &auml;ndern. Unter dem Punkt 'Gekommen' " .
"wird der Engel als anwesend markiert, ein Ja bei Aktiv bedeutet, " .
"dass der Engel aktiv war und damit ein Anspruch auf ein T-Shirt hat. " .
"Wenn T-Shirt ein 'Ja' enth&auml;lt, bedeutet dies, dass der Engel " .
"bereits sein T-Shirt erhalten hat.<br /><br />\n";
$html .= "<form action=\"" . page_link_to("admin_user") . "&action=save&id=$id\" method=\"post\">\n"; $html .= "<form action=\"" . page_link_to("admin_user") . "&action=save&id=$id\" method=\"post\">\n";
$html .= "<table border=\"0\">\n"; $html .= "<table border=\"0\">\n";
@ -28,40 +23,18 @@ function admin_user() {
$html .= "<tr><td>\n"; $html .= "<tr><td>\n";
$html .= "<table>\n"; $html .= "<table>\n";
$html .= " <tr><td>Nick</td><td>" . $html .= " <tr><td>Nick</td><td>" . "<input type=\"text\" size=\"40\" name=\"eNick\" value=\"" . $user_source['Nick'] . "\"></td></tr>\n";
"<input type=\"text\" size=\"40\" name=\"eNick\" value=\"" . $html .= " <tr><td>lastLogIn</td><td>" . date("Y-m-d H:i", $user_source['lastLogIn']) . "</td></tr>\n";
$user_source['Nick'] . "\"></td></tr>\n"; $html .= " <tr><td>Name</td><td>" . "<input type=\"text\" size=\"40\" name=\"eName\" value=\"" . $user_source['Name'] . "\"></td></tr>\n";
$html .= " <tr><td>lastLogIn</td><td>" . $html .= " <tr><td>Vorname</td><td>" . "<input type=\"text\" size=\"40\" name=\"eVorname\" value=\"" . $user_source['Vorname'] . "\"></td></tr>\n";
date("Y-m-d H:i", $user_source['lastLogIn']) . "</td></tr>\n"; $html .= " <tr><td>Alter</td><td>" . "<input type=\"text\" size=\"5\" name=\"eAlter\" value=\"" . $user_source['Alter'] . "\"></td></tr>\n";
$html .= " <tr><td>Name</td><td>" . $html .= " <tr><td>Telefon</td><td>" . "<input type=\"text\" size=\"40\" name=\"eTelefon\" value=\"" . $user_source['Telefon'] . "\"></td></tr>\n";
"<input type=\"text\" size=\"40\" name=\"eName\" value=\"" . $html .= " <tr><td>Handy</td><td>" . "<input type=\"text\" size=\"40\" name=\"eHandy\" value=\"" . $user_source['Handy'] . "\"></td></tr>\n";
$user_source['Name'] . "\"></td></tr>\n"; $html .= " <tr><td>DECT</td><td>" . "<input type=\"text\" size=\"4\" name=\"eDECT\" value=\"" . $user_source['DECT'] . "\"></td></tr>\n";
$html .= " <tr><td>Vorname</td><td>" . $html .= " <tr><td>email</td><td>" . "<input type=\"text\" size=\"40\" name=\"eemail\" value=\"" . $user_source['email'] . "\"></td></tr>\n";
"<input type=\"text\" size=\"40\" name=\"eVorname\" value=\"" . $html .= " <tr><td>ICQ</td><td>" . "<input type=\"text\" size=\"40\" name=\"eICQ\" value=\"" . $user_source['ICQ'] . "\"></td></tr>\n";
$user_source['Vorname'] . "\"></td></tr>\n"; $html .= " <tr><td>jabber</td><td>" . "<input type=\"text\" size=\"40\" name=\"ejabber\" value=\"" . $user_source['jabber'] . "\"></td></tr>\n";
$html .= " <tr><td>Alter</td><td>" . $html .= " <tr><td>Size</td><td>" . html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size']) . "</td></tr>\n";
"<input type=\"text\" size=\"5\" name=\"eAlter\" value=\"" .
$user_source['Alter'] . "\"></td></tr>\n";
$html .= " <tr><td>Telefon</td><td>" .
"<input type=\"text\" size=\"40\" name=\"eTelefon\" value=\"" .
$user_source['Telefon'] . "\"></td></tr>\n";
$html .= " <tr><td>Handy</td><td>" .
"<input type=\"text\" size=\"40\" name=\"eHandy\" value=\"" .
$user_source['Handy'] . "\"></td></tr>\n";
$html .= " <tr><td>DECT</td><td>" .
"<input type=\"text\" size=\"4\" name=\"eDECT\" value=\"" .
$user_source['DECT'] . "\"></td></tr>\n";
$html .= " <tr><td>email</td><td>" .
"<input type=\"text\" size=\"40\" name=\"eemail\" value=\"" .
$user_source['email'] . "\"></td></tr>\n";
$html .= " <tr><td>ICQ</td><td>" .
"<input type=\"text\" size=\"40\" name=\"eICQ\" value=\"" .
$user_source['ICQ'] . "\"></td></tr>\n";
$html .= " <tr><td>jabber</td><td>" .
"<input type=\"text\" size=\"40\" name=\"ejabber\" value=\"" .
$user_source['jabber'] . "\"></td></tr>\n";
$html .= " <tr><td>Size</td><td>" .
html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size']) . "</td></tr>\n";
$options = array( $options = array(
'1' => "Yes", '1' => "Yes",
@ -76,13 +49,17 @@ function admin_user() {
$html .= " <tr><td>Aktiv</td><td>\n"; $html .= " <tr><td>Aktiv</td><td>\n";
$html .= html_options('eAktiv', $options, $user_source['Aktiv']) . "</td></tr>\n"; $html .= html_options('eAktiv', $options, $user_source['Aktiv']) . "</td></tr>\n";
// Aktiv erzwingen
if (in_array('admin_active', $privileges)) {
$html .= " <tr><td>" . _("Force active") . "</td><td>\n";
$html .= html_options('force_active', $options, $user_source['force_active']) . "</td></tr>\n";
}
// T-Shirt bekommen? // T-Shirt bekommen?
$html .= " <tr><td>T-Shirt</td><td>\n"; $html .= " <tr><td>T-Shirt</td><td>\n";
$html .= html_options('eTshirt', $options, $user_source['Tshirt']) . "</td></tr>\n"; $html .= html_options('eTshirt', $options, $user_source['Tshirt']) . "</td></tr>\n";
$html .= " <tr><td>Hometown</td><td>" . $html .= " <tr><td>Hometown</td><td>" . "<input type=\"text\" size=\"40\" name=\"Hometown\" value=\"" . $user_source['Hometown'] . "\"></td></tr>\n";
"<input type=\"text\" size=\"40\" name=\"Hometown\" value=\"" .
$user_source['Hometown'] . "\"></td></tr>\n";
$html .= "</table>\n</td><td valign=\"top\">" . User_Avatar_render($user_source) . "</td></tr>"; $html .= "</table>\n</td><td valign=\"top\">" . User_Avatar_render($user_source) . "</td></tr>";
@ -106,12 +83,8 @@ function admin_user() {
$angel_types[$angel_type['id']] = $angel_type['name']; $angel_types[$angel_type['id']] = $angel_type['name'];
if (isset($_REQUEST['submit_user_angeltypes'])) { if (isset($_REQUEST['submit_user_angeltypes'])) {
$selected_angel_types = isset($_REQUEST['selected_angel_types']) && is_array($_REQUEST['selected_angel_types'])? $selected_angel_types = isset($_REQUEST['selected_angel_types']) && is_array($_REQUEST['selected_angel_types']) ? array_intersect($_REQUEST['selected_angel_types'], array_keys($angel_types)) : array();
array_intersect($_REQUEST['selected_angel_types'], array_keys($angel_types)) $accepted_angel_types = isset($_REQUEST['accepted_angel_types']) && is_array($_REQUEST['accepted_angel_types']) ? array_unique(array_diff(array_intersect($_REQUEST['accepted_angel_types'], array_keys($angel_types)), $nonrestricted_angel_types)) : array();
: array();
$accepted_angel_types = isset($_REQUEST['accepted_angel_types']) && is_array($_REQUEST['accepted_angel_types'])?
array_unique(array_diff(array_intersect($_REQUEST['accepted_angel_types'], array_keys($angel_types)), $nonrestricted_angel_types))
: array();
if (in_array("admin_user_angeltypes", $privileges)) if (in_array("admin_user_angeltypes", $privileges))
$selected_angel_types = array_merge((array) $selected_angel_types, $accepted_angel_types); $selected_angel_types = array_merge((array) $selected_angel_types, $accepted_angel_types);
$selected_angel_types = array_unique($selected_angel_types); $selected_angel_types = array_unique($selected_angel_types);
@ -144,11 +117,15 @@ function admin_user() {
$html .= form(array( $html .= form(array(
msg(), msg(),
form_multi_checkboxes(array('selected_angel_types' => 'gewünscht', 'accepted_angel_types' => 'akzeptiert'), form_multi_checkboxes(array(
"Angeltypes", 'selected_angel_types' => 'gewünscht',
$angel_types, 'accepted_angel_types' => 'akzeptiert'
array('selected_angel_types' => $selected_angel_types, 'accepted_angel_types' => array_merge($accepted_angel_types, $nonrestricted_angel_types)), ), "Angeltypes", $angel_types, array(
array('accepted_angel_types' => $nonrestricted_angel_types)), 'selected_angel_types' => $selected_angel_types,
'accepted_angel_types' => array_merge($accepted_angel_types, $nonrestricted_angel_types)
), array(
'accepted_angel_types' => $nonrestricted_angel_types
)),
form_submit('submit_user_angeltypes', _("Save")) form_submit('submit_user_angeltypes', _("Save"))
)); ));
@ -156,10 +133,8 @@ function admin_user() {
$html .= "Hier kannst Du das Passwort dieses Engels neu setzen:<form action=\"" . page_link_to("admin_user") . "&action=change_pw&id=$id\" method=\"post\">\n"; $html .= "Hier kannst Du das Passwort dieses Engels neu setzen:<form action=\"" . page_link_to("admin_user") . "&action=change_pw&id=$id\" method=\"post\">\n";
$html .= "<table>\n"; $html .= "<table>\n";
$html .= " <tr><td>Passwort</td><td>" . $html .= " <tr><td>Passwort</td><td>" . "<input type=\"password\" size=\"40\" name=\"new_pw\" value=\"\"></td></tr>\n";
"<input type=\"password\" size=\"40\" name=\"new_pw\" value=\"\"></td></tr>\n"; $html .= " <tr><td>Wiederholung</td><td>" . "<input type=\"password\" size=\"40\" name=\"new_pw2\" value=\"\"></td></tr>\n";
$html .= " <tr><td>Wiederholung</td><td>" .
"<input type=\"password\" size=\"40\" name=\"new_pw2\" value=\"\"></td></tr>\n";
$html .= "</table>"; $html .= "</table>";
$html .= "<input type=\"submit\" value=\"Speichern\">\n"; $html .= "<input type=\"submit\" value=\"Speichern\">\n";
@ -248,23 +223,11 @@ function admin_user() {
break; break;
case 'save': case 'save':
$forced_active = $user['force_active'];
if (in_array('admin_active', $privileges))
$forced_active = $_REQUEST['force_active'];
$SQL = "UPDATE `User` SET "; $SQL = "UPDATE `User` SET ";
$SQL .= " `Nick` = '" . sql_escape($_POST["eNick"]) . "', `Name` = '" . sql_escape($_POST["eName"]) . "', " . $SQL .= " `Nick` = '" . sql_escape($_POST["eNick"]) . "', `Name` = '" . sql_escape($_POST["eName"]) . "', " . "`Vorname` = '" . sql_escape($_POST["eVorname"]) . "', " . "`Telefon` = '" . sql_escape($_POST["eTelefon"]) . "', " . "`Handy` = '" . sql_escape($_POST["eHandy"]) . "', " . "`Alter` = '" . sql_escape($_POST["eAlter"]) . "', " . "`DECT` = '" . sql_escape($_POST["eDECT"]) . "', " . "`email` = '" . sql_escape($_POST["eemail"]) . "', " . "`ICQ` = '" . sql_escape($_POST["eICQ"]) . "', " . "`jabber` = '" . sql_escape($_POST["ejabber"]) . "', " . "`Size` = '" . sql_escape($_POST["eSize"]) . "', " . "`Gekommen`= '" . sql_escape($_POST["eGekommen"]) . "', " . "`Aktiv`= '" . sql_escape($_POST["eAktiv"]) . "', " . "`force_active`= " . sql_escape($force_active) . ", " . "`Tshirt` = '" . sql_escape($_POST["eTshirt"]) . "', " . "`Hometown` = '" . sql_escape($_POST["Hometown"]) . "' " . "WHERE `UID` = '" . sql_escape($id) . "' LIMIT 1;";
"`Vorname` = '" . sql_escape($_POST["eVorname"]) . "', " .
"`Telefon` = '" . sql_escape($_POST["eTelefon"]) . "', " .
"`Handy` = '" . sql_escape($_POST["eHandy"]) . "', " .
"`Alter` = '" . sql_escape($_POST["eAlter"]) . "', " .
"`DECT` = '" . sql_escape($_POST["eDECT"]) . "', " .
"`email` = '" . sql_escape($_POST["eemail"]) . "', " .
"`ICQ` = '" . sql_escape($_POST["eICQ"]) . "', " .
"`jabber` = '" . sql_escape($_POST["ejabber"]) . "', " .
"`Size` = '" . sql_escape($_POST["eSize"]) . "', " .
"`Gekommen`= '" . sql_escape($_POST["eGekommen"]) . "', " .
"`Aktiv`= '" . sql_escape($_POST["eAktiv"]) . "', " .
"`Tshirt` = '" . sql_escape($_POST["eTshirt"]) . "', " .
"`Hometown` = '" . sql_escape($_POST["Hometown"]) . "' " .
"WHERE `UID` = '" . sql_escape($id) .
"' LIMIT 1;";
sql_query($SQL); sql_query($SQL);
engelsystem_log("Updated user: " . $_POST["eNick"] . ", " . $_POST["eSize"] . ", arrived: " . $_POST["eGekommen"] . ", active: " . $_POST["eAktiv"] . ", tshirt: " . $_POST["eTshirt"]); engelsystem_log("Updated user: " . $_POST["eNick"] . ", " . $_POST["eSize"] . ", arrived: " . $_POST["eGekommen"] . ", active: " . $_POST["eAktiv"] . ", tshirt: " . $_POST["eTshirt"]);
$html .= success("Änderung wurde gespeichert...\n", true); $html .= success("Änderung wurde gespeichert...\n", true);
@ -325,17 +288,23 @@ function admin_user() {
'email' => '<a href="mailto:' . htmlspecialchars($angel['email']) . '">' . htmlspecialchars($angel['email']) . '</a>' . $popup, 'email' => '<a href="mailto:' . htmlspecialchars($angel['email']) . '">' . htmlspecialchars($angel['email']) . '</a>' . $popup,
'Gekommen' => '<img src="pic/icons/' . ($angel['Gekommen'] == 1 ? 'tick' : 'cross') . '.png" alt="' . $angel['Gekommen'] . '">', 'Gekommen' => '<img src="pic/icons/' . ($angel['Gekommen'] == 1 ? 'tick' : 'cross') . '.png" alt="' . $angel['Gekommen'] . '">',
'Aktiv' => '<img src="pic/icons/' . ($angel['Aktiv'] == 1 ? 'tick' : 'cross') . '.png" alt="' . $angel['Aktiv'] . '">', 'Aktiv' => '<img src="pic/icons/' . ($angel['Aktiv'] == 1 ? 'tick' : 'cross') . '.png" alt="' . $angel['Aktiv'] . '">',
'force_active' => '<img src="pic/icons/' . ($angel['force_active'] == 1 ? 'tick' : 'cross') . '.png" alt="' . $angel['force_active'] . '">',
'Tshirt' => '<img src="pic/icons/' . ($angel['Tshirt'] == 1 ? 'tick' : 'cross') . '.png" alt="' . $angel['Tshirt'] . '">', 'Tshirt' => '<img src="pic/icons/' . ($angel['Tshirt'] == 1 ? 'tick' : 'cross') . '.png" alt="' . $angel['Tshirt'] . '">',
'Size' => $angel['Size'], 'Size' => $angel['Size'],
'lastLogIn' => date('d.m.&\n\b\s\p;H:i', $angel['lastLogIn']), 'lastLogIn' => date('d.m.&\n\b\s\p;H:i', $angel['lastLogIn']),
'edit' => img_button(page_link_to('admin_user') . '&id=' . $angel['UID'], 'pencil', _("edit")), 'edit' => img_button(page_link_to('admin_user') . '&id=' . $angel['UID'], 'pencil', _("edit"))
); );
} }
$angels = array_map('prepare_angel_table', $angels); $angels = array_map('prepare_angel_table', $angels);
$Gekommen = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Gekommen` = 1"); $Gekommen = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Gekommen` = 1");
$Active = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Aktiv` = 1"); $Active = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Aktiv` = 1");
$Tshirt = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Tshirt` = 1"); $Tshirt = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Tshirt` = 1");
$angels[] = array('Nick' => '<strong>Summe</strong>', 'Gekommen' => $Gekommen, 'Aktiv' => $Active, 'Tshirt' => $Tshirt); $angels[] = array(
'Nick' => '<strong>Summe</strong>',
'Gekommen' => $Gekommen,
'Aktiv' => $Active,
'Tshirt' => $Tshirt
);
$html .= table(array( $html .= table(array(
'Nick' => '<a href="' . page_link_to("admin_user") . '&amp;OrderBy=Nick">Nick</a>', 'Nick' => '<a href="' . page_link_to("admin_user") . '&amp;OrderBy=Nick">Nick</a>',
'Name' => '<a href="' . page_link_to("admin_user") . '&amp;OrderBy=Vorname">Vorname</a> <a href="' . page_link_to("admin_user") . '&amp;OrderBy=Name">Name</a>', 'Name' => '<a href="' . page_link_to("admin_user") . '&amp;OrderBy=Vorname">Vorname</a> <a href="' . page_link_to("admin_user") . '&amp;OrderBy=Name">Name</a>',
@ -344,11 +313,12 @@ function admin_user() {
'email' => '<a href="' . page_link_to("admin_user") . '&amp;OrderBy=email">E-Mail</a>', 'email' => '<a href="' . page_link_to("admin_user") . '&amp;OrderBy=email">E-Mail</a>',
'Gekommen' => '<div class="rotate"><a href="' . page_link_to("admin_user") . '&amp;OrderBy=Gekommen">Gekommen</a></div>', 'Gekommen' => '<div class="rotate"><a href="' . page_link_to("admin_user") . '&amp;OrderBy=Gekommen">Gekommen</a></div>',
'Aktiv' => '<div class="rotate"><a href="' . page_link_to("admin_user") . '&amp;OrderBy=Aktiv">Aktiv</a></div>', 'Aktiv' => '<div class="rotate"><a href="' . page_link_to("admin_user") . '&amp;OrderBy=Aktiv">Aktiv</a></div>',
'force_active' => '<div class="rotate"><a href="' . page_link_to("admin_user") . '&amp;OrderBy=force_active">' . _("Forced") . '</a></div>',
'Tshirt' => '<div class="rotate"><a href="' . page_link_to("admin_user") . '&amp;OrderBy=Tshirt">T-Shirt</a></div>', 'Tshirt' => '<div class="rotate"><a href="' . page_link_to("admin_user") . '&amp;OrderBy=Tshirt">T-Shirt</a></div>',
'Size' => '<div class="rotate"><a href="' . page_link_to("admin_user") . '&amp;OrderBy=Size">Gr&ouml;&szlig;e</a></div>', 'Size' => '<div class="rotate"><a href="' . page_link_to("admin_user") . '&amp;OrderBy=Size">Gr&ouml;&szlig;e</a></div>',
'lastLogIn' => '<a href="' . page_link_to("admin_user") . '&amp;OrderBy=lastLogIn">Last login</a>', 'lastLogIn' => '<a href="' . page_link_to("admin_user") . '&amp;OrderBy=lastLogIn">Last login</a>',
'edit' => ''), 'edit' => ''
$angels); ), $angels);
} }
return $html; return $html;
} }