summaryrefslogtreecommitdiffstats
path: root/application/modules/user/forms
diff options
context:
space:
mode:
authorBjörn Geiger2011-03-27 16:44:55 +0200
committerBjörn Geiger2011-03-27 16:44:55 +0200
commitaaf8275e5ff92504357c5f3167a3f256d0d393ad (patch)
tree1b6faae50f95f7a3bc2c51c452fc33c8f867caa4 /application/modules/user/forms
parentCompare Methode bei allen Mappern ergänzt (diff)
downloadpbs2-aaf8275e5ff92504357c5f3167a3f256d0d393ad.tar.gz
pbs2-aaf8275e5ff92504357c5f3167a3f256d0d393ad.tar.xz
pbs2-aaf8275e5ff92504357c5f3167a3f256d0d393ad.zip
Rollenverwaltung User Module
Diffstat (limited to 'application/modules/user/forms')
-rw-r--r--application/modules/user/forms/LinkRight.php48
-rw-r--r--application/modules/user/forms/RoleAdd.php50
-rw-r--r--application/modules/user/forms/RoleEdit.php65
3 files changed, 163 insertions, 0 deletions
diff --git a/application/modules/user/forms/LinkRight.php b/application/modules/user/forms/LinkRight.php
new file mode 100644
index 0000000..139aee4
--- /dev/null
+++ b/application/modules/user/forms/LinkRight.php
@@ -0,0 +1,48 @@
+<?php
+
+class user_Form_LinkRight extends Zend_Form
+{
+ private $rightlist;
+ private $roleID;
+
+ public function setRightlist($rightlist){
+ $this->rightlist = $rightlist;
+ }
+
+ public function setRoleID($roleID){
+ $this->roleID = $roleID;
+ }
+
+ public function init()
+ {
+ $this->setName("LinkRight");
+ $this->setMethod('post');
+
+ $rightfield = $this->createElement('select','rightID');
+ $rightfield ->setLabel('Right:');
+
+ if(count($this->rightlist)>0){
+ foreach($this->rightlist as $right => $r){
+ $rightfield->addMultiOption($r->getID(), $r->getTitle());
+ }
+ }
+ $rightfield->setRegisterInArrayValidator(false);
+ $this->addElement($rightfield);
+
+ $this->addElement('submit', 'link', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add Right',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="/user/role/show/roleID/' . $this->roleID . '"',
+ ));
+ }
+
+
+}
+
diff --git a/application/modules/user/forms/RoleAdd.php b/application/modules/user/forms/RoleAdd.php
new file mode 100644
index 0000000..3b5200b
--- /dev/null
+++ b/application/modules/user/forms/RoleAdd.php
@@ -0,0 +1,50 @@
+<?php
+
+class user_Form_RoleAdd extends Zend_Form
+{
+ private $rightlist;
+
+ public function setRightlist($rightlist){
+ $this->rightlist = $rightlist;
+ }
+
+ public function init()
+ {
+ $this->setName("RoleAdd");
+ $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:',
+ ));
+
+ $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="/user/role/"',
+ ));
+ }
+
+
+}
+
diff --git a/application/modules/user/forms/RoleEdit.php b/application/modules/user/forms/RoleEdit.php
new file mode 100644
index 0000000..170a2f9
--- /dev/null
+++ b/application/modules/user/forms/RoleEdit.php
@@ -0,0 +1,65 @@
+<?php
+
+class user_Form_RoleEdit extends Zend_Form
+{
+ private $roleID;
+
+ public function setRoleID($roleID){
+ $this->roleID = $roleID;
+ }
+
+ public function init()
+ {
+ $this->setName("RoleEdit");
+ $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('hidden', 'groupID', array(
+ 'value' => $_POST['groupID'],
+ ));
+
+ $this->addElement('submit', 'save', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
+
+ if(strpos($_SERVER['HTTP_REFERER'], '/user/role/show/roleID')) {
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="/user/role/show/roleID/' . $this->roleID . '"',
+ ));
+ } else {
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="/user/role/"',
+ ));
+ }
+ }
+
+
+}
+