create multiple shifts

This commit is contained in:
Philip Häusler 2011-09-06 20:45:06 +02:00
parent 28b50acb88
commit e665d1701f
6 changed files with 167 additions and 0 deletions

View File

@ -0,0 +1,50 @@
<?php
// Assistent zum Anlegen mehrerer neuer Schichten
function admin_shifts() {
$msg = "";
$ok = true;
// 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.");
}
// Auswahl der sichtbaren Locations für die Schichten
$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'];
if (isset ($_REQUEST['rid']) && preg_match("/^[0-9]+$/") && isset ($room_array[$_REQUEST['rid']]))
$rid = $_REQUEST['rid'];
else {
$ok = false;
$rid = 0;
$msg .= error("Wähle bitte einen Raum aus.");
}
$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,
'room_select' => $room_select
));
}
?>

View File

@ -108,6 +108,15 @@ table {
border-collapse: collapse;
}
fieldset hr {
background-color: #f0f0f0;
border: none;
color: #f0f0f0;
height: 1px;
margin: 0;
padding: 0;
}
fieldset table {
margin: 4px;
}
@ -115,6 +124,7 @@ fieldset table {
fieldset p {
clear: both;
margin: 4px;
min-height: 23px;
}
fieldset p label {
@ -123,6 +133,11 @@ fieldset p label {
width: 200px;
}
fieldset p label input {
float: right;
margin: 2px 10px 0 0;
}
th {
background: #f0f0f0;
}
@ -226,3 +241,20 @@ tr:hover .hidden {
.done {
text-decoration: line-through;
}
.spinner a {
background: #f0f0f0;
border: 1px solid #888;
padding: 1px 5px;
text-decoration: none;
}
.spinner input {
border: 1px solid #888;
border-left: none;
border-right: none;
padding: 3px 3px 1px 3px;
margin: 0;
text-align: right;
width: 42px;
}

View File

@ -122,6 +122,10 @@ if (in_array($p, $privileges)) {
require_once ('includes/pages/admin_import.php');
$content = admin_import();
}
elseif ($p == "admin_shifts") {
require_once ('includes/pages/admin_shifts.php');
$content = admin_shifts();
}
elseif ($p == "admin_log") {
require_once ('includes/pages/admin_log.php');
$content = admin_log();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -0,0 +1,67 @@
<form action="" method="post">
<fieldset>
<p>
<label>
Name/Beschreibung:
</label>
<input type="text" name="name" value="%name%" />
</p>
<p>
<label>
Ort:
</label>%room_select%
</p>
<p>
<label>
Beginn:
</label>
<input type="text" value="" />
</p>
<p>
<label>
Ende:
</label>
<input type="text" value="" />
</p><h2>Modus:</h2>
<p>
<label>
<input type="radio" name="method" value="single" />
</label>Eine Schicht erstellen.
</p>
<p>
<label>
<input type="radio" name="method" value="multi" />
</label>Mehrere Schichten erstellen:
</p>
<p>
<label>
Schichtlänge in Minuten:
</label>
<input type="text" name="length" value="120" />
</p>
<p>
<label>
<input type="radio" name="method" value="variable" />
</label>Mehrere Schichten mit variabler Länge erstellen:
</p>
<p>
<label>
Schichtwechsel-Stunden:
</label>
<input type="text" name="change_hours" value="00, 04, 08, 10, 12, 14, 16, 18, 20, 22" />
</p><h2>Benötigte Engel:</h2>
<p>
<label>
<input type="radio" name="angelmode" value="location" />
</label>Benötigte Engel vom Ort übernehmen.
</p>
<p>
<label>
<input type="radio" name="angelmode" value="manually" />
</label>Es werden folgende Engel benötigt:
</p>%angel_types%
<p>
<input type="submit" name="preview" value="Vorschau" />
</p>
</fieldset>
</form>

View File

@ -0,0 +1,14 @@
<p>
<label>
%type%:
</label>
<span class="spinner"><a id="type_%id%_down" href="#">-</a><input type="text" id="type_%id%" name="type_%id%" value="%value%" /><a id="type_%id%_up" href="#">+</a></span>
<script type="text/javascript">
document.getElementById("type_%id%_up").onclick = function(e){
document.getElementById("type_%id%").value = parseInt(document.getElementById("type_%id%").value) + 1;
};
var down = document.getElementById("type_%id%_down").onclick = function(e){
document.getElementById("type_%id%").value = parseInt(document.getElementById("type_%id%").value) - 1;
};
</script>
</p>