summaryrefslogtreecommitdiffstats
path: root/application/modules/user/controllers
diff options
context:
space:
mode:
authorSimon2011-04-12 14:59:42 +0200
committerSimon2011-04-12 14:59:42 +0200
commit689d829bdb496bbe136fcd50014dbf31d5e1c6a0 (patch)
tree1fde016930a1b2b838ae3f060e1c7244a82e6a3c /application/modules/user/controllers
parentdefault-roles entfernt (diff)
parentverschiedene Korrekturen (diff)
downloadpbs2-689d829bdb496bbe136fcd50014dbf31d5e1c6a0.tar.gz
pbs2-689d829bdb496bbe136fcd50014dbf31d5e1c6a0.tar.xz
pbs2-689d829bdb496bbe136fcd50014dbf31d5e1c6a0.zip
merge
Diffstat (limited to 'application/modules/user/controllers')
-rw-r--r--application/modules/user/controllers/AuthController.php13
-rw-r--r--application/modules/user/controllers/GroupController.php93
-rw-r--r--application/modules/user/controllers/PersonController.php126
-rw-r--r--application/modules/user/controllers/RoleController.php22
4 files changed, 112 insertions, 142 deletions
diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php
index bb16e94..d1596ae 100644
--- a/application/modules/user/controllers/AuthController.php
+++ b/application/modules/user/controllers/AuthController.php
@@ -133,6 +133,7 @@ class User_AuthController extends Zend_Controller_Action
if (isset($personID)){
$this->personmapper = new Application_Model_PersonMapper();
$person = $this->personmapper->find($personID);
+ print_r($person);
try {
$this->personmapper->delete($person);
}catch(Zend_Exception $e)
@@ -141,10 +142,14 @@ class User_AuthController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
return;
}
- $auth->clearIdentity();
- Zend_Session::namespaceUnset('userIDs');
- Zend_Session::forgetMe();
- $this->_helper->redirector('login', 'auth');
+ if($this->_request->getParam('personID')) {
+ $this->_helper->redirector('', 'person');
+ } else {
+ $auth->clearIdentity();
+ Zend_Session::namespaceUnset('userIDs');
+ Zend_Session::forgetMe();
+ $this->_helper->redirector('login', 'auth');
+ }
return;
}
} else {
diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php
index a853a75..0a4b25d 100644
--- a/application/modules/user/controllers/GroupController.php
+++ b/application/modules/user/controllers/GroupController.php
@@ -30,7 +30,34 @@ class User_GroupController extends Zend_Controller_Action
public function indexAction()
{
- $this->_helper->redirector('show', 'group');
+ $this->view->groupList = $this->groupList;
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('group');
+ if($search != ''){
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->groupList = $mySearch->search($this->view->groupList);
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(5);
+ $pagination->setElement($this->view->groupList);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/group/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
+
+ $this->view->groupList = $pagination->getElements();
+ $this->view->pagination = $pagination->pagination($pageurl);
+ $this->view->page = $pagination->getRequestPage();
+ $this->view->userIDsNamespace = $this->userIDsNamespace;
+ }
+
+ public function searchAction(){
+ $this->_redirect('/user/group/index/search/'.($_GET['search']));
}
public function addAction()
@@ -94,7 +121,7 @@ class User_GroupController extends Zend_Controller_Action
$editForm = new user_Form_GroupEdit(array('groupID' => $groupID), $_POST);
if ($editForm->isValid($_POST)) {
$group = new Application_Model_Group($_POST);
- $group->setID($this->_request->getParam('groupID'));
+ $group->setID($groupID);
try {
$this->groupMapper->save($group);
} catch(Zend_Exception $e)
@@ -103,19 +130,10 @@ class User_GroupController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
return;
}
- if($_SERVER['HTTP_REFERER']) {
- $this->_redirect($_SERVER['HTTP_REFERER']);
- } else {
- if(isset($groupID)) {
- $this->_redirect('/user/group/show/groupID/' . $groupID);
- } else {
- $this->_helper->redirector('', 'group');
- }
- }
+ $this->_helper->redirector('', 'group');
return;
}
}
-
$this->view->editForm = $editForm;
}
@@ -231,10 +249,14 @@ class User_GroupController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
return;
}
- if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show') !== false && strpos($_SERVER['HTTP_REFERER'], '/groupID/') === false) {
- $this->_helper->redirector('changemembership', 'person');
+ if($_SERVER['HTTP_REFERER']) {
+ if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show') !== false && strpos($_SERVER['HTTP_REFERER'], '/groupID/') === false) {
+ $this->_helper->redirector('changemembership', 'person');
+ } else {
+ $this->_helper->redirector('', 'group');
+ }
} else {
- $this->_helper->redirector('showall', 'group');
+ $this->_helper->redirector('', 'group');
}
return;
} else {
@@ -262,9 +284,9 @@ class User_GroupController extends Zend_Controller_Action
$membership->setRoleID($_POST['roleID']);
try {
$id = $this->membershipMapper->save($membership);
-
+
$membership->setID($id);
-
+
$newMember = new Pbs_NewMember();
$newMember->createDefaults($membership);
} catch(Zend_Exception $e)
@@ -292,41 +314,8 @@ class User_GroupController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
return;
}
- $this->_redirect("/user/group/edit/groupID/" . $membership->getGroupID());
+ $this->_redirect("/user/group/show/groupID/" . $membership->getGroupID());
}
} }
-
- public function showallAction()
- {
- $this->view->groupList = $this->groupList;
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setModule('group');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->groupList = $mySearch->search($this->view->groupList);
- }
- $this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(5);
- $pagination->setElement($this->view->groupList);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/group/showall'.((isset($this->view->search))?'/search/'.$this->view->search:''));
-
- $this->view->groupList = $pagination->getElements();
- $this->view->pagination = $pagination->pagination($pageurl);
- $this->view->page = $pagination->getRequestPage();
- $this->view->userIDsNamespace = $this->userIDsNamespace;
- }
-
- public function searchAction(){
- $this->_redirect('/user/group/showall/search/'.($_GET['search']));
- }
-}
-
+} \ No newline at end of file
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
@@ -46,6 +46,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) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- 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) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- 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() . "<br/>";
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() . "<br/>";
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
diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php
index 74efd70..91357f0 100644
--- a/application/modules/user/controllers/RoleController.php
+++ b/application/modules/user/controllers/RoleController.php
@@ -61,7 +61,7 @@ class User_RoleController extends Zend_Controller_Action
}
public function searchAction(){
- if(Pbs_Acl::checkRight('ro')) {
+ if(!Pbs_Acl::checkRight('ro')) {
$this->_redirect('/user');
}
$this->_redirect('/user/role/index/search/'.($_GET['search']));
@@ -157,7 +157,7 @@ class User_RoleController extends Zend_Controller_Action
if ($editForm->isValid($_POST)) {
$role = new Application_Model_Role($_POST);
- $role->setID($this->_request->getParam('roleID'));
+ $role->setID($roleID);
try {
$this->roleMapper->save($role);
} catch(Zend_Exception $e)
@@ -166,15 +166,7 @@ class User_RoleController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
return;
}
- if($_SERVER['HTTP_REFERER']) {
- $this->_redirect($_SERVER['HTTP_REFERER']);
- } else {
- if(isset($roleID)) {
- $this->_redirect('/user/role/show/roleID/' . $roleID);
- } else {
- $this->_helper->redirector('', 'role');
- }
- }
+ $this->_helper->redirector('', 'role');
return;
}
}
@@ -272,8 +264,12 @@ class User_RoleController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
return;
}
- if(strpos($_SERVER['HTTP_REFERER'], '/user/role/show') !== false && strpos($_SERVER['HTTP_REFERER'], '/roleID/') === false) {
- $this->_helper->redirector('changemembership', 'person');
+ if($_SERVER['HTTP_REFERER']) {
+ if(strpos($_SERVER['HTTP_REFERER'], '/user/role/show') !== false && strpos($_SERVER['HTTP_REFERER'], '/roleID/') === false) {
+ $this->_helper->redirector('changemembership', 'person');
+ } else {
+ $this->_helper->redirector('', 'role');
+ }
} else {
$this->_helper->redirector('', 'role');
}