diff --git a/includes/pages/admin_angel_types.php b/includes/pages/admin_angel_types.php index f9c39ebf..a6c4130d 100644 --- a/includes/pages/admin_angel_types.php +++ b/includes/pages/admin_angel_types.php @@ -73,6 +73,7 @@ function admin_angel_types() { sql_query("DELETE FROM `NeededAngelTypes` WHERE `angel_type_id`=" . sql_escape($id) . " LIMIT 1"); sql_query("DELETE FROM `ShiftEntry` WHERE `TID`=" . sql_escape($id) . " LIMIT 1"); sql_query("DELETE FROM `AngelTypes` WHERE `id`=" . sql_escape($id) . " LIMIT 1"); + sql_query("DELETE FROM `UserAngelTypes` WHERE `angeltype_id`=" . sql_escape($id) . " LIMIT 1"); success(sprintf("Angel type %s deleted.", $name)); redirect(page_link_to('admin_angel_types')); } diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 62f312ea..2474f941 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -1,6 +1,6 @@ \n"; $html .= "\n"; @@ -56,20 +57,7 @@ function admin_user() { "\n"; $html .= " \n"; + html_select_key('size', 'size', $tshirt_sizes, mysql_result($Erg, 0, "Size")) . "\n"; $options = array ( '1' => "Yes", @@ -101,6 +89,49 @@ function admin_user() { $html .= "
"; + // UserAngelType subform + list ($user_source) = sql_select($SQL); + + $selected_angel_types_source = sql_select("SELECT * FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user_source['UID'])); + $selected_angel_types = array (); + foreach ($selected_angel_types_source as $selected_angel_type) + $selected_angel_types[] = $selected_angel_type['angeltype_id']; + + $angel_types_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`"); + $angel_types = array (); + foreach ($angel_types_source as $angel_type) + $angel_types[$angel_type['id']] = $angel_type['name'] . ($angel_type['restricted'] ? " (restricted)" : ""); + + if (isset ($_REQUEST['submit_user_angeltypes'])) { + $selected_angel_types = array (); + foreach ($angel_types as $angel_type_id => $angel_type_name) + if (isset ($_REQUEST['angel_types_' . $angel_type_id])) + $selected_angel_types[] = $angel_type_id; + + // Assign angel-types + foreach ($angel_types_source as $angel_type) + if (!in_array($angel_type['id'], $selected_angel_types)) + sql_query("DELETE FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user_source['UID']) . " AND `angeltype_id`=" . sql_escape($angel_type['id']) . " LIMIT 1"); + + foreach ($selected_angel_types as $selected_angel_type_id) + if (sql_num_query("SELECT * FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user_source['UID']) . " AND `angeltype_id`=" . sql_escape($selected_angel_type_id) . " LIMIT 1") == 0) + if (in_array("admin_user_angeltypes", $privileges)) + sql_query("INSERT INTO `UserAngelTypes` SET `confirm_user_id`=" . sql_escape($user['UID']) . ", `user_id`=" . sql_escape($user_source['UID']) . ", `angeltype_id`=" . sql_escape($selected_angel_type_id)); + else + sql_query("INSERT INTO `UserAngelTypes` SET `user_id`=" . sql_escape($user_source['UID']) . ", `angeltype_id`=" . sql_escape($selected_angel_type_id)); + + success("Angeltypes saved."); + redirect(page_link_to('admin_user') . '&id=' . $user_source['UID']); + } + + $html .= form(array ( + msg(), + form_checkboxes('angel_types', "Angeltypes", $angel_types, $selected_angel_types), + form_submit('submit_user_angeltypes', Get_Text("Save")) + )); + + $html .= "
"; + $html .= "Hier kannst Du das Passwort dieses Engels neu setzen:\n"; $html .= "
Size" . - html_select_key('size', 'size', array ( - 'S' => "S", - 'M' => "M", - 'L' => "L", - 'XL' => "XL", - '2XL' => "2XL", - '3XL' => "3XL", - '4XL' => "4XL", - '5XL' => "5XL", - 'S-G' => "S Girl", - 'M-G' => "M Girl", - 'L-G' => "L Girl", - 'XL-G' => "XL Girl" - ), mysql_result($Erg, 0, "Size")) . "
\n"; $html .= "
Passwort" . @@ -232,23 +263,23 @@ function admin_user() { $html .= "Anzahl Engel: $Zeilen

\n"; $html .= ' - - - - - - - - - - - - - '; +
- Nick - Vorname NameAlter - E-Mail - GrößeGekommenAktivT-ShirtRegistriertÄnd.
+ + + + + + + + + + + + '; $Gekommen = 0; $Active = 0; $Tshirt = 0;
+ Nick + Vorname NameAlter + E-Mail + GrößeGekommenAktivT-ShirtRegistriertÄnd.