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 | |
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
-rw-r--r-- | application/controllers/IndexController.php | 1 | ||||
-rw-r--r-- | application/modules/user/controllers/FilterController.php | 7 | ||||
-rw-r--r-- | application/modules/user/forms/FilterEntry.php | 68 | ||||
-rw-r--r-- | pbs-newdata.sql | 56 |
4 files changed, 107 insertions, 25 deletions
diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index 2972e9e..5f61df4 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -10,6 +10,7 @@ class IndexController extends Zend_Controller_Action public function indexAction() { + print_a($_SERVER); if(stristr($_SERVER['HTTP_USER_AGENT'],'prebootGUI')){ $this->_forward('index','Index','fbgui'); } 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); diff --git a/pbs-newdata.sql b/pbs-newdata.sql index d3dd6ab..8e6fe11 100644 --- a/pbs-newdata.sql +++ b/pbs-newdata.sql @@ -13,9 +13,28 @@ INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `h -- Adding group INSERT INTO `pbs`.`pbs_group` (`groupID` ,`title` ,`description`)VALUES -(1, 'Group 1', 'Our Testgroup'), -(2, 'Group 2', 'The Second Testgroup'), -(3, 'Group 3', 'Wohoo'); +(1, 'Group 1', 'First Group'), +(2, 'Group 2', 'Second Group'), +(3, 'Group 3', 'Third Group'), +(4, 'Group 4', 'Fourth Group'), +(5, 'Group 5', 'Fifth Group'), +(6, 'Group 6', 'Sixth Group'), +(7, 'Group 7', 'Seventh Group'), +(8, 'Group 8', 'Eight Group'), +(9, 'Group 9', 'Nineth Group'), +(10, 'Group 10', 'Tenth Group'); + +INSERT INTO `pbs`.`pbs_groupgroups` (`parentID`, `groupID`) VALUES +(1, 2), +(1, 3), +(2, 4), +(2, 5), +(1, 8), +(3, 6), +(3, 7), +(3, 9), +(3, 10); + -- Adding role INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`) VALUES (1, '1', 'Role 1-Group1', NULL); @@ -66,18 +85,18 @@ INSERT INTO `pbs_bootos` (`bootosID`, `configID`, `groupID`, `membershipID`, `ti (9, 1, 1, 1, 'BootOs 9', 'Description 9', 'initpath 9', 'kernelpath 9', 'default kcl 9', '1299693782', '2012-03-09', 0), (10, 1, 1, 1, 'BootOs 10', 'Description 10', 'initpath 10', 'kernelpath 10', 'default kcl 10', '1299693782', '2012-03-09', 0); --- Adding bootiso -INSERT INTO `pbs_bootiso` (`bootisoID`, `title`, `membershipID`, `groupID`, `prebootID`, `serialnumber`, `created`, `expires`, `public`) VALUES -(1, 'BootIso 1', 1, 1, '1', 123456789, '123', '2012-03-09', 0), -(2, 'BootIso 2', 1, 1, '2', 2147483647, '456', '2012-03-09', 0), -(3, 'BootIso 3', 1, 1, '3', 2147483647, '789', '2012-03-09', 0); - -- Adding preboot INSERT INTO `pbs_preboot` (`prebootID`, `title`, `membershipID`, `groupID`, `path_preboot`) VALUES (1, 'Preboot 1', 1, 1, 'path 1'), (2, 'Preboot 2', 1, 1, 'path 1'), (3, 'Preboot 3', 1, 1, 'path 1'); +-- Adding bootiso +INSERT INTO `pbs_bootiso` (`bootisoID`, `title`, `membershipID`, `groupID`, `prebootID`, `serialnumber`, `created`, `expires`, `public`) VALUES +(1, 'BootIso 1', 1, 1, '1', 123456789, '123', '2012-03-09', 0), +(2, 'BootIso 2', 1, 1, '2', 2147483647, '456', '2012-03-09', 0), +(3, 'BootIso 3', 1, 1, '3', 2147483647, '789', '2012-03-09', 0); + -- Adding Pools INSERT INTO `pbs_pool` (`poolID`, `groupID`, `title`, `description`, `location`) VALUES (1, 1, 'Pool 1', 'Description 1', 'Keller'), @@ -127,14 +146,17 @@ INSERT INTO `pbs_session` (`sessionID`, `alphasessionID`,`clientID`, `bootmenuen -- Adding Filter INSERT INTO `pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `title`, `description`, `created`, `priority`) VALUES -(1, 1, 1, 1, 'Filter 1', 'Innerhalb der Uni', '1299697337', 10), -(2, 1, 1, 5, 'Filter 2', 'Ausserhalb der Uni', '1299697073', 20), -(3, 1, 1, 4, 'Filter 3', 'Desc3', '1299697277', 5); +(1, 1, 1, 1, 'Filter 1', 'Innerhalb der Uni', '', 1), +(2, 1, 1, 2, 'Filter 2', 'Ausserhalb der Uni', '', 1), +(3, 1, 1, 3, 'Filter 3', 'Montags-Freitag \r\nvon 8 bis 16 Uhr \r\nInnerhalb der Uni', '', 10); -- Adding Filterentries INSERT INTO `pbs_filterentries` (`filterentriesID`, `filterID`, `filtertypeID`, `filtervalue`, `filtervalue2`) VALUES -(1, 1, 7, '08:00', '18:00'), -(2, 2, 1, '001.001.001.001', '132.229.255.255'), -(3, 2, 1, '132.231.001.001', '255.255.255.255'), -(4, 1, 1, '132.230.001.001', '132.230.255.255'), -(5, 3, 3, '1', ''); +(1, 1, 6, '1', NULL), +(2, 1, 1, '132.230.001.001', '132.230.255.255'), +(3, 2, 6, '1', NULL), +(4, 2, 1, '000.000.000.000', '132.229.255.255'), +(5, 2, 1, '132.231.001.001', '255.255.255.255'), +(6, 3, 6, '1', NULL), +(7, 3, 7, '08:00', '16:00'), +(8, 3, 10, '1', '5'); |