summaryrefslogtreecommitdiffstats
path: root/application/modules
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules')
-rw-r--r--application/modules/user/controllers/AuthController.php4
-rw-r--r--application/modules/user/controllers/PersonController.php79
-rw-r--r--application/modules/user/views/scripts/auth/index.phtml1
-rw-r--r--application/modules/user/views/scripts/person/index.phtml20
4 files changed, 60 insertions, 44 deletions
diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php
index df45b90..db47f44 100644
--- a/application/modules/user/controllers/AuthController.php
+++ b/application/modules/user/controllers/AuthController.php
@@ -15,7 +15,8 @@ class User_AuthController extends Zend_Controller_Action
public function indexAction()
{
-
+ $this->_helper-> viewRenderer-> setNoRender();
+ $this->_helper->redirector('login', 'auth');
}
public function loginAction()
@@ -72,6 +73,7 @@ class User_AuthController extends Zend_Controller_Action
$this->_helper-> viewRenderer-> setNoRender();
$auth = Zend_Auth::getInstance();
$auth->clearIdentity();
+ Zend_Session::namespaceUnset('userIDs');
$this->_helper->redirector('login', 'auth');
return;
}
diff --git a/application/modules/user/controllers/PersonController.php b/application/modules/user/controllers/PersonController.php
index 87e492c..3d231f4 100644
--- a/application/modules/user/controllers/PersonController.php
+++ b/application/modules/user/controllers/PersonController.php
@@ -4,17 +4,11 @@ class user_PersonController extends Zend_Controller_Action
{
protected $person = null;
-
protected $personmapper = null;
-
protected $membershipMapper = null;
-
protected $memberships = null;
-
protected $groupMapper = null;
-
protected $groups = null;
-
protected $groupRequestMapper = null;
public function init()
@@ -32,10 +26,10 @@ class user_PersonController extends Zend_Controller_Action
foreach($this->memberships as $membership) {
$group = $this->groupMapper->find($membership['groupID']);
$this->groups[] = array (
- 'groupID' => $group->getID(),
- 'title' => $group->getTitle(),
- 'description' => $group->getDescription(),
- 'membershipID' => $membership['membershipID']
+ 'groupID' => $group->getID(),
+ 'title' => $group->getTitle(),
+ 'description' => $group->getDescription(),
+ 'membershipID' => $membership['membershipID']
);
}
}
@@ -49,6 +43,7 @@ class user_PersonController extends Zend_Controller_Action
{
$this->view->person = $this->person;
$this->view->groups = $this->groups;
+ $this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
}
public function editAction()
@@ -116,7 +111,8 @@ class user_PersonController extends Zend_Controller_Action
}
if (!isset($_POST["request"])){
if(count($allgroups) <= 0) {
- echo "No Groups to choose.";
+ $this->_helper->redirector('', 'person');
+ return;
}
$requestForm = new user_Form_GroupRequest(array('grouplist' => $allgroups));
} else {
@@ -169,35 +165,48 @@ class user_PersonController extends Zend_Controller_Action
if(isset($userIDsNamespace['membershipID'])) {
$this->_redirect('/user/');
} else {
- if(isset($_POST['selectmembership'])) {
- $roleSession = new Zend_Session_Namespace('userIDs');
- $roleSession->membershipID = $_POST['membershipID'];
- $roleSession->personID = $this->person->getID();
- $membership = $this->membershipMapper->find($_POST['membershipID']);
- $roleSession->groupID = $membership->getGroupID();
- $roleSession->roleID = $membership->getRoleID();
- $this->_redirect('/user/');
- return;
- } else {
- $groupMapper = new Application_Model_GroupMapper();
- $roleMapper = new Application_Model_RoleMapper();
- if(isset($this->memberships)) {
- foreach($this->memberships as $membership) {
- $group = $groupMapper->find($membership['groupID']);
- $role = $roleMapper->find($membership['roleID']);
- $membershipList[] = array(
- 'membershipID' => $membership['membershipID'],
- 'group' => $group->getTitle(),
- 'role' => $role->getTitle()
- );
+ if(count($this->memberships) > 0) {
+ if(isset($_POST['selectmembership'])) {
+ $roleSession = new Zend_Session_Namespace('userIDs');
+ $roleSession->membershipID = $_POST['membershipID'];
+ $roleSession->personID = $this->person->getID();
+ $membership = $this->membershipMapper->find($_POST['membershipID']);
+ $roleSession->groupID = $membership->getGroupID();
+ $roleSession->roleID = $membership->getRoleID();
+ $this->_redirect('/user/');
+ return;
+ } else {
+ $groupMapper = new Application_Model_GroupMapper();
+ $roleMapper = new Application_Model_RoleMapper();
+ if(isset($this->memberships)) {
+ foreach($this->memberships as $membership) {
+ $group = $groupMapper->find($membership['groupID']);
+ $role = $roleMapper->find($membership['roleID']);
+ $membershipList[] = array(
+ 'membershipID' => $membership['membershipID'],
+ 'group' => $group->getTitle(),
+ 'role' => $role->getTitle()
+ );
+ }
}
+ $membershipSelectForm = new user_Form_MembershipSelect(array('membershiplist' => $membershipList));
+ $this->view->membershipSelectForm = $membershipSelectForm;
}
- $membershipSelectForm = new user_Form_MembershipSelect(array('membershiplist' => $membershipList));
- $this->view->membershipSelectForm = $membershipSelectForm;
+ } else {
+ $this->_helper->redirector('request', 'person');
}
}
}
+ public function changemembershipAction()
+ {
+ $this->_helper-> viewRenderer-> setNoRender();
+ Zend_Session::namespaceUnset('userIDs');
+ $this->_helper->redirector('selectmembership', 'person');
+ return;
+ }
+
+
}
@@ -212,3 +221,5 @@ class user_PersonController extends Zend_Controller_Action
+
+
diff --git a/application/modules/user/views/scripts/auth/index.phtml b/application/modules/user/views/scripts/auth/index.phtml
deleted file mode 100644
index 4a9f827..0000000
--- a/application/modules/user/views/scripts/auth/index.phtml
+++ /dev/null
@@ -1 +0,0 @@
-<br /><br /><center>View script for controller <b>Auth</b> and script/action name <b>index</b></center> \ No newline at end of file
diff --git a/application/modules/user/views/scripts/person/index.phtml b/application/modules/user/views/scripts/person/index.phtml
index 3826d25..f23bc07 100644
--- a/application/modules/user/views/scripts/person/index.phtml
+++ b/application/modules/user/views/scripts/person/index.phtml
@@ -19,16 +19,20 @@ if(isset($this->groups)) {
?>
<br />
<h2>Member in the following Groups:</h2>
+ <?php echo $this->formButton('changeGroup', 'Select other Membership', array(
+ 'onclick' => 'self.location="/user/person/changemembership"',
+ 'class' => 'rightbutton'))?>
<table>
-<?php
-foreach($this->groups as $group) {
- ?>
<tr>
<th>Title</th>
<th>Description</th>
<th>Leave</th>
</tr>
- <tr>
+ <?php
+ foreach($this->groups as $group) {
+ ?>
+ <tr
+ <?php if($group['membershipID'] == $this->userIDsNamespace['membershipID']) echo 'class="selectedMembership"'; else echo 'class="entry"'; ?>>
<td><?php echo $group['title']; ?></td>
<td><?php echo $group['description']; ?></td>
<td class='action'><a
@@ -44,14 +48,14 @@ foreach($this->groups as $group) {
</td>
</tr>
<?php
-}
-}
-?>
+ }
+ ?>
</table>
-<?php echo $this->formButton('addtogroup', 'Add to additional
+ <?php echo $this->formButton('addtogroup', 'Add to additional
Groups', array(
'onclick' => 'self.location="/user/person/request/"',
'class' => 'addbutton'));
+}
?>
<br />
<br />