From 526167ed11a9e13d20698029bc08f13cd574d946 Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Tue, 16 Dec 2014 09:55:14 +0100 Subject: add create shift type --- includes/view/ShiftTypes_view.php | 41 ++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'includes/view') diff --git a/includes/view/ShiftTypes_view.php b/includes/view/ShiftTypes_view.php index a7df2c87..580e4c45 100644 --- a/includes/view/ShiftTypes_view.php +++ b/includes/view/ShiftTypes_view.php @@ -4,6 +4,25 @@ function ShiftType_delete_view($shifttype) { } function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id) { + $angeltypes_select = [ + '' => _('All') + ]; + foreach ($angeltypes as $angeltype) + $angeltypes_select[$angeltype['id']] = $angeltype['name']; + + return page_with_title($shifttype_id ? _('Edit shifttype') : _('Create shifttype'), [ + msg(), + buttons([ + button(page_link_to('shifttypes'), shifttypes_title(), 'back') + ]), + form([ + form_text('name', _('Name'), $name), + form_select('angeltype_id', _('Angeltype'), $angeltypes_select, $angeltype_id), + form_textarea('description', _('Description'), $description), + form_info('', _('Please use markdown for the description.')), + form_submit('submit', _('Save')) + ]) + ]); } function ShiftType_view($shifttype) { @@ -12,21 +31,21 @@ function ShiftType_view($shifttype) { function ShiftTypes_list_view($shifttypes) { foreach ($shifttypes as &$shifttype) { $shifttype['actions'] = table_buttons([ - button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _("edit"), "btn-xs"), - button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttypes['id'], _("delete"), "btn-xs") + button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _('edit'), 'btn-xs'), + button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'btn-xs') ]); } - return page_with_title(shifttypes_title(), array( + return page_with_title(shifttypes_title(), [ msg(), - buttons(array( - button(page_link_to('shifttypes') . '&action=edit', _("New shifttype"), 'add') - )), - table(array( - 'name' => _("Name"), - 'actions' => "" - ), $shifttypes) - )); + buttons([ + button(page_link_to('shifttypes') . '&action=edit', _('New shifttype'), 'add') + ]), + table([ + 'name' => _('Name'), + 'actions' => '' + ], $shifttypes) + ]); } ?> \ No newline at end of file -- cgit v1.2.3-54-g00ecf