diff options
Diffstat (limited to 'application/modules/user/forms')
| -rw-r--r-- | application/modules/user/forms/FilterEntry.php | 194 | ||||
| -rw-r--r-- | application/modules/user/forms/Login.php | 27 | ||||
| -rw-r--r-- | application/modules/user/forms/RecoverPassword.php | 28 | ||||
| -rw-r--r-- | application/modules/user/forms/Register.php | 105 |
4 files changed, 342 insertions, 12 deletions
diff --git a/application/modules/user/forms/FilterEntry.php b/application/modules/user/forms/FilterEntry.php index 21ceb93..55941c0 100644 --- a/application/modules/user/forms/FilterEntry.php +++ b/application/modules/user/forms/FilterEntry.php @@ -11,7 +11,7 @@ class user_Form_FilterEntry extends Zend_Form $this->setMethod('post'); $this->setAttrib('id','filterentryform'); #print_a($this->data); - + print_a($this->selectData); try{ $filtertypemapper = new Application_Model_FilterTypeMapper(); $filtertype = $filtertypemapper->fetchAll(); @@ -33,70 +33,238 @@ class user_Form_FilterEntry extends Zend_Form $desc = "Select the filtertype"; $label1 = 'Value 1:'; $label2 = 'Value 2:'; + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'id' => 'val1' + )); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( + 'label' => $label2, + 'id' => 'val2' + )); break; case "1": $desc = "You can set one IP or an IP-Range"; $label1 = 'Start:'; $label2 = 'End:'; + + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'validators' => array( + array( + 'regex', + false, + array( + '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid IP-Adress", + Zend_Validate_Regex::INVALID => 'IP-Adress contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val1' + )); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( + 'label' => $label2, + 'validators' => array( + array( + 'regex', + false, + array( + '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid IP-Adress", + Zend_Validate_Regex::INVALID => 'IP-Adress contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val2' + )); break; case "2": $desc = "You can set one Mac-Adress or an Mac-Range"; $label1 = 'Start:'; $label2 = 'End:'; + + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'validators' => array( + array( + 'regex', + false, + array( + '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress", + Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val1' + )); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( + 'label' => $label2, + 'validators' => array( + array( + 'regex', + false, + array( + '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress", + Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val2' + )); break; case "3": $desc = "Select your Pool"; - $label1 = 'PoolID:'; + $label1 = 'PoolID:'; + + $filtervalue1 = $this->createElement('select','filtervalue'); + $filtervalue1 ->setLabel($label1); + if(count($this->selectData['pools'])>0){ + foreach($this->selectData['pools'] as $id => $g){ + $filtervalue1->addMultiOption($g['poolID'], $g['title']); + } + } + $filtervalue1->setRegisterInArrayValidator(false); break; case "4": $desc = "Select your BootIso"; $label1 = 'BootIsoID:'; + + $filtervalue1 = $this->createElement('select','filtervalue'); + $filtervalue1 ->setLabel($label1); + if(count($this->selectData['bootisos'])>0){ + foreach($this->selectData['bootisos'] as $id => $g){ + $filtervalue1->addMultiOption($g['bootisoID'], $g['title']); + } + } + $filtervalue1->setRegisterInArrayValidator(false); break; case "5": $desc = "Select a Membership"; $label1 = 'Membership:'; + + $filtervalue1 = $this->createElement('select','filtervalue'); + $filtervalue1 ->setLabel($label1); + if(count($this->selectData['memberships'])>0){ + $personMapper = new Application_Model_PersonMapper(); + foreach($this->selectData['memberships'] as $id => $g){ + // Display full name of Person + $person = new Application_Model_Person(); + $personMapper->find($g['personID'],$person); + $filtervalue1->addMultiOption($g['membershipID'], $person->getName().", ".$person->getFirstname()); + } + } + $filtervalue1->setRegisterInArrayValidator(false); break; case "6": $desc = "Select a Group"; $label1 = 'Group:'; + // TODO: insert the child Groups + $filtervalue1 = $this->createElement('select','filtervalue'); + $filtervalue1 ->setLabel($label1); + if(count($this->selectData['groups'])>0){ + foreach($this->selectData['groups'] as $id => $g){ + $filtervalue1->addMultiOption($g['groupID'], $g['title']); + } + } + $filtervalue1->setRegisterInArrayValidator(false); break; case "7": $desc = "Specify a time-range"; $label1 = 'Start:'; $label2 = 'End:'; + + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'required' => true, + 'id' => 'val1' + )); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( + 'label' => $label2, + 'required' => true, + 'id' => 'val2' + )); break; case "8": $desc = "Select a Client"; $label1 = 'Client:'; + + $filtervalue1 = $this->createElement('select','filtervalue'); + $filtervalue1 ->setLabel($label1); + if(count($this->selectData['clients'])>0){ + foreach($this->selectData['clients'] as $id => $g){ + $filtervalue1->addMultiOption($g['clientID'], $g['macadress']." - ".$g['hardwarehash']); + } + } + $filtervalue1->setRegisterInArrayValidator(false); break; case "9": $desc = "Define a Hardwarehash"; $label1 = 'Hardwarehash:'; + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(32, 32)), + ), + 'required' => true, + 'id' => 'val1' + )); break; case "10": $desc = "Specify the Weekday (Monday:1, Tuesday:2 ... Sunday:7) or a range"; $label1 = 'Start Day:'; $label2 = 'End Day:'; + + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'required' => true, + 'id' => 'val1' + )); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( + 'label' => $label2, + 'required' => true, + 'id' => 'val2' + )); break; case "11": $desc = "Specify the date or a day range of the filter"; $label1 = 'Start Date:'; $label2 = 'End Date:'; + + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'required' => true, + 'id' => 'val1' + )); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( + 'label' => $label2, + 'required' => true, + 'id' => 'val2' + )); break; } $filtertypes->setDescription($desc); $this->addElement($filtertypes); - $this->addElement('text', 'filtervalue', array( - 'label' => $label1, - 'id' => 'val1' - )); - if(!in_array($filterentryID,array(3,4,5,6,8,9))){ - $this->addElement('text', 'filtervalue2', array( - 'label' => $label2, - 'id' => 'val2' - )); + + $this->addElement($filtervalue1); + if(isset($filtervalue2 )){ + $this->addElement($filtervalue2); } $this->addElement('submit', 'add', array( @@ -127,6 +295,10 @@ class user_Form_FilterEntry extends Zend_Form function setFilterID($v){ $this->filterID = $v; } + private $selectData; + function setSelectData($v){ + $this->selectData = $v; + } } ?> diff --git a/application/modules/user/forms/Login.php b/application/modules/user/forms/Login.php index 58c5cc9..342e0b2 100644 --- a/application/modules/user/forms/Login.php +++ b/application/modules/user/forms/Login.php @@ -5,7 +5,32 @@ class user_Form_Login extends Zend_Form public function init() { - /* Form Elements & Other Definitions Here ... */ + $this->setName("Login"); + $this->setMethod('post'); + + $this->addElement('text', 'email', array( + 'filters' => array('StringTrim', 'StringToLower'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'E-Mail:', + )); + + $this->addElement('password', 'password', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Password:', + )); + + $this->addElement('submit', 'login', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Login', + )); } diff --git a/application/modules/user/forms/RecoverPassword.php b/application/modules/user/forms/RecoverPassword.php new file mode 100644 index 0000000..90feb87 --- /dev/null +++ b/application/modules/user/forms/RecoverPassword.php @@ -0,0 +1,28 @@ +<?php + +class user_Form_RecoverPassword extends Zend_Form +{ + + public function init() + { + $this->setName("RecoverPassword"); + $this->setMethod('post'); + + $this->addElement('text', 'email', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 30)), + ), + 'required' => true, + 'label' => 'Email:', + )); + $this->addElement('submit', 'recoverPassword', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Recover Password', + )); + } + + +} + diff --git a/application/modules/user/forms/Register.php b/application/modules/user/forms/Register.php new file mode 100644 index 0000000..9c2a42d --- /dev/null +++ b/application/modules/user/forms/Register.php @@ -0,0 +1,105 @@ +<?php + +class user_Form_Register extends Zend_Form +{ + + public function init() + { + $this->setName("Register"); + $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', 'name', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Name:', + )); + + $this->addElement('text', 'firstname', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Firstname:', + )); + + $this->addElement('text', 'street', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Street:', + )); + + $this->addElement('text', 'housenumber', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Housenumber:', + )); + + $this->addElement('text', 'city', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'City:', + )); + + $this->addElement('text', 'postalcode', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Postalcode:', + )); + + $this->addElement('text', 'email', array( + 'filters' => array('StringTrim', 'StringToLower'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Email:', + )); + + $this->addElement('password', 'password', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Password:', + )); + + $this->addElement('submit', 'register', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Register', + )); + + + } + + + +} + |
