2011-09-06 20:45:06 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
// Assistent zum Anlegen mehrerer neuer Schichten
|
|
|
|
function admin_shifts() {
|
|
|
|
$msg = "";
|
|
|
|
$ok = true;
|
|
|
|
|
2011-09-06 21:05:09 +02:00
|
|
|
$name = "";
|
|
|
|
$rid = 0;
|
|
|
|
$start = date('Y-m-d 00:00');
|
|
|
|
$end = date('Y-m-d 00:00', time() + 24 * 60 * 60);
|
2011-09-06 20:45:06 +02:00
|
|
|
|
2011-09-06 21:05:09 +02:00
|
|
|
// Locations laden
|
2011-09-06 20:45:06 +02:00
|
|
|
$rooms = sql_select("SELECT * FROM `Room` WHERE `show`='Y' ORDER BY `Name`");
|
|
|
|
$room_array = array ();
|
|
|
|
foreach ($rooms as $room)
|
|
|
|
$room_array[$room['RID']] = $room['Name'];
|
|
|
|
|
2011-09-06 21:05:09 +02:00
|
|
|
if (isset ($_REQUEST['preview'])) {
|
|
|
|
// Name/Bezeichnung der Schicht, darf nicht leer sein
|
|
|
|
if (isset ($_REQUEST['name']) && strlen($_REQUEST['name']) > 0)
|
|
|
|
$name = strip_request_item('name');
|
|
|
|
else {
|
|
|
|
$ok = false;
|
|
|
|
$name = "";
|
|
|
|
$msg .= error("Gib bitte einen Namen für die Schicht(en) an.");
|
|
|
|
}
|
2011-09-06 20:45:06 +02:00
|
|
|
|
2011-09-06 21:05:09 +02:00
|
|
|
// Auswahl der sichtbaren Locations für die Schichten
|
|
|
|
|
|
|
|
if (isset ($_REQUEST['rid']) && preg_match("/^[0-9]+$/", $_REQUEST['rid']) && isset ($room_array[$_REQUEST['rid']]))
|
|
|
|
$rid = $_REQUEST['rid'];
|
|
|
|
else {
|
|
|
|
$ok = false;
|
|
|
|
$rid = $rooms[0]['RID'];
|
|
|
|
$msg .= error("Wähle bitte einen Raum aus.");
|
|
|
|
}
|
|
|
|
}
|
2011-09-06 20:45:06 +02:00
|
|
|
$room_select = html_select_key('rid', $room_array, '');
|
|
|
|
|
|
|
|
$types = sql_select("SELECT * FROM `AngelTypes` ORDER BY `Name`");
|
|
|
|
$angel_types = "";
|
|
|
|
foreach ($types as $type) {
|
|
|
|
$angel_types .= template_render('../templates/admin_shifts_angel_types.html', array (
|
|
|
|
'id' => $type['TID'],
|
|
|
|
'type' => $type['Name'],
|
|
|
|
'value' => "0"
|
|
|
|
));
|
|
|
|
}
|
|
|
|
return template_render('../templates/admin_shifts.html', array (
|
|
|
|
'angel_types' => $angel_types,
|
2011-09-06 21:05:09 +02:00
|
|
|
'room_select' => $room_select,
|
|
|
|
'msg' => $msg,
|
|
|
|
'name' => $name,
|
|
|
|
'start' => $start,
|
|
|
|
'end' => $end
|
2011-09-06 20:45:06 +02:00
|
|
|
));
|
|
|
|
}
|
|
|
|
?>
|