#35 admin_shifts: escape from preview

This commit is contained in:
Philip Häusler 2011-10-12 17:02:48 +02:00
parent ca0ff25131
commit d4c17f48f5
4 changed files with 61 additions and 15 deletions

View File

@ -11,6 +11,8 @@ function admin_shifts() {
$end = $start +24 * 60 * 60; $end = $start +24 * 60 * 60;
$mode = ''; $mode = '';
$angelmode = ''; $angelmode = '';
$length = '';
$change_hours = '';
// Locations laden // Locations laden
$rooms = sql_select("SELECT * FROM `Room` WHERE `show`='Y' ORDER BY `Name`"); $rooms = sql_select("SELECT * FROM `Room` WHERE `show`='Y' ORDER BY `Name`");
@ -24,7 +26,7 @@ function admin_shifts() {
foreach ($types as $type) foreach ($types as $type)
$needed_angel_types[$type['TID']] = 0; $needed_angel_types[$type['TID']] = 0;
if (isset ($_REQUEST['preview'])) { if (isset ($_REQUEST['preview']) || isset ($_REQUEST['back'])) {
// Name/Bezeichnung der Schicht, darf leer sein // Name/Bezeichnung der Schicht, darf leer sein
$name = strip_request_item('name'); $name = strip_request_item('name');
@ -110,6 +112,10 @@ function admin_shifts() {
$msg .= error("Bitte wähle benötigte Engel."); $msg .= error("Bitte wähle benötigte Engel.");
} }
// Beim Zurück-Knopf das Formular zeigen
if (isset ($_REQUEST['back']))
$ok = false;
// Alle Eingaben in Ordnung // Alle Eingaben in Ordnung
if ($ok) { if ($ok) {
if ($angelmode == 'location') { if ($angelmode == 'location') {
@ -200,8 +206,20 @@ function admin_shifts() {
$_SESSION['admin_shifts_shifts'] = $shifts; $_SESSION['admin_shifts_shifts'] = $shifts;
$_SESSION['admin_shifts_types'] = $needed_angel_types; $_SESSION['admin_shifts_types'] = $needed_angel_types;
$hidden_types = "";
foreach ($needed_angel_types as $type_id => $count)
$hidden_types .= '<input type="hidden" name="type_' . $type_id . '" value="' . $count . '" />';
return template_render('../templates/admin_shift_preview.html', array ( return template_render('../templates/admin_shift_preview.html', array (
'shifts_table' => $shifts_table 'shifts_table' => $shifts_table,
'name' => $name,
'rid' => $rid,
'start' => date("Y-m-d H:i", $start),
'end' => date("Y-m-d H:i", $end),
'mode' => $mode,
'length' => $length,
'change_hours' => $change_hours,
'angelmode' => $angelmode,
'needed_angel_types' => $hidden_types
)); ));
} }

View File

@ -133,6 +133,10 @@ fieldset p label {
width: 200px; width: 200px;
} }
fieldset p label[for] {
width: auto;
}
fieldset p label input { fieldset p label input {
float: right; float: right;
margin: 2px 10px 0 0; margin: 2px 10px 0 0;

View File

@ -17,7 +17,16 @@
</tbody> </tbody>
</table> </table>
<p> <p>
<input type="submit" name="submit" value="Erstellen" /> <input type="submit" name="back" value="Zurück" /><input type="submit" name="submit" value="Erstellen" />
</p> </p>
<input type="hidden" name="name" value="%name%" />
<input type="hidden" name="rid" value="%rid%" />
<input type="hidden" name="start" value="%start%" />
<input type="hidden" name="end" value="%end%" />
<input type="hidden" name="mode" value="%mode%" />
<input type="hidden" name="length" value="%length%" />
<input type="hidden" name="change_hours" value="%change_hours%" />
<input type="hidden" name="angelmode" value="%angelmode%" />
%needed_angel_types%
</fieldset> </fieldset>
</form> </form>

View File

@ -29,13 +29,19 @@
</p><h2>Modus:</h2> </p><h2>Modus:</h2>
<p> <p>
<label> <label>
<input type="radio" name="mode" value="single" %mode_single_selected%/> <input id="mode_single" type="radio" name="mode" value="single" %mode_single_selected%/>
</label>Eine Schicht erstellen. </label>
<label for="mode_single">
Eine Schicht erstellen.
</label>
</p> </p>
<p> <p>
<label> <label>
<input type="radio" name="mode" id="multi_shifts" value="multi" %mode_multi_selected%/> <input type="radio" name="mode" id="multi_shifts" value="multi" %mode_multi_selected%/>
</label>Mehrere Schichten erstellen: </label>
<label for="multi_shifts">
Mehrere Schichten erstellen:
</label>
</p> </p>
<p> <p>
<label> <label>
@ -46,7 +52,10 @@
<p> <p>
<label> <label>
<input type="radio" name="mode" id="var_multi_shifts" value="variable" %mode_variable_selected%/> <input type="radio" name="mode" id="var_multi_shifts" value="variable" %mode_variable_selected%/>
</label>Mehrere Schichten mit variabler Länge erstellen: </label>
<label for="var_multi_shifts">
Mehrere Schichten mit variabler Länge erstellen:
</label>
</p> </p>
<p> <p>
<label> <label>
@ -56,13 +65,19 @@
</p><h2>Benötigte Engel:</h2> </p><h2>Benötigte Engel:</h2>
<p> <p>
<label> <label>
<input type="radio" name="angelmode" value="location" %angelmode_location_selected%/> <input id="angelmode_location" type="radio" name="angelmode" value="location" %angelmode_location_selected%/>
</label>Benötigte Engel vom Ort übernehmen. </label>
<label for="angelmode_location">
Benötigte Engel vom Ort übernehmen.
</label>
</p> </p>
<p> <p>
<label> <label>
<input type="radio" name="angelmode" id="manual_angelmode" value="manually" %angelmode_manually_selected%/> <input type="radio" name="angelmode" id="manual_angelmode" value="manually" %angelmode_manually_selected%/>
</label>Es werden folgende Engel benötigt: </label>
<label for="manual_angelmode">
Es werden folgende Engel benötigt:
</label>
</p>%angel_types% </p>%angel_types%
<p> <p>
<input type="submit" name="preview" value="Vorschau" /> <input type="submit" name="preview" value="Vorschau" />