diff options
author | Bot <bot@myigel.name> | 2017-01-02 03:57:23 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2017-01-02 03:57:23 +0100 |
commit | 7313e15ce8236e19331fb6639a3a5b97c8f06ecd (patch) | |
tree | 399e5eaa403d6dd5993ca8fb6f2162319d2ed2e1 /includes/view/ShiftTypes_view.php | |
parent | b839e401062b294292fdcbd7e30b79bc149fab6f (diff) |
PSR-2 formatting
Diffstat (limited to 'includes/view/ShiftTypes_view.php')
-rw-r--r-- | includes/view/ShiftTypes_view.php | 85 |
1 files changed, 44 insertions, 41 deletions
diff --git a/includes/view/ShiftTypes_view.php b/includes/view/ShiftTypes_view.php index 3e4cccc6..e2850ab0 100644 --- a/includes/view/ShiftTypes_view.php +++ b/includes/view/ShiftTypes_view.php @@ -1,84 +1,87 @@ <?php -function ShiftType_name_render($shifttype) { - global $privileges; - if (in_array('shifttypes', $privileges)) { - return '<a href="' . shifttype_link($shifttype) . '">' . $shifttype['name'] . '</a>'; - } - return $shifttype['name']; +function ShiftType_name_render($shifttype) +{ + global $privileges; + if (in_array('shifttypes', $privileges)) { + return '<a href="' . shifttype_link($shifttype) . '">' . $shifttype['name'] . '</a>'; + } + return $shifttype['name']; } -function ShiftType_delete_view($shifttype) { - return page_with_title(sprintf(_("Delete shifttype %s"), $shifttype['name']), [ +function ShiftType_delete_view($shifttype) +{ + return page_with_title(sprintf(_("Delete shifttype %s"), $shifttype['name']), [ info(sprintf(_("Do you want to delete shifttype %s?"), $shifttype['name']), true), buttons([ button(page_link_to('shifttypes'), _("cancel"), 'cancel'), - button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'] . '&confirmed', _("delete"), 'ok') - ]) + button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'] . '&confirmed', _("delete"), 'ok') + ]) ]); } -function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id) { - $angeltypes_select = [ - '' => _('All') +function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id) +{ + $angeltypes_select = [ + '' => _('All') ]; - foreach ($angeltypes as $angeltype) { - $angeltypes_select[$angeltype['id']] = $angeltype['name']; - } + foreach ($angeltypes as $angeltype) { + $angeltypes_select[$angeltype['id']] = $angeltype['name']; + } - return page_with_title($shifttype_id ? _('Edit shifttype') : _('Create shifttype'), [ + return page_with_title($shifttype_id ? _('Edit shifttype') : _('Create shifttype'), [ msg(), buttons([ - button(page_link_to('shifttypes'), shifttypes_title(), 'back') + 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')) - ]) + form_submit('submit', _('Save')) + ]) ]); } -function ShiftType_view($shifttype, $angeltype) { - $parsedown = new Parsedown(); - $title = $shifttype['name']; - if ($angeltype) { - $title .= ' <small>' . sprintf(_('for team %s'), $angeltype['name']) . '</small>'; - } - return page_with_title($title, [ +function ShiftType_view($shifttype, $angeltype) +{ + $parsedown = new Parsedown(); + $title = $shifttype['name']; + if ($angeltype) { + $title .= ' <small>' . sprintf(_('for team %s'), $angeltype['name']) . '</small>'; + } + return page_with_title($title, [ msg(), buttons([ button(page_link_to('shifttypes'), shifttypes_title(), 'back'), $angeltype ? button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], $angeltype['name']) : '', button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _('edit'), 'edit'), - button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'delete') + button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'delete') ]), heading(_("Description"), 2), - $parsedown->parse($shifttype['description']) + $parsedown->parse($shifttype['description']) ]); } -function ShiftTypes_list_view($shifttypes) { - foreach ($shifttypes as &$shifttype) { - $shifttype['name'] = '<a href="' . page_link_to('shifttypes') . '&action=view&shifttype_id=' . $shifttype['id'] . '">' . $shifttype['name'] . '</a>'; - $shifttype['actions'] = table_buttons([ +function ShiftTypes_list_view($shifttypes) +{ + foreach ($shifttypes as &$shifttype) { + $shifttype['name'] = '<a href="' . page_link_to('shifttypes') . '&action=view&shifttype_id=' . $shifttype['id'] . '">' . $shifttype['name'] . '</a>'; + $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=' . $shifttype['id'], _('delete'), 'btn-xs') + button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'btn-xs') ]); - } + } - return page_with_title(shifttypes_title(), [ + return page_with_title(shifttypes_title(), [ msg(), buttons([ - button(page_link_to('shifttypes') . '&action=edit', _('New shifttype'), 'add') + button(page_link_to('shifttypes') . '&action=edit', _('New shifttype'), 'add') ]), table([ 'name' => _('Name'), - 'actions' => '' - ], $shifttypes) + 'actions' => '' + ], $shifttypes) ]); } - -?>
\ No newline at end of file |