diff options
| author | Simon | 2011-03-21 12:48:44 +0100 |
|---|---|---|
| committer | Simon | 2011-03-21 12:48:44 +0100 |
| commit | e83e5f1768562d142e638980dc0c8d7fd4d88104 (patch) | |
| tree | e2de8972e8e3091753f76d1f2ce0130ebd767df7 /application/modules | |
| parent | Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff) | |
| download | pbs2-e83e5f1768562d142e638980dc0c8d7fd4d88104.tar.gz pbs2-e83e5f1768562d142e638980dc0c8d7fd4d88104.tar.xz pbs2-e83e5f1768562d142e638980dc0c8d7fd4d88104.zip | |
FilterEntries-Formular steht
Diffstat (limited to 'application/modules')
| -rw-r--r-- | application/modules/user/controllers/FilterController.php | 7 | ||||
| -rw-r--r-- | application/modules/user/forms/FilterEntry.php | 68 |
2 files changed, 67 insertions, 8 deletions
diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php index 444a33a..307c40d 100644 --- a/application/modules/user/controllers/FilterController.php +++ b/application/modules/user/controllers/FilterController.php @@ -206,13 +206,16 @@ class User_FilterController extends Zend_Controller_Action // TODO: get all child groups $grouppMapper = new Application_Model_GroupMapper(); - $groups = $grouppMapper->findBY('groupID',$this->membership->getGroupID()); + $group = new Application_Model_Group(); + $grouppMapper->find($this->membership->getGroupID(),$group); + $groups[] = $group->toArray(); $clientMapper = new Application_Model_ClientMapper(); $clients = $clientMapper->findBY('groupID',$this->membership->getGroupID()); return array ( 'clients' => $clients, 'memberships' => $memberships, + 'groups' => $groups, 'bootisos' => $bootisos, 'pools' => $pools); @@ -246,7 +249,7 @@ class User_FilterController extends Zend_Controller_Action $addform = new user_Form_FilterEntry(array('buttontext' => 'Add Filterentry', 'selectData' => $selectData, 'data'=>$_POST - )); + )); if ($addform->isValid($_POST)) { print_a('valid'); $newfilterenty = new Application_Model_FilterEntries(); diff --git a/application/modules/user/forms/FilterEntry.php b/application/modules/user/forms/FilterEntry.php index 55941c0..c2581c2 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); + #print_a($this->selectData); try{ $filtertypemapper = new Application_Model_FilterTypeMapper(); $filtertype = $filtertypemapper->fetchAll(); @@ -189,11 +189,37 @@ class user_Form_FilterEntry extends Zend_Form $filtervalue1 = $this->createElement('text', 'filtervalue', array( 'label' => $label1, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM", + Zend_Validate_Regex::INVALID => 'Time contains invalid characters.' + ) + ) + ) + ), 'required' => true, 'id' => 'val1' )); $filtervalue2 = $this->createElement('text', 'filtervalue2', array( 'label' => $label2, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM", + Zend_Validate_Regex::INVALID => 'Time contains invalid characters.' + ) + ) + ) + ), 'required' => true, 'id' => 'val2' )); @@ -231,11 +257,37 @@ class user_Form_FilterEntry extends Zend_Form $filtervalue1 = $this->createElement('text', 'filtervalue', array( 'label' => $label1, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([1-7])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7", + Zend_Validate_Regex::INVALID => 'Day contains invalid characters.' + ) + ) + ) + ), 'required' => true, 'id' => 'val1' )); $filtervalue2 = $this->createElement('text', 'filtervalue2', array( 'label' => $label2, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([1-7])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7", + Zend_Validate_Regex::INVALID => 'Day contains invalid characters.' + ) + ) + ) + ), 'required' => true, 'id' => 'val2' )); @@ -246,15 +298,19 @@ class user_Form_FilterEntry extends Zend_Form $label2 = 'End Date:'; $filtervalue1 = $this->createElement('text', 'filtervalue', array( - 'label' => $label1, + 'label' => $label1, 'required' => true, 'id' => 'val1' - )); + )); + $filtervalue1->addValidator('Date',false, array('format'=>'dd.MM.yyyy')); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( - 'label' => $label2, - 'required' => true, + 'label' => $label2, + 'required' => true, 'id' => 'val2' - )); + )); + $filtervalue2->addValidator('Date',false, array('format'=>'dd.MM.yyyy')); + break; } $filtertypes->setDescription($desc); |
