#56 fixed problem with editing angels rights and angels can not subscribe running oder ended shifs now

This commit is contained in:
Philip Häusler 2012-05-19 16:41:00 +02:00
parent 2a944121f8
commit bc03069017
2 changed files with 355 additions and 349 deletions

View File

@ -179,8 +179,8 @@ function admin_user() {
switch ($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'save_groups' : case 'save_groups' :
if ($id != $user['UID']) { if ($id != $user['UID']) {
list ($my_highest_group) = sql_select("SELECT * FROM `UserGroups` WHERE `uid`=" . sql_escape($user['UID']) . " ORDER BY `uid`"); list ($my_highest_group) = sql_select("SELECT * FROM `UserGroups` WHERE `uid`=" . sql_escape($user['UID']) . " ORDER BY `group_id`");
list ($his_highest_group) = sql_select("SELECT * FROM `UserGroups` WHERE `uid`=" . sql_escape($id) . " ORDER BY `uid`"); list ($his_highest_group) = sql_select("SELECT * FROM `UserGroups` WHERE `uid`=" . sql_escape($id) . " ORDER BY `group_id`");
if ($my_highest_group <= $his_highest_group) { if ($my_highest_group <= $his_highest_group) {
$groups = sql_select("SELECT * FROM `Groups` LEFT OUTER JOIN `UserGroups` ON (`UserGroups`.`group_id` = `Groups`.`UID` AND `UserGroups`.`uid` = " . sql_escape($id) . ") WHERE `Groups`.`UID` >= " . sql_escape($my_highest_group['group_id']) . " ORDER BY `Groups`.`Name`"); $groups = sql_select("SELECT * FROM `Groups` LEFT OUTER JOIN `UserGroups` ON (`UserGroups`.`group_id` = `Groups`.`UID` AND `UserGroups`.`uid` = " . sql_escape($id) . ") WHERE `Groups`.`UID` >= " . sql_escape($my_highest_group['group_id']) . " ORDER BY `Groups`.`Name`");

View File

@ -164,6 +164,12 @@ function user_shifts() {
else else
header("Location: " . page_link_to('user_shifts')); header("Location: " . page_link_to('user_shifts'));
// Schicht läuft schon, Eintragen für Engel nicht mehr möglich
if(!in_array('user_shifts_admin', $privileges) && time() > $shift['start']) {
error("Diese Schicht läuft gerade oder ist bereits vorbei. Bitte kontaktiere den Schichtkoordinator um Dich eintragen zu lassen.");
header("Location: " . page_link_to('user_shifts'));
}
$type = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($type_id) . " LIMIT 1"); $type = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($type_id) . " LIMIT 1");
if (count($type) == 0) if (count($type) == 0)
header("Location: " . page_link_to('user_shifts')); header("Location: " . page_link_to('user_shifts'));
@ -333,7 +339,7 @@ function view_user_shifts() {
$entry_list[] = $entry['Nick']; $entry_list[] = $entry['Nick'];
} }
if ($angeltype['count'] - count($entries) > 0) { if ($angeltype['count'] - count($entries) > 0) {
if (!$my_shift || in_array('user_shifts_admin', $privileges)) { if ((time() < $shift['end'] && !$my_shift) || in_array('user_shifts_admin', $privileges)) {
$entry_list[] = '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">' . ($angeltype['count'] - count($entries)) . ' Helfer' . ($angeltype['count'] - count($entries) != 1 ? '' : '') . ' gebraucht &raquo;</a>'; $entry_list[] = '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">' . ($angeltype['count'] - count($entries)) . ' Helfer' . ($angeltype['count'] - count($entries) != 1 ? '' : '') . ' gebraucht &raquo;</a>';
} else { } else {
$entry_list[] = ($angeltype['count'] - count($entries)) . ' Helfer gebraucht'; $entry_list[] = ($angeltype['count'] - count($entries)) . ' Helfer gebraucht';