diff options
author | Björn Geiger | 2011-03-28 12:56:10 +0200 |
---|---|---|
committer | Björn Geiger | 2011-03-28 12:56:10 +0200 |
commit | 84f8c7b61f61ff68e9568e01c23689d591dc4828 (patch) | |
tree | 35d6e718bdb2d6413a34d5d1bc5be40db76bb2bd | |
parent | updatebutton geadded (diff) | |
download | pbs2-84f8c7b61f61ff68e9568e01c23689d591dc4828.tar.gz pbs2-84f8c7b61f61ff68e9568e01c23689d591dc4828.tar.xz pbs2-84f8c7b61f61ff68e9568e01c23689d591dc4828.zip |
Groupcontroller User Module
-rw-r--r-- | .zfproject.xml | 41 | ||||
-rw-r--r-- | application/modules/dev/views/scripts/group/edit.phtml | 2 | ||||
-rw-r--r-- | application/modules/user/controllers/GroupController.php | 263 | ||||
-rw-r--r-- | application/modules/user/forms/GroupAdd.php | 65 | ||||
-rw-r--r-- | application/modules/user/forms/GroupEdit.php | 68 | ||||
-rw-r--r-- | application/modules/user/forms/GroupLink.php | 55 | ||||
-rw-r--r-- | application/modules/user/views/scripts/group/add.phtml | 4 | ||||
-rw-r--r-- | application/modules/user/views/scripts/group/edit.phtml | 10 | ||||
-rw-r--r-- | application/modules/user/views/scripts/group/index.phtml | 1 | ||||
-rw-r--r-- | application/modules/user/views/scripts/group/link.phtml | 4 | ||||
-rw-r--r-- | application/modules/user/views/scripts/group/show.phtml | 147 | ||||
-rw-r--r-- | application/modules/user/views/scripts/group/showall.phtml | 79 | ||||
-rw-r--r-- | public/media/css/style.css | 119 | ||||
-rw-r--r-- | public/media/css/user.css | 37 |
14 files changed, 804 insertions, 91 deletions
diff --git a/.zfproject.xml b/.zfproject.xml index 3845e14..3dcb267 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -123,6 +123,14 @@ </controllerFile> <controllerFile controllerName="Group"> <actionMethod actionName="index"/> + <actionMethod actionName="add"/> + <actionMethod actionName="edit"/> + <actionMethod actionName="show"/> + <actionMethod actionName="link"/> + <actionMethod actionName="delete"/> + <actionMethod actionName="grantperson"/> + <actionMethod actionName="revokeperson"/> + <actionMethod actionName="showall"/> </controllerFile> <controllerFile controllerName="Role"> <actionMethod actionName="index"/> @@ -184,6 +192,9 @@ <formFile formName="RoleAdd"/> <formFile formName="RoleEdit"/> <formFile formName="LinkRight"/> + <formFile formName="GroupEdit"/> + <formFile formName="GroupAdd"/> + <formFile formName="GroupLink"/> </formsDirectory> <layoutsDirectory enabled="false"/> <modelsDirectory> @@ -206,15 +217,6 @@ <viewControllerScriptsDirectory forControllerName="Auth"> <viewScriptFile forActionName="recoverpassword"/> </viewControllerScriptsDirectory> - <viewControllerScriptsDirectory forControllerName="Person"> - <viewScriptFile forActionName="index"/> - </viewControllerScriptsDirectory> - <viewControllerScriptsDirectory forControllerName="Group"> - <viewScriptFile forActionName="index"/> - </viewControllerScriptsDirectory> - <viewControllerScriptsDirectory forControllerName="Role"> - <viewScriptFile forActionName="index"/> - </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Bootiso"> <viewScriptFile forActionName="index"/> </viewControllerScriptsDirectory> @@ -279,6 +281,9 @@ <viewScriptFile forActionName="removefilterentry"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Person"> + <viewScriptFile forActionName="index"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Person"> <viewScriptFile forActionName="edit"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Person"> @@ -288,6 +293,9 @@ <viewScriptFile forActionName="selectmembership"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Role"> + <viewScriptFile forActionName="index"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Role"> <viewScriptFile forActionName="add"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Role"> @@ -299,6 +307,21 @@ <viewControllerScriptsDirectory forControllerName="Role"> <viewScriptFile forActionName="linkright"/> </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Group"> + <viewScriptFile forActionName="add"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Group"> + <viewScriptFile forActionName="edit"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Group"> + <viewScriptFile forActionName="show"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Group"> + <viewScriptFile forActionName="link"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Group"> + <viewScriptFile forActionName="showall"/> + </viewControllerScriptsDirectory> </viewScriptsDirectory> <viewHelpersDirectory/> <viewFiltersDirectory/> diff --git a/application/modules/dev/views/scripts/group/edit.phtml b/application/modules/dev/views/scripts/group/edit.phtml index dd3acbe..a0f9b32 100644 --- a/application/modules/dev/views/scripts/group/edit.phtml +++ b/application/modules/dev/views/scripts/group/edit.phtml @@ -1,6 +1,6 @@ <?php if(isset($this->addForm)) { - $this->addForm->setAction('/etc/group/add'); + $this->addForm->setAction('/dev/group/add'); echo $this->addForm; } else { diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php index 52136af..3180ebd 100644 --- a/application/modules/user/controllers/GroupController.php +++ b/application/modules/user/controllers/GroupController.php @@ -3,20 +3,279 @@ class User_GroupController extends Zend_Controller_Action { + protected $groupMapper = null; + + protected $groupGroupsMapper = null; + + protected $membershipMapper = null; + + protected $groupRequestMapper = null; + + protected $personmapper = null; + + protected $rolemapper = null; + + protected $groupList = null; + + protected $userIDsNamespace = null; + public function init() { if (Zend_Auth::getInstance()->hasIdentity()) { - + $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + $this->groupMapper = new Application_Model_GroupMapper(); + $this->groupGroupsMapper = new Application_Model_GroupGroupsMapper(); + $this->membershipMapper = new Application_Model_MembershipMapper(); + $this->groupRequestMapper = new Application_Model_GroupRequestMapper(); + $this->personmapper = new Application_Model_PersonMapper(); + $this->rolemapper = new Application_Model_RoleMapper(); + $this->groupList = $this->groupMapper->fetchAll(); } else { $this->_helper->redirector('login', 'auth'); + return; } } public function indexAction() { - // action body + $this->_helper->redirector('show', 'group'); + } + + public function addAction() + { + if (!isset($_POST["add"])){ + $addForm = new user_Form_GroupAdd(array('grouplist' => $this->groupList)); + } else { + $addForm = new user_Form_GroupAdd(array('grouplist' => $this->groupList),$_POST); + + if ($addForm->isValid($_POST)) { + $group = new Application_Model_Group($_POST); + try { + $this->groupMapper->save($group); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + if($_POST['superordinatedGroupID'] != -1) { + $lastID = $this->groupMapper->getDbTable()->getDefaultAdapter()->lastInsertId(); + $groupgroups = new Application_Model_GroupGroups(); + $groupgroups->setParentID($_POST['superordinatedGroupID']); + $groupgroups->setGroupID($lastID); + try { + $this->groupGroupsMapper->save($groupgroups); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + + } + $this->_helper->redirector('', 'group'); + return; + } + } + + $this->view->addForm = $addForm; + } + + public function editAction() + { + $groupID = $this->_request->getParam('groupID'); + if(!isset($groupID)) { + $groupID = $this->userIDsNamespace['groupID']; + } + if(!isset($groupID)) { + $addForm = new user_Form_GroupAdd(array('grouplist' => $this->groupList)); + $this->view->addForm = $addForm; + return; + } + if (!isset($_POST["save"])){ + $group = $this->groupMapper->find($groupID); + $_POST['title'] = $group->getTitle(); + $_POST['description'] = $group->getDescription(); + $editForm = new user_Form_GroupEdit(array('groupID' => $groupID)); + } else { + $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')); + try { + $this->groupMapper->save($group); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $this->_helper->redirector('', 'group'); + return; + } + } + + $this->view->editForm = $editForm; } + public function showAction() + { + $groupID = $this->_request->getParam('groupID'); + if(!isset($groupID)) { + $groupID = $this->userIDsNamespace['groupID']; + } + if($groupID) { + $groupRequests = $this->groupRequestMapper->findBy('groupID', $groupID); + if(isset($groupRequests)) { + foreach($groupRequests as $groupRequest) { + $person = $this->personmapper->find($groupRequest['personID']); + $groupRequestList[] = array( + 'grouprequestID' => $groupRequest['grouprequestID'], + 'person' => $person + ); + } + if(is_array($groupRequestList)) { + $this->view->groupRequestList = $groupRequestList; + } + $this->view->roleList = $this->rolemapper->findBy('groupID', $groupID); + } + $members = $this->membershipMapper->findBy('groupID', $groupID); + if(isset($members)) { + foreach($members as $member) { + $person = $this->personmapper->find($member['personID']); + $membersList[] = array( + 'membershipID' => $member['membershipID'], + 'person' => $person + ); + } + if(is_array($membersList)) { + $this->view->membersList = $membersList; + } + } + $groupgroups = $this->groupGroupsMapper->findBy('groupID', $groupID); + if(is_object($groupgroups)) { + $parentGroup = $this->groupMapper->find($groupgroups->getParentID()); + $this->view->$parentGroup = $parentGroup; + } + $group = $this->groupMapper->find($groupID); + $this->view->userIDsNamespace = $this->userIDsNamespace; + $this->view->group = $group; + $this->view->groupID = $groupID; + } + } + + public function linkAction() + { + if (!isset($_POST["link"])){ + $linkForm = new user_Form_GroupLink(array('grouplist' => $this->groupList)); + } else { + $linkForm = new user_Form_GroupLink(array('grouplist' => $this->groupList),$_POST); + + if ($linkForm->isValid($_POST)) { + $groupgroups = new Application_Model_GroupGroups(); + $groupgroups->setParentID($_POST['superordinatedGroupID']); + $groupgroups->setGroupID($_POST['groupID']); + try { + $this->groupGroupsMapper->save($groupgroups); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $this->_helper->redirector('', 'group'); + return; + } + } + + $this->view->linkForm = $linkForm; + } + + public function deleteAction() + { + $this->_helper->viewRenderer->setNoRender(); + $groupID = $this->_request->getParam('groupID'); + if(!isset($groupID)) { + $groupID = $this->userIDsNamespace['groupID']; + } + if (isset($groupID)){ + $group = $this->groupMapper->find($groupID); + try { + $this->groupMapper->delete($group); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show')) { + if(strpos($_SERVER['HTTP_REFERER'], '/groupID/')) { + $this->_redirect('/user/group/show/groupID/' . $groupID); + } else { + $this->_helper->redirector('changemembership', 'person'); + } + } else { + $this->_helper->redirector('showall', 'group'); + } + return; + } + } + + public function grantpersonAction() + { + $this->_helper->viewRenderer->setNoRender(); + if(isset($_POST['grouprequestID']) && isset($_POST['roleID'])) { + $groupRequest = $this->groupRequestMapper->find($_POST['grouprequestID']); + try { + $this->groupRequestMapper->delete($groupRequest); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $membership = new Application_Model_Membership(); + $membership->setGroupID($groupRequest->getGroupID()); + $membership->setPersonID($groupRequest->getPersonID()); + $membership->setRoleID($_POST['roleID']); + try { + $this->membershipMapper->save($membership); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $this->_redirect("/user/group/show/groupID/" . $groupRequest->getGroupID()); + } + } + + public function revokepersonAction() + { + $this->_helper->viewRenderer->setNoRender(); + $membershipID = $this->_request->getParam('membershipID'); + if(isset($membershipID)) { + $membership = $this->membershipMapper->find($membershipID); + if(isset($membership)) { + try { + $this->membershipMapper->delete($membership); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $this->_redirect("/user/group/edit/groupID/" . $membership->getGroupID()); + } + + } } + + public function showallAction() + { + $this->view->userIDsNamespace = $this->userIDsNamespace; + $this->view->groupList = $this->groupList; + } + } diff --git a/application/modules/user/forms/GroupAdd.php b/application/modules/user/forms/GroupAdd.php new file mode 100644 index 0000000..47855de --- /dev/null +++ b/application/modules/user/forms/GroupAdd.php @@ -0,0 +1,65 @@ +<?php + +class user_Form_GroupAdd extends Zend_Form +{ + private $grouplist; + + public function setGrouplist($grouplist){ + $this->grouplist = $grouplist; + + } + + + public function init() + { + $this->setName("GroupAdd"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + + $this->addElement('text', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'label' => 'Description:', + )); + + $groupfield = $this->createElement('select','superordinatedGroupID'); + $groupfield ->setLabel('superordinated Group:'); + + $groupfield->addMultiOption('-1', '---- none ----'); + + if(count($this->grouplist)>0){ + foreach($this->grouplist as $group => $g){ + $groupfield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $groupfield->setRegisterInArrayValidator(false); + $this->addElement($groupfield); + + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Add', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="/dev/group/"', + )); + } + + +} + diff --git a/application/modules/user/forms/GroupEdit.php b/application/modules/user/forms/GroupEdit.php new file mode 100644 index 0000000..0da0f61 --- /dev/null +++ b/application/modules/user/forms/GroupEdit.php @@ -0,0 +1,68 @@ +<?php + +class user_Form_GroupEdit extends Zend_Form +{ + private $groupID; + + public function setGroupID($groupID){ + $this->groupID = $groupID; + + } + + public function init() + { + $this->setName("GroupEdit"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + 'value' => $_POST['title'], + )); + + $this->addElement('text', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'label' => 'Description:', + 'value' => $_POST['description'], + )); + + $this->addElement('submit', 'save', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Save', + )); + + if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show')) { + if(strpos($_SERVER['HTTP_REFERER'], '/groupID/')) { + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="/user/group/show/groupID/' . $this->groupID . '"', + )); + } else { + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="/user/group/show/"', + )); + } + } else { + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="/user/group/showall"', + )); + } + } +}
\ No newline at end of file diff --git a/application/modules/user/forms/GroupLink.php b/application/modules/user/forms/GroupLink.php new file mode 100644 index 0000000..d2aafcc --- /dev/null +++ b/application/modules/user/forms/GroupLink.php @@ -0,0 +1,55 @@ +<?php + +class user_Form_GroupLink extends Zend_Form +{ + private $grouplist; + + public function setGrouplist($grouplist){ + $this->grouplist = $grouplist; + + } + + public function init() + { + $this->setName("GroupLink"); + $this->setMethod('post'); + + $groupfield = $this->createElement('select','groupID'); + $groupfield ->setLabel('Group:'); + + if(count($this->grouplist)>0){ + foreach($this->grouplist as $group => $g){ + $groupfield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $groupfield->setRegisterInArrayValidator(false); + $this->addElement($groupfield); + + $groupfield1 = $this->createElement('select','superordinatedGroupID'); + $groupfield1 ->setLabel('superordinated Group:'); + + if(count($this->grouplist)>0){ + foreach($this->grouplist as $group => $g){ + $groupfield1->addMultiOption($g->getID(), $g->getTitle()); + } + } + $groupfield1->setRegisterInArrayValidator(false); + $this->addElement($groupfield1); + + $this->addElement('submit', 'link', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Link', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="/user/group/"', + )); + } + + +} + diff --git a/application/modules/user/views/scripts/group/add.phtml b/application/modules/user/views/scripts/group/add.phtml new file mode 100644 index 0000000..4f96cf0 --- /dev/null +++ b/application/modules/user/views/scripts/group/add.phtml @@ -0,0 +1,4 @@ +<?php +$this->addForm->setAction($this->url()); +echo $this->addForm; +?>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/group/edit.phtml b/application/modules/user/views/scripts/group/edit.phtml new file mode 100644 index 0000000..d513dea --- /dev/null +++ b/application/modules/user/views/scripts/group/edit.phtml @@ -0,0 +1,10 @@ +<?php +if(isset($this->addForm)) { + $this->addForm->setAction('/user/group/add'); + echo $this->addForm; +} +else { + $this->editForm->setAction($this->url()); + echo $this->editForm; +} +?> diff --git a/application/modules/user/views/scripts/group/index.phtml b/application/modules/user/views/scripts/group/index.phtml deleted file mode 100644 index a1e5635..0000000 --- a/application/modules/user/views/scripts/group/index.phtml +++ /dev/null @@ -1 +0,0 @@ -<br /><br /><center>View script for controller <b>Group</b> and script/action name <b>index</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/group/link.phtml b/application/modules/user/views/scripts/group/link.phtml new file mode 100644 index 0000000..94ad343 --- /dev/null +++ b/application/modules/user/views/scripts/group/link.phtml @@ -0,0 +1,4 @@ +<?php +$this->linkForm->setAction($this->url()); +echo $this->linkForm; +?>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/group/show.phtml b/application/modules/user/views/scripts/group/show.phtml new file mode 100644 index 0000000..18ad1d3 --- /dev/null +++ b/application/modules/user/views/scripts/group/show.phtml @@ -0,0 +1,147 @@ +<?php +if($this->groupID) { + if(isset($this->userIDsNamespace['groupID'])) { + ?> +<h1>Group</h1> + <?php + } else { + ?> +<h1>Group Details</h1> + <?php + } + if(isset($this->userIDsNamespace['groupID'])) { + echo $this->formButton('deletegroup', 'Delete', array( + 'onclick' => 'self.location="/user/group/delete/"', + 'class' => 'rightbutton')); + echo $this->formButton('editgroup', 'Edit', array( + 'onclick' => 'self.location="/user/group/edit/"', + 'class' => 'rightbutton')); + } else { + echo $this->formButton('deletegroup', 'Delete', array( + 'onclick' => 'self.location="/user/group/delete/groupID/' . $this->group->getID() .'"', + 'class' => 'rightbutton')); + echo $this->formButton('editgroup', 'Edit', array( + 'onclick' => 'self.location="/user/group/edit/groupID/' . $this->group->getID() .'"', + 'class' => 'rightbutton')); + } + ?> +<span class="clear"></span> +<table> + <tr> + <th>Title</th> + <th>Description</th> + </tr> + <tr class="entry"> + <td><?php echo $this->group->getTitle(); ?></td> + <td><?php echo $this->group->getDescription(); ?></td> + </tr> + <?php + if(isset($parentGroup) && is_object($parentGroup)) { + ?> + <tr> + <td><b>Superordinated Group:</b></td> + <td><?php echo $this->parentGroup->getTitle(); ?></td> + </tr> + <?php + } + ?> +</table> + <?php + echo $this->formButton('editgroup', 'Show Grouplist', array( + 'onclick' => 'self.location="/user/group/showall"', + 'class' => 'rightbutton')); + if(isset($this->groupRequestList)) { + ?> +<br /> +<h2>Requests:</h2> +<table> + <tr> + <th>Firstname</th> + <th>Name</th> + <th>email</th> + <th>city</th> + <th>grant</th> + </tr> + <?php + foreach($this->groupRequestList as $grouprequest) { + $grouprequestID = $grouprequest['grouprequestID']; + $person = $grouprequest['person']; + ?> + <tr class="entry"> + <td><?php echo $person->getFirstname(); ?></td> + <td><?php echo $person->getName(); ?></td> + <td><?php echo $person->getEmail(); ?></td> + <td><?php echo $person->getCity(); ?></td> + <td> + <form action="/user/group/grantperson" method="post"><input + type="hidden" name="grouprequestID" + value="<?php echo $grouprequestID; ?>" /> <?php printRoleSelect($this->roleList); ?> + <input type="image" src='/media/img/save.png' alt='Grant Person' + name="confirm" value="confirm" /></form> + </td> + </tr> + <?php + } + ?> +</table> + <?php + } + if(isset($this->membersList)) { + ?> +<br /> +<h2>Members:</h2> +<table> + <tr> + <th>Firstname</th> + <th>Name</th> + <th>email</th> + <th>city</th> + <th>revoke</th> + </tr> + + <?php + foreach($this->membersList as $member) { + $membershipID = $member['membershipID']; + $person = $member['person']; + ?> + <tr class="entry"> + <td><?php echo $person->getFirstname(); ?></td> + <td><?php echo $person->getName(); ?></td> + <td><?php echo $person->getEmail(); ?></td> + <td><?php echo $person->getCity(); ?></td> + <td class='action'><a + href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'revokeperson', + 'membershipID' => $membershipID, + ), + 'default', + true) ?>"> <img src='/media/img/delete.png' alt='Delete Group' /></a> + </td> + </tr> + <?php + } + ?> +</table> + <?php + } +} + +function printRoleSelect($roleList) { + if(!is_array($roleList)) { + return; + } + echo "<select name=\"roleID\">"; + foreach($roleList as $role) { + echo "<option value=\"" . $role['roleID'] . "\">" . $role['title'] . "</option>"; + } + echo "</select>"; +} +?> +<br /> +<br /> +<br /> +<br /> +<br /> diff --git a/application/modules/user/views/scripts/group/showall.phtml b/application/modules/user/views/scripts/group/showall.phtml new file mode 100644 index 0000000..e26e91e --- /dev/null +++ b/application/modules/user/views/scripts/group/showall.phtml @@ -0,0 +1,79 @@ +<h1>Groups</h1> +<?php echo $this->formButton('addgroup', 'Add Group', array( + 'onclick' => 'self.location="/user/group/add"', + 'class' => 'addbutton')) +?> +<table> + <tr> + <th>Title</th> + <th colspan=3>Actions</th> + </tr> + <?php + $count = 0; + foreach($this->groupList as $group) { + ?> + <tr + <?php if($group->getID() == $this->userIDsNamespace['groupID']) echo 'class="selectedEntry"'; else echo 'class="entry"'; ?>> + <td><?php echo $group->getTitle(); ?></td> + <td class='action'><a + href="<?php if($group->getID() == $this->userIDsNamespace['groupID']) echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'show' + ), + 'default', + true); else echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'show', + 'groupID' => $group->getID() + ), + 'default', + true); ?>"> <img src='/media/img/show.png' alt='Show Group' /></a></td> + <td class='action'><a + href="<?php if($group->getID() == $this->userIDsNamespace['groupID']) echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'edit' + ), + 'default', + true); else echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'edit', + 'groupID' => $group->getID() + ), + 'default', + true); ?>"> <img src='/media/img/edit.png' alt='Edit Group' /></a></td> + <td class='action'><a + href="<?php if($group->getID() == $this->userIDsNamespace['groupID']) echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'delete' + ), + 'default', + true); else echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'delete', + 'groupID' => $group->getID() + ), + 'default', + true); ?>"> <img src='/media/img/delete.png' alt='Delete Group' /></a> + </td> + </tr> + <?php + $count++; + } + ?> +</table> + <?php echo $this->formButton('linkgroups', 'Link Groups', array( + 'onclick' => 'self.location="/user/group/link"', + 'class' => 'addbutton')) + ?> diff --git a/public/media/css/style.css b/public/media/css/style.css index 7e147d0..5a311b5 100644 --- a/public/media/css/style.css +++ b/public/media/css/style.css @@ -34,11 +34,10 @@ body { #sidepannel { float: left; - font-size:12px; + font-size: 12px; } - -#footer { +#footer { margin: 0; width: 1000px; clear: both; @@ -107,8 +106,8 @@ body { #content { padding: 10px; font-size: 13px; - min-height:400px; - background-color:#F2F3F1; + min-height: 400px; + background-color: #F2F3F1; } #debug { @@ -138,37 +137,35 @@ body { width: 160px; padding: 0; margin: 0 0 21px 0; - background-color: #ffffff; - border-bottom: none; + background-color: #ffffff; + border-bottom: none; overflow: hidden; - } +} .portletNavigationTree .portletItem { - border-left: none; - border-right: none; - } + border-left: none; + border-right: none; +} .portletNavigationTree dt { display: none; - } +} -.portletNavigationTree ul, -.portletNavigationTree ul li, -.portletNavigationTree dd, -.portletNavigationTree div { +.portletNavigationTree ul,.portletNavigationTree ul li,.portletNavigationTree dd,.portletNavigationTree div + { margin: 0; padding: 0; - } +} .portletNavigationTree ul li { margin: 0; border-bottom: 1px solid #fff; list-style: none; - } +} .portletNavigationTree ul li.navTreeLastItem { - border-bottom: none; - } + border-bottom: none; +} .portletNavigationTree li.navTreeItem a { display: block; @@ -178,100 +175,98 @@ body { text-decoration: none; color: #363534; background: #c9cac8; - } - +} /* - navTreeLevel0 - */ .portletNavigationTree ul.navTreeLevel0 a { - padding-left: 4px; - } + padding-left: 4px; +} .portletNavigationTree ul.navTreeLevel0 a:hover { - background: #004a99; - color: #fff; - } + background: #004a99; + color: #fff; +} .portletNavigationTree ul.navTreeLevel0 a.navTreeCurrentItem { background: #004a99 !important; color: #fff; margin-left: 0px; padding-left: 4px; - } +} .portletNavigationTree ul.navTreeLevel0 li { - background: url(/media/img/navigationLevel0.gif) repeat-y left top #c9cac8; - padding-left: 4px; - } - + background: url(/media/img/navigationLevel0.gif) repeat-y left top + #c9cac8; + padding-left: 4px; +} /* - navTreeLevel1 - */ .portletNavigationTree ul.navTreeLevel1 { - /* border-top: 1px solid #fff; */ - margin: 0 0 0 0px; - } + /* border-top: 1px solid #fff; */ + margin: 0 0 0 0px; +} .portletNavigationTree ul.navTreeLevel1 a { background: #d5d6d2; color: #363534; padding-left: 4px; - } +} .portletNavigationTree ul.navTreeLevel1 a:hover { background: #2a6ebb; color: #fff; - } +} .portletNavigationTree ul.navTreeLevel1 li { - background: url(/media/img/navigationLevel1.gif) repeat-y 0px top; - } + background: url(/media/img/navigationLevel1.gif) repeat-y 0px top; +} .portletNavigationTree ul.navTreeLevel1 a.navTreeCurrentItem { background: #2a6ebb !important; color: #fff; margin-left: 0px; - } +} .portletNavigationTree ul.navTreeLevel1 li.navTreeLastItem { - border-bottom: none; - } - + border-bottom: none; +} /* - navTreeLevel2 - */ .portletNavigationTree ul.navTreeLevel2 { - border-top: 1px solid #fff; - margin: 0; - } + border-top: 1px solid #fff; + margin: 0; +} .portletNavigationTree ul.navTreeLevel2 a { background: #e0e1dd; margin-left: 0px; padding-left: 4px; - } +} .portletNavigationTree ul.navTreeLevel2 a:hover { background: #6f9ad3; color: #fff; - } +} .portletNavigationTree ul.navTreeLevel2 li { - background: url(/media/img/navigationLevel2.gif) repeat-y left top; - } + background: url(/media/img/navigationLevel2.gif) repeat-y left top; +} .portletNavigationTree ul.navTreeLevel2 li.navTreeLastItem { - border: none; - } + border: none; +} .portletNavigationTree ul.navTreeLevel2 a.navTreeCurrentItem { background: #6f9ad3 !important; color: #fff !important; - } +} .portletNavigationTree ul.navTreeLevel2 a.navTreeItemInPath { background: #6f9ad3 !important; color: #fff !important; - } -/* ################################################### */ +} +/* ################################################### */ #content h1 { display: block; text-align: center; @@ -297,13 +292,15 @@ td { font-size: 12px; border: 1px solid #CCC; } -.updatebutton, .addbutton { + +.updatebutton,.addbutton { float: right; } .updatebutton:before { content: url(/media/img/update.png) ' '; } + .addbutton:before { content: url(/media/img/create.png) ' '; } @@ -323,14 +320,6 @@ td { background-color: #FFF5CC; } -tr.selectedMembership { - background-color: red; -} - -tr.selectedMembership td { - padding-left: 3px; -} - .monospace { font-family: Courier New, monospace; } @@ -435,4 +424,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 diff --git a/public/media/css/user.css b/public/media/css/user.css index 24e830e..00d144a 100644 --- a/public/media/css/user.css +++ b/public/media/css/user.css @@ -1,19 +1,30 @@ -.dashboard ul{ - padding:0px; +.dashboard ul { + padding: 0px; } -.dashboard li{ - list-style:none; - border:1px solid black; + +.dashboard li { + list-style: none; + border: 1px solid black; -moz-border-radius: 1em 4em 1em 4em; border-radius: 1em 4em 1em 4em; - padding:10px 40px; - margin:10px; - background-color:#FFF; + padding: 10px 40px; + margin: 10px; + background-color: #FFF; } -.dashboard a{ - color:#000; - text-decoration:none; + +.dashboard a { + color: #000; + text-decoration: none; } -.dashboard .bottomimg{ - text-align:center; + +.dashboard .bottomimg { + text-align: center; } + +tr.selectedEntry { + background-color: red; +} + +tr.selectedEntry td { + padding-left: 3px; +}
\ No newline at end of file |