diff options
author | Philip Häusler <msquare@notrademark.de> | 2014-05-13 16:49:09 +0200 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2014-05-13 16:49:09 +0200 |
commit | d394ed2feec7801d7fb38240fc6f001d4367063c (patch) | |
tree | dea0c0ca4c4283d630ff1f0a84c158d7fd07b210 /includes/controller/angeltypes_controller.php | |
parent | f1145b8a5e8630e0180d35ff1ced2e934b872f01 (diff) |
notify coordinators about unconfirmed angeltypes
Diffstat (limited to 'includes/controller/angeltypes_controller.php')
-rw-r--r-- | includes/controller/angeltypes_controller.php | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php index 6b94545b..59e55a2d 100644 --- a/includes/controller/angeltypes_controller.php +++ b/includes/controller/angeltypes_controller.php @@ -85,9 +85,6 @@ function angeltype_delete_controller() { function angeltype_edit_controller() { global $privileges, $user; - if (! in_array('admin_angel_types', $privileges)) - redirect(page_link_to('angeltypes')); - $name = ""; $restricted = false; $description = ""; @@ -102,21 +99,32 @@ function angeltype_edit_controller() { $name = $angeltype['name']; $restricted = $angeltype['restricted']; $description = $angeltype['description']; + + if (! User_is_AngelType_coordinator($user, $angeltype)) + redirect(page_link_to('angeltypes')); + } else { + if (! in_array('admin_angel_types', $privileges)) + redirect(page_link_to('angeltypes')); } + // In coordinator mode only allow to modify description + $coordinator_mode = ! in_array('admin_angel_types', $privileges); + if (isset($_REQUEST['submit'])) { $ok = true; - if (isset($_REQUEST['name'])) { - list($valid, $name) = AngelType_validate_name($_REQUEST['name'], $angeltype); - if (! $valid) { - $ok = false; - error(_("Please check the name. Maybe it already exists.")); + if (! $coordinator_mode) { + if (isset($_REQUEST['name'])) { + list($valid, $name) = AngelType_validate_name($_REQUEST['name'], $angeltype); + if (! $valid) { + $ok = false; + error(_("Please check the name. Maybe it already exists.")); + } } + + $restricted = isset($_REQUEST['restricted']); } - $restricted = isset($_REQUEST['restricted']); - if (isset($_REQUEST['description'])) $description = strip_request_item_nl('description'); @@ -142,7 +150,7 @@ function angeltype_edit_controller() { return array( isset($angeltype) ? sprintf(_("Edit %s"), $name) : _("Add new angeltype"), - AngelType_edit_view($name, $restricted, $description) + AngelType_edit_view($name, $restricted, $description, $coordinator_mode) ); } @@ -174,7 +182,7 @@ function angeltype_controller() { return array( sprintf(_("Team %s"), $angeltype['name']), - AngelType_view($angeltype, $members, $user_angeltype, in_array('admin_user_angeltypes', $privileges) || $user_angeltype['coordinator'], in_array('admin_angel_types', $privileges)) + AngelType_view($angeltype, $members, $user_angeltype, in_array('admin_user_angeltypes', $privileges) || $user_angeltype['coordinator'], in_array('admin_angel_types', $privileges), $user_angeltype['coordinator']) ); } |