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 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)); }
/** * @return EngineBlock_Form_VirtualOrganisationIdp */ public function _initVOId() { $element = new Zend_Form_Element_Hidden('vo_id'); $element->setRequired(TRUE); $element->setAllowEmpty(false); return $this->addElement($element); }
/** * @return EngineBlock_Form_GroupProviderGroupMemberFilter */ public function _initGroupProviderId() { $element = new Zend_Form_Element_Hidden('group_provider_id'); $element->setRequired(TRUE); $element->setAllowEmpty(false); return $this->addElement($element); }
public function __construct($options = null) { parent::__construct($options); $this->setName('addreference'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $title = new Zend_Form_Element_Text('publicationtitle'); $title->setLabel('Publication title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a title')->setAttrib('size', 60)->setDescription('As the bibliographic details that have been entered are such a mess, this is slightly tricky. Try one word from the title of the book/journal or an author surname. Then click on the one that comes up.')->setDecorators($decorators); $id = new Zend_Form_Element_Hidden('pubID'); $id->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label'); $pages = new Zend_Form_Element_Text('pages_plates'); $pages->setLabel('Pages or plate number: ')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->setAttrib('size', 9); $reference = new Zend_Form_Element_Text('reference'); $reference->setLabel('Reference number: ')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->setAttrib('size', 15); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large'); $this->addElements(array($title, $id, $pages, $reference, $submit)); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $this->addElement($hash); $this->addDisplayGroup(array('publicationtitle', 'pubID', 'pages_plates', 'reference'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Add a new reference'); $this->addDisplayGroup(array('submit'), 'submit'); }
public function init() { $this->setMethod('post')->setAttrib('id', 'frmVenta')->setAttrib('style', 'width: 300px;margin:auto;'); // Producto $e = new Zend_Form_Element_Select('id_producto'); $e->setLabel('Producto'); $e->setRequired(); $_producto = new Application_Model_Producto(); $e->addMultiOption(-1, '--Producto--'); $e->addMultiOptions($_producto->getComboValues()); $e->addValidator(new Zend_Validate_InArray($_producto->getComboValidValues())); $this->addElement($e); // Cantidad $e = new Zend_Form_Element_Text('cantidad'); $e->setLabel('Cantidad'); $e->setRequired(); $e->addValidator(new Zend_Validate_Int(new Zend_Locale('US'))); $e->addValidator(new Zend_Validate_GreaterThan(0)); $e->addValidator(new Zend_Validate_LessThan(100)); $this->addElement($e); // AddVentaDetalles $e = new Zend_Form_Element_Hidden('is_detalle'); $e->setValue(true); $e->setRequired(); $this->addElement($e); //Submit $e = new Zend_Form_Element_Submit('submit'); $e->setLabel('Agregar'); $this->addElement($e); }
public function init() { parent::init(); $this->setAction('/core/review/edit'); $reviewId = new Zend_Form_Element_Hidden('review_id'); $reviewId->setRequired(true)->setLabel('review_id')->addValidators(array('Int'))->setDecorators(array('Composite')); $this->addElement($reviewId); }
public function init() { parent::init(); $this->setAction('/core/session/chairs'); $submissionId = new Zend_Form_Element_Hidden('session_id'); $submissionId->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite')); $users = new TA_Form_Element_User('user_id'); $users->setTaController('session')->populateElement('chair')->setAttrib('onchange', "this.form.submit()"); $this->addElements(array($submissionId, $users)); }
public function init($userId) { global $mySession; $db = new Db(); $full_name_value = ""; $location_value = ""; $check_in_value = ""; $rating_value = ""; $headline_value = ""; $comment_value = ""; $review_value = ""; /*if($userId != "") { $userData = $db->runQuery("select * from ".OWNER_REVIEW." where property_id = '".$userId."' "); if($userData != "" && count($userData) > 0) { $full_name_value = $userData[0]['owner_name']; $location_value = $userData[0]['location']; $check_in_value = $userData[0]['check_in']; $rating_value = $userData[0]['rating']; $headline_value = $userData[0]['headline']; $comment_value = $userData[0]['comment']; $review_value = $userData[0]['review']; } }*/ $full_name = new Zend_Form_Element_Text('full_name'); $full_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter Full Name"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "50")->setValue($full_name_value); $location = new Zend_Form_Element_Text('location'); $location->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "50")->setValue($location_value); $check_in = new Zend_Form_Element_Text('check_in'); $check_in->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter phone number"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($check_in_value); $ratingArr = array(); $ratingArr[0]['key'] = ""; $ratingArr[0]['value'] = "- - Select - -"; for ($i = 1; $i <= 10; $i++) { $ratingArr[$i]['key'] = $i; $ratingArr[$i]['value'] = $i; } $rating = new Zend_Form_Element_Select('rating'); $rating->setRequired(true)->addMultiOptions($ratingArr)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($rating_value); $headline = new Zend_Form_Element_Text('headline'); $headline->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required reviewHeadline")->setAttrib("maxlength", "100")->setValue($headline_value); $comment = new Zend_Form_Element_Textarea('comment'); $comment->addDecorator('Errors', array('class' => 'error'))->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "300")->setValue($comment_value); $review = new Zend_Form_Element_Textarea('review'); $review->setRequired(true)->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "required")->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "1000")->addValidator('NotEmpty', true, array('messages' => "Enter message"))->setValue($review_value); $step = new Zend_Form_Element_Hidden('step'); $step->setRequired(true)->setValue("8"); /*$check = new Zend_Form_Element_Hidden('check'); $check->setRequired(true) ->setValue($text);*/ $this->addElements(array($full_name, $location, $check_in, $rating, $headline, $comment, $review, $step)); }
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 __construct($options = null) { parent::__construct($options); $this->setMethod('GET'); self::$_instanceCounter++; $idEl = new Zend_Form_Element_Hidden(self::$_idParam); $idEl->setRequired(false); $idEl->setValue($this->_getFormid()); $this->setAttrib('id', $this->_getFormid()); $this->addElement($idEl); }
public function init() { parent::init(); $this->setAction('/core/submit/edit'); $submissionId = new Zend_Form_Element_Hidden('submission_id'); $submissionId->setRequired(true)->setLabel('submission_id')->addValidators(array('Int'))->setDecorators(array('Composite')); $submission = $this->getSubForm('submission'); $submission->addElement($submissionId); $file = $submission->getElement('file'); $file->setDescription($file->getDescription() . ' (Uploading a new file will overwrite the old one)')->setRequired(false); }
public function init($name = "") { global $mySession; $db = new Db(); //echo "url .... : ".$name; die; $emailid_val = ""; $emailfrnz_val = ""; $quremailid = $db->runquery("SELECT emailid FROM " . ORDER_RECORD . " WHERE teeurl='" . $name . "'"); //prd($quremailid); if ($quremailid != "" and count($quremailid) > 0) { for ($i = 0; $i < count($quremailid); $i++) { if ($i == 0) { $emailfrnz[$i] = $quremailid[$i]['emailid']; } else { if (!in_array($quremailid[$i]['emailid'], $emailfrnz)) { $emailfrnz[$i] = $quremailid[$i]['emailid']; } } } // prd($emailfrnz); $emailfrnz_val = implode(",", $emailfrnz); } $qur1 = $db->runquery("SELECT * FROM " . LAUNCHCAMPAIGN . " WHERE url='" . $name . "' "); $qur = $db->runquery("SELECT * FROM " . USERS . " WHERE user_id='" . $qur1[0]['user_id'] . "'"); //$qur=$db->runquery("select * from ".ADDRESS." join ".STATE." on ".STATE.".state_id=".ADDRESS.".state where user_id='".$mySession->TeeLoggedID."' "); if ($qur != "" and count($qur) > 0) { $emailid_val = $qur[0]['emailid']; } # FORM ELEMENT:public name # TYPE : text $emailid = new Zend_Form_Element_Text('emailid'); $emailid->setRequired(true)->addDecorator('Errors', array('class' => 'error'))->setAttrib('class', 'changeaddress')->setAttrib("style", "width:300px; height:30px;")->setValue($emailid_val); if (@$_REQUEST['emailid'] != "") { $emailid->addValidator('EmailAddress', true)->addDecorator('Errors', array('class' => 'error'))->addErrorMessage('Please enter a valid email address'); } # FORM ELEMENT:address # TYPE : text //$friendsemailid= new Zend_Form_Element_Text('friendsemailid'); // $friendsemailid->setRequired(true) // ->addValidator('NotEmpty',true,array('messages' =>'One id is required')) // ->addDecorator('Errors', array('class'=>'errmsg')) // ->setAttrib("style","width:300px; height:30px;") // ->setAttrib('class','changepasstextbox') // ->setValue($emailfrnz_val); $friendsemailid = new Zend_Form_Element_Hidden('friendsemailid'); $friendsemailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'One id is required'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("style", "width:300px; height:30px;")->setAttrib('class', 'changepasstextbox')->setValue($emailfrnz_val); # FORM ELEMENT:city # TYPE : text $subject = new Zend_Form_Element_Text('subject'); $subject->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Subject is required'))->addDecorator('Errors', array('class' => 'error'))->setAttrib('class', 'changeaddress')->setAttrib("style", "width:300px; height:30px;"); $content = new Zend_Form_Element_Textarea('content'); $content->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Content is required'))->addDecorator('Errors', array('class' => 'error'))->setAttrib('class', 'changeaddress')->setAttrib("style", "width:300px; height:150px;"); $this->addElements(array($emailid, $friendsemailid, $subject, $content)); }
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() { $this->setMethod('post'); $this->setAttrib('enctype', 'multipart/form-data'); $photo = new Zend_Form_Element_File('photo'); $photo->setLabel('photo.upload'); $photo->setDestination($this->getAttrib('tmp')); $photo->addValidator('Count', false, 1); $photo->addValidator('Size', false, $this->getAttrib('filesize')); $photo->addValidator( 'Extension', false, $this->getAttrib('extensions') ); $photo->setRequired(true); $photo->removeDecorator('Errors'); $this->addElement($photo, 'photo'); $fbId = new Zend_Form_Element_Hidden('fbid'); $fbId->addValidator( 'Db_NoRecordExists', false, array( 'table' => 'zdjecia', 'field' => 'fbuserid' ) ); $fbId->setLabel('fbid'); $fbId->setRequired(true); $fbId->removeDecorator('Errors'); $fbId->removeDecorator('Label'); $this->addElement($fbId); $save = new Zend_Form_Element_Submit('Save'); $save->setLabel('Zgłoś Zdjęcie'); $save->setAttrib('class', 'ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only'); $this->addElement($save); $this->addDecorator( new Zend_Form_Decorator_FormErrors( array( 'ignoreSubForms'=>true, 'markupListStart' => '<ul class="ui-state-error ui-corner-all">', ) ) ) ->addDecorator('FormElements') ->addDecorator('HtmlTag') ->addDecorator('Form'); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'roles'); $id = new Zend_Form_Element_Hidden('id'); $rolename = new Zend_Form_Element_Text('rolename'); $rolename->setAttrib('maxLength', 50); $rolename->setAttrib('title', 'Role name'); $rolename->addFilter(new Zend_Filter_StringTrim()); $rolename->setRequired(true); $rolename->addValidator('NotEmpty', false, array('messages' => 'Please enter role name.')); $rolename->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9 ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid role name.'))); $rolename->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'rolename', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive!=0'))); $rolename->getValidator('Db_NoRecordExists')->setMessage('Role name already exists.'); $rolename->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 50, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role name must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role name must contain at least %min% characters.'))))); $roletype = new Zend_Form_Element_Text('roletype'); $roletype->setRequired(true); $roletype->setAttrib('maxLength', 25); $roletype->setAttrib('title', 'Role type'); $roletype->addFilter(new Zend_Filter_StringTrim()); $roletype->addValidator('NotEmpty', false, array('messages' => 'Please enter role type.')); $roletype->addValidator("regex", true, array('pattern' => '/^[a-zA-Z]+?$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))); $roletype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'roletype', 'exclude' => 'id != "' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive != 0'))); $roletype->getValidator('Db_NoRecordExists')->setMessage('Role type already exists.'); $roletype->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 25, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role type must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role type must contain at least %min% characters.'))))); $roledescription = new Zend_Form_Element_Textarea('roledescription'); $roledescription->setAttrib('rows', 10); $roledescription->setAttrib('cols', 50); $roledescription->setAttrib('maxlength', '100'); $roledescription->setAttrib('title', 'Role description'); $levelid = new Zend_Form_Element_Hidden('levelid'); $levelid->addFilter(new Zend_Filter_StringTrim()); $levelid->setRequired(true); $levelid->addValidator('NotEmpty', false, array('messages' => 'Please select level.')); $istimeActive = Zend_Controller_Front::getInstance()->getRequest()->getParam('istimeactive'); $prev_cnt = new Zend_Form_Element_Hidden('prev_cnt'); $prev_cnt->setRequired(true); if ($istimeActive) { $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges other than time management.')); } else { $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges.')); } $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $url = "'roles/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'roles\\');'"; $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});")); $this->addElements(array($id, $rolename, $roletype, $roledescription, $levelid, $submit, $prev_cnt)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { parent::init(); $this->setAction('/core/feedback/mailall'); $this->setAttrib('id', 'mailform'); $status = new Zend_Form_Element_Hidden('id'); $status->setRequired(true)->setLabel('id')->addValidators(array('Int'))->setDecorators(array('Composite')); $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($status, $dummy)); $this->addElement('submit', 'submit', array('label' => 'Send emails (this may take a while)', 'decorators' => $this->_buttonElementDecorator)); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { parent::__construct($options); $this->setName('TypeToRuler'); $type = new Zend_Form_Element_Select('type'); $type->setLabel('Medieval coin type: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow')); $ruler_id = new Zend_Form_Element_Hidden('ruler_id'); $ruler_id->setRequired(true)->addValidator('Int'); $submit = new Zend_Form_Element_Submit('submit'); $this->addElements(array($type, $ruler_id, $submit))->setLegend('Add a new type')->setMethod('post'); parent::init(); }
public function init() { parent::init(); $this->setAction('/core/session/show'); $conference = Zend_Registry::get('conference'); $sessionId = new Zend_Form_Element_Hidden('session_id'); $sessionId->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite')); $presentationModel = new Core_Model_Presentation(); $select = new Zend_Form_Element_Select('presentation_id'); $select->setAttrib('onchange', 'this.form.submit()')->setMultiOptions($presentationModel->getPresentationsForSelect('--- attach presentation ---'))->setRegisterInArrayValidator(false)->setDecorators(array('Composite')); $this->addElements(array($sessionId, $select)); }
public function init() { parent::init(); $this->setAction('/core/submit/reviewers'); $submissionId = new Zend_Form_Element_Hidden('submission_id'); $submissionId->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite')); $users = new TA_Form_Element_User('user_id'); $users->setTaController('submit')->populateElement('reviewer')->setAttrib('onchange', "this.form.submit()"); // use custom decorator for this element $users->removeDecorator('User'); $users->addDecorator('Userreviewer', array('placement' => 'prepend')); $this->addElements(array($submissionId, $users)); }
public function __construct($options = null) { parent::__construct($options); $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate'); $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element'); $this->addPrefixPath('Pas_Form_Decorator', 'Pas/Form/Decorator/', 'decorator'); $decorator = array('SimpleInput'); $decoratorSelect = array('SelectInput'); $decorators = array(array('ViewHelper'), array('Description', array('tag' => '', 'placement' => 'append')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li'))); $this->setAttrib('accept-charset', 'UTF-8'); $this->setName('comments'); $comment_author_IP = new Zend_Form_Element_Hidden('user_ip'); $comment_author_IP->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->addFilters(array('StripTags', 'StringTrim'))->setRequired(true)->addValidator('Ip')->setValue($_SERVER['REMOTE_ADDR']); $comment_agent = new Zend_Form_Element_Hidden('user_agent'); $comment_agent->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->addFilters(array('StripTags', 'StringTrim'))->setValue($_SERVER['HTTP_USER_AGENT'])->setRequired(true); $comment_subject = new Zend_Form_Element_Hidden('comment_subject'); $comment_subject->removeDecorator('HtmlTag')->addFilters(array('StripTags', 'StringTrim'))->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setRequired(true); $comment_findID = new Zend_Form_Element_Hidden('comment_findID'); $comment_findID->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidators(array('Int'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label'); $comment_author = new Zend_Form_Element_Text('comment_author'); $comment_author->setLabel('Enter your name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid name!')->setDecorators($decorators); $comment_author_email = new Zend_Form_Element_Text('comment_author_email'); $comment_author_email->setLabel('Enter your email address: ')->setDecorators($decorators)->setRequired(true)->setAttrib('size', 40)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addValidator('EmailAddress')->addErrorMessage('Please enter a valid email address!')->setDescription('* This will not be displayed to the public'); $comment_type = new Zend_Form_Element_Select('comment_type'); $comment_type->setLabel('Error type: ')->setRequired(true)->setDecorators($decorators)->addMultiOptions(array(NULL => NULL, 'Choose error type' => array('Incorrect ID' => 'Incorrect identification', 'More info' => 'I have further information', 'Incorrect image' => 'Incorrect image', 'Incorrect parish' => 'Incorrect parish', 'Grid reference issues' => 'Grid reference wrong', 'Date found wrong' => 'Date of discovery wrong', 'Spelling errors' => 'Spelling errors', 'Duplicated record' => 'Duplicated record', 'Data problems apparent' => 'Data problems', 'Other' => 'Other reason')))->addErrorMessage('You must enter an error report type'); $comment_author_url = new Zend_Form_Element_Text('comment_author_url'); $comment_author_url->setLabel('Enter your web address: ')->setDecorators($decorators)->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addErrorMessage('Please enter a valid address!')->setDescription('* Not compulsory'); $comment_content = new Pas_Form_Element_RTE('comment_content'); $comment_content->setLabel('Enter your comment: ')->setRequired(true)->addFilter('StringTrim')->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Basic')->addFilter('StringTrim')->addFilter('WordChars')->addFilter('HtmlBody')->addFilter('EmptyParagraph')->addErrorMessage('Please enter something in the comments box!'); $config = Zend_registry::get('config'); $privateKey = $config->recaptcha->privatekey; $pubKey = $config->recaptcha->pubkey; $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'ReCaptcha', 'label' => 'Prove you are not a robot you varmint!', 'captchaOptions' => array('captcha' => 'ReCaptcha', 'privKey' => $privateKey, 'pubKey' => $pubKey, 'theme' => 'clean'))); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { $this->addElements(array($comment_findID, $comment_author_IP, $comment_agent, $comment_subject, $comment_author, $comment_author_email, $comment_content, $comment_author_url, $comment_type, $captcha, $submit)); $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_type', 'comment_content', 'captcha', 'submit'), 'details'); } else { $this->addElements(array($comment_findID, $comment_subject, $comment_author_IP, $comment_agent, $comment_author, $comment_author_email, $comment_content, $comment_author_url, $comment_type, $submit)); $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_type', 'comment_content', 'submit'), 'details'); } $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('HtmlTag'); $this->details->removeDecorator('DtDdWrapper'); $this->details->setLegend('Enter your error report: '); }
private function _setupElements() { $translate = Zend_Registry::get('Zend_Translate'); $this->setAttrib('id', 'themeForm'); $this->setTranslator($translate); $name = new Zend_Form_Element_Text('name'); $name->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setErrorMessages(array('Username is required')); $cssProperty = new Zend_Form_Element_Hidden('cssProperty'); $cssProperty->setRequired(true)->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'css-property'); $submit = new Zend_Form_Element_Submit('save'); $submit->setLabel('Save Theme'); $submit->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'u-login'); $this->addElements(array($name, $cssProperty, $submit)); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'frm_multiple_resume'); $this->setAttrib('name', 'frm_multiple_resume'); $this->setAttrib('action', BASE_URL . 'candidatedetails/multipleresume'); $id = new Zend_Form_Element_Hidden('id'); $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null); $requisition_id = new Zend_Form_Element_Select("requisition_id"); $requisition_id->setRegisterInArrayValidator(false); $requisition_id->setLabel("Requisition ID"); $requisition_id->setAttrib("class", "formDataElement"); $requisition_id->setAttrib('onchange', 'displayParticularCandidates(this,"cand")'); $requisition_id->setAttrib('title', 'Requisition ID'); if ($id_val == '') { $requisition_id->setRequired(true); $requisition_id->addValidator('NotEmpty', false, array('messages' => 'Please select requisition id.')); } $candidate_firstname = new Zend_Form_Element_Text('candidate_firstname'); $candidate_firstname->setIsArray(TRUE); $candidate_firstname->setAttrib('maxLength', 90); $candidate_firstname->setAttrib('title', 'Candidate First Name'); $candidate_firstname->setAttrib('class', 'candidate_firstname'); $candidate_firstname->addFilter(new Zend_Filter_StringTrim()); $candidate_firstname->setRequired(true); $candidate_firstname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid candidate first name.'))); $candidate_lastname = new Zend_Form_Element_Text('candidate_lastname'); $candidate_lastname->setIsArray(TRUE); $candidate_lastname->setAttrib('maxLength', 90); $candidate_lastname->setAttrib('title', 'Candidate Last Name'); $candidate_lastname->setAttrib('class', 'candidate_lastname'); $candidate_lastname->addFilter(new Zend_Filter_StringTrim()); $candidate_lastname->setRequired(true); $candidate_lastname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid candidate last name.'))); $candidate_resumes = new Zend_Form_Element_Hidden('cand_resume'); $candidate_resumes->setIsArray(TRUE); $candidate_resumes->setRequired(true); $candidate_resumes->addValidator('NotEmpty', false, array('messages' => 'Please select file.')); $cand_status = new Zend_Form_Element_Select("cand_status"); $cand_status->setRegisterInArrayValidator(false); $cand_status->setLabel("Status"); $cand_status->setAttrib("class", "formDataElement"); $cand_status->setAttrib('title', 'Candidate status'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'multiple-submit-button'); $submit->setLabel('Save'); $this->addElements(array($cand_status, $id, $requisition_id, $candidate_firstname, $candidate_lastname, $candidate_resumes, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setName('category'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $parentid = new Zend_Form_Element_Select('parentid'); $parentid->setLabel('CATEGORIES_PARENT')->addMultiOption(0, 'CATEGORIES_MAIN_CATEGORY')->addFilter('Int'); $title = new Zend_Form_Element_Text('title'); $title->setLabel('CATEGORIES_TITLE')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $type = new Zend_Form_Element_Hidden('type'); $type->setRequired(true)->addValidator('NotEmpty'); $ordering = new Zend_Form_Element_Hidden('ordering'); $ordering->setLabel('CATEGORIES_ORDERING')->addFilter('Int'); $this->addElements(array($id, $parentid, $title, $type, $ordering)); }
public function init() { $this->addDecorators(array("ViewHelper"), array("Errors")); $new_password = new Zend_Form_Element_Password("new_password"); $new_password->setLabel("New Password"); $new_password->setRequired(true); $new_password->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "alnum", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 30))); $confirm_password = new Zend_Form_Element_Password("confirm_password"); $confirm_password->setLabel("Confirm New Password"); $confirm_password->setRequired(true); $confirm_password->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "alnum", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 30))); $owner_id = new Zend_Form_Element_Hidden("owner_id"); $owner_id->setRequired(true); $this->addElements(array($new_password, $confirm_password, $owner_id)); }
public function __construct($options = null) { $countries = new Countries(); $countries_options = $countries->getOptions(); $counties = new Counties(); $counties_options = $counties->getCountyname2(); $peoples = new Peoples(); $people_options = $peoples->getNames2(); parent::__construct($options); $this->setName('organisation'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li'))); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Organisation name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Please enter an organisation name: ')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $website = new Zend_Form_Element_Text('website'); $website->setLabel('Organisation website: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Pas_Validate_Url())->addErrorMessage('Please enter a valid URL')->setAttrib('size', 60)->setDecorators($decorators); $address1 = new Zend_Form_Element_Text('address1'); $address1->setLabel('Address line one: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $address2 = new Zend_Form_Element_Text('address2'); $address2->setLabel('Address line two: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $address3 = new Zend_Form_Element_Text('address3'); $address3->setLabel('Address line three: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $address = new Zend_Form_Element_Text('address'); $address->setLabel('Full address: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $town_city = new Zend_Form_Element_Text('town_city'); $town_city->setLabel('Town or city: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $county = new Zend_Form_Element_Select('county'); $county->setLabel('County: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Please choose a county', 'Valid counties' => $counties_options))->addValidator('InArray', false, array(array_keys($counties_options)))->setDecorators($decorators); $country = new Zend_Form_Element_Select('country'); $country->SetLabel('Country: ')->setRequired(true)->setValue('GB')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Please choose a country', 'Valid countries' => $countries_options))->addValidator('InArray', false, array(array_keys($countries_options)))->setDecorators($decorators); $postcode = new Zend_Form_Element_Text('postcode'); $postcode->setLabel('Postcode: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 10))->addValidator('ValidPostCode')->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('Please enter a valid postcode')->setAttrib('size', 10)->setDecorators($decorators); $contactperson = new Zend_Form_Element_Text('contact'); $contactperson->setLabel('Organisation\'s lead contact: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setAttrib('size', 50)->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators); $contactpersonID = new Zend_Form_Element_Hidden('contactpersonID'); $contactpersonID->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label'); $submit = $this->addElement('submit', 'submit', array('label' => 'Login...')); $submit = $this->getElement('submit'); $submit->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'large'); $this->addElements(array($name, $website, $address1, $address2, $address3, $address, $town_city, $county, $country, $postcode, $contactperson, $contactpersonID)); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $this->addElement($hash); $this->addDisplayGroup(array('name', 'website', 'address1', 'address2', 'address3', 'address', 'town_city', 'county', 'country', 'postcode', 'contact', 'contactpersonID'), 'details'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->setLegend('Organisation details: '); $this->addDisplayGroup(array('submit'), 'submit'); }
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)); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { parent::__construct($options); $this->setName('artefactlink'); $old_findID = new Zend_Form_Element_Text('old_findID'); $old_findID->setLabel('Filter by find ID #')->setRequired(true)->setAttrib('size', 20)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200)); $findID = new Zend_Form_Element_Hidden('findID'); $findID->setRequired(true)->setAttrib('size', 11)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200)); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Link coin, artefact or container'); $this->addElements(array($findID, $old_findID, $submit)); $this->addDisplayGroup(array('old_findID', 'findID'), 'details'); $this->details->setLegend('Link artefact: '); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
public function init() { parent::init(); $this->setAction('/core/review/list/'); $this->setAttrib('id', 'statusform'); $submissionId = new Zend_Form_Element_Hidden('submission_id'); $submissionId->setRequired(true)->setLabel('submission_id')->addValidators(array('Int'))->setDecorators(array('Composite')); // todo: replace with 'new' way of doing this $statusOptions = Zend_Registry::get('formconfig')->formdefaults->submit->status->toArray(); $status = new Zend_Form_Element_Select('status'); $status->setLabel('Status')->setAttrib('class', 'small')->addFilter('Null')->addMultiOptions($statusOptions)->setDecorators(array('Composite')); $sessionModel = new Core_Model_Session(); $sessions = $sessionModel->getSessionsForSelect(''); $session = new Zend_Form_Element_Select('session_id'); $session->setLabel('Proposed Session')->setAttrib('class', 'small')->addMultiOption('', '--- select a session ---')->addFilter('Null')->addMultiOptions($sessions)->setDecorators(array('Composite')); $this->addElements(array($submissionId, $status, $session)); $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator)); }