From a26061089a91bf3a214d6a0dba9ffad8a7006a61 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Thu, 17 Mar 2011 14:03:43 +0100 Subject: Person und Gruppen, Fehler korrigiert + Layout --- .../modules/dev/controllers/AuthController.php | 10 ++- .../modules/dev/controllers/GroupController.php | 61 +++++++++----- .../modules/dev/controllers/PersonController.php | 50 ++++++------ .../modules/dev/views/scripts/auth/delete.phtml | 0 .../modules/dev/views/scripts/auth/index.phtml | 0 .../modules/dev/views/scripts/auth/logout.phtml | 1 - .../modules/dev/views/scripts/bootos/index.phtml | 82 ++++++++++--------- .../modules/dev/views/scripts/group/delete.phtml | 6 -- .../dev/views/scripts/group/grantperson.phtml | 11 --- .../modules/dev/views/scripts/group/index.phtml | 58 ++++++++----- .../dev/views/scripts/group/revokeperson.phtml | 6 -- .../modules/dev/views/scripts/group/show.phtml | 91 ++++++++++----------- .../modules/dev/views/scripts/person/index.phtml | 0 .../modules/dev/views/scripts/person/leave.phtml | 6 -- .../modules/dev/views/scripts/person/show.phtml | 94 ++++++++-------------- 15 files changed, 235 insertions(+), 241 deletions(-) delete mode 100644 application/modules/dev/views/scripts/auth/delete.phtml delete mode 100644 application/modules/dev/views/scripts/auth/index.phtml delete mode 100644 application/modules/dev/views/scripts/auth/logout.phtml delete mode 100644 application/modules/dev/views/scripts/group/delete.phtml delete mode 100644 application/modules/dev/views/scripts/group/grantperson.phtml delete mode 100644 application/modules/dev/views/scripts/group/revokeperson.phtml delete mode 100644 application/modules/dev/views/scripts/person/index.phtml delete mode 100644 application/modules/dev/views/scripts/person/leave.phtml (limited to 'application/modules/dev') diff --git a/application/modules/dev/controllers/AuthController.php b/application/modules/dev/controllers/AuthController.php index 49640c0..8265c6e 100644 --- a/application/modules/dev/controllers/AuthController.php +++ b/application/modules/dev/controllers/AuthController.php @@ -13,13 +13,14 @@ class dev_AuthController extends Zend_Controller_Action public function indexAction() { + $this->_helper-> viewRenderer-> setNoRender(); $this->_helper->redirector('login', 'auth'); } public function loginAction() { if (Zend_Auth::getInstance()->hasIdentity()) { - print_a('Already logged in.'); + $this->_redirect('/dev/'); } else { if (!isset($_POST["login"])){ $loginForm = new dev_Form_AuthLogin(); @@ -61,7 +62,6 @@ class dev_AuthController extends Zend_Controller_Action } } } - $this->view->loginForm = $loginForm; } } @@ -101,16 +101,17 @@ class dev_AuthController extends Zend_Controller_Action return; } } - $this->view->registerForm = $registerForm; } } public function logoutAction() { + $this->_helper-> viewRenderer-> setNoRender(); $auth = Zend_Auth::getInstance(); $auth->clearIdentity(); $this->_helper->redirector('login', 'auth'); + return; } public function recoverpasswordAction() @@ -141,12 +142,12 @@ class dev_AuthController extends Zend_Controller_Action } */ } - $this->view->recoverPasswordForm = $recoverPasswordForm; } public function deleteAction() { + $this->_helper-> viewRenderer-> setNoRender(); $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); $person = $result[0]; $personID = $person["personID"]; @@ -164,6 +165,7 @@ class dev_AuthController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $auth->clearIdentity(); $this->_helper->redirector('login', 'auth'); + return; } } } diff --git a/application/modules/dev/controllers/GroupController.php b/application/modules/dev/controllers/GroupController.php index 1a063a7..c86e4fe 100644 --- a/application/modules/dev/controllers/GroupController.php +++ b/application/modules/dev/controllers/GroupController.php @@ -20,8 +20,9 @@ class dev_GroupController extends Zend_Controller_Action $this->personmapper = new Application_Model_PersonMapper(); $this->rolemapper = new Application_Model_RoleMapper(); $this->groupList = $this->groupMapper->fetchAll(); - } else { - $this->_redirect('/dev/login/auth'); + } else { + $this->_helper->redirector('login', 'auth'); + return; } } @@ -62,7 +63,8 @@ class dev_GroupController extends Zend_Controller_Action } } - echo "Group successfully added.
"; + $this->_helper->redirector('', 'group'); + return; } } @@ -71,13 +73,14 @@ class dev_GroupController extends Zend_Controller_Action public function editAction() { - if(!isset($_POST['groupID'])) { + $groupID = $this->_request->getParam('groupID'); + if(!isset($groupID)) { $addForm = new dev_Form_GroupAdd(array('grouplist' => $this->groupList)); $this->view->addForm = $addForm; return; } if (!isset($_POST["save"])){ - $group = $this->groupMapper->find($_POST['groupID']); + $group = $this->groupMapper->find($groupID); $_POST['title'] = $group->getTitle(); $_POST['description'] = $group->getDescription(); $editForm = new dev_Form_GroupEdit(); @@ -94,7 +97,8 @@ class dev_GroupController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "
"; return; } - echo "Successfully saved.
"; + $this->_helper->redirector('', 'group'); + return; } } @@ -103,8 +107,9 @@ class dev_GroupController extends Zend_Controller_Action public function showAction() { - if($_POST['groupID']) { - $groupRequests = $this->groupRequestMapper->findBy('groupID', $_POST['groupID']); + $groupID = $this->_request->getParam('groupID'); + if($groupID) { + $groupRequests = $this->groupRequestMapper->findBy('groupID', $groupID); if(isset($groupRequests)) { foreach($groupRequests as $groupRequest) { $person = $this->personmapper->find($groupRequest['personID']); @@ -113,10 +118,12 @@ class dev_GroupController extends Zend_Controller_Action 'person' => $person ); } - $this->view->groupRequestList = $groupRequestList; - $this->view->roleList = $this->rolemapper->findBy('groupID', $_POST['groupID']); + if(is_array($groupRequestList)) { + $this->view->groupRequestList = $groupRequestList; + } + $this->view->roleList = $this->rolemapper->findBy('groupID', $groupID); } - $members = $this->membershipMapper->findBy('groupID', $_POST['groupID']); + $members = $this->membershipMapper->findBy('groupID', $groupID); if(isset($members)) { foreach($members as $member) { $person = $this->personmapper->find($member['personID']); @@ -125,15 +132,18 @@ class dev_GroupController extends Zend_Controller_Action 'person' => $person ); } - $this->view->memberslist = $membersList; + if(is_array($membersList)) { + $this->view->membersList = $membersList; + } } - $groupgroups = $this->groupGroupsMapper->findBy('groupID', $_POST['groupID']); + $groupgroups = $this->groupGroupsMapper->findBy('groupID', $groupID); if(is_object($groupgroups)) { $parentGroup = $this->groupMapper->find($groupgroups->getParentID()); $this->view->$parentGroup = $parentGroup; } - $group = $this->groupMapper->find($_POST['groupID']); + $group = $this->groupMapper->find($groupID); $this->view->group = $group; + $this->view->groupID = $groupID; } } @@ -156,7 +166,8 @@ class dev_GroupController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "
"; return; } - echo "Groups successfully linked.
"; + $this->_helper->redirector('', 'group'); + return; } } @@ -165,8 +176,10 @@ class dev_GroupController extends Zend_Controller_Action public function deleteAction() { - if (isset($_POST["groupID"])){ - $group = $this->groupMapper->find($_POST["groupID"]); + $this->_helper->viewRenderer->setNoRender(); + $groupID = $this->_request->getParam('groupID'); + if (isset($groupID)){ + $group = $this->groupMapper->find($groupID); try { $this->groupMapper->delete($group); } catch(Zend_Exception $e) @@ -175,12 +188,14 @@ class dev_GroupController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "
"; return; } - echo "Group successfully deleted.
"; + $this->_helper->redirector('', 'group'); + return; } } public function grantpersonAction() { + $this->_helper->viewRenderer->setNoRender(); if(isset($_POST['grouprequestID']) && isset($_POST['roleID'])) { $groupRequest = $this->groupRequestMapper->find($_POST['grouprequestID']); try { @@ -203,14 +218,16 @@ class dev_GroupController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "
"; return; } - echo "Chosen Person has been successfully added to the chosen group.
"; + $this->_redirect("/dev/group/show/groupID/" . $groupRequest->getGroupID()); } } public function revokepersonAction() { - if(isset($_POST['membershipID'])) { - $membership = $this->membershipMapper->find($_POST['membershipID']); + $this->_helper->viewRenderer->setNoRender(); + $membershipID = $this->_request->getParam('membershipID'); + if(isset($membershipID)) { + $membership = $this->membershipMapper->find($membershipID); if(isset($membership)) { try { $this->membershipMapper->delete($membership); @@ -220,7 +237,7 @@ class dev_GroupController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "
"; return; } - echo "Chosen Person has been successfully removed from the chosen group.
"; + $this->_redirect("/dev/group/edit/groupID/" . $membership->getGroupID()); } } diff --git a/application/modules/dev/controllers/PersonController.php b/application/modules/dev/controllers/PersonController.php index b7e050f..e422870 100644 --- a/application/modules/dev/controllers/PersonController.php +++ b/application/modules/dev/controllers/PersonController.php @@ -24,19 +24,24 @@ class dev_PersonController extends Zend_Controller_Action foreach($this->memberships as $membership) { $group = $this->groupMapper->find($membership['groupID']); $this->groups[] = array ( - 'id' => $group->getID(), - 'title' => $group->getTitle() + 'groupID' => $group->getID(), + 'title' => $group->getTitle(), + 'description' => $group->getDescription(), + 'membershipID' => $membership['membershipID'] ); } } } else { - $this->_redirect('/dev/auth/login'); + $this->_helper->redirector('login', 'auth'); + return; } } public function indexAction() { - $this->_redirect('/dev/person/show'); + $this->_helper-> viewRenderer-> setNoRender(); + $this->_helper->redirector('show', 'person'); + return; } public function showAction() @@ -69,10 +74,10 @@ class dev_PersonController extends Zend_Controller_Action echo "Email Address already existing."; return; } - echo "Successfully saved.
"; + $this->_helper->redirector('show', 'person'); + return; } } - $this->view->editForm = $editForm; } @@ -112,7 +117,8 @@ class dev_PersonController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "
"; return; } - echo "Successfully requested.
"; + $this->_helper->redirector('show', 'person'); + return; } } $this->view->requestForm = $requestForm; @@ -120,24 +126,21 @@ class dev_PersonController extends Zend_Controller_Action public function leaveAction() { + $this->_helper-> viewRenderer-> setNoRender(); $this->view->person = $this->person; - if(isset($_POST['groupID'])) { - if(isset($this->memberships)) { - foreach($this->memberships as $membership) { - if($membership['groupID'] == $_POST['groupID']) { - $membershipObject = $this->membershipMapper->find($membership['membershipID']); - try { - $this->membershipMapper->delete($membershipObject); - } catch(Zend_Exception $e) - { - echo "Caught exception: " . get_class($e) . "
"; - echo "Message: " . $e->getMessage() . "
"; - return; - } - echo "You have been successfully removed from the chosen group.
"; - } - } + $membershipID = $this->_request->getParam('membershipID'); + if(isset($membershipID)) { + $membership = $this->membershipMapper->find($membershipID); + try { + $this->membershipMapper->delete($membership); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "
"; + echo "Message: " . $e->getMessage() . "
"; + return; } + $this->_helper->redirector('show', 'person'); + return; } } } @@ -152,3 +155,4 @@ class dev_PersonController extends Zend_Controller_Action + diff --git a/application/modules/dev/views/scripts/auth/delete.phtml b/application/modules/dev/views/scripts/auth/delete.phtml deleted file mode 100644 index e69de29..0000000 diff --git a/application/modules/dev/views/scripts/auth/index.phtml b/application/modules/dev/views/scripts/auth/index.phtml deleted file mode 100644 index e69de29..0000000 diff --git a/application/modules/dev/views/scripts/auth/logout.phtml b/application/modules/dev/views/scripts/auth/logout.phtml deleted file mode 100644 index a709bd9..0000000 --- a/application/modules/dev/views/scripts/auth/logout.phtml +++ /dev/null @@ -1 +0,0 @@ -

View script for controller Auth and script/action name logout
\ No newline at end of file diff --git a/application/modules/dev/views/scripts/bootos/index.phtml b/application/modules/dev/views/scripts/bootos/index.phtml index 6462b1f..c5970b6 100644 --- a/application/modules/dev/views/scripts/bootos/index.phtml +++ b/application/modules/dev/views/scripts/bootos/index.phtml @@ -4,38 +4,39 @@ 'class' => 'addbutton'))?> - - - - - - - - - - - - - - - - bootoslist)==0) - echo "
IDTitleGroupIDMembershipIDConfigIDInitKernelKclDescriptionChangedExpiresPublicActions
There are no BootOs's to display." ?> - bootoslist as $bootos): ?> - - escape($bootos->getID()); ?> - escape($bootos->getTitle()); ?> - escape($bootos->getGroupID()); ?> - escape($bootos->getMembershipID()); ?> - escape($bootos->getConfigID()); ?> - escape($bootos->getPath_init()); ?> - escape($bootos->getPath_kernel()); ?> - escape($bootos->getDefaultkcl()); ?> - escape($bootos->getDescription()); ?> - escape(date('Y-m-d H:i:s', $bootos->getCreated())); ?> - escape($bootos->getExpires()); ?> - escape($bootos->getPublic()); ?> - There are no BootOs's to display." ?> + bootoslist as $bootos): ?> + + escape($bootos->getID()); ?> + escape($bootos->getTitle()); ?> + escape($bootos->getGroupID()); ?> + escape($bootos->getMembershipID()); ?> + escape($bootos->getConfigID()); ?> + escape($bootos->getPath_init()); ?> + escape($bootos->getPath_kernel()); ?> + escape($bootos->getDefaultkcl()); ?> + escape($bootos->getDescription()); ?> + escape(date('Y-m-d H:i:s', $bootos->getCreated())); ?> + escape($bootos->getExpires()); ?> + escape($bootos->getPublic()); ?> + Edit BootOS - Edit BootOS + Delete BootOS - - + true) ?>">Delete BootOS + + - - - + + + diff --git a/application/modules/dev/views/scripts/group/delete.phtml b/application/modules/dev/views/scripts/group/delete.phtml deleted file mode 100644 index fc96431..0000000 --- a/application/modules/dev/views/scripts/group/delete.phtml +++ /dev/null @@ -1,6 +0,0 @@ - -
No group has been chosen.
- -
No Request has been chosen.
- -
No Role has been chosen.
- Groups +formButton('addgroup', 'Add Group', array( + 'onclick' => 'self.location="/dev/group/add"', + 'class' => 'addbutton'))?> - - + + groupList as $group) { ?> - + - + +
Title:Functions:TitleActions
getTitle(); ?> -
Details
-
Edit
-
Delete
+
Show Group Edit Group Delete Group
-
- +formButton('linkgroups', 'Link Groups', array( + 'onclick' => 'self.location="/dev/group/link"', + 'class' => 'addbutton'))?>
diff --git a/application/modules/dev/views/scripts/group/revokeperson.phtml b/application/modules/dev/views/scripts/group/revokeperson.phtml deleted file mode 100644 index 6af5564..0000000 --- a/application/modules/dev/views/scripts/group/revokeperson.phtml +++ /dev/null @@ -1,6 +0,0 @@ - -
No Membership has been chosen.
- Group Details groupID) { ?> -
-
-
-
+ formButton('deletegroup', 'Delete', array( + 'onclick' => 'self.location="/dev/group/delete/groupID/' . $this->group->getID() .'"', + 'class' => 'rightbutton'))?> + formButton('editgroup', 'Edit', array( + 'onclick' => 'self.location="/dev/group/edit/groupID/' . $this->group->getID() .'"', + 'class' => 'rightbutton'))?> + - - + + - - + + groupRequestList)) { ?>
-
Grouprequests:
-
+

Requests:

Title:group->getTitle(); ?>TitleDescription
Description:
group->getTitle(); ?> group->getDescription(); ?>
- - - - - + + + + + groupRequestList as $grouprequest) { $grouprequestID = $grouprequest['grouprequestID']; $person = $grouprequest['person']; ?> - + memberslist)) { + if(isset($this->membersList)) { ?>
-
Members:
-
+

Members:

Firstname:Name:email:city:grant:FirstnameNameemailcitygrant
getFirstname(); ?> getName(); ?> getEmail(); ?> getCity(); ?> -
roleList); ?> -
+
roleList); ?> +
- - - - - + + + + + memberslist as $member) { + foreach($this->membersList as $member) { $membershipID = $member['membershipID']; $person = $member['person']; ?> - + - -
No Group has been chosen.
- "; } +?> +




\ No newline at end of file diff --git a/application/modules/dev/views/scripts/person/index.phtml b/application/modules/dev/views/scripts/person/index.phtml deleted file mode 100644 index e69de29..0000000 diff --git a/application/modules/dev/views/scripts/person/leave.phtml b/application/modules/dev/views/scripts/person/leave.phtml deleted file mode 100644 index fc96431..0000000 --- a/application/modules/dev/views/scripts/person/leave.phtml +++ /dev/null @@ -1,6 +0,0 @@ - -
No group has been chosen.
- - - -
Firstname:Name:email:city:FirstnameNameemailcityrevoke
getFirstname(); ?> getName(); ?> getEmail(); ?> getCity(); ?> -
-
+
Delete Group
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Title:person->getTitle(); ?>
Name:person->getName(); ?>
Firstname:person->getFirstname(); ?>
Street:person->getStreet(); ?>
Housenumber:person->getHousenumber(); ?>
City:person->getCity(); ?>
Postalcode:person->getPostalcode(); ?>
Email:person->getEmail(); ?>
Last Login Date:person->getLogindate()) echo date ('d. F Y - H:i', $this->person->getLogindate()); ?> Uhr
Register Date:person->getRegisterdate()); ?> Uhr
+

Person

+formButton('editperson', 'Edit', array( + 'onclick' => 'self.location="/dev/person/edit/"', + 'class' => 'rightbutton'))?> +

+
Title: person->getTitle(); ?>
+
Name: person->getName(); ?>
+
Firstname: person->getFirstname(); ?>
+
Street: person->getStreet(); ?>
+
Housenumber: person->getHousenumber(); ?>
+
City: person->getCity(); ?>
+
Postalcode: person->getPostalcode(); ?>
+
Email: person->getEmail(); ?>
+
Last Login Date: person->getLogindate()) echo date ('d. F Y - H:i', $this->person->getLogindate()) . " Uhr"; ?>
+
Register Date: person->getRegisterdate()) . ' Uhr'; ?>
groups)) { ?>
-
Member in the following Groups:
-
+

Member in the following Groups:

groups as $group) { ?> - + + - + groups as $group) { } ?>
TitleFunctionsDescriptionLeave
-
Remove - Membership
+
Delete Group
-
-
- -
+formButton('addtogroup', 'Add to additional +Groups', array( + 'onclick' => 'self.location="/dev/person/request/"', + 'class' => 'addbutton')); +?> +




\ No newline at end of file -- cgit v1.2.3-55-g7522