From 67701f80256723b179f6a73b8990cfcc22a3a8c8 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Wed, 29 Jun 2011 17:47:26 +0200 Subject: Add und Edit Formular korrgieirt --- application/forms/EventEdit.php | 192 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 188 insertions(+), 4 deletions(-) (limited to 'application/forms/EventEdit.php') diff --git a/application/forms/EventEdit.php b/application/forms/EventEdit.php index a34161d..f2ad783 100644 --- a/application/forms/EventEdit.php +++ b/application/forms/EventEdit.php @@ -2,11 +2,195 @@ class Application_Form_EventEdit extends Zend_Form { + private $membershiplist; + private $bootoslist; + private $poollist; + private $eventcategorylist; - public function init() - { - /* Form Elements & Other Definitions Here ... */ - } + public function setMembershiplist($membershiplist){ + $this->membershiplist = $membershiplist; + + } + + public function getMembershiplist(){ + return $this->membershiplist; + } + + public function setBootoslist($bootoslist){ + $this->bootoslist = $bootoslist; + + } + + public function getBootoslist(){ + return $this->bootoslist; + } + + public function setPoollist($poollist){ + $this->poollist = $poollist; + + } + + public function getPoollist(){ + return $this->poollist; + } + + public function getEventcategorylist() + { + return $this->eventcategorylist; + } + + public function setEventcategorylist($eventcategorylist) + { + $this->eventcategorylist = $eventcategorylist; + } + + public function init() + { + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + 'value' => $_POST['title'], + )); + + if($_POST['immediate'] == 1) { + $this->addElement('checkbox', 'immediate', array( + 'required' => false, + 'label' => 'Immediate Event', + 'value'=>array(0,1), + 'checked' => 'checked', + )); + } else { + $this->addElement('checkbox', 'immediate', array( + 'required' => false, + 'label' => 'Immediate Event', + 'value'=>array(0,1), + )); + } + + $this->addElement('text', 'start', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Start:', + 'value' => $_POST['start'], + )); + + $this->addElement('text', 'end', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'End:', + 'value' => $_POST['end'], + )); + + if($_POST['repeat'] == 1) { + $this->addElement('checkbox', 'repeat', array( + 'required' => false, + 'label' => 'Repeat:', + 'value'=>array(0,1), + 'checked' => 'checked', + )); + } else { + $this->addElement('checkbox', 'repeat', array( + 'required' => false, + 'label' => 'Repeat:', + 'value'=>array(0,1), + )); + } + + $this->addElement('text', 'participants', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'label' => 'Participants:', + 'value' => $_POST['participants'], + )); + + $eventcategoryfield = new Zend_Form_Element_Select('category'); + $eventcategoryfield ->setLabel('Category:'); + + if(count($this->eventcategorylist)>0){ + foreach($this->eventcategorylist as $category => $c){ + $eventcategoryfield->addMultiOption($c->getID(), $c->getTitle()); + } + } + + $eventcategoryfield->setRegisterInArrayValidator(false); + $eventcategoryfield->setValue($_POST['category']); + $this->addElement($eventcategoryfield); + + $this->addElement('text', 'note', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'label' => 'Note:', + 'value' => $_POST['note'], + )); + + $poolfield = $this->createElement('select','pbs_poolID'); + $poolfield ->setLabel('Pool:'); + + if(count($this->poollist)>0){ + foreach($this->poollist as $pool => $p){ + $poolfield->addMultiOption($p['poolID'], $p['title']); + } + } + + $poolfield->setRegisterInArrayValidator(false); + $poolfield->setValue($_POST['pbs_poolID']); + $this->addElement($poolfield); + + // $membershipfield = $this->createElement('select','pbs_membershipID'); + // $membershipfield ->setLabel('Membership:'); + // + // if(count($this->membershiplist)>0){ + // foreach($this->membershiplist as $membership => $m){ + // $membershipfield->addMultiOption($m['membershipID'], $m['person']); + // } + // } + // + // $membershipfield->setRegisterInArrayValidator(false); + // $this->addElement($membershipfield); + + $bootosfield = $this->createElement('select','pbs_bootosID'); + $bootosfield ->setLabel('BootOS:'); + + if(count($this->bootoslist)>0){ + foreach($this->bootoslist as $bootos => $b){ + $bootosfield->addMultiOption($b['bootosID'], $b['title']); + } + } + + $bootosfield->setRegisterInArrayValidator(false); + $bootosfield->setValue($_POST['pbs_bootosID']); + $this->addElement($bootosfield); + + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Create Event' + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="javascript:history.back();"', + )); + + } } -- cgit v1.2.3-55-g7522