From af06cbe6a477a52fa99a2d1b047a9c3e8b6b22f9 Mon Sep 17 00:00:00 2001 From: Simon Franz Date: Wed, 16 Mar 2011 17:13:02 +0100 Subject: Benutzung von Form in Modulen nutzbar, editclient funktioniert, Mac wird geparsed --- application/models/MembershipMapper.php | 1 + application/modules/fbgui/Bootstrap.php | 5 +++++ application/modules/user/Bootstrap.php | 5 +++++ .../modules/user/controllers/ClientController.php | 3 +-- application/modules/user/forms/Client.php | 19 ++++++++++++++++--- 5 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 application/modules/fbgui/Bootstrap.php create mode 100644 application/modules/user/Bootstrap.php (limited to 'application') diff --git a/application/models/MembershipMapper.php b/application/models/MembershipMapper.php index 313248c..4385f95 100644 --- a/application/models/MembershipMapper.php +++ b/application/models/MembershipMapper.php @@ -68,6 +68,7 @@ class Application_Model_MembershipMapper public function find($id, Application_Model_Membership $membership = null) { + $return = false; if($membership == null){ $return = true; } diff --git a/application/modules/fbgui/Bootstrap.php b/application/modules/fbgui/Bootstrap.php new file mode 100644 index 0000000..7ddaf6b --- /dev/null +++ b/application/modules/fbgui/Bootstrap.php @@ -0,0 +1,5 @@ +find($clientID,$client); - if($client->getGroupID() == $this->membership->getGroupID()){ - # print_a($this);die(); + if($client->getGroupID() == $this->membership->getGroupID()){ $editclient = new user_Form_Client(array('buttontext' => 'Edit Client')); $editclient->populate($client->toArray()); $this->view->editclient = $editclient; diff --git a/application/modules/user/forms/Client.php b/application/modules/user/forms/Client.php index a79ede1..9f3926c 100644 --- a/application/modules/user/forms/Client.php +++ b/application/modules/user/forms/Client.php @@ -8,18 +8,31 @@ class user_Form_Client extends Zend_Form $this->setName("pool"); $this->setMethod('post'); - $this->addElement('text', 'macadress', array( + $mac = $this->createElement('text', 'macadress', array( 'filters' => array('StringTrim'), 'validators' => array( - array('StringLength', false, array(0, 50)), + 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, 'label' => 'MacAdress:', )); + $this->addElement($mac); + + $this->addElement('text', 'hardwarehash', array( 'filters' => array('StringTrim'), 'validators' => array( - array('StringLength', false, array(0, 50)), + array('StringLength', false, array(32, 32)), ), 'required' => true, 'label' => 'Hardwarehash:', -- cgit v1.2.3-55-g7522