Exemple #1
0
 public function init()
 {
     $this->setAction('/core/user/new');
     $this->setAttrib('enctype', 'multipart/form-data');
     $fname = new Zend_Form_Element_Text('fname');
     $fname->setLabel('First Name')->setRequired(true)->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $lname = new Zend_Form_Element_Text('lname');
     $lname->setLabel('Last Name')->setRequired(true)->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $organisation = new Zend_Form_Element_Text('organisation');
     $organisation->setLabel('Organisation')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $country = new TA_Form_Element_Country('country');
     $country->setLabel('Country')->setDecorators(array('Composite'));
     $jobtitle = new Zend_Form_Element_Text('jobtitle');
     $jobtitle->setLabel('Job title')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $profile = new Zend_Form_Element_Textarea('profile');
     $profile->setLabel('Biography')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->setRequired(true)->setAttrib('class', 'medium')->setDescription('the invitation will be sent to this address')->addValidators(array(array('EmailAddress', true)))->setDecorators(array('Composite'));
     $resize = new TA_Filter_ImageResize();
     $resize->setWidth(260)->setHeight(170);
     $image = new TA_Form_Element_MagicFile('file');
     $image->setLabel('Picture')->setDescription('Image should be at least 300 pixels wide and 200 pixels high, and not be over 5Mb')->addDecorators($this->_magicFileElementDecorator)->addFilter($resize)->addValidators(array(array('Count', true, 1), array('IsImage', true), array('Size', true, array('max' => '5Mb')), array('ImageSize', true, array('minwidth' => 300, 'minheight' => 200))));
     $this->addElements(array($fname, $lname, $organisation, $email, $country, $jobtitle, $profile, $image));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Exemple #2
0
 public function init()
 {
     parent::init();
     $this->setAction('/core/feedback/participant');
     $id = new Zend_Form_Element_Hidden('id');
     $id->setRequired(true)->setLabel('id')->addValidators(array('Int'))->setDecorators(array('Composite'));
     $country = new TA_Form_Element_Country('country');
     $country->setLabel('Please select the country in which you work as primary place of employment.')->setDecorators(array('Composite'));
     $orgType = new Zend_Form_Element_Select('org_type');
     $orgType->setLabel('Please select the type of organisation that most closely resembles your primary place of employment.')->setAttrib('class', 'medium')->setMultiOptions(array('0' => '---', 'nren' => 'National Research and Education Network (NREN)', 'high' => 'Higher / Further Education Institute (universities / college / polytechnic...)', 'ari' => 'Academic Research Institute', 'project' => 'Research project', 'admin' => 'Administrative departments of academic institutions', 'local' => 'Local / regional / central government department', 'cultural' => 'Cultural organisation (galeries, librairies, museums, etc.)', 'comm' => 'Commercial organisation', 'other' => 'Other non-profit (specify)'))->setDecorators(array('Composite'));
     $orgOther = new Zend_Form_Element_Text('org_type_other');
     $orgOther->setDescription('Other, please specify')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $occupation = new Zend_Form_Element_Select('occupation');
     $occupation->setLabel('Please select the title that most closely resembles your primary role in the organisation.')->setAttrib('class', 'medium')->setMultiOptions(array('0' => '---', 'director' => 'Director (responsible for overall organisational management)', 'manager' => 'Technical Manager', 'admin' => 'Administrative / Operational Manager', 'tech' => 'Technical staff / Engineer', 'res' => 'Researcher / Scientist', 'prof' => 'Professor / Teacher', 'pr' => 'Public Relations / Communications', 'bizz' => 'Business Development', 'stud' => 'Student', 'other' => 'Other (specify)'))->setDecorators(array('Composite'));
     $occOther = new Zend_Form_Element_Text('occupation_other');
     $occOther->setDescription('Other, please specify')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $interest = new Zend_Form_Element_MultiCheckbox('interest');
     $interest->setLabel('Please select your main areas of interest. Up to three selections are possible.')->setAttrib('class', 'tiny')->setMultiOptions(array('sec' => 'Network security (incident, prevention and response)', 'nom' => 'Network operations management', 'clouds' => 'Storage and clouds', 'grids' => 'Grids', 'media' => 'Media management and distribution', 'auth' => 'Authentication and Authorisation systems and federations', 'wireless' => 'Fixed & mobile wireless and roaming technologies', 'vid' => 'Video / web-based conferencing', 'reg' => 'Regulatory issues including privacy', 'pr' => 'PR / communications / business development', 'strat' => 'Strategic development: European policy setting and / or organisational management', 'other' => 'Other (specify)'))->addValidator('Callback', true, array('callback' => function ($value, $arr) {
         return count($arr['interest']) > 3 ? false : true;
     }, 'messages' => array(Zend_Validate_Callback::INVALID_VALUE => "Please don't select more than three options")))->setDecorators(array('Composite'));
     $intOther = new Zend_Form_Element_Text('interest_other');
     $intOther->setDescription('Other, please specify')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $this->addElements(array($id, $country, $orgType, $orgOther, $occupation, $occOther, $interest, $intOther));
     $this->addElement('submit', 'submit', array('decorators' => $this->_buttonElementDecorator));
 }