fix #49: "Array" after preview in mass-shift-generation

This commit is contained in:
Jan-Philipp Litza 2012-12-30 15:20:44 +01:00
parent de695c0fe4
commit 3efe63fa10
1 changed files with 3 additions and 2 deletions

View File

@ -74,7 +74,7 @@ function admin_shifts() {
elseif ($_REQUEST['mode'] == 'variable') { elseif ($_REQUEST['mode'] == 'variable') {
if (isset ($_REQUEST['change_hours']) && preg_match("/^([0-9]{2}(,|$))/", trim(str_replace(" ", "", $_REQUEST['change_hours'])))) { if (isset ($_REQUEST['change_hours']) && preg_match("/^([0-9]{2}(,|$))/", trim(str_replace(" ", "", $_REQUEST['change_hours'])))) {
$mode = 'variable'; $mode = 'variable';
$change_hours = explode(",", $_REQUEST['change_hours']); $change_hours = array_map('trim', explode(",", $_REQUEST['change_hours']));
} else { } else {
$ok = false; $ok = false;
$msg .= error("Bitte gib die Schichtwechsel-Stunden kommagetrennt ein.", true); $msg .= error("Bitte gib die Schichtwechsel-Stunden kommagetrennt ein.", true);
@ -209,6 +209,7 @@ function admin_shifts() {
$hidden_types = ""; $hidden_types = "";
foreach ($needed_angel_types as $type_id => $count) foreach ($needed_angel_types as $type_id => $count)
$hidden_types .= '<input type="hidden" name="type_' . $type_id . '" value="' . $count . '" />'; $hidden_types .= '<input type="hidden" name="type_' . $type_id . '" value="' . $count . '" />';
sort($change_hours);
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, 'name' => $name,
@ -217,7 +218,7 @@ function admin_shifts() {
'end' => date("Y-m-d H:i", $end), 'end' => date("Y-m-d H:i", $end),
'mode' => $mode, 'mode' => $mode,
'length' => $length, 'length' => $length,
'change_hours' => $change_hours, 'change_hours' => implode(', ', $change_hours),
'angelmode' => $angelmode, 'angelmode' => $angelmode,
'needed_angel_types' => $hidden_types 'needed_angel_types' => $hidden_types
)); ));