summaryrefslogtreecommitdiffstats
path: root/application/modules/user/controllers/GroupController.php
diff options
context:
space:
mode:
authorBjörn Geiger2011-04-12 14:54:50 +0200
committerBjörn Geiger2011-04-12 14:54:50 +0200
commite5fcbd73596db87bb5cd24e1ba91cf735549b3c3 (patch)
tree52c44f8a51a0684c9630cdee19c83ce6a7d6458a /application/modules/user/controllers/GroupController.php
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-e5fcbd73596db87bb5cd24e1ba91cf735549b3c3.tar.gz
pbs2-e5fcbd73596db87bb5cd24e1ba91cf735549b3c3.tar.xz
pbs2-e5fcbd73596db87bb5cd24e1ba91cf735549b3c3.zip
verschiedene Korrekturen
Diffstat (limited to 'application/modules/user/controllers/GroupController.php')
-rw-r--r--application/modules/user/controllers/GroupController.php93
1 files changed, 41 insertions, 52 deletions
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