From fb9e5f028899f8205541fe86d7eb9c5e12c4a5ad Mon Sep 17 00:00:00 2001
From: Björn Geiger
Date: Fri, 8 Apr 2011 13:20:06 +0200
Subject: Auch beim hinzufügen von weiteren Rechten nun Checkboxliste
---
.../modules/user/controllers/RoleController.php | 28 ++++++++++++----------
1 file changed, 16 insertions(+), 12 deletions(-)
(limited to 'application/modules/user/controllers')
diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php
index 4e0aa52..88e2eeb 100644
--- a/application/modules/user/controllers/RoleController.php
+++ b/application/modules/user/controllers/RoleController.php
@@ -303,20 +303,24 @@ class User_RoleController extends Zend_Controller_Action
}
if(count($rightlist) > 0) {
if (!isset($_POST["link"])){
- $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, 'roleID' => $roleID));
+ $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist));
} else {
- $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, 'roleID' => $roleID), $_POST);
+ $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, $_POST));
if ($linkForm->isValid($_POST)) {
- $rightroles = new Application_Model_RightRoles();
- $rightroles->setRightID($_POST['rightID']);
- $rightroles->setRoleID($roleID);
- try {
- $this->rightRolesMapper->save($rightroles);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "
";
- echo "Message: " . $e->getMessage() . "
";
- return;
+ foreach($_POST['rights'] as $rightID => $bool) {
+ if($bool == 1) {
+ $rightroles = new Application_Model_RightRoles();
+ $rightroles->setRightID($rightID);
+ $rightroles->setRoleID($roleID);
+ try {
+ $this->rightRolesMapper->save($rightroles);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "
";
+ echo "Message: " . $e->getMessage() . "
";
+ return;
+ }
+ }
}
$this->_redirect('/user/role/show/roleID/' . $roleID);
return;
--
cgit v1.2.3-55-g7522