summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.zfproject.xml9
-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
-rw-r--r--public/media/css/style.css15
6 files changed, 76 insertions, 52 deletions
diff --git a/.zfproject.xml b/.zfproject.xml
index 7b8e6d9..aa9f121 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -113,6 +113,7 @@
<actionMethod actionName="request"/>
<actionMethod actionName="leave"/>
<actionMethod actionName="selectMembership"/>
+ <actionMethod actionName="changemembership"/>
</controllerFile>
<controllerFile controllerName="Group">
<actionMethod actionName="index"/>
@@ -179,9 +180,6 @@
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Auth">
- <viewScriptFile forActionName="index"/>
- </viewControllerScriptsDirectory>
- <viewControllerScriptsDirectory forControllerName="Auth">
<viewScriptFile forActionName="login"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Auth">
@@ -271,8 +269,9 @@
<viewControllerScriptsDirectory forControllerName="Person">
<viewScriptFile forActionName="request"/>
</viewControllerScriptsDirectory>
- <viewControllerScriptsDirectory forControllerName="Group">
- <viewScriptFile forActionName="select"/>
+ <viewControllerScriptsDirectory forControllerName="Person">
+ <viewScriptFile forActionName="selectmembership"/>
+ </viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory/>
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 />
diff --git a/public/media/css/style.css b/public/media/css/style.css
index c9ad7e8..644f0c2 100644
--- a/public/media/css/style.css
+++ b/public/media/css/style.css
@@ -201,7 +201,7 @@ th {
td {
font-size: 12px;
- border: 1px solid #CCC;
+ border: 1px solid #CCC;
}
.addbutton {
@@ -227,6 +227,14 @@ td {
background-color: #FFF5CC;
}
+tr.selectedMembership {
+ background-color: red;
+}
+
+tr.selectedMembership td {
+ padding-left: 3px;
+}
+
.monospace {
font-family: Courier New, monospace;
}
@@ -249,7 +257,8 @@ dl.zend_form dd * {
tr.entry {
background-color: #FFF5CC;
}
-tr.entry td{
+
+tr.entry td {
padding-left: 3px;
}
@@ -330,4 +339,4 @@ td.action img {
background: #FFFFFF url('/media/img/box_info.png') no-repeat;
background-position: 10px center;
color: #777;
-}
+} \ No newline at end of file