From e965f8d04150fbd17ee1b5fcbca5ae85bbe6d6bd Mon Sep 17 00:00:00 2001 From: msquare Date: Thu, 29 Sep 2016 11:18:17 +0200 Subject: prohibit inline control structures on model and view --- includes/view/ShiftTypes_view.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'includes/view/ShiftTypes_view.php') diff --git a/includes/view/ShiftTypes_view.php b/includes/view/ShiftTypes_view.php index 10431440..163d6646 100644 --- a/includes/view/ShiftTypes_view.php +++ b/includes/view/ShiftTypes_view.php @@ -2,27 +2,29 @@ function ShiftType_name_render($shifttype) { global $privileges; - if (in_array('shifttypes', $privileges)) + if (in_array('shifttypes', $privileges)) { return '' . $shifttype['name'] . ''; + } return $shifttype['name']; } function ShiftType_delete_view($shifttype) { - return page_with_title(sprintf(_("Delete shifttype %s"), $shifttype['name']), array( + return page_with_title(sprintf(_("Delete shifttype %s"), $shifttype['name']), [ info(sprintf(_("Do you want to delete shifttype %s?"), $shifttype['name']), true), - buttons(array( + buttons([ button(page_link_to('shifttypes'), _("cancel"), 'cancel'), 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') ]; - foreach ($angeltypes as $angeltype) + foreach ($angeltypes as $angeltype) { $angeltypes_select[$angeltype['id']] = $angeltype['name']; + } return page_with_title($shifttype_id ? _('Edit shifttype') : _('Create shifttype'), [ msg(), @@ -42,8 +44,9 @@ function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $s function ShiftType_view($shifttype, $angeltype) { $parsedown = new Parsedown(); $title = $shifttype['name']; - if ($angeltype) + if ($angeltype) { $title .= ' ' . sprintf(_('for team %s'), $angeltype['name']) . ''; + } return page_with_title($title, [ msg(), buttons([ -- cgit v1.3.1