Merge remote-tracking branch 'engelsystem/feature-igel-rewrite'

This commit is contained in:
Igor Scheller 2017-09-20 01:24:56 +02:00
commit 5b12eecdd6
3 changed files with 14 additions and 12 deletions

View File

@ -32,14 +32,19 @@ function shift_entry_add_controller()
} }
$shift['Name'] = $room_array[$shift['RID']]; $shift['Name'] = $room_array[$shift['RID']];
$type_id = 0; $type_id = null;
if ($request->has('type_id') && preg_match('/^\d+$/', $request->input('type_id'))) { if ($request->has('type_id') && preg_match('/^\d+$/', $request->input('type_id'))) {
$type_id = $request->input('type_id'); $type_id = $request->input('type_id');
} else {
redirect(page_link_to('user_shifts'));
} }
if (in_array('user_shifts_admin', $privileges) || in_array('shiftentry_edit_angeltype_supporter', $privileges)) { if (in_array('user_shifts_admin', $privileges) || in_array('shiftentry_edit_angeltype_supporter', $privileges)) {
if($type_id == null) {
// If no angeltype id is given, then select first existing angeltype.
$needed_angeltypes = NeededAngelTypes_by_shift($shift_id);
if(count($needed_angeltypes) > 0) {
$type_id = $needed_angeltypes[0]['id'];
}
}
$type = AngelType($type_id); $type = AngelType($type_id);
} else { } else {
// TODO: Move queries to model // TODO: Move queries to model

View File

@ -124,14 +124,12 @@ class ShiftCalendarShiftRenderer
} }
if (in_array('user_shifts_admin', $privileges)) { if (in_array('user_shifts_admin', $privileges)) {
$html .= '<li class="list-group-item">' . _('Add more angels') . ':'; $html .= '<li class="list-group-item">';
foreach ($needed_angeltypes as $angeltype) { $html .= button(
$html .= ' ' . button( page_link_to('user_shifts', ['shift_id' => $shift['SID']]),
page_link_to('user_shifts', ['shift_id' => $shift['SID'], 'type_id' => $angeltype['id']]), glyph('plus') . _('Add more angels'),
$angeltype['name'], 'btn-xs'
'btn-xs' );
);
}
$html .= '</li>'; $html .= '</li>';
} }
if ($html != '') { if ($html != '') {

View File

@ -1,6 +1,5 @@
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
RewriteEngine on RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f