summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.zfproject.xml21
-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
-rw-r--r--application/modules/user/forms/RoleAdd.php21
-rw-r--r--application/modules/user/layouts/user.phtml10
-rw-r--r--application/modules/user/views/scripts/auth/delete.phtml2
-rw-r--r--application/modules/user/views/scripts/group/index.phtml105
-rw-r--r--application/modules/user/views/scripts/group/show.phtml17
-rw-r--r--application/modules/user/views/scripts/person/index.phtml216
-rw-r--r--application/modules/user/views/scripts/person/owndetails.phtml108
-rw-r--r--pbs-newdata.sql15
-rw-r--r--public/media/js/script.js6
14 files changed, 500 insertions, 275 deletions
diff --git a/.zfproject.xml b/.zfproject.xml
index 3a64fde..93c6784 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -123,7 +123,7 @@
<actionMethod actionName="leave"/>
<actionMethod actionName="selectMembership"/>
<actionMethod actionName="changemembership"/>
- <actionMethod actionName="showall"/>
+ <actionMethod actionName="owndetails"/>
<actionMethod actionName="show"/>
</controllerFile>
<controllerFile controllerName="Group">
@@ -135,7 +135,6 @@
<actionMethod actionName="delete"/>
<actionMethod actionName="grantperson"/>
<actionMethod actionName="revokeperson"/>
- <actionMethod actionName="showall"/>
</controllerFile>
<controllerFile controllerName="Role">
<actionMethod actionName="index"/>
@@ -304,6 +303,12 @@
<viewControllerScriptsDirectory forControllerName="Person">
<viewScriptFile forActionName="selectmembership"/>
</viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Person">
+ <viewScriptFile forActionName="owndetails"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Person">
+ <viewScriptFile forActionName="show"/>
+ </viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Role">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
@@ -335,20 +340,14 @@
<viewScriptFile forActionName="link"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Group">
- <viewScriptFile forActionName="showall"/>
- </viewControllerScriptsDirectory>
- <viewHelpersDirectory/>
- <viewFiltersDirectory/>
- <viewControllerScriptsDirectory forControllerName="Person">
- <viewScriptFile forActionName="showall"/>
- </viewControllerScriptsDirectory>
- <viewControllerScriptsDirectory forControllerName="Person">
- <viewScriptFile forActionName="show"/>
+ <viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Session">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
+ <viewHelpersDirectory/>
+ <viewFiltersDirectory/>
</viewsDirectory>
<bootstrapFile filesystemName="Bootstrap.php"/>
</moduleDirectory>
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');
}
diff --git a/application/modules/user/forms/RoleAdd.php b/application/modules/user/forms/RoleAdd.php
index 89cd540..4b5f059 100644
--- a/application/modules/user/forms/RoleAdd.php
+++ b/application/modules/user/forms/RoleAdd.php
@@ -41,23 +41,33 @@ class user_Form_RoleAdd extends Zend_Form
'label' => 'Title:',
));
- $sform = new Zend_Form_SubForm(array('legend' => 'Rights:'));
+ $this->addElement('text', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'label' => 'Description:',
+ 'value' => $_POST['description'],
+ ));
- $sform->addElement('button', 'checkAll', array(
+ if($this->addrighttoroleright) {
+ $sform = new Zend_Form_SubForm(array('legend' => 'Rights:'));
+ $sform->addElement('button', 'checkAll', array(
'required' => false,
'ignore' => true,
'label' => 'Check All',
'class' => 'leftbutton',
'onclick' => "checkAllCheckBoxes(new Array('inheritance'));",
- ));
-
- if($this->addrighttoroleright) {
+ ));
+
$sform->addElement('button', 'uncheckAll', array(
'required' => false,
'ignore' => true,
'label' => 'Uncheck All',
'onclick' => "uncheckAllCheckBoxes(new Array('inheritance'));",
));
+
if(count($this->rightlist) > 0) {
foreach($this->rightlist as $rightcategory => $rights) {
foreach($rights as $rightID => $rightTitle) {
@@ -72,6 +82,7 @@ class user_Form_RoleAdd extends Zend_Form
unset($elements);
}
}
+
$this->addSubForm($sform, 'rights');
}
diff --git a/application/modules/user/layouts/user.phtml b/application/modules/user/layouts/user.phtml
index 32569c9..2886d7a 100644
--- a/application/modules/user/layouts/user.phtml
+++ b/application/modules/user/layouts/user.phtml
@@ -30,19 +30,19 @@ echo $this->headScript()."\n";
<li>
<ul class='navTreeLevel1'>
<?php if(Zend_Auth::getInstance()->hasIdentity()) {
- echo "<li class='navTreeItem'><a href='/user/person'>Own Details</a></li>";
+ echo "<li class='navTreeItem'><a href='/user/person/owndetails'>Own Details</a></li>";
}
?>
<?php if (Zend_Auth::getInstance()->hasIdentity() && count(Zend_Session::namespaceGet('userIDs')) > 0) {
# This should be splitted
if(Pbs_Acl::checkRight('pso'))
- echo "<li class='navTreeItem'><a href='/user/person/showall'>Personlist</a></li>";
+ echo "<li class='navTreeItem'><a href='/user/person'>Person</a></li>";
if(Pbs_Acl::checkRight('gsdo'))
- echo "<li class='navTreeItem'><a href='/user/group'>Own Group</a></li>";
+ echo "<li class='navTreeItem'><a href='/user/group/show'>Own Group</a></li>";
if(Pbs_Acl::checkRight('gso'))
- echo "<li class='navTreeItem'><a href='/user/group/showall'>Grouplist</a></li>";
+ echo "<li class='navTreeItem'><a href='/user/group'>Group</a></li>";
if(Pbs_Acl::checkRight('ro'))
- echo "<li class='navTreeItem'><a href='/user/role'>Rolelist</a></li>";
+ echo "<li class='navTreeItem'><a href='/user/role'>Role</a></li>";
if(Pbs_Acl::checkRight('bai') || Pbs_Acl::checkRight('bui'))
echo "<li class='navTreeItem'><a href='/user/bootiso'>BootIso</a></li>";
if(Pbs_Acl::checkRight('pro'))
diff --git a/application/modules/user/views/scripts/auth/delete.phtml b/application/modules/user/views/scripts/auth/delete.phtml
index 62bf24e..83afc80 100644
--- a/application/modules/user/views/scripts/auth/delete.phtml
+++ b/application/modules/user/views/scripts/auth/delete.phtml
@@ -1,5 +1,5 @@
<h1>Delete Account</h1>
-Do you really want to delete this account?
+Do you really want to delete account?
<?php
$this->deleteconfirmform->setAction($this->url());
echo $this->deleteconfirmform;
diff --git a/application/modules/user/views/scripts/group/index.phtml b/application/modules/user/views/scripts/group/index.phtml
new file mode 100644
index 0000000..2e376b3
--- /dev/null
+++ b/application/modules/user/views/scripts/group/index.phtml
@@ -0,0 +1,105 @@
+<h1>Groups Overview</h1>
+<?php echo $this->searchform; ?>
+<?php echo $this->formButton('addgroup', 'Add Group', array(
+ 'onclick' => 'self.location="/user/group/add"',
+ 'class' => 'addbutton'))
+?>
+
+<div class='searchvars'>
+<div class='head'>Available searchfilter:</div>
+<div class='code'>title</div>
+<div class='code'>description</div>
+</div>
+
+<div class='listelement'><?php
+if(count($this->groupList)==0)
+echo "There are no groups" ?> <?php foreach ($this->groupList as $k => $group): ?>
+<?php
+$class='';
+if($group->getID() == $this->userIDsNamespace['groupID'])
+$class= 'highlight checked';
+?>
+<div class='element<?php echo " $class";?>'><?php if($group->getID() != $this->userIDsNamespace['groupID']) {
+ ?>
+<div class='number'>
+ <div class='smallnumber'>Group</div>
+ <?php echo $k+1; ?>
+</div>
+ <?php
+}
+?>
+<div class='content'>
+<div class='actions'><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>
+<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>
+<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>
+</div>
+<div class='title'><?php echo $group->getTitle(); ?></div>
+ <?php if($group->getDescription()) {
+ ?>
+<div class='subtitle'><?php echo $group->getDescription(); ?></div>
+ <?php
+ } else {
+ ?>
+<div class='subtitle'>&nbsp;</div>
+ <?php
+ }
+ ?></div>
+<div class='clear'></div>
+</div>
+<?php endforeach ?></div>
+<?php echo $this->pagination; ?>
+
+<?php echo $this->formButton('linkgroups', 'Link Groups', array(
+ 'onclick' => 'self.location="/user/group/link"',
+ 'class' => 'addbutton'))
+?>
+<br />
+<br />
diff --git a/application/modules/user/views/scripts/group/show.phtml b/application/modules/user/views/scripts/group/show.phtml
index 19dc396..2bb200c 100644
--- a/application/modules/user/views/scripts/group/show.phtml
+++ b/application/modules/user/views/scripts/group/show.phtml
@@ -83,13 +83,26 @@ foreach($this->groupRequestList as $grouprequest) {
<br />
<h2>Members:</h2>
<div class='listelement'><?php if(count($this->membersList)==0)
-echo "This hroup has no members." ?> <?php foreach ($this->membersList as $member): ?>
+echo "This hroup has no members." ?> <?php foreach ($this->membersList as $k => $member): ?>
<?php
$membershipID = $member['membershipID'];
$person = $member['person'];
$role = $member['role'];
+$class='';
+if($person->getID() == $this->userIDsNamespace['personID'])
+$class= 'highlight checked';
+?>
+<div class='element<?php echo " $class";?>'>
+<?php
+if($person->getID() != $this->userIDsNamespace['personID']) {
+ ?>
+ <div class='number'>
+ <div class='smallnumber'>Person</div>
+ <?php echo $k+1; ?>
+ </div>
+<?php
+}
?>
-<div class='element'>
<div class='content'>
<div class='actions'><a
href="<?php echo $this->url(
diff --git a/application/modules/user/views/scripts/person/index.phtml b/application/modules/user/views/scripts/person/index.phtml
index 8f91cfd..1304299 100644
--- a/application/modules/user/views/scripts/person/index.phtml
+++ b/application/modules/user/views/scripts/person/index.phtml
@@ -1,108 +1,126 @@
-<h1>Own Details</h1>
-<?php if($this->editRight === true) echo $this->formButton('editperson', 'Edit', array(
- 'onclick' => 'self.location="/user/person/edit/"',
- 'class' => 'rightbutton'))?>
-<div class='detailelement'>
-<div class='element'>
-<div class='content'>
-<div class="title">Title:&nbsp;<span class="noBold"><?php echo $this->person->getTitle(); ?></span></div>
-</div>
-<div class='clear'></div>
-</div>
-<div class='element'>
-<div class='content'>
-<div class="title">Name:&nbsp;<span class="noBold"><?php echo $this->person->getName(); ?></span></div>
-</div>
-<div class='clear'></div>
-</div>
-<div class='element'>
-<div class='content'>
-<div class="title">Firstname:&nbsp;<span class="noBold"><?php echo $this->person->getFirstname(); ?></span></div>
-</div>
-<div class='clear'></div>
-</div>
-<div class='element'>
-<div class='content'>
-<div class="title">Street:&nbsp;<span class="noBold"><?php echo $this->person->getStreet(); ?></span></div>
-</div>
-<div class='clear'></div>
-</div>
-<div class='element'>
-<div class='content'>
-<div class="title">Housenumber:&nbsp;<span class="noBold"><?php echo $this->person->getHousenumber(); ?></span></div>
-</div>
-<div class='clear'></div>
-</div>
-<div class='element'>
-<div class='content'>
-<div class="title">City:&nbsp;<span class="noBold"><?php echo $this->person->getCity(); ?></span></div>
-</div>
-<div class='clear'></div>
-</div>
-<div class='element'>
-<div class='content'>
-<div class="title">Postalcode:&nbsp;<span class="noBold"><?php echo $this->person->getPostalcode(); ?></span></div>
-</div>
-<div class='clear'></div>
-</div>
-<div class='element'>
-<div class='content'>
-<div class="title">Email:&nbsp;<span class="noBold"><?php echo $this->person->getEmail(); ?></span></div>
-</div>
-<div class='clear'></div>
-</div>
-<div class='element'>
-<div class='content'>
-<div class="title">Last Login Date:&nbsp;<span class="noBold"><?php if( $this->person->getLogindate()) echo date ('d. F Y - H:i', $this->person->getLogindate()) . " Uhr"; ?></span></div>
-</div>
-<div class='clear'></div>
-</div>
-<div class='element'>
-<div class='content'>
-<div class="title">Register Date:&nbsp;<span class="noBold"><?php echo date ('d. F Y - H:i', $this->person->getRegisterdate()) . ' Uhr'; ?></span></div>
-</div>
-<div class='clear'></div>
-</div>
-</div>
-<br />
-<h2>Member in the following Groups:</h2>
-<?php if($this->groupRequestRight === true) echo $this->formButton('addtogroup', 'Add to additional
-Groups', array(
- 'onclick' => 'self.location="/user/person/request/"',
- 'class' => 'addbutton')); ?>
-<div class='listelement'><?php if(count($this->groups)==0)
-echo "You are in no group." ?> <?php foreach ($this->groups as $group): ?>
+<h1>Persons Overview</h1>
+<?php echo $this->searchform; ?>
+<div class='searchvars'>
+<div class='head'>Available searchfilter:</div>
+<div class='code'>title</div>
+<div class='code'>name</div>
+<div class='code'>firstname</div>
+<div class='code'>email</div>
+</div>
+
+<div class='listelement'><?php if(count($this->personList)==0)
+echo "There are no Persons to display." ?> <?php foreach ($this->personList as $k => $person): ?>
<?php
$class='';
-if($group['membershipID'] == $this->userIDsNamespace['membershipID'])
+if($person->getID() == $this->userIDsNamespace['personID'])
$class= 'highlight checked';
?>
<div class='element<?php echo " $class";?>'>
+<?php if($person->getID() != $this->userIDsNamespace['personID']) {
+ ?>
+ <div class='number'>
+ <div class='smallnumber'>Person</div>
+ <?php echo $k+1; ?>
+ </div>
+<?php
+}
+?>
<div class='content'>
-<div class='actions'><?php if($this->leaveRight === true): ?> <a
+<div class='actions'><?php
+if($person->getID() == $this->userIDsNamespace['personID']) {
+ if($this->showRight === true) {
+ ?> <a
+ href="<?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'person',
+ 'action' => 'owndetails'
+ ),
+ 'default',
+ true);?>"> <img src='/media/img/show.png' alt='Show Person' /></a>
+ <?php
+ }
+ if($this->editRight === true) { ?> <a
href="<?php echo $this->url(
- array(
- 'module' => 'user',
- 'controller' => 'person',
- 'action' => 'leave',
- 'membershipID' => $group['membershipID']
- ),
- 'default',
- true) ?>"> <img src='/media/img/delete.png' alt='Delete Group' /></a>
- <?php endif; ?></div>
-<div class='title'><?php echo $group['title']; ?></div>
- <?php if($group['description']) {
- ?>
-<div class='subtitle'><?php echo $group['description']; ?></div>
- <?php
- } else {
- ?>
-<div class='subtitle'>&nbsp;</div>
- <?php
- }
- ?></div>
+ array(
+ 'module' => 'user',
+ 'controller' => 'person',
+ 'action' => 'edit'
+ ),
+ 'default',
+ true);?>"> <img src='/media/img/edit.png' alt='Edit Person' /></a>
+ <?php
+ }
+ if($this->deleteRight === true) { ?> <a
+ href="<?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'auth',
+ 'action' => 'delete'
+ ),
+ 'default',
+ true);?>"> <img src='/media/img/delete.png' alt='Delete Account' /></a>
+ <?php
+ }
+} else {
+ if($this->showOtherRight === true) {
+ ?> <a
+ href=" <?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'person',
+ 'action' => 'show',
+ 'personID' => $person->getID()
+ ),
+ 'default',
+ true); ?>"> <img src='/media/img/show.png' alt='Show Person' /></a>
+ <?php
+ }
+ if($this->editOtherRight === true) {
+ ?> <a
+ href=" <?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'person',
+ 'action' => 'edit',
+ 'personID' => $person->getID()
+ ),
+ 'default',
+ true); ?>"> <img src='/media/img/edit.png' alt='Edit Person' /></a>
+ <?php
+ }
+ if($this->deleteOtherRight === true) {
+ ?> <a
+ href=" <?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'auth',
+ 'action' => 'delete',
+ 'personID' => $person->getID()
+ ),
+ 'default',
+ true); ?>"> <img src='/media/img/delete.png' alt='Delete Account' /></a>
+ <?php
+ }
+}
+?></div>
+<div class='title'><?php echo $person->getTitle(); ?>&nbsp;<?php echo $person->getFirstname(); ?>&nbsp;<?php echo $person->getName(); ?></div>
+<div class='subtitle'><?php echo $person->getEmail(); ?></div>
+</div>
<div class='clear'></div>
</div>
- <?php endforeach ?></div>
- <?php echo $this->pagination;
- ?> \ No newline at end of file
+<?php endforeach ?></div>
+
+<?php echo $this->pagination; ?>
+
+<script>
+$(document).ready(function(){
+ if($('.element').find('.dispnone').length >= 1){
+ $(this).find('.title').css('cursor','pointer');
+
+ $('.title').click(function(){
+ $(this).siblings('.dispnone').toggle();
+ });
+ }
+});
+</script>
diff --git a/application/modules/user/views/scripts/person/owndetails.phtml b/application/modules/user/views/scripts/person/owndetails.phtml
new file mode 100644
index 0000000..8f91cfd
--- /dev/null
+++ b/application/modules/user/views/scripts/person/owndetails.phtml
@@ -0,0 +1,108 @@
+<h1>Own Details</h1>
+<?php if($this->editRight === true) echo $this->formButton('editperson', 'Edit', array(
+ 'onclick' => 'self.location="/user/person/edit/"',
+ 'class' => 'rightbutton'))?>
+<div class='detailelement'>
+<div class='element'>
+<div class='content'>
+<div class="title">Title:&nbsp;<span class="noBold"><?php echo $this->person->getTitle(); ?></span></div>
+</div>
+<div class='clear'></div>
+</div>
+<div class='element'>
+<div class='content'>
+<div class="title">Name:&nbsp;<span class="noBold"><?php echo $this->person->getName(); ?></span></div>
+</div>
+<div class='clear'></div>
+</div>
+<div class='element'>
+<div class='content'>
+<div class="title">Firstname:&nbsp;<span class="noBold"><?php echo $this->person->getFirstname(); ?></span></div>
+</div>
+<div class='clear'></div>
+</div>
+<div class='element'>
+<div class='content'>
+<div class="title">Street:&nbsp;<span class="noBold"><?php echo $this->person->getStreet(); ?></span></div>
+</div>
+<div class='clear'></div>
+</div>
+<div class='element'>
+<div class='content'>
+<div class="title">Housenumber:&nbsp;<span class="noBold"><?php echo $this->person->getHousenumber(); ?></span></div>
+</div>
+<div class='clear'></div>
+</div>
+<div class='element'>
+<div class='content'>
+<div class="title">City:&nbsp;<span class="noBold"><?php echo $this->person->getCity(); ?></span></div>
+</div>
+<div class='clear'></div>
+</div>
+<div class='element'>
+<div class='content'>
+<div class="title">Postalcode:&nbsp;<span class="noBold"><?php echo $this->person->getPostalcode(); ?></span></div>
+</div>
+<div class='clear'></div>
+</div>
+<div class='element'>
+<div class='content'>
+<div class="title">Email:&nbsp;<span class="noBold"><?php echo $this->person->getEmail(); ?></span></div>
+</div>
+<div class='clear'></div>
+</div>
+<div class='element'>
+<div class='content'>
+<div class="title">Last Login Date:&nbsp;<span class="noBold"><?php if( $this->person->getLogindate()) echo date ('d. F Y - H:i', $this->person->getLogindate()) . " Uhr"; ?></span></div>
+</div>
+<div class='clear'></div>
+</div>
+<div class='element'>
+<div class='content'>
+<div class="title">Register Date:&nbsp;<span class="noBold"><?php echo date ('d. F Y - H:i', $this->person->getRegisterdate()) . ' Uhr'; ?></span></div>
+</div>
+<div class='clear'></div>
+</div>
+</div>
+<br />
+<h2>Member in the following Groups:</h2>
+<?php if($this->groupRequestRight === true) echo $this->formButton('addtogroup', 'Add to additional
+Groups', array(
+ 'onclick' => 'self.location="/user/person/request/"',
+ 'class' => 'addbutton')); ?>
+<div class='listelement'><?php if(count($this->groups)==0)
+echo "You are in no group." ?> <?php foreach ($this->groups as $group): ?>
+<?php
+$class='';
+if($group['membershipID'] == $this->userIDsNamespace['membershipID'])
+$class= 'highlight checked';
+?>
+<div class='element<?php echo " $class";?>'>
+<div class='content'>
+<div class='actions'><?php if($this->leaveRight === true): ?> <a
+ href="<?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'person',
+ 'action' => 'leave',
+ 'membershipID' => $group['membershipID']
+ ),
+ 'default',
+ true) ?>"> <img src='/media/img/delete.png' alt='Delete Group' /></a>
+ <?php endif; ?></div>
+<div class='title'><?php echo $group['title']; ?></div>
+ <?php if($group['description']) {
+ ?>
+<div class='subtitle'><?php echo $group['description']; ?></div>
+ <?php
+ } else {
+ ?>
+<div class='subtitle'>&nbsp;</div>
+ <?php
+ }
+ ?></div>
+<div class='clear'></div>
+</div>
+ <?php endforeach ?></div>
+ <?php echo $this->pagination;
+ ?> \ No newline at end of file
diff --git a/pbs-newdata.sql b/pbs-newdata.sql
index 5715328..14c10dd 100644
--- a/pbs-newdata.sql
+++ b/pbs-newdata.sql
@@ -36,23 +36,22 @@ INSERT INTO `pbs`.`pbs_groupgroups` (`parentID`, `groupID`) VALUES
-- Adding role
-INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (2, '1', 'Role 2-Group1', NULL, 0);
-INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (3, '2', 'Role 1-Group2', NULL, 0);
-INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (4, '2', 'Role 2-Group2', NULL, 0);
+INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (4, '2', 'Role 1-Group2', NULL, 0);
+INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (5, '2', 'Role 2-Group2', NULL, 0);
+INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (6, '2', 'Role 3-Group2', NULL, 0);
INSERT INTO `pbs_rightroles` (`roleID`, `rightID`) VALUES
-(2, 4),
-(2, 3),
-(3, 1),
-(4, 2);
+(4, 4),
+(4, 3),
+(5, 1),
+(6, 2);
-- Adding memberships
INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `personID`) VALUES (1, '1', '1', '1');
INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `personID`) VALUES (2, '1', '2', '2');
INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `personID`) VALUES (3, '2', '3', '1');
INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `personID`) VALUES (4, '2', '4', '3');
-INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `personID`) VALUES (NULL , '1', '2', '1');
-- Adding clients
INSERT INTO `pbs_client` (`clientID`, `groupID`,`macadress`, `hardwarehash`) VALUES
diff --git a/public/media/js/script.js b/public/media/js/script.js
index 546e1f6..ce87812 100644
--- a/public/media/js/script.js
+++ b/public/media/js/script.js
@@ -1,7 +1,9 @@
$(document).ready(function() {
path = window.location.pathname.split('/');
- if (path[3] == 'showall') {
- mypath = '/' + path[1] + '/' + path[2] + '/' + path[3];
+ if (path[2] == 'person' && (path[3] == 'owndetails' || path[3] == 'edit' || path[3] == 'request') && path[4] != 'personID') {
+ mypath = '/' + path[1] + '/' + path[2] + '/owndetails';
+ } else if(path[2] == 'group' && (path[3] == 'show' || path[3] == 'edit') && path[4] != 'groupID') {
+ mypath = '/' + path[1] + '/' + path[2] + '/show';
} else {
mypath = '/' + path[1] + '/' + path[2];
}