From 3f8e5e47c05a2cf8fe4e51034523b0b6021b45f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20H=C3=A4usler?= Date: Tue, 16 Dec 2014 10:19:38 +0100 Subject: [PATCH] add update, delete and view for shift type --- db/update.sql | 2 + includes/controller/shifttypes_controller.php | 68 ++++++++++++++++++- includes/view/ShiftTypes_view.php | 23 ++++++- 3 files changed, 90 insertions(+), 3 deletions(-) diff --git a/db/update.sql b/db/update.sql index 8c9bdaec..7375b507 100644 --- a/db/update.sql +++ b/db/update.sql @@ -6,6 +6,8 @@ CREATE TABLE IF NOT EXISTS `ShiftTypes` ( `description` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; +ALTER TABLE `ShiftTypes` ADD INDEX ( `angeltype_id` ); +ALTER TABLE `ShiftTypes` ADD FOREIGN KEY ( `angeltype_id` ) REFERENCES `engelsystem`.`AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; INSERT INTO `engelsystem`.`Privileges` (`id`, `name`, `desc`) VALUES (NULL , 'shifttypes', 'Administrate shift types'); INSERT INTO `GroupPrivileges` SET `group_id`=-5, `privilege_id`=(SELECT `id` FROM `Privileges` WHERE `name`='shifttypes'); diff --git a/includes/controller/shifttypes_controller.php b/includes/controller/shifttypes_controller.php index aaefaa33..f5760ad5 100644 --- a/includes/controller/shifttypes_controller.php +++ b/includes/controller/shifttypes_controller.php @@ -1,6 +1,31 @@ ' . sprintf(_('for team %s'), $angeltype['name']) . ''; + 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'), _('edit'), 'edit'), + button(page_link_to('shifttypes'), _('delete'), 'delete') + ]), + $parsedown->parse($shifttype['description']) + ]); } function ShiftTypes_list_view($shifttypes) {