public function init() { parent::init(); $this->setAction('/core/feedback/programme'); $id = new Zend_Form_Element_Hidden('id'); $id->setRequired(true)->setLabel('id')->addValidators(array('Int'))->setDecorators(array('Composite')); $best = new Zend_Form_Element_Textarea('best_stuff'); $best->setLabel('Which sessions or presentations were the best – and why?')->setAttrib('class', 'medium')->setDescription('Please limit your comments to 1000 characters')->setRequired(false)->addValidator('StringLength', true, array(1, 5000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer comment', Zend_Validate_StringLength::TOO_LONG => 'Your comment is too long')))->setDecorators(array('Composite')); $worst = clone $best; $worst->setName('worst_stuff')->setLabel('Which sessions or presentations were the worst – and why?'); $comments = clone $best; $comments->setName('comments')->setLabel('Comments on the programme'); $this->addElements(array($id, $best, $worst)); $elements = array('exhibition' => 'How useful did you find the exhibitions and demos?', 'meetings' => 'How useful did you find the meetings / workshops around the conference?', 'lightning' => 'How useful did you find the lightning talks?', 'poster' => 'How useful did you find the poster presentations?'); // add all elements in loop, since they are all the same foreach ($elements as $name => $label) { $newSelect = new Zend_Form_Element_Radio($name); $newSelect->setLabel($label)->setAttrib('class', 'tiny')->setMultiOptions($this->_getFieldValues('rating', 'feedback'))->setDecorators(array('Composite')); $newText = new Zend_Form_Element_Text('remarks_' . $name); $newText->setDescription('Comments')->setAttrib('class', 'medium')->setDecorators(array('Composite')); $this->addElements(array($newSelect, $newText)); } $this->addElement($comments); $this->addElement('submit', 'submit', array('decorators' => $this->_buttonElementDecorator)); }
public function getValues($suppressArrayNotation = false) { $values = parent::getValues($suppressArrayNotation); if ($values['session_id'] == 0) { $values['session_id'] = null; } return $values; }
public function init() { parent::init(); $this->setAction('/core/feedback/mailto'); $this->setAttrib('id', 'mailtoform'); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email address')->setRequired(true)->setAttrib('class', 'medium')->addValidators(array(array('EmailAddress', true)))->setDecorators(array('Composite')); $this->addElements(array($email)); $this->addElement('submit', 'submit', array('label' => 'Send email', 'decorators' => $this->_buttonElementDecorator)); }
public function init() { parent::init(); $this->setAction('/core/review/mail'); $this->setAttrib('id', 'mailform'); $dummy = new Zend_Form_Element_Checkbox('dummy'); $dummy->setLabel('Do a test run (does not send emails)')->setChecked(true)->setDecorators(array('Composite')); $this->addElements(array($dummy)); $this->addElement('submit', 'submit', array('label' => 'Send emails (this may take a while)', 'decorators' => $this->_buttonElementDecorator)); }
public function init() { parent::init(); $this->setAction('/core/user/roles'); $id = new Zend_Form_Element_Hidden('user_id'); $id->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite')); $userModel = new Core_Model_User(); $roles = new Zend_Form_Element_Select('role_id'); $roles->setAttrib('class', 'large')->setAttrib('onchange', 'this.form.submit()')->setMultiOptions($userModel->getRolesForSelect())->setDecorators(array('Composite')); $this->addElements(array($id, $roles)); }
public function init() { parent::init(); $this->setAction('/core/presentation/speakers'); $id = new Zend_Form_Element_Hidden('presentation_id'); $id->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite')); $presentationModel = new Core_Model_Presentation(); $users = new TA_Form_Element_User('user_id'); $users->setTaController('presentation')->populateElement('presenter')->setAttrib('onchange', "this.form.submit()"); $this->addElements(array($id, $users)); }
public function init() { parent::init(); $this->setAction('/core/session/evaluate/format/html'); $this->setAttrib('id', 'evaluateform'); $evaluationId = new Zend_Form_Element_Hidden('session_evaluation_id'); $evaluationId->addValidator('Int')->addFilter('Null')->setDecorators(array('Composite')); $sessionId = new Zend_Form_Element_Hidden('session_id'); $sessionId->setRequired(true)->addValidator('Int')->setDecorators(array('Composite')); $comments = new Zend_Form_Element_Textarea('comments'); $comments->setLabel('Comments')->setAttrib('class', 'small')->setRequired(true)->setDecorators(array('Composite')); $attendees = new Zend_Form_Element_Text('attendees'); $attendees->setLabel('Attendees')->setAttrib('class', 'tiny')->addValidator('Int')->addFilter('Null')->setRequired(false)->setDecorators(array('Composite')); $this->addElements(array($evaluationId, $sessionId, $comments, $attendees)); $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator)); }
public function init() { parent::init(); $this->setAction('/core/session/files'); $this->setAttrib('enctype', 'multipart/form-data'); $id = new Zend_Form_Element_Hidden('session_id'); $id->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite')); // the name of this form element must be of an existing filetype $file1 = new TA_Form_Element_MagicFile('slides'); $file1->setLabel('Session slide')->setDescription('')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '4Mb')))); $subForm = new Zend_Form_SubForm(); $subForm->addElements(array($file1))->setDecorators(array('FormElements')); $this->addSubForm($subForm, 'files'); $this->addElements(array($id)); $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator)); }
public function init() { parent::init(); $this->setAttrib('enctype', 'multipart/form-data'); $id = new Zend_Form_Element_Hidden('presentation_id'); $id->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite')); $paper = new TA_Form_Element_MagicFile('paper'); $paper->setLabel('Paper')->setDescription('OpenOffice, PDF, and Microsoft Word are acceptable formats.')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '64Mb')))); $slides = new TA_Form_Element_MagicFile('slides'); $slides->setLabel('Slides')->setDescription('Microsoft Powerpoint, OpenOffice, and PDF are acceptable formats.')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '64Mb')))); $file1 = new TA_Form_Element_MagicFile('misc'); $file1->setLabel('Extra file')->setDescription('')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '64Mb')))); $subForm = new Zend_Form_SubForm(); $subForm->addElements(array($paper, $slides, $file1))->setDecorators(array('FormElements')); $this->addSubForm($subForm, 'files'); $this->addElements(array($id)); $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator)); }
public function init() { parent::init(); $this->setAction('/core/presentation/import'); $status = new Zend_Form_Element_Select('status'); $status->setLabel('With status')->setAttrib('class', 'small')->setAttrib('disabled', 'disabled')->addMultiOptions($this->_getFieldValues('status', 'submit'))->setDecorators(array('Composite')); $submitStart = new Zend_Form_Element_Text('submit_start'); $submitStart->setLabel('From')->setDescription('dd/mm/yy')->setAttrib('class', 'small')->setRequired(true)->setDecorators(array('Composite')); $submitEnd = new Zend_Form_Element_Text('submit_end'); $submitEnd->setLabel('To')->setDescription('dd/mm/yy')->setAttrib('class', 'small')->setRequired(true)->setDecorators(array('Composite')); $setRole = new Zend_Form_Element_Checkbox('set_role'); $setRole->setLabel('Give user \'presenter\' role')->setRequired(false)->setChecked(true)->setDecorators(array('Composite')); $setLink = new Zend_Form_Element_Checkbox('set_link'); $setLink->setLabel('Make user a speaker for this presentation')->setRequired(false)->setChecked(true)->setDecorators(array('Composite')); $sessions = new Zend_Form_Element_Checkbox('link_sessions'); $sessions->setLabel('Link sessions to presentations')->setRequired(false)->setChecked(true)->setDecorators(array('Composite')); $overwrite = new Zend_Form_Element_Checkbox('_overwrite'); $overwrite->setLabel('Overwrite exsiting presentations')->setRequired(false)->setChecked(false)->setDecorators(array('Composite')); $fileLink = new Zend_Form_Element_Checkbox('link_files'); $fileLink->setLabel('Link files to presentations')->setRequired(false)->setChecked(true)->setDecorators(array('Composite')); $this->addElements(array($status, $submitStart, $submitEnd, $setRole, $setLink, $sessions, $fileLink, $overwrite)); $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator)); }
public function init() { parent::init(); $this->setAction('/core/feedback/logistics'); $id = new Zend_Form_Element_Hidden('id'); $id->setRequired(true)->setLabel('id')->addValidators(array('Int'))->setDecorators(array('Composite')); $elements = array('website' => 'Conference website', 'core' => 'Conference software (CORE) usability', 'social_media' => 'Conference social media (usefulness)', 'registration' => 'Registration / payment procedures', 'hotel_booking' => 'Hotel booking procedures', 'doc_during' => 'Onsite information', 'venue' => 'Venue', 'network' => 'Networking facilities', 'catering' => 'Catering', 'social_events' => 'Social events'); // add all elements in loop, since they are all the same foreach ($elements as $name => $label) { $newSelect = new Zend_Form_Element_Radio($name); $newSelect->setLabel($label)->setAttrib('class', 'tiny')->setMultiOptions($this->_getFieldValues('rating', 'feedback'))->setDecorators(array('Composite')); $newText = new Zend_Form_Element_Text('remarks_' . $name); $newText->setDescription('Comments')->setAttrib('class', 'medium')->setDecorators(array('Composite')); $this->addElements(array($newSelect, $newText)); } $accomodation = new Zend_Form_Element_Radio('vfm_accomodation'); $accomodation->setLabel('Accommodation')->setAttrib('class', 'tiny')->setMultiOptions(array('good' => 'Good value for money', 'reasonable' => 'Reasonable value for money', 'poor' => 'Poor value for money'))->setDecorators(array('Composite')); $regfee = clone $accomodation; $regfee->setName('vfm_regfee')->setLabel('Registration fee'); $comments = new Zend_Form_Element_Textarea('comments'); $comments->setLabel('Comments on the logistical arrangements')->setAttrib('class', 'medium')->setDescription('Please limit your comments to 1000 characters')->setRequired(false)->addValidator('StringLength', true, array(1, 5000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer comment', Zend_Validate_StringLength::TOO_LONG => 'Your comment is too long')))->setDecorators(array('Composite')); $this->addElements(array($id, $accomodation, $regfee, $comments)); $this->addElement('submit', 'submit', array('decorators' => $this->_buttonElementDecorator)); }
public function setDefaults(array $values) { parent::setDefaults($values); }
/** * Override method to unserialize multiCheckbox values * */ public function setDefaults(array $defaults) { $defaults['topic'] = isset($defaults['topic']) ? unserialize($defaults['topic']) : null; $defaults['submission_type'] = isset($defaults['submission_type']) ? unserialize($defaults['submission_type']) : null; parent::setDefaults($defaults); }
/** * Override method to unserialize multiCheckbox values * */ public function setDefaults(array $defaults) { $defaults['part_reasons'] = isset($defaults['part_reasons']) ? unserialize($defaults['part_reasons']) : null; $defaults['conf_hear'] = isset($defaults['conf_hear']) ? unserialize($defaults['conf_hear']) : null; parent::setDefaults($defaults); }
/** * Override method to unserialize multiCheckbox values * */ public function setDefaults(array $defaults) { $defaults['interest'] = isset($defaults['interest']) ? unserialize($defaults['interest']) : null; parent::setDefaults($defaults); }
/** * Set default values for elements * Override method to add form elements that were dynamically added * Every row in the dynamic value array adds the form element * * @return Zend_Form */ public function setDefaults(array $values) { foreach ($values['timeslots'] as $dynamicValues) { if ($dynamicValues instanceof Core_Resource_Timeslot_Item) { $dynamicValues = $dynamicValues->toMagicArray('dd/MM/yyyy H:m'); } $dynElement = $this->addDynamicElement('timeslot_' . $dynamicValues['timeslot_id']); if ($dynElement) { $dynElement->setValue($dynamicValues); } } parent::setDefaults($values); }