summaryrefslogtreecommitdiffstats
path: root/application/modules/user
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules/user')
-rw-r--r--application/modules/user/controllers/AuthController.php12
-rw-r--r--application/modules/user/controllers/PersonController.php49
-rw-r--r--application/modules/user/forms/PersonEdit.php2
-rw-r--r--application/modules/user/forms/Register.php2
-rw-r--r--application/modules/user/views/scripts/person/index.phtml39
-rw-r--r--application/modules/user/views/scripts/person/owndetails.phtml48
-rw-r--r--application/modules/user/views/scripts/person/show.phtml29
7 files changed, 142 insertions, 39 deletions
diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php
index d1596ae..a90c8db 100644
--- a/application/modules/user/controllers/AuthController.php
+++ b/application/modules/user/controllers/AuthController.php
@@ -52,9 +52,14 @@ class User_AuthController extends Zend_Controller_Action
$person->setID($result[0]['personID']);
$date = new DateTime();
$person->setLogindate($date->getTimestamp());
- $this->personmapper->save($person);
- $this->_helper->redirector('selectmembership', 'person');
- return;
+ if($person->getSuspended()) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Your Account is suspended', 'error');
+ } else {
+ $this->personmapper->save($person);
+ $this->_helper->redirector('selectmembership', 'person');
+ return;
+ }
} else {
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('Wrong Email or Password', 'error');
@@ -95,6 +100,7 @@ class User_AuthController extends Zend_Controller_Action
$person = new Application_Model_Person($_POST);
$this->personmapper = new Application_Model_PersonMapper();
$date = new DateTime();
+ $person->setSuspended(0);
$person->setRegisterdate($date->getTimestamp());
$person->setPasswordSalt(MD5($date->getTimestamp()));
$person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
diff --git a/application/modules/user/controllers/PersonController.php b/application/modules/user/controllers/PersonController.php
index 98f7bb5..25b1f0a 100644
--- a/application/modules/user/controllers/PersonController.php
+++ b/application/modules/user/controllers/PersonController.php
@@ -63,6 +63,7 @@ class user_PersonController extends Zend_Controller_Action
$this->view->showOtherRight = Pbs_Acl::checkRight('psood');
$this->view->editOtherRight = Pbs_Acl::checkRight('peoa');
$this->view->deleteOtherRight = Pbs_Acl::checkRight('pdo');
+ $this->view->suspendRight = Pbs_Acl::checkRight('psa');
$this->view->userIDsNamespace = $this->userIDsNamespace;
$this->view->personList = $this->personmapper->fetchAll();
@@ -123,6 +124,7 @@ class user_PersonController extends Zend_Controller_Action
$this->view->groupRequestRight = true;
$this->view->editRight = Pbs_Acl::checkRight('peod');
$this->view->leaveRight = Pbs_Acl::checkRight('gl');
+ $this->view->suspendRight = Pbs_Acl::checkRight('psa');
$this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
}
@@ -386,6 +388,7 @@ class user_PersonController extends Zend_Controller_Action
$this->view->personID = $personID;
$this->view->editRight = Pbs_Acl::checkRight('peoa');
$this->view->deleteRight = Pbs_Acl::checkRight('pd');
+ $this->view->suspendRight = Pbs_Acl::checkRight('psa');
$this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
} else {
$this->_helper->redirector('', 'person');
@@ -409,6 +412,52 @@ class user_PersonController extends Zend_Controller_Action
return;
}
+ public function suspendAction()
+ {
+ if(!Pbs_Acl::checkRight('psa')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $personID = $this->_request->getParam('personID');
+ if(isset($personID)) {
+ $person = $this->personmapper->find($personID);
+ $person->setSuspended(1);
+ if(isset($person)) {
+ try {
+ $this->personmapper->save($person);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/person/");
+ }
+ }
+ }
+ public function resumeAction()
+ {
+ if(!Pbs_Acl::checkRight('psa')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $personID = $this->_request->getParam('personID');
+ if(isset($personID)) {
+ $person = $this->personmapper->find($personID);
+ $person->setSuspended(0);
+ if(isset($person)) {
+ try {
+ $this->personmapper->save($person);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/person/");
+ }
+ }
+ }
}
diff --git a/application/modules/user/forms/PersonEdit.php b/application/modules/user/forms/PersonEdit.php
index 7175691..392174c 100644
--- a/application/modules/user/forms/PersonEdit.php
+++ b/application/modules/user/forms/PersonEdit.php
@@ -92,7 +92,7 @@ class user_Form_PersonEdit extends Zend_Form
$this->addElement('password', 'newpassword', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
+ array('StringLength', false, array(5, 50)),
),
'required' => false,
'label' => 'Neues Password:',
diff --git a/application/modules/user/forms/Register.php b/application/modules/user/forms/Register.php
index 9c2a42d..1a054c4 100644
--- a/application/modules/user/forms/Register.php
+++ b/application/modules/user/forms/Register.php
@@ -84,7 +84,7 @@ class user_Form_Register extends Zend_Form
$this->addElement('password', 'password', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
+ array('StringLength', false, array(5, 50)),
),
'required' => true,
'label' => 'Password:',
diff --git a/application/modules/user/views/scripts/person/index.phtml b/application/modules/user/views/scripts/person/index.phtml
index 1304299..93dfd78 100644
--- a/application/modules/user/views/scripts/person/index.phtml
+++ b/application/modules/user/views/scripts/person/index.phtml
@@ -15,14 +15,12 @@ $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='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='number'>
+<div class='smallnumber'>Person</div>
+ <?php echo $k+1; ?></div>
+ <?php
}
?>
<div class='content'>
@@ -103,6 +101,33 @@ if($person->getID() == $this->userIDsNamespace['personID']) {
<?php
}
}
+if($this->suspendRight === true) {
+ if($person->getSuspended() == 1) {
+ ?> <a
+ href=" <?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'person',
+ 'action' => 'resume',
+ 'personID' => $person->getID()
+ ),
+ 'default',
+ true); ?>"> <img src='/media/img/resume.png' alt='Resume Account' /></a>
+ <?php
+ } else {
+ ?> <a
+ href=" <?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'person',
+ 'action' => 'suspend',
+ 'personID' => $person->getID()
+ ),
+ 'default',
+ true); ?>"> <img src='/media/img/suspend.png'
+ alt='Suspend 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>
diff --git a/application/modules/user/views/scripts/person/owndetails.phtml b/application/modules/user/views/scripts/person/owndetails.phtml
index db9221d..dc6e9aa 100644
--- a/application/modules/user/views/scripts/person/owndetails.phtml
+++ b/application/modules/user/views/scripts/person/owndetails.phtml
@@ -1,27 +1,40 @@
<h1>Own Details</h1>
<style>
-label{width:150px !important;}
+label {
+ width: 150px !important;
+}
</style>
<?php if($this->editRight === true) echo $this->formButton('editperson', 'Edit', array(
'onclick' => 'self.location="/user/person/edit/"',
'class' => 'rightbutton'))?>
<div class='listelement'>
<div class='element'>
- <div class='content'>
- <div class='title'><?php echo $this->person->getTitle()." ".$this->person->getFirstname()." ".$this->person->getName(); ?></div>
- <div class='subtitle'><?php echo $this->person->getEmail(); ?></div>
- <div class='details'>
- <label>Street:</label><div class='item'><?php echo $this->person->getStreet(); ?>&nbsp;</div>
- <label>Housenumber:</label><div class='item'><?php echo $this->person->getHousenumber(); ?>&nbsp;</div>
- <label>City:</label><div class='item'><?php echo $this->person->getCity(); ?>&nbsp;</div>
- <label>Postalcode:</label><div class='item'><?php echo $this->person->getPostalcode(); ?>&nbsp;</div>
- <label>Email:</label><div class='item'><?php echo $this->person->getEmail(); ?>&nbsp;</div>
- <label>Last Login:</label><div class='item'><?php if( $this->person->getLogindate()) echo date ('d. F Y - H:i', $this->person->getLogindate()) . " Uhr"; ?>&nbsp;</div>
- <label>Register Date:</label><div class='item'><?php echo date ('d. F Y - H:i', $this->person->getRegisterdate()) . ' Uhr'; ?>&nbsp;</div>
- </div>
- </div>
- <div class='clear'>
+<div class='content'>
+<div class='title'><?php echo $this->person->getTitle()." ".$this->person->getFirstname()." ".$this->person->getName(); ?></div>
+<div class='subtitle'><?php echo $this->person->getEmail(); ?></div>
+<div class='details'><label>Street:</label>
+<div class='item'><?php echo $this->person->getStreet(); ?>&nbsp;</div>
+<label>Housenumber:</label>
+<div class='item'><?php echo $this->person->getHousenumber(); ?>&nbsp;</div>
+<label>City:</label>
+<div class='item'><?php echo $this->person->getCity(); ?>&nbsp;</div>
+<label>Postalcode:</label>
+<div class='item'><?php echo $this->person->getPostalcode(); ?>&nbsp;</div>
+<label>Email:</label>
+<div class='item'><?php echo $this->person->getEmail(); ?>&nbsp;</div>
+<label>Last Login:</label>
+<div class='item'><?php if( $this->person->getLogindate()) echo date ('d. F Y - H:i', $this->person->getLogindate()) . " Uhr"; ?>&nbsp;</div>
+<label>Register Date:</label>
+<div class='item'><?php echo date ('d. F Y - H:i', $this->person->getRegisterdate()) . ' Uhr'; ?>&nbsp;</div>
+<?php if($this->suspendRight === true)
+{
+ ?> <label>Suspended:</label>
+<div class='item'><?php if($this->person->getSuspended() == 1) echo "yes"; else echo "no"; ?></div>
+ <?php
+}
+?></div>
</div>
+<div class='clear'></div>
</div>
<br />
<h2>Member in the following Groups:</h2>
@@ -65,8 +78,7 @@ $class= 'highlight checked';
<?php endforeach ?></div>
<?php echo $this->pagination;
if(isset($this->groupRequestList)) {
- ?>
-<br />
+ ?> <br />
<h2>Requests:</h2>
<div class='listelement'><?php
foreach($this->groupRequestList as $grouprequest) {
@@ -103,4 +115,4 @@ foreach($this->groupRequestList as $grouprequest) {
?></div>
<?php
}
- ?>
+ ?> \ No newline at end of file
diff --git a/application/modules/user/views/scripts/person/show.phtml b/application/modules/user/views/scripts/person/show.phtml
index c43bde3..2f2ef56 100644
--- a/application/modules/user/views/scripts/person/show.phtml
+++ b/application/modules/user/views/scripts/person/show.phtml
@@ -66,7 +66,18 @@
</div>
<div class='clear'></div>
</div>
+<?php if($this->suspendRight === true)
+{
+ ?>
+<div class='element'>
+<div class='content'>
+<div class="title">Suspended:&nbsp;<span class="noBold"><?php if($this->person->getSuspended() == 1) echo "yes"; else echo "no"; ?></span></div>
+</div>
+<div class='clear'></div>
</div>
+ <?php
+}
+?></div>
<br />
<h2>Member in the following Groups:</h2>
<div class='listelement'><?php if(count($this->groups)==0)
@@ -105,18 +116,18 @@ foreach($this->groupRequestList as $grouprequest) {
<div class='element'>
<div class='content'>
<div class='title'><?php echo $group->getTitle(); ?></div>
- <?php if($group->getDescription()) {
- ?>
+ <?php if($group->getDescription()) {
+ ?>
<div class='subtitle'><?php echo $group->getDescription(); ?></div>
- <?php
- } else {
- ?>
+ <?php
+ } else {
+ ?>
<div class='subtitle'>&nbsp;</div>
- <?php
- }
- ?></div>
+ <?php
+ }
+ ?></div>
</div>
- <?php
+ <?php
}
?></div>
<?php