From e5fcbd73596db87bb5cd24e1ba91cf735549b3c3 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Tue, 12 Apr 2011 14:54:50 +0200 Subject: verschiedene Korrekturen --- .../modules/user/controllers/PersonController.php | 126 +++++++++------------ 1 file changed, 53 insertions(+), 73 deletions(-) (limited to 'application/modules/user/controllers/PersonController.php') diff --git a/application/modules/user/controllers/PersonController.php b/application/modules/user/controllers/PersonController.php index ad8f596..7511233 100644 --- a/application/modules/user/controllers/PersonController.php +++ b/application/modules/user/controllers/PersonController.php @@ -45,6 +45,44 @@ class user_PersonController extends Zend_Controller_Action } public function indexAction() + { + if(!Pbs_Acl::checkRight('pso')) { + $this->_redirect('/user'); + } + $this->view->showRight = Pbs_Acl::checkRight('psod'); + $this->view->editRight = Pbs_Acl::checkRight('peoa'); + $this->view->deleteRight = Pbs_Acl::checkRight('pd'); + $this->view->showOtherRight = Pbs_Acl::checkRight('psood'); + $this->view->editOtherRight = Pbs_Acl::checkRight('peoa'); + $this->view->deleteOtherRight = Pbs_Acl::checkRight('pdo'); + $this->view->userIDsNamespace = $this->userIDsNamespace; + + $this->view->personList = $this->personmapper->fetchAll(); + + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('person'); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $this->view->personList = $mySearch->search($this->view->personList); + } + $this->view->searchform = $mySearch->searchForm(); + + // Pagination + $pagination = new Pbs_Pagination(); + $pagination->setPerPage(5); + $pagination->setElement($this->view->personList); + $pagination->setRequestPage($this->_request->getParam('page')); + $pagination->setPageUrl('/user/person/index/'.((isset($this->view->search))?'/search/'.$this->view->search:'')); + + $this->view->personList = $pagination->getElements(); + $this->view->pagination = $pagination->pagination($pageurl); + $this->view->page = $pagination->getRequestPage(); + } + + public function owndetailsAction() { #if(!Pbs_Acl::checkRight('psod')) { # $this->_redirect('/user'); @@ -62,7 +100,7 @@ class user_PersonController extends Zend_Controller_Action $this->view->page = $pagination->getRequestPage(); // This should be activated in case the person has no membership and no rights. $this->view->groupRequestRight = true; - $this->view->editRight = Pbs_Acl::checkRight('peoa'); + $this->view->editRight = Pbs_Acl::checkRight('peod'); $this->view->leaveRight = Pbs_Acl::checkRight('gl'); $this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); } @@ -98,11 +136,12 @@ class user_PersonController extends Zend_Controller_Action $this->personmapper->save($person); } catch(Zend_Exception $e) { - echo "Caught exception: " . get_class($e) . "
"; - echo "Message: " . $e->getMessage() . "
"; - echo "Email Address already existing."; + $pbsNotifier = new Pbs_Notifier(); + $this->view->notification = $pbsNotifier->notify('Email already registered', 'error'); + $this->view->registerForm = $registerForm; return; } + $this->_helper->redirector('', 'person'); } else { if(isset($_POST['newpassword'])) { $date = new DateTime(); @@ -115,13 +154,13 @@ class user_PersonController extends Zend_Controller_Action $this->personmapper->save($this->person); } catch(Zend_Exception $e) { - echo "Caught exception: " . get_class($e) . "
"; - echo "Message: " . $e->getMessage() . "
"; - echo "Email Address already existing."; + $pbsNotifier = new Pbs_Notifier(); + $this->view->notification = $pbsNotifier->notify('Email already registered', 'error'); + $this->view->registerForm = $registerForm; return; } + $this->_helper->redirector('owndetails', 'person'); } - $this->_helper->redirector('', 'person'); return; } } @@ -165,7 +204,7 @@ class user_PersonController extends Zend_Controller_Action } if (!isset($_POST["request"])){ if(count($allgroups) <= 0) { - $this->_helper->redirector('', 'person'); + $this->_helper->redirector('owndetails', 'person'); return; } $requestForm = new user_Form_GroupRequest(array('grouplist' => $allgroups)); @@ -186,7 +225,7 @@ class user_PersonController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "
"; return; } - $this->_helper->redirector('', 'person'); + $this->_helper->redirector('owndetails', 'person'); return; } } @@ -211,7 +250,7 @@ class user_PersonController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "
"; return; } - $this->_helper->redirector('', 'person'); + $this->_helper->redirector('owndetails', 'person'); return; } } @@ -263,49 +302,11 @@ class user_PersonController extends Zend_Controller_Action return; } - public function showallAction() - { - if(!Pbs_Acl::checkRight('pso')) { - $this->_redirect('/user'); - } - $this->view->showRight = Pbs_Acl::checkRight('psod'); - $this->view->editRight = Pbs_Acl::checkRight('peoa'); - $this->view->deleteRight = Pbs_Acl::checkRight('pd'); - $this->view->showOtherRight = Pbs_Acl::checkRight('psood'); - $this->view->editOtherRight = Pbs_Acl::checkRight('peoa'); - $this->view->deleteOtherRight = Pbs_Acl::checkRight('pdo'); - $this->view->userIDsNamespace = $this->userIDsNamespace; - - $this->view->personList = $this->personmapper->fetchAll(); - - // Search - $search = $this->_request->getParam('search'); - $mySearch = new Pbs_Search(); - $mySearch->setSearchTerm($search); - $mySearch->setModule('person'); - if($search != ''){ - $this->view->search = $mySearch->getSearchTerm(); - $this->view->personList = $mySearch->search($this->view->personList); - } - $this->view->searchform = $mySearch->searchForm(); - - // Pagination - $pagination = new Pbs_Pagination(); - $pagination->setPerPage(5); - $pagination->setElement($this->view->personList); - $pagination->setRequestPage($this->_request->getParam('page')); - $pagination->setPageUrl('/user/person/showall'.((isset($this->view->search))?'/search/'.$this->view->search:'')); - - $this->view->personList = $pagination->getElements(); - $this->view->pagination = $pagination->pagination($pageurl); - $this->view->page = $pagination->getRequestPage(); - } - public function searchAction(){ - if(Pbs_Acl::checkRight('pso')) { + if(!Pbs_Acl::checkRight('pso')) { $this->_redirect('/user'); } - $this->_redirect('/user/person/showall/search/'.($_GET['search'])); + $this->_redirect('/user/person/index/search/'.($_GET['search'])); } public function showAction() @@ -349,25 +350,4 @@ class user_PersonController extends Zend_Controller_Action return; } } - - -} - - - - - - - - - - - - - - - - - - - +} \ No newline at end of file -- cgit v1.2.3-55-g7522