public function init() { $languageFile = Zend_Registry::get('languageFile'); $translate = new Zend_Translate('array', $languageFile, 'zh_CN'); $this->setTranslator($translate); $this->setMethod('POST'); $this->setName('contactForm'); $element = new Zend_Form_Element_Text('name'); $element->setLabel('怎么称呼您'); $this->addElement($element); $element = new Zend_Form_Element_Text('email'); $element->setLabel('您的Email'); //$element->setRequired(true); $this->addElement($element); $element = new Elements(); $element->addReCaptcha($this); $this->addDisplayGroup(array('name', 'email', 'captcha'), 'leftSection'); $this->getDisplayGroup('leftSection')->removeDecorator('DtDdWrapper'); $element = new Zend_Form_Element_Textarea('body'); $element->setLabel('想要开通城市地区和找房贴士,关于您的简单介绍'); $element->addPrefixPath('My_Validator', 'My/Validator/', 'validate'); $element->addValidator('FormValueNotNull', true); //$element->setRequired(true); $element->setAttrib('rows', 13); $this->addElement($element); $this->addDisplayGroup(array('body'), 'rightSection'); $this->getDisplayGroup('rightSection')->removeDecorator('DtDdWrapper'); $element = new Zend_Form_Element_Submit('post'); $element->removeDecorator('Label'); $this->addElement($element); }
public function init() { $media_library_model = new Cms_Model_MediaLibraries(); $media_library = $media_library_model->getByPath($this->_attribs['media_library_path']); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Title'); $title->setRequired(true); $title->addFilter('StringTrim'); $title->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $this->addElement($title); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('Description'); $description->addFilter('StringTrim'); $description->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $this->addElement($description); $original = new Zend_Form_Element_File('original'); $original->addValidator('Count', false, 1); $original->addValidator('Extension', false, 'jpeg,jpg,png'); $original->addFilter('Rename', $this->_attribs['file_name']); $original->setDestination(My_Utilities::getUploadMediaPathDiffSizes($this->_attribs['file_name'], $this->_attribs['media_library_path'], 'original')); $original->setLabel('Image:'); $this->addElement($original); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Potvrdi'); $this->setAction('')->setMethod('post')->addElement($submit); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Cancel'); $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black'); $cancel->setAttrib("onClick", "window.location = window.location.origin+'/cms/medias/index/library_id/" . $media_library->id . "'"); $this->addElement($cancel); }
public function init() { $this->setName('send-tweet'); $e = new Zend_Form_Element_Text('latitude'); $e->setLabel('Latitude'); $e->addFilter('StringTrim'); $e->setAttrib('onblur', 'setMarkerFromForm()'); $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/')); $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Latitude is not valid'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Text('longitude'); $e->setLabel('Longitude'); $e->addFilter('StringTrim'); $e->setAttrib('onblur', 'setMarkerFromForm()'); $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/')); $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Longitude is not valid'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Textarea('tweet'); $e->setLabel('Tweet'); $e->setRequired(true); $e->addFilter('StripTags'); $e->addFilter('StringTrim'); $e->addValidator(new Zend_Validate_StringLength(array('max' => 140))); $e->setTranslator(new Zend_Translate_Adapter_Array(array('isEmpty' => 'Please supply the message to be tweeted', 'stringLengthTooLong' => 'No more than 140 characters please!'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Submit('send'); $e->setIgnore(true); $e->setLabel('Tweet!'); $this->addElement($e); }
public function init() { $this->setMethod('POST'); $this->setName('guestForm'); $element = new Zend_Form_Element_Text('name'); $element->setLabel('怎么称呼您'); $element->setDescription('必填,中英文都可,2到30个字'); $element->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('email'); $element->setLabel('您的Email'); $element->setRequired(true); $element->addValidator(new Zend_Validate_EmailAddress()); $element->addValidator('NotEmpty'); $element->setDescription('必填'); $this->addElement($element); $element = new Zend_Form_Element_Textarea('body'); $element->setLabel('您的留言'); $element->setAttrib('rows', 4); $element->addValidator('NotEmpty'); $this->addElement($element); $element = new Elements(); $element->addReCaptcha($this); $element = new Zend_Form_Element_Submit('post'); $element->setValue('提交')->removeDecorator('Label'); $this->addElement($element); }
/** account form */ public function createAccountForm($defaultValue = array()) { $form = new Zend_Form(); $form->setAction($this->webroot . '/user/settings')->setMethod('post'); $email = new Zend_Form_Element_Text('email'); $email->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255)->addValidator('EmailAddress'); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255); $company = new Zend_Form_Element_Text('company'); $company->setAttrib('maxLength', 255); $city = new Zend_Form_Element_Text('city'); $city->setAttrib('maxLength', 100); $country = new Zend_Form_Element_Text('country'); $country->setAttrib('maxLength', 100); $validator = new Zend_Validate_Callback(array('Zend_Uri', 'check')); $website = new Zend_Form_Element_Text('website'); $website->setAttrib('maxLength', 255)->addValidator($validator); $biography = new Zend_Form_Element_Textarea('biography'); $biography->addValidator(new Zend_Validate_Alnum()); $submit = new Zend_Form_Element_Submit('modifyAccount'); $submit->setLabel($this->t('Modify')); $privacy = new Zend_Form_Element_Radio('privacy'); $privacy->addMultiOptions(array(MIDAS_USER_PUBLIC => $this->t('Public (Anyone can see my information, excluding email address)'), MIDAS_USER_PRIVATE => $this->t('Private (User information will be hidden)')))->setRequired(true)->setValue(MIDAS_COMMUNITY_PUBLIC); if (isset($defaultValue['email'])) { $email->setValue($defaultValue['email']); } if (isset($defaultValue['firstname'])) { $firstname->setValue($defaultValue['firstname']); } if (isset($defaultValue['lastname'])) { $lastname->setValue($defaultValue['lastname']); } if (isset($defaultValue['company'])) { $company->setValue($defaultValue['company']); } if (isset($defaultValue['privacy'])) { $privacy->setValue($defaultValue['privacy']); } if (isset($defaultValue['city'])) { $city->setValue($defaultValue['city']); } if (isset($defaultValue['country'])) { $country->setValue($defaultValue['country']); } if (isset($defaultValue['website'])) { $website->setValue($defaultValue['website']); } if (isset($defaultValue['biography'])) { $biography->setValue($defaultValue['biography']); } $form->addElements(array($email, $website, $city, $country, $biography, $firstname, $lastname, $company, $privacy, $submit)); return $form; }
protected function _motivo() { $e = new Zend_Form_Element_Textarea('motivo'); $e->setLabel(_('Reason') . ':'); $e->setRequired(true); $e->setAttrib('rows', 4); $e->setAttrib("data-parsley-required", "true"); $e->setAttrib('placeholder', _('Describe why you want to change your e-mail address...')); $e->addFilter('StripTags'); $e->addFilter('StringTrim'); $e->addValidator('StringLength', false, array(10)); $e->setAttrib('class', 'form-control'); return $e; }
public function init() { $this->setMethod('post')->setAction('/venta/registrar')->setAttrib('id', 'frmVenta')->setAttrib('style', 'width: 300px;margin:auto;'); // Comentarios $e = new Zend_Form_Element_Textarea('comentarios'); $e->setLabel('Comentarios'); $e->setRequired(false); $e->addValidator(new Zend_Validate_StringLength(array('min' => 5, 'max' => 100))); $e->setAttrib('cols', '20'); $e->setAttrib('rows', '2'); $this->addElement($e); //Submit $e = new Zend_Form_Element_Submit('submit'); $e->setlabel('Registrar'); $this->addElement($e); }
/** Initialize this form. */ public function init() { $this->setName('landingpage_admin'); $this->setMethod('POST'); $csrf = new Midas_Form_Element_Hash('csrf'); $csrf->setSalt('kUjBumZdEykrY8JHB88uzZjv'); $csrf->setDecorators(array('ViewHelper')); $text = new Zend_Form_Element_Textarea(LANDINGPAGE_TEXT_KEY); $text->setLabel('Landing Page Text'); $text->setRequired(true); $text->addValidator('NotEmpty', true); $text->setAttrib('cols', '80'); $text->setAttrib('rows', '40'); $this->addDisplayGroup(array($text), 'global'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Save'); $this->addElements(array($csrf, $text, $submit)); }
public function __construct() { // Validators -------------------------- $notEmpty = new Zend_Validate_NotEmpty(array(true)); $notEmpty->setMessage($this->_errorMessages['isEmpy']); $digits = new Zend_Validate_Digits(); $digits->setMessage($this->_errorMessages['digits']); $emailValidator = new Zend_Validate_EmailAddress(); $emailValidator->setMessage($this->_errorMessages['emailValidator']); $foneValidator = new Zend_Validate_StringLength(); $foneValidator->setMin(8); $foneValidator->setMessage($this->_errorMessages['foneValidator']); //-------------------------------------- $nome = new Zend_Form_Element_Text('nome'); $nome->setAttrib('class', 'form-control'); $nome->setRequired(true); $nome->addValidator($notEmpty, true); //-------------------------------------------------------- $fone = new Zend_Form_Element_Text('fone'); $fone->setAttrib('class', 'form-control'); $fone->setRequired(true); $fone->addValidator($notEmpty, true); $fone->addValidator($digits, true); $fone->addValidator($foneValidator, true); //-------------------------------------------------------- $email = new Zend_Form_Element_Text('email'); $email->setAttrib('class', 'form-control'); $email->setRequired(true); $email->addValidator($notEmpty, true); $email->addValidator($emailValidator, true); //-------------------------------------------------------- $mensagem = new Zend_Form_Element_Textarea('mensagem'); $mensagem->setAttrib('class', 'form-control'); $mensagem->setAttrib('cols', 30); $mensagem->setAttrib('rows', 10); $mensagem->setRequired(true); $mensagem->addValidator($notEmpty, true); //-------------------------------------------------------- $this->addElement($nome); $this->addElement($fone); $this->addElement($email); $this->addElement($mensagem); $this->setElementDecorators(array('ViewHelper', 'Errors')); }
public function init() { $tr = Zend_Registry::get('tr'); $http_code = new Zend_Form_Element_Text('http_code'); $http_code->setLabel($tr->_('HTTP_CODE')); $http_code->setRequired(false); $this->addElement($http_code); $name = new Zend_Form_Element_Text('name'); $name->setLabel($tr->_('NAME')); $name->setRequired(true); $name->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($name); $msg = new Zend_Form_Element_Textarea('message'); $msg->setLabel($tr->_('ERROR_MESSAGE')); $msg->setAttribs(array('rows' => 10, 'cols' => 35)); $msg->setRequired(true); $msg->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($msg); /** Maybe next version will have it back. $action = new Default_Model_Action; $all = $action->getList(); $actions = new Zend_Form_Element_Multiselect('actions'); $actions->setLabel('Associated Actions with this Error'); $actions->setMultiOptions($all); $actions->setAttrib('size', 8); $this->addElement($actions); */ $desc = new Zend_Form_Element_Textarea('description'); $desc->cols = 35; $desc->rows = 15; $desc->setLabel($tr->_('DESCRIPTION')); $desc->setRequired(false); $this->addElement($desc); $this->addElement(new Zend_Form_Element_Submit($tr->_('SUBMIT'))); parent::init(); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'announcements'); $this->setAttrib('name', 'announcements'); $id = new Zend_Form_Element_Hidden('id'); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginuserGroup = $auth->getStorage()->read()->group_id; } if ($loginuserGroup == HR_GROUP) { $businessunit_id = new Zend_Form_Element_Select("businessunit_id"); } else { $businessunit_id = new Zend_Form_Element_Multiselect("businessunit_id"); } $businessunit_id->setLabel("Business Units"); $businessunit_id->setRegisterInArrayValidator(false); $businessunit_id->setRequired(true); $businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.')); $department_id = new Zend_Form_Element_Multiselect("department_id"); $department_id->setLabel("Departments"); $department_id->setRegisterInArrayValidator(false); $department_id->setRequired(true); $department_id->addValidator('NotEmpty', false, array('messages' => 'Please select department.')); $title = new Zend_Form_Element_Text("title"); $title->setLabel("Title"); $title->setAttrib('maxLength', 100); $title->addFilter(new Zend_Filter_StringTrim()); $title->setRequired(true); $title->addValidator('NotEmpty', false, array('messages' => 'Please enter title.')); $title->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid title.'))); $title->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_announcements', 'field' => 'title', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1'))); // Validation for duplicate name is not required $title->getValidator('Db_NoRecordExists')->setMessage('Title name already exists.'); $description = new Zend_Form_Element_Textarea('post_description'); $description->setLabel("Description"); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setRequired(true); $description->addValidator('NotEmpty', false, array('messages' => 'Please enter post.')); $this->addElements(array($id, $businessunit_id, $department_id, $title, $description)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oFormName); $oImageSrc = new Zend_Form_Element_Text("image_src"); $oImageSrc->setLabel("Nazwa wygenerowana:")->setFilters($this->_aFilters); $oImageSrc->setRequired(FALSE); $this->addElement($oImageSrc); $oUserName = new Zend_Form_Element_Text("image_user_name"); $oUserName->setLabel("Nazwa użytkownika:")->setFilters($this->_aFilters); $oUserName->addValidator(new Zend_Validate_StringLength(array("max" => 50))); $oUserName->setRequired(TRUE); $oUserName->setAttrib("class", "valid"); $this->addElement($oUserName); $oDescription = new Zend_Form_Element_Textarea("image_descr"); $oDescription->setLabel("Opis:")->setFilters($this->_aFilters); $oDescription->addValidator(new Zend_Validate_StringLength(array("max" => 100))); $oDescription->setRequired(FALSE); $oDescription->setAttrib("class", "valid"); $this->addElement($oDescription); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "image_settings_submit"); $oSubmit->setLabel("Zapisz"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/_defaultform.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
public function init() { $this->setMethod('POST'); $this->setName('sendEmailForm'); //$this->setAction('index/view'); $element = new Zend_Form_Element_Hidden('id'); $element->setValue($this->advertisement->id); $this->addElement($element); $element = new Zend_Form_Element_Hidden('city'); $element->setValue($this->city); $this->addElement($element); $element = new Zend_Form_Element_Text('name'); $element->setLabel('怎么称呼您'); $element->setRequired(true); $element->setDescription('必填'); $this->addElement($element); $element = new Zend_Form_Element_Text('email'); $element->setLabel('您的Email'); $element->setRequired(true); $element->addValidator(new Zend_Validate_EmailAddress()); $element->addFilter(new Zend_Filter_HtmlEntities()); $element->addFilter(new Zend_Filter_StripTags()); $element->addValidator('NotEmpty'); $element->setDescription('必填'); $this->addElement($element); $element = new Zend_Form_Element_Textarea('body'); $element->setLabel('内容'); $element->setRequired(true); $element->addValidator('NotEmpty'); $element->setDescription('必填'); $element->setAttrib('rows', 4); $this->addElement($element); $element = new Elements(); $element->addReCaptcha($this); $element = new Zend_Form_Element_Submit('send'); $element->setValue('发送'); $element->removeDecorator('Label'); $this->addElement($element); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'feedback'); $id = new Zend_Form_Element_Hidden('id'); $title = new Zend_Form_Element_Text('title'); $title->setAttrib('maxLength', 20); $title->addFilter(new Zend_Filter_StringTrim()); $title->setRequired(true); $title->addValidator('NotEmpty', false, array('messages' => 'Please enter title.')); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('size', '40'); //$description->setAttrib('cols', 50); $description->setAttrib('maxlength', '2000'); $description->setRequired(true); $description->addValidator('NotEmpty', false, array('messages' => 'Please enter description.')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $title, $description, $submit)); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'servicerequest'); $id = new Zend_Form_Element_Hidden('id'); $service_desk_id = new Zend_Form_Element_Hidden('service_desk_id'); $service_desk_conf_id = new Zend_Form_Element_Select('service_desk_conf_id'); $service_desk_conf_id->setLabel("Category"); $service_desk_conf_id->setRequired(true); $service_desk_conf_id->addValidator('NotEmpty', false, array('messages' => 'Please select category.')); $service_desk_conf_id->addMultiOptions(array('' => 'Select category')); $service_desk_conf_id->setRegisterInArrayValidator(false); $service_request_id = new Zend_Form_Element_Select('service_request_id'); $service_request_id->setLabel("Request Type"); $service_request_id->setRequired(true); $service_request_id->addValidator('NotEmpty', false, array('messages' => 'Please select request type.')); $service_request_id->addMultiOptions(array('' => 'Select request')); $service_request_id->setRegisterInArrayValidator(false); $priority = new Zend_Form_Element_Select('priority'); $priority->setLabel("Priority"); $priority->setRequired(true); $priority->addValidator('NotEmpty', false, array('messages' => 'Please select priority.')); $priority->addMultiOptions(array('' => 'Select priority', '1' => 'Low', '2' => 'Medium', '3' => 'High')); $priority->setRegisterInArrayValidator(false); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel("Description"); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setRequired(true); $description->setAttrib('maxlength', '2000'); $description->addValidator('NotEmpty', false, array('messages' => 'Please enter description.')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $service_desk_conf_id, $service_request_id, $priority, $description, $submit, $service_desk_id)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $naoVazio = new Zend_Validate_NotEmpty(); $categoriaTB = new Application_Model_DbTable_Categoria(); $categorias = $categoriaTB->fetchAll(null, 'categoria'); $array = array(0 => 'Selecione uma categoria'); foreach ($categorias as $categoria) { $array[$categoria->idcategoria] = $categoria->categoria; } $idcategoria = new Zend_Form_Element_Select('idcategoria', array('label' => 'Categoria:', 'required' => true, 'multioptions' => $array)); $idcategoria->addValidator($naoVazio); $filter = new Zend_Filter_Null(); $idcategoria->addFilter($filter); $this->addElement($idcategoria); $titulo = new Zend_Form_Element_Text('titulo', array('label' => 'Titulo:', 'required' => true)); $titulo->addValidator($naoVazio); $this->addElement($titulo); $texto = new Zend_Form_Element_Textarea('texto', array('label' => 'Texto:', 'required' => true)); $texto->addValidator($naoVazio); $this->addElement($texto); $botao = new Zend_Form_Element_Submit('botao', array('label' => 'Salvar')); $this->addElement($botao); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'empprobationreview'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $reviewdate = new ZendX_JQuery_Form_Element_DatePicker('reviewdate'); $reviewdate->setOptions(array('class' => 'brdr_none')); $reviewdate->setAttrib('readonly', 'false'); $reviewdate->setRequired(true); $reviewdate->addValidator('NotEmpty', false, array('messages' => 'Please select review date.')); $next_reviewdate = new ZendX_JQuery_Form_Element_DatePicker('next_reviewdate'); $next_reviewdate->setOptions(array('class' => 'brdr_none')); $next_reviewdate->setAttrib('readonly', 'false'); $next_reviewdate->setRequired(true); $next_reviewdate->addValidator('NotEmpty', false, array('messages' => 'Please select next review date.')); $feedback = new Zend_Form_Element_Textarea('feedback'); $feedback->setAttrib('rows', 10); $feedback->setAttrib('cols', 50); $feedback->setAttrib('maxlength', '2000'); $feedback->setRequired(true); $feedback->addValidator('NotEmpty', false, array('messages' => 'Please enter feedback or comments.')); $probationstatus = new Zend_Form_Element_Select("probationstatus"); $probationstatus->setRegisterInArrayValidator(true); $probationstatus->setAttrib("class", "formDataElement"); $probationstatus->addMultiOptions(array('' => 'Select Probation Status', 'Performance Review' => 'Performance Review', 'Probation Complete' => 'Probation Complete', 'Extended' => 'Extended')); $probationstatus->setAttrib('title', 'Probation Status'); $probationstatus->setRequired(true); $probationstatus->addValidator('NotEmpty', false, array('messages' => 'Please select status.')); $submitadd = new Zend_Form_Element_Button('submitbutton'); $submitadd->setAttrib('id', 'submitbuttons'); $submitadd->setAttrib('onclick', 'validatedocumentonsubmit(this)'); $submitadd->setLabel('Save'); $this->addElements(array($id, $userid, $reviewdate, $feedback, $probationstatus, $next_reviewdate, $submitadd)); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'experiencedetails'); $id = new Zend_Form_Element_Hidden('id'); $user_id = new Zend_Form_Element_Hidden('user_id'); //company_name ... $company_name = new Zend_Form_Element_Text('comp_name'); $company_name->addFilter(new Zend_Filter_StringTrim()); $company_name->setRequired(true); $company_name->setAttrib("maxlength", 50); $company_name->addValidator('NotEmpty', false, array('messages' => 'Please enter company name.')); $company_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid company name.'))))); //Company website ... $comp_website = new Zend_Form_Element_Text('comp_website'); $comp_website->addFilter(new Zend_Filter_StringTrim()); $comp_website->setAttrib('maxLength', 50); $comp_website->setRequired(false); $comp_website->addValidator('NotEmpty', false, array('messages' => 'Please enter company website.')); $comp_website->addValidator("regex", true, array('pattern' => '/^(http:\\/\\/www|https:\\/\\/www|www)+\\.([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]{2,3})$/', 'messages' => array('regexNotMatch' => 'Please enter valid URL.'))); // designation... $designation = new Zend_Form_Element_Text('designation'); $designation->addFilter(new Zend_Filter_StringTrim()); $designation->setAttrib("maxlength", 50); $designation->setRequired(true); $designation->addValidator('NotEmpty', false, array('messages' => 'Please enter designation.')); $designation->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\.\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid designation.'))))); //from_date.. $from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date'); $from_date->setRequired(true); $from_date->addValidator('NotEmpty', false, array('messages' => 'Please select from date.')); $from_date->setAttrib('readonly', 'true'); $from_date->setAttrib('onfocus', 'this.blur()'); //to_date $to_date = new ZendX_JQuery_Form_Element_DatePicker('to_date'); $to_date->setRequired(true); $to_date->addValidator('NotEmpty', false, array('messages' => 'Please select to date.')); $to_date->setAttrib('readonly', 'true'); $to_date->setAttrib('onfocus', 'this.blur()'); // reason_for_leaving .... $reason_for_leaving = new Zend_Form_Element_Textarea('reason_for_leaving'); $reason_for_leaving->setAttrib('rows', 10); $reason_for_leaving->setAttrib('cols', 50); $reason_for_leaving->setRequired(true); $reason_for_leaving->addValidator('NotEmpty', false, array('messages' => 'Please enter reason for leaving.')); // Reference person Details.... //Referer name .... $reference_name = new Zend_Form_Element_Text('reference_name'); $reference_name->addFilter(new Zend_Filter_StringTrim()); $reference_name->setRequired(false); $reference_name->setAttrib("maxlength", 50); $reference_name->addValidator('NotEmpty', false, array('messages' => 'Please enter referrer name.')); $reference_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid referrer name.'))))); //Referer mobile number .... $reference_contact = new Zend_Form_Element_Text('reference_contact'); $reference_contact->addFilter(new Zend_Filter_StringTrim()); $reference_contact->setRequired(false); $reference_contact->setAttrib("maxlength", 10); $reference_contact->addValidator('NotEmpty', false, array('messages' => 'Please enter referrer contact.')); $reference_contact->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Referrer contact must contain at most of 10 numbers.', Zend_Validate_StringLength::TOO_SHORT => 'Referrer contact must contain at least of %min% characters.'))))); $reference_contact->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); //Referer Email.... $reference_email = new Zend_Form_Element_Text('reference_email'); $reference_email->addFilters(array('StringTrim', 'StripTags')); $reference_email->setRequired(false); $reference_email->setAttrib("maxlength", 50); $reference_email->addValidator('NotEmpty', false, array('messages' => 'Please enter referrer email.')); $reference_email->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid email.'))); //Form Submit.... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $user_id, $company_name, $comp_website, $designation, $from_date, $to_date, $reason_for_leaving, $reference_name, $reference_contact, $reference_email, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('from_date', 'to_date')); }
public function __construct() { // Validators -------------------------- $notEmpty = new Zend_Validate_NotEmpty(array(true)); $notEmpty->setMessage($this->_errorMessages['isEmpy']); $digits = new Zend_Validate_Digits(); $digits->setMessage($this->_errorMessages['digits']); $emailValidator = new Zend_Validate_EmailAddress(); $emailValidator->setMessage($this->_errorMessages['emailValidator']); $foneValidator = new Zend_Validate_StringLength(); $foneValidator->setMin(8); $foneValidator->setMessage($this->_errorMessages['foneValidator']); $dddValidator = new Zend_Validate_StringLength(); $dddValidator->setMin(2); $dddValidator->setMessage($this->_errorMessages['foneValidator']); //-------------------------------------- $nome = new Zend_Form_Element_Text('nome'); $nome->setAttrib('class', 'form-control'); $nome->setAttrib('required', true); $nome->setAttrib('accesskey', 'n'); $nome->setRequired(true); $nome->addValidator($notEmpty, true); //-------------------------------------------------------- $fone = new Zend_Form_Element_Text('fone'); $fone->setAttrib('class', 'form-control fone-input'); $fone->setAttrib('required', true); $fone->setAttrib('accesskey', 'f'); $fone->setRequired(true); $fone->addValidator($notEmpty, true); $fone->addValidator($digits, true); $fone->addValidator($foneValidator, true); //-------------------------------------------------------- $cidade = new Zend_Form_Element_Text('cidade'); $cidade->setAttrib('class', 'form-control'); $cidade->setAttrib('required', false); $cidade->setAttrib('accesskey', 'c'); $cidade->setRequired(false); //-------------------------------------------------------- $ddd = new Zend_Form_Element_Text('ddd'); $ddd->setAttrib('class', 'form-control'); $ddd->setAttrib('required', true); $ddd->setAttrib('accesskey', 'd'); $ddd->setRequired(true); $ddd->addValidator($notEmpty, true); $ddd->addValidator($digits, true); $ddd->addValidator($dddValidator, true); //-------------------------------------------------------- $email = new Zend_Form_Element_Text('email'); $email->setAttrib('class', 'form-control'); $email->setAttrib('required', true); $email->setAttrib('accesskey', 'e'); $email->setRequired(true); $email->addValidator($notEmpty, true); $email->addValidator($emailValidator, true); //-------------------------------------------------------- $mensagem = new Zend_Form_Element_Textarea('mensagem'); $mensagem->setAttrib('class', 'form-control'); $mensagem->setAttrib('required', true); $mensagem->setAttrib('accesskey', 'm'); $mensagem->setAttrib('cols', 1); $mensagem->setAttrib('rows', 1); $mensagem->setRequired(true); $mensagem->addValidator($notEmpty, true); //-------------------------------------------------------- $imovel = new Zend_Form_Element_Text('imovel'); $imovel->setAttrib('class', 'form-control'); $imovel->setAttrib('accesskey', 'i'); $imovel->setAttrib('cols', 1); $imovel->setAttrib('rows', 1); $imovel->setRequired(false); //-------------------------------------------------- $this->addElement($nome); $this->addElement($fone); $this->addElement($ddd); $this->addElement($email); $this->addElement($cidade); $this->addElement($mensagem); $this->addElement($imovel); $this->setElementDecorators(array('ViewHelper', 'Errors')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'frm_candidate'); $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'); // To give option to user to select either file upload OR fill up form. $selected_option = Zend_Controller_Front::getInstance()->getRequest()->getParam('selected_option', null); // Below condition is used to skip form validation if the user opt for 'file upload'. if ($id_val == '') { $requisition_id->setRequired(true); $requisition_id->addValidator('NotEmpty', false, array('messages' => 'Please select requisition id.')); } /*$candidate_name = new Zend_Form_Element_Text('candidate_name'); $candidate_name->setAttrib('maxLength', 90); $candidate_name->setAttrib('title', 'Candidate Name'); $candidate_name->addFilter(new Zend_Filter_StringTrim()); $candidate_name->setRequired(true); $candidate_name->addValidator('NotEmpty', false, array('messages' => 'Please enter candidate name.')); $candidate_name->addValidator("regex",true,array( 'pattern'=>'/^[a-zA-Z.\- ?]+$/', 'messages'=>array( 'regexNotMatch'=>'Please enter valid candidate name.' ) ));*/ $candidate_firstname = new Zend_Form_Element_Text('candidate_firstname'); $candidate_firstname->setAttrib('maxLength', 50); $candidate_firstname->setAttrib('title', 'Candidate First Name'); $candidate_firstname->addFilter(new Zend_Filter_StringTrim()); $candidate_firstname->setRequired(true); $candidate_firstname->addValidator('NotEmpty', false, array('messages' => 'Please enter candidate first name.')); $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->setAttrib('maxLength', 50); $candidate_lastname->setAttrib('title', 'Candidate Last Name'); $candidate_lastname->addFilter(new Zend_Filter_StringTrim()); $candidate_lastname->setRequired(true); $candidate_lastname->addValidator('NotEmpty', false, array('messages' => 'Please enter candidate last name.')); $candidate_lastname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid candidate last name.'))); $emailid = new Zend_Form_Element_Text('emailid'); if ($selected_option == 'fill-up-form') { $emailid->setRequired(true); } $emailid->setAttrib('maxLength', 70); $emailid->setAttrib('title', 'Email'); $emailid->addFilter(new Zend_Filter_StringTrim()); $emailid->addValidator('NotEmpty', false, array('messages' => 'Please enter email.')); $emailid->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid email.'))); $emailid->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_candidatedetails', 'field' => 'emailid', 'exclude' => 'id != "' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive != 0'))); $emailid->getValidator('Db_NoRecordExists')->setMessage('Email already exists.'); $contact_number = new Zend_Form_Element_Text('contact_number'); if ($selected_option == 'fill-up-form') { $contact_number->setRequired(true); } $contact_number->setAttrib('maxLength', 10); $contact_number->setAttrib('title', 'Contact Number.'); $contact_number->addFilter(new Zend_Filter_StringTrim()); $contact_number->addValidator('NotEmpty', false, array('messages' => 'Please enter contact number.')); $contact_number->addValidator("regex", true, array('pattern' => '/^(?!0{10})([0-9\\+\\-\\)\\(]{10})+$/', 'messages' => array('regexNotMatch' => 'Please enter valid contact number.'))); $contact_number->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_candidatedetails', 'field' => 'contact_number', 'exclude' => 'id != "' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive != 0'))); $contact_number->getValidator('Db_NoRecordExists')->setMessage('Contact number already exists.'); $qualification = new Zend_Form_Element_Text('qualification'); $qualification->setAttrib('maxLength', 90); $qualification->setAttrib('title', 'Qualification.'); $qualification->addFilter(new Zend_Filter_StringTrim()); if ($selected_option == 'fill-up-form') { $qualification->setRequired(true); } $qualification->addValidator('NotEmpty', false, array('messages' => 'Please enter qualification.')); $qualification->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid qualification.'))); $experience = new Zend_Form_Element_Text('experience'); $experience->setAttrib('maxLength', 5); $experience->setAttrib('title', 'Work Experience.'); $experience->addFilter(new Zend_Filter_StringTrim()); if ($selected_option == 'fill-up-form') { $experience->setRequired(true); } $experience->addValidator('NotEmpty', false, array('messages' => 'Please enter work experience.')); $experience->addValidator("regex", true, array('pattern' => '/^([0-9]*\\.?[0-9]{1,2})$/', 'messages' => array('regexNotMatch' => 'Please enter valid experience.'))); $skillset = new Zend_Form_Element_Textarea('skillset'); $skillset->setAttrib('rows', 10); $skillset->setAttrib('cols', 50); $skillset->setAttrib('title', 'Skill Set'); if ($selected_option == 'fill-up-form') { $skillset->setRequired(true); } $skillset->addValidator('NotEmpty', false, array('messages' => 'Please enter skill set.')); $education_summary = new Zend_Form_Element_Textarea('education_summary'); $education_summary->setAttrib('rows', 10); $education_summary->setAttrib('cols', 50); $education_summary->setAttrib('title', 'Education Summary.'); $summary = new Zend_Form_Element_Textarea('summary'); $summary->setAttrib('rows', 10); $summary->setAttrib('cols', 50); $summary->setAttrib('title', 'Summary.'); $cand_location = new Zend_Form_Element_Textarea('cand_location'); $cand_location->setAttrib('rows', 10); $cand_location->setAttrib('cols', 50); $cand_location->setAttrib('maxlength', 150); $cand_location->setAttrib('title', 'Location.'); if ($selected_option == 'fill-up-form') { $cand_location->setRequired(true); } $cand_location->addValidator('NotEmpty', false, array('messages' => 'Please enter location.')); $country = new Zend_Form_Element_Select("country"); $country->setRegisterInArrayValidator(false); $country->setLabel("Country"); $country->setAttrib("class", "formDataElement"); $country->setAttrib('onchange', 'displayParticularState_normal(this,"","state","city")'); $country->setAttrib('title', 'Country'); if ($selected_option == 'fill-up-form') { $country->setRequired(true); } $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $state = new Zend_Form_Element_Select("state"); $state->setRegisterInArrayValidator(false); if ($selected_option == 'fill-up-form') { $state->setRequired(true); } $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $state->addMultiOptions(array('' => 'Select State')); $state->setLabel("State"); $state->setAttrib("class", "formDataElement"); $state->setAttrib('onchange', 'displayParticularCity_normal(this,"","city","")'); $state->setAttrib('title', 'State'); $city = new Zend_Form_Element_Select("city"); $city->setRegisterInArrayValidator(false); $city->addMultiOptions(array('' => 'Select City')); $city->setLabel("City"); $city->setAttrib("class", "formDataElement"); $city->setAttrib('title', 'City'); if ($selected_option == 'fill-up-form') { $city->setRequired(true); } $city->addValidator('NotEmpty', false, array('messages' => 'Please select city.')); $pincode = new Zend_Form_Element_Text('pincode'); $pincode->setAttrib('maxLength', 10); $pincode->setAttrib('title', 'Postal Code.'); $pincode->addFilter(new Zend_Filter_StringTrim()); if ($selected_option == 'fill-up-form') { $pincode->setRequired(true); } $pincode->addValidator('NotEmpty', false, array('messages' => 'Please enter postal code.')); $pincode->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Postal code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Postal code must contain at least %min% characters.'))))); $pincode->addValidator("regex", true, array('pattern' => '/^(?!0{3})[0-9a-zA-Z]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid postal code.'))); $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', 'submitbutton'); $submit->setAttrib('class', 'cvsbmtbtn'); $submit->setLabel('Save'); //start of candidate work details. for ($i = 0; $i < 3; $i++) { $company_name[$i] = new Zend_Form_Element_Text('txt_cname[' . $i . ']'); $company_name[$i]->setAttrib('id', 'idtxt_cname' . $i); $company_name[$i]->setAttrib('maxlength', 70); $company_name[$i]->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\-& ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid company name.'))); $this->addElement($company_name[$i]); $cdesignation[$i] = new Zend_Form_Element_Text('txt_desig[' . $i . ']'); $cdesignation[$i]->setAttrib('id', 'idtxt_desig' . $i); $cdesignation[$i]->setAttrib('maxlength', 40); $cdesignation[$i]->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\-& ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid designation.'))); $this->addElement($cdesignation[$i]); $from_date[$i] = new Zend_Form_Element_Text('txt_from[' . $i . ']'); $from_date[$i]->setAttrib('id', 'idtxt_from' . $i); $from_date[$i]->setAttrib('readonly', 'readonly'); $this->addElement($from_date[$i]); $to_date[$i] = new Zend_Form_Element_Text('txt_to[' . $i . ']'); $to_date[$i]->setAttrib('id', 'idtxt_to' . $i); $to_date[$i]->setAttrib('readonly', 'readonly'); $this->addElement($to_date[$i]); $cnumber[$i] = new Zend_Form_Element_Text('txt_cnumber[' . $i . ']'); $cnumber[$i]->setAttrib('id', 'idtxt_cnumber' . $i); $cnumber[$i]->setAttrib('maxlength', 10); $cnumber[$i]->addValidator("regex", true, array('pattern' => '/^(?!0{10})([0-9\\+\\-\\)\\(]{10})+$/', 'messages' => array('regexNotMatch' => 'Please enter valid contact number.'))); $this->addElement($cnumber[$i]); $website[$i] = new Zend_Form_Element_Text('txt_website[' . $i . ']'); $website[$i]->setAttrib('id', 'idtxt_website' . $i); $website[$i]->setAttrib('maxlength', 70); $website[$i]->addValidator("regex", true, array('pattern' => '/^(http:\\/\\/www|https:\\/\\/www|www)+\\.([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]{2,3})$/', 'messages' => array('regexNotMatch' => 'Please enter valid URL.'))); $this->addElement($website[$i]); $comp_address[$i] = new Zend_Form_Element_Textarea('txt_address[' . $i . ']'); $comp_address[$i]->setAttrib('id', 'idtxt_address' . $i); $this->addElement($comp_address[$i]); } //end of candidate work details. $job_title = new Zend_Form_Element_Text('job_title'); $job_title->setAttrib('readonly', 'readonly'); $this->addElements(array($job_title, $cand_status, $id, $requisition_id, $candidate_firstname, $candidate_lastname, $emailid, $contact_number, $qualification, $experience, $skillset, $education_summary, $summary, $cand_location, $country, $state, $city, $pincode, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'businessunits/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'businessunits'); $id = new Zend_Form_Element_Hidden('id'); $unitname = new Zend_Form_Element_Text('unitname'); $unitname->setAttrib('maxLength', 50); $unitname->addFilter(new Zend_Filter_StringTrim()); $unitname->setRequired(true); $unitname->addValidator('NotEmpty', false, array('messages' => 'Please enter name.')); $unitname->addValidator("regex", true, array('pattern' => '/^(?![0-9]{4})[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))); $unitname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_businessunits', 'field' => 'unitname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $unitname->getValidator('Db_NoRecordExists')->setMessage('Name already exists.'); $unitcode = new Zend_Form_Element_Text('unitcode'); $unitcode->addFilter(new Zend_Filter_StringTrim()); $unitcode->setRequired(true); $unitcode->setAttrib("maxlength", 4); $unitcode->addValidator('NotEmpty', false, array('messages' => 'Please enter code.')); $unitcode->addValidators(array(array('StringLength', false, array('min' => 2, 'max' => 4, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Code must contain at least %min% characters.'))))); $unitcode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\&\'\\.\\s]+$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid code.'))))); $unitcode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_businessunits', 'field' => 'unitcode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $unitcode->getValidator('Db_NoRecordExists')->setMessage('Code already exists.'); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date'); $start_date->setAttrib('readonly', 'true'); $start_date->setAttrib('onfocus', 'this.blur()'); $start_date->setOptions(array('class' => 'brdr_none')); $country = new Zend_Form_Element_Select('country'); $country->setLabel('country'); $country->setRequired(true); $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $country->setAttrib('onchange', 'displayParticularState_normal(this,"state","state","city")'); $countryModal = new Default_Model_Countries(); $countriesData = $countryModal->fetchAll('isactive=1', 'country'); $country->addMultiOption('', 'Select country'); foreach ($countriesData->toArray() as $data) { $country->addMultiOption($data['country_id_org'], $data['country']); } $country->setRegisterInArrayValidator(false); $state = new Zend_Form_Element_Select('state'); $state->setAttrib('onchange', 'displayParticularCity_normal(this,"city","city","")'); $state->setRegisterInArrayValidator(false); $state->addMultiOption('', 'Select State'); $state->setRequired(true); $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $city = new Zend_Form_Element_Select('city'); $city->setAttrib('class', 'selectoption'); $city->setAttrib('onchange', 'displayCityCode(this)'); $city->setRegisterInArrayValidator(false); $city->addMultiOption('', 'Select City'); $city->setRequired(true); $city->addValidator('NotEmpty', false, array('messages' => 'Please select city.')); $address1 = new Zend_Form_Element_Textarea('address1'); $address1->setAttrib('rows', 10); $address1->setAttrib('cols', 50); $address1->setRequired(true); $address1->addValidator('NotEmpty', false, array('messages' => 'Please enter street address.')); $address2 = new Zend_Form_Element_Textarea('address2'); $address2->setAttrib('rows', 10); $address2->setAttrib('cols', 50); $address3 = new Zend_Form_Element_Textarea('address3'); $address3->setAttrib('rows', 10); $address3->setAttrib('cols', 50); $timezone = new Zend_Form_Element_Select('timezone'); $timezone->setLabel('timezone'); $timezone->setRequired(true); $timezone->addValidator('NotEmpty', false, array('messages' => 'Please select time zone.')); $timezoneModel = new Default_Model_Timezone(); $timezonedata = $timezoneModel->fetchAll('isactive=1', 'timezone'); $timezone->addMultiOption('', 'Select Time zone'); foreach ($timezonedata->toArray() as $data) { $timezone->addMultiOption($data['id'], $data['timezone'] . ' [' . $data['timezone_abbr'] . ']'); } $timezone->setRegisterInArrayValidator(false); $unithead = new Zend_Form_Element_Text('unithead'); $unithead->setLabel('timezone'); $unithead->setAttrib('maxlength', '50'); $unithead->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $unitname, $unitcode, $description, $start_date, $country, $state, $city, $address1, $address2, $address3, $timezone, $unithead, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('start_date')); }
public function init() { $this->setMethod("post"); // produto_nome $produto_nome = new Zend_Form_Element_Text("produto_nome"); $produto_nome->setLabel("Nome"); $produto_nome->setRequired(); $produto_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do produto')); $produto_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // produto_id $produto_id = new Zend_Form_Element_Hidden("produto_id"); // fabricante_nome $fabricante_nome = new Zend_Form_Element_Text("fabricante_nome"); $fabricante_nome->setLabel("Fabricante"); //$fabricante_nome->setRequired(); $fabricante_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do fabricante')); $fabricante_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // fabricante_id $fabricante_id = new Zend_Form_Element_Hidden("fabricante_id"); // marca_nome $marca_nome = new Zend_Form_Element_Text("marca_nome"); $marca_nome->setLabel("Marca"); $marca_nome->setRequired(); $marca_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome da marca')); $marca_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // marca_id $marca_id = new Zend_Form_Element_Hidden("marca_id"); // reclamacao_nome $reclamacao_nome = new Zend_Form_Element_Text("reclamacao_nome"); $reclamacao_nome->setLabel("Nome"); $reclamacao_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu nome')); // reclamacap_email $reclamacao_email = new Zend_Form_Element_Text("reclamacao_email"); $reclamacao_email->setLabel("E-mail"); $reclamacao_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu e-mail')); // reclamacao_empresa $reclamacao_empresa = new Zend_Form_Element_Text("reclamacao_empresa"); $reclamacao_empresa->setLabel("Empresa onde comprou o produto"); $reclamacao_empresa->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu e-mail')); // reclamacao_cidade $reclamacao_cidade = new Zend_Form_Element_Text("reclamacao_cidade"); $reclamacao_cidade->setLabel("Cidade"); $reclamacao_cidade->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe sua cidade')); // reclamacao_estado $reclamacao_estado = new Zend_Form_Element_Select("reclamacao_estado"); $reclamacao_estado->setLabel("Estado"); $reclamacao_estado->setAttribs(array('class' => 'form-control')); $reclamacao_estado->setMultiOptions($this->getEstados()); // reclamacao_descricao $reclamacao_descricao = new Zend_Form_Element_Textarea("reclamacao_descricao"); $reclamacao_descricao->setLabel("Descreva sua reclamação"); $reclamacao_descricao->setRequired(); $reclamacao_descricao->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $reclamacao_descricao->setAttribs(array('class' => 'form-control', 'rows' => 5, 'placeholder' => 'Informe porque você está insatisfeito com o produto', 'maxlenght' => 500)); $reclamacao_descricao->addValidator(new App_Validate_Reclamacao()); // reclamacao_nota $reclamacao_nota = new Zend_Form_Element_Radio("reclamacao_nota"); $reclamacao_nota->setLabel("Dê sua nota para o produto"); $reclamacao_nota->setRequired(); $reclamacao_nota->setAttribs(array('class' => '')); $reclamacao_nota->setMultiOptions($this->getNotasHtml()); $reclamacao_nota->setOptions(array('escape' => false)); $reclamacao_nota->setSeparator(" "); $reclamacao_nota->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); // submit $submit = new Zend_Form_Element_Submit("submit"); $submit->setLabel("Registrar Reclamação"); $submit->setAttrib("class", 'form-control btn btn-success'); $this->addElements(array($produto_nome, $fabricante_nome, $marca_nome, $reclamacao_descricao, $reclamacao_nome, $reclamacao_email, $reclamacao_cidade, $reclamacao_estado, $reclamacao_nota, $submit, $produto_id, $marca_id, $fabricante_id)); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'leaverequest'); $id = new Zend_Form_Element_Hidden('id'); $availableleaves = new Zend_Form_Element_Text('no_of_days'); $availableleaves->setAttrib('readonly', 'true'); $availableleaves->setAttrib('onfocus', 'this.blur()'); $appliedleavesdaycount = new Zend_Form_Element_Text('appliedleavesdaycount'); $appliedleavesdaycount->setAttrib('readonly', 'true'); $appliedleavesdaycount->setAttrib('onfocus', 'this.blur()'); $repmanagerid = new Zend_Form_Element_Text('rep_mang_id'); $repmanagerid->setAttrib('readonly', 'true'); $repmanagerid->setAttrib('onfocus', 'this.blur()'); $issatholiday = new Zend_Form_Element_Hidden('is_sat_holiday'); $leavetypeid = new Zend_Form_Element_Select('leavetypeid'); $leavetypeid->setAttrib('class', 'selectoption'); $leavetypeid->addMultiOption('', 'Select Leave Type'); $leavetypeid->setRegisterInArrayValidator(false); $leavetypeid->setRequired(true); $leavetypeid->addValidator('NotEmpty', false, array('messages' => 'Please select leave type.')); $leaveday = new Zend_Form_Element_Select('leaveday'); $leaveday->setRegisterInArrayValidator(false); $leaveday->setAttrib('onchange', 'hidetodatecalender(this)'); $leaveday->setMultiOptions(array('1' => 'Full Day', '2' => 'Half Day')); $leaveday->setRequired(true); $leaveday->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date'); $from_date->setAttrib('readonly', 'true'); $from_date->setAttrib('onfocus', 'this.blur()'); $from_date->setOptions(array('class' => 'brdr_none')); $from_date->setRequired(true); $from_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $to_date = new ZendX_JQuery_Form_Element_DatePicker('to_date'); $to_date->setAttrib('readonly', 'true'); $to_date->setAttrib('onfocus', 'this.blur()'); $to_date->setAttrib('onblur', 'validate_todate()'); $to_date->setOptions(array('class' => 'brdr_none')); $reason = new Zend_Form_Element_Textarea('reason'); $reason->setAttrib('rows', 10); $reason->setAttrib('cols', 50); $reason->setAttrib('maxlength', '400'); $reason->setRequired(true); $reason->addValidator('NotEmpty', false, array('messages' => 'Please enter reason.')); $leavestatus = new Zend_Form_Element_Text('leavestatus'); $leavestatus->setAttrib('readonly', 'true'); $leavestatus->setAttrib('onfocus', 'this.blur()'); $createddate = new Zend_Form_Element_Text('createddate'); $createddate->setAttrib('readonly', 'true'); $createddate->setAttrib('onfocus', 'this.blur()'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Apply'); $url = "'leaverequest/saveleaverequestdetails/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "''"; $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});")); $this->addElements(array($id, $reason, $availableleaves, $repmanagerid, $leaveday, $from_date, $to_date, $leavetypeid, $issatholiday, $appliedleavesdaycount, $leavestatus, $createddate, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('from_date', 'to_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'requisition'); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $id = new Zend_Form_Element_Hidden('id'); $requisition_code = new Zend_Form_Element_Text('requisition_code'); $requisition_code->setAttrib('title', 'Requisition Code.'); $requisition_code->setAttrib('readonly', 'readonly'); $requisition_code->setAttrib('onfocus', 'this.blur()'); $requisition_code->setRequired(true); $requisition_code->addValidator('NotEmpty', false, array('messages' => 'Identity codes are not configured yet.')); $onboard_date = new Zend_Form_Element_Text('onboard_date'); $onboard_date->setAttrib('title', 'Due Date.'); $onboard_date->setAttrib('maxLength', 10); $onboard_date->setAttrib('readonly', 'readonly'); $onboard_date->setAttrib('onfocus', 'this.blur()'); $business_unit = new Zend_Form_Element_Select("business_unit"); $business_unit->setAttrib("class", "formDataElement"); $business_unit->setAttrib("onchange", "getdepts_req(this,'department','position_id');"); $business_unit->setAttrib('title', 'Business Unit.'); $department = new Zend_Form_Element_Select("department"); $department->setAttrib("class", "formDataElement"); $department->setAttrib('title', 'Department.'); $department->addMultiOptions(array('' => 'Select Department')); $department->setAttrib('onchange', 'displayEmpReportingmanagers(this,"reporting_id","req")'); $jobtitle = new Zend_Form_Element_Select("jobtitle"); $jobtitle->setAttrib("class", "formDataElement"); $jobtitle->setAttrib("onchange", "getpositions_req('department','business_unit','position_id','jobtitle');"); $jobtitle->setAttrib('title', 'Job Title.'); $reporting_id = new Zend_Form_Element_Select("reporting_id"); $reporting_id->setAttrib('title', 'Reporting Manager.'); $reporting_id->setRegisterInArrayValidator(false); $reporting_id->addMultiOptions(array('' => 'Select Reporting Manager')); $position_id = new Zend_Form_Element_Select("position_id"); $position_id->setAttrib("class", "formDataElement"); $position_id->setAttrib('title', 'Position.'); $position_id->addMultiOptions(array('' => 'Select Position')); $req_no_positions = new Zend_Form_Element_Text('req_no_positions'); $req_no_positions->setAttrib('maxLength', 4); $req_no_positions->setAttrib('title', 'Required no.of positions.'); $req_no_positions->addFilter(new Zend_Filter_StringTrim()); $jobdescription = new Zend_Form_Element_Textarea('jobdescription'); $jobdescription->setAttrib('rows', 10); $jobdescription->setAttrib('cols', 50); $jobdescription->setAttrib('title', 'Job description.'); $req_skills = new Zend_Form_Element_Textarea('req_skills'); $req_skills->setAttrib('rows', 10); $req_skills->setAttrib('cols', 50); $req_skills->setAttrib('maxlength', 400); $req_skills->setAttrib('title', 'Required Skills.'); $req_qualification = new Zend_Form_Element_Text('req_qualification'); $req_qualification->setAttrib('maxLength', 100); $req_qualification->setAttrib('title', 'Required Qualification.'); $req_qualification->addFilter(new Zend_Filter_StringTrim()); $req_exp_years = new Zend_Form_Element_Text('req_exp_years'); $req_exp_years->setAttrib('maxLength', 5); $req_exp_years->setAttrib('title', 'Required Experience.'); $req_exp_years->addFilter(new Zend_Filter_StringTrim()); $emp_type = new Zend_Form_Element_Select("emp_type"); $emp_type->setAttrib("class", "formDataElement"); $emp_type->setAttrib('title', 'Employment Status.'); $req_priority = new Zend_Form_Element_Select("req_priority"); $req_priority->setAttrib('title', 'Priority.'); $req_priority->addMultiOptions(array('' => 'Select Priority', 1 => 'High', 3 => 'Low', 2 => 'Medium')); $req_priority->setAttrib("class", "formDataElement"); $additional_info = new Zend_Form_Element_Textarea('additional_info'); $additional_info->setAttrib('rows', 10); $additional_info->setAttrib('cols', 50); $additional_info->setAttrib('maxlength', 400); $additional_info->setAttrib('title', 'Additional Information.'); $req_status = new Zend_Form_Element_Select('req_status'); $req_status->setLabel('Requisition Status'); if ($loginuserGroup == HR_GROUP || $loginuserGroup == '' || $loginuserGroup == MANAGEMENT_GROUP) { $reporting_id->setAttrib("class", "formDataElement"); $reporting_id->setRequired(true); $reporting_id->addValidator('NotEmpty', false, array('messages' => 'Please select reporting manager.')); } $onboard_date->setRequired(true); $onboard_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.')); $department->setRegisterInArrayValidator(false); $department->setRequired(true); $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.')); $jobtitle->setRegisterInArrayValidator(false); $jobtitle->setRequired(true); $jobtitle->addValidator('NotEmpty', false, array('messages' => 'Please select job title.')); $position_id->setRegisterInArrayValidator(false); $position_id->setRequired(true); $position_id->addValidator('NotEmpty', false, array('messages' => 'Please select position.')); $req_no_positions->setRequired(true); $req_no_positions->addValidator('NotEmpty', false, array('messages' => 'Please enter required no.of positions.')); $req_no_positions->addValidator("regex", true, array('pattern' => '/^([0-9]+?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))); $req_no_positions->addValidator("greaterThan", true, array('min' => 0, 'messages' => array('notGreaterThan' => 'No.of positions cannot be zero.'))); $req_skills->setRequired(true); $req_skills->addValidator('NotEmpty', false, array('messages' => 'Please enter required skills.')); $req_qualification->setRequired(true); $req_qualification->addValidator('NotEmpty', false, array('messages' => 'Please enter required qualification.')); $req_qualification->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z\\/\\-\\. ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid qualification.'))); $req_exp_years->setRequired(true); $req_exp_years->addValidator('NotEmpty', false, array('messages' => 'Please enter required experience range.')); $req_exp_years->addValidator("regex", true, array('pattern' => '/^([0-9]{1,2}\\-[0-9]{1,2})+$/', 'messages' => array('regexNotMatch' => 'Please enter valid experience range.'))); $emp_type->setRegisterInArrayValidator(false); $emp_type->setRequired(true); $emp_type->addValidator('NotEmpty', false, array('messages' => 'Please select employment status.')); $req_priority->setRequired(true); $req_priority->addValidator('NotEmpty', false, array('messages' => 'Please select priority.')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $email_cnt = new Zend_Form_Element_Hidden('email_cnt'); $idval = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null); $bunit_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('business_unit', null); $approver1 = new Zend_Form_Element_Select("approver1"); $approver1->setRegisterInArrayValidator(false); $approver1->addMultiOptions(array('' => 'Select Approver -1')); $approver1->setRequired(true); $approver1->addValidator('NotEmpty', false, array('messages' => 'Please select approver-1.')); $approver2 = new Zend_Form_Element_Select("approver2"); $approver2->setRegisterInArrayValidator(false); $approver2->addMultiOptions(array('' => 'Select Approver -2')); $approver3 = new Zend_Form_Element_Select("approver3"); $approver3->setRegisterInArrayValidator(false); $approver3->addMultiOptions(array('' => 'Select Approver -3')); $this->addElements(array($id, $submit, $requisition_code, $onboard_date, $business_unit, $department, $jobtitle, $reporting_id, $position_id, $req_no_positions, $jobdescription, $req_skills, $req_qualification, $req_exp_years, $emp_type, $req_priority, $additional_info, $req_status, $email_cnt, $approver1, $approver2, $approver3)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $oOrderId = new Zend_Form_Element_Text("id"); $oOrderId->setLabel("Numer zamówienia:"); $oOrderId->addValidator(new Zend_Validate_Digits()); $oOrderId->setRequired(TRUE); $oFirstName = new Zend_Form_Element_Text("user_first_name"); $oFirstName->setLabel("Imię:"); $oFirstName->addValidator(new Zend_Validate_Alpha(array("allowWhiteSpace" => true))); $oFirstName->setRequired(TRUE); $oFirstName->setAttrib("class", "valid"); $oLastName = new Zend_Form_Element_Text("user_last_name"); $oLastName->setLabel("Nazwisko:"); $oLastName->addValidator(new Zend_Validate_Alpha(array("allowWhiteSpace" => true))); $oLastName->setRequired(TRUE); $oLastName->setAttrib("class", "valid"); $oAddressEmail = new Zend_Form_Element_Text("user_email_address"); $oAddressEmail->setLabel("Adres e-mail:"); $oAddressEmail->addValidator(new Zend_Validate_EmailAddress()); $oAddressEmail->setRequired(TRUE); $oAddressEmail->setAttrib("class", "valid"); $oPhone = new Zend_Form_Element_Text("phone"); $oPhone->setLabel("Telefon:"); $oPhone->setRequired(TRUE); $oPhone->setAttrib("class", "valid"); $oOrderStatusId = new Zend_Form_Element_Text("order_status_id"); $oOrderStatusId->setLabel("Status zamówienia (ID):"); $oOrderStatusId->addValidator(new Zend_Validate_Digits()); $oOrderStatusId->setRequired(TRUE); $oOrderStatusId->setAttrib("class", "valid"); $oOrderStatusUserName = new Zend_Form_Element_Text("order_status_user_name"); $oOrderStatusUserName->setLabel("Status zamówienia:"); $oOrderStatusUserName->addValidator(new Zend_Validate_StringLength(array("max" => 20))); $oOrderStatusUserName->setRequired(TRUE); $oOrderFileId = new Zend_Form_Element_Select("order_file_id"); $oOrderFileId->setLabel("Nazwa pliku:"); $oOrderFileId->addMultiOptions($this->_aAllOrderFile); $oValidateGreaterThan = new Zend_Validate_GreaterThan(0); $oValidateGreaterThan->setMessage("Nie wybrano pliku", Zend_Validate_GreaterThan::NOT_GREATER); $oOrderFileId->addValidator($oValidateGreaterThan); $oOrderFileId->setRequired(TRUE); $oOrderFileId->setAttrib("class", "valid"); $oOrderFileUserName = new Zend_Form_Element_Text("order_file_user_name"); $oOrderFileUserName->setLabel("Nazwa pliku:"); $oOrderFileUserName->addValidator(new Zend_Validate_StringLength(array("max" => 100))); $oOrderFileUserName->setRequired(TRUE); $oAmount = new Zend_Form_Element_Text("amount"); $oAmount->setLabel("Cena:"); $oAmount->addValidator(new Zend_Validate_Float(array("locale" => "en_US"))); $oAmount->setRequired(TRUE); $oAmount->setAttrib("class", "valid"); $oLocation = new Zend_Form_Element_Text("location"); $oLocation->setLabel("Lokalizacja:"); $oLocation->addValidator(new Zend_Validate_StringLength(array("max" => 20))); $oLocation->setRequired(TRUE); $oCallId = new Zend_Form_Element_Text("call_id"); $oCallId->setLabel("Sygnatura:"); $oCallId->addValidator(new Zend_Validate_StringLength(array("max" => 45))); $oCallId->setRequired(TRUE); $oCsaCallId = new Zend_Form_Element_Text("csa_call_id"); $oCsaCallId->setLabel("Sygnatura lokalna:"); $oCsaCallId->addValidator(new Zend_Validate_StringLength(array("max" => 20))); $oCsaCallId->setRequired(TRUE); $oCollection = new Zend_Form_Element_Textarea("collection"); $oCollection->setLabel("Kolekcja:"); $oCollection->addValidator(new Zend_Validate_StringLength(array("max" => 20))); $oCollection->setRequired(TRUE); $oJournalTitle = new Zend_Form_Element_Textarea("journal_title"); $oJournalTitle->setLabel("Tytuł książki / czasopisma:"); $oJournalTitle->addValidator(new Zend_Validate_StringLength(array("max" => 255))); $oJournalTitle->setRequired(FALSE); $oJournalYearPublication = new Zend_Form_Element_Text("journal_year_publication"); $oJournalYearPublication->setLabel("Rocznik:"); $oJournalYearPublication->addValidator(new Zend_Validate_Date("YYYY")); $oJournalYearPublication->setRequired(FALSE); $oJournalYearPublication->setAttrib("class", "valid"); $oJournalNumber = new Zend_Form_Element_Text("journal_number"); $oJournalNumber->setLabel("Numeracja (tom, vol., nr):"); $oJournalNumber->setRequired(FALSE); $oJournalNumber->setAttrib("class", "valid"); $oArticleAuthor = new Zend_Form_Element_Text("article_author"); $oArticleAuthor->setLabel("Autor artykułu:"); $oArticleAuthor->setRequired(TRUE); $oArticleAuthor->setAttrib("class", "valid"); $oArticleTitle = new Zend_Form_Element_Textarea("article_title"); $oArticleTitle->setLabel("Tytuł artykułu:"); $oArticleTitle->setRequired(TRUE); $oArticleTitle->setAttrib("class", "valid"); $oPageFrom = new Zend_Form_Element_Text("page_from"); $oPageFrom->setLabel("Strony od:"); $oPageFrom->addValidator(new Zend_Validate_Digits()); $oPageFrom->setRequired(TRUE); $oPageFrom->setAttrib("class", "valid"); $oPageUntil = new Zend_Form_Element_Text("page_until"); $oPageUntil->setLabel("Strony do:"); $oPageUntil->addValidator(new Zend_Validate_Digits()); $oPageUntil->addValidator(new AppCms2_Validate_PageGreaterThan()); $oPageUntil->setRequired(TRUE); $oPageUntil->setAttrib("class", "valid"); $oComment = new Zend_Form_Element_Textarea("comment"); $oComment->setLabel("Uwagi do zamówienia:"); //$oComment->addValidator(new AppCms2_Validate_SpecialAlpha()); $oComment->setRequired(TRUE); $oComment->setAttrib("class", "valid"); $oFooterPdf = new Zend_Form_Element_Textarea("footer_pdf"); $oFooterPdf->setLabel("Stopka PDF:"); $oFooterPdf->setRequired(FALSE); $oUserCreatedDate = new Zend_Form_Element_Text("user_created_date"); $oUserCreatedDate->setLabel("Data utworzenia:"); $oUserCreatedDate->addValidator(new Zend_Validate_Date("Y-m-d")); $oUserCreatedDate->setRequired(TRUE); $oUserModifiedDate = new Zend_Form_Element_Text("user_modified_date"); $oUserModifiedDate->setLabel("Data modyfikacji:"); $oUserModifiedDate->addValidator(new Zend_Validate_Date("Y-m-d")); $oUserModifiedDate->setRequired(TRUE); $oUserExecutionDate = new Zend_Form_Element_Text("user_execution_date"); $oUserExecutionDate->setLabel("Data umieszczenia pliku na serwerze:"); $oUserExecutionDate->addValidator(new Zend_Validate_Date("Y-m-d")); $oUserExecutionDate->setRequired(TRUE); $oUserExpirationDate = new Zend_Form_Element_Text("user_expiration_date"); $oUserExpirationDate->setLabel("Data wygaśnięcia zamówienia:"); $oUserExpirationDate->addValidator(new Zend_Validate_Date("Y-m-d")); $oUserExpirationDate->setRequired(TRUE); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 1440)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmitSaveAndMakeAction = new Zend_Form_Element_Button("order_submit_save_and_make_action"); $oSubmitSaveAndMakeAction->setLabel(""); $oSubmitSaveAndPrint = new Zend_Form_Element_Button("order_submit_save_and_print"); $oSubmitSaveAndPrint->setLabel(""); $oSubmitCancel = new Zend_Form_Element_Button("order_submit_cancel"); $oSubmitCancel->setLabel(""); $oSubmitAddFile = new Zend_Form_Element_Button("order_add_file"); $oSubmitAddFile->setLabel(""); $oSubmitOuterMagazine = new Zend_Form_Element_Button("order_submit_outer_magazine"); $oSubmitOuterMagazine->setLabel(""); $this->addElement($oFormName); $this->addElement($oOrderId); $this->addElement($oOrderStatusId); $this->addElement($oOrderStatusUserName); $this->addElement($oFirstName); $this->addElement($oLastName); $this->addElement($oAddressEmail); $this->addElement($oPhone); $this->addElement($oLocation); $this->addElement($oCallId); $this->addElement($oCsaCallId); $this->addElement($oCollection); $this->addElement($oJournalTitle); $this->addElement($oPageFrom); $this->addElement($oPageUntil); $this->addDisplayGroup(array($oJournalYearPublication, $oJournalNumber, $oArticleAuthor, $oArticleTitle), "journal_group", array("legend" => "Dotyczy tylko czasopism")); $this->addElement($oUserCreatedDate); $this->addElement($oUserModifiedDate); $this->addElement($oUserExecutionDate); $this->addElement($oUserExpirationDate); $this->addElement($oComment); $this->addElement($oFooterPdf); $this->addElement($oAmount); $this->addElement($oOrderFileId); $this->addElement($oOrderFileUserName); $this->addElement($oSubmitAddFile); $this->addElement($oSubmitSaveAndPrint); $this->addElement($oSubmitCancel); $this->addElement($oSubmitOuterMagazine); $this->addElement($oSubmitSaveAndMakeAction); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("user"); $oViewScript->setViewScript("_forms/ordersettings.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $oOrderId = new Zend_Form_Element_Text("id"); $oOrderId->setLabel("Numer zamówienia:"); $oOrderId->addValidator(new Zend_Validate_Digits()); $oOrderId->setRequired(TRUE); $oOrderStatusId = new Zend_Form_Element_Text("order_status_id"); $oOrderStatusId->setLabel("Status zamówienia (ID):"); $oOrderStatusId->addValidator(new Zend_Validate_Digits()); $oOrderStatusId->setRequired(FALSE); $oOrderStatusId->setAttrib("class", "valid"); $oOrderStatusUserName = new Zend_Form_Element_Text("order_status_user_name"); $oOrderStatusUserName->setLabel("Status zamówienia:"); $oOrderStatusUserName->addValidator(new Zend_Validate_StringLength(array("max" => 20))); $oOrderStatusUserName->setRequired(TRUE); $oOrderFileUserName = new Zend_Form_Element_Text("order_file_user_name"); $oOrderFileUserName->setLabel("Nazwa pliku:"); $oOrderFileUserName->addValidator(new Zend_Validate_StringLength(array("max" => 100))); $oOrderFileUserName->setRequired(TRUE); $oAmount = new Zend_Form_Element_Text("amount"); $oAmount->setLabel("Cena:"); $oAmount->addValidator(new Zend_Validate_Digits()); $oAmount->setRequired(TRUE); $oCallId = new Zend_Form_Element_Text("call_id"); $oCallId->setLabel("Sygnatura:"); $oCallId->addValidator(new Zend_Validate_StringLength(array("max" => 45))); $oCallId->setRequired(TRUE); $oJournalTitle = new Zend_Form_Element_Textarea("journal_title"); $oJournalTitle->setLabel("Tytuł książki / czasopisma:"); $oJournalTitle->addValidator(new Zend_Validate_StringLength(array("max" => 255))); $oJournalTitle->setRequired(TRUE); $oJournalYearPublication = new Zend_Form_Element_Text("journal_year_publication"); $oJournalYearPublication->setLabel("Rocznik:"); $oJournalYearPublication->addValidator(new Zend_Validate_Date("YYYY")); $oJournalYearPublication->setRequired(FALSE); $oJournalYearPublication->setAttrib("class", "valid"); $oJournalNumber = new Zend_Form_Element_Text("journal_number"); $oJournalNumber->setLabel("Numeracja (tom, vol., nr):"); $oJournalNumber->setRequired(FALSE); $oJournalNumber->setAttrib("class", "valid"); $oArticleAuthor = new Zend_Form_Element_Text("article_author"); $oArticleAuthor->setLabel("Autor artykułu:"); $oArticleAuthor->setRequired(FALSE); $oArticleAuthor->setAttrib("class", "valid"); $oArticleTitle = new Zend_Form_Element_Textarea("article_title"); $oArticleTitle->setLabel("Tytuł artykułu:"); $oArticleTitle->setRequired(FALSE); $oArticleTitle->setAttrib("class", "valid"); $oPageFrom = new Zend_Form_Element_Text("page_from"); $oValidateGreaterThan = new Zend_Validate_GreaterThan(0); $oValidateGreaterThan->setMessage("Wpisz 1 w przypadku problemów z określeniem numeru strony"); $oPageFrom->setLabel("Strony od:"); $oPageFrom->addValidator(new Zend_Validate_Digits()); $oPageFrom->addValidator($oValidateGreaterThan); $oPageFrom->setRequired(TRUE); $oPageFrom->setAttrib("class", "valid"); $oPageUntil = new Zend_Form_Element_Text("page_until"); $oPageUntil->setLabel("Strony do:"); $oPageUntil->addValidator(new Zend_Validate_Digits()); $oPageUntil->addValidator(new AppCms2_Validate_PageGreaterThan()); $oPageUntil->addValidator($oValidateGreaterThan); $oPageUntil->setRequired(TRUE); $oPageUntil->setAttrib("class", "valid"); $oComment = new Zend_Form_Element_Textarea("comment"); $oComment->setLabel("Uwagi do zamówienia:"); //$oComment->addValidator(new AppCms2_Validate_SpecialAlpha()); $oComment->setRequired(TRUE); $oComment->setAttrib("class", "valid"); $oUserCreatedDate = new Zend_Form_Element_Text("user_created_date"); $oUserCreatedDate->setLabel("Data utworzenia:"); $oUserCreatedDate->addValidator(new Zend_Validate_Date("Y-m-d")); $oUserCreatedDate->setRequired(TRUE); $oUserModifiedDate = new Zend_Form_Element_Text("user_modified_date"); $oUserModifiedDate->setLabel("Data modyfikacji:"); $oUserModifiedDate->addValidator(new Zend_Validate_Date("Y-m-d")); $oUserModifiedDate->setRequired(TRUE); $oUserExecutionDate = new Zend_Form_Element_Text("user_execution_date"); $oUserExecutionDate->setLabel("Data umieszczenia pliku na serwerze:"); $oUserExecutionDate->addValidator(new Zend_Validate_Date("Y-m-d")); $oUserExecutionDate->setRequired(TRUE); $oUserExpirationDate = new Zend_Form_Element_Text("user_expiration_date"); $oUserExpirationDate->setLabel("Data wygaśnięcia zamówienia:"); $oUserExpirationDate->addValidator(new Zend_Validate_Date("Y-m-d")); $oUserExpirationDate->setRequired(TRUE); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 1440)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmitSaveAndMakeAction = new Zend_Form_Element_Button("order_submit_save_and_make_action"); $oSubmitSaveAndMakeAction->setLabel(""); $oSubmitCancel = new Zend_Form_Element_Button("order_submit_cancel"); $oSubmitCancel->setLabel(""); $this->addElement($oFormName); $this->addElement($oOrderId); $this->addElement($oOrderStatusId); $this->addElement($oOrderStatusUserName); $this->addElement($oOrderFileUserName); $this->addElement($oCallId); $this->addElement($oJournalTitle); $this->addElement($oPageFrom); $this->addElement($oPageUntil); $this->addDisplayGroup(array($oJournalYearPublication, $oJournalNumber, $oArticleAuthor, $oArticleTitle), "journal_group", array("legend" => "Dotyczy tylko czasopism")); $this->addElement($oUserCreatedDate); $this->addElement($oUserModifiedDate); $this->addElement($oUserExecutionDate); $this->addElement($oUserExpirationDate); $this->addElement($oComment); $this->addElement($oAmount); $this->addElement($oSubmitCancel); $this->addElement($oSubmitSaveAndMakeAction); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("borrower"); $oViewScript->setViewScript("_forms/ordersettings.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'frm_sinterview_rounds'); $id = new Zend_Form_Element_Hidden('id'); $req_id = new Zend_Form_Element_Select("req_id"); $req_id->setRegisterInArrayValidator(false); $req_id->setRequired(true); $req_id->setAttrib("class", "formDataElement"); $req_id->addValidator('NotEmpty', false, array('messages' => 'Please select requisition id.')); $req_id->setAttrib('title', 'Interviewer'); $req_id->setAttrib('onchange', 'displayParticularCandidates(this,"")'); $candidate_name = new Zend_Form_Element_Select('candidate_name'); $candidate_name->setAttrib('title', 'Candidate Name'); $candidate_name->addFilter(new Zend_Filter_StringTrim()); $candidate_name->setRequired(true); $candidate_name->addValidator('NotEmpty', false, array('messages' => 'Please select candidate.')); $candidate_name->addMultiOption('', 'Select candidate'); $candidate_name->setRegisterInArrayValidator(false); $interviewer_id = new Zend_Form_Element_Select("interviewer_id"); $interviewer_id->setRegisterInArrayValidator(false); $interviewer_id->setAttrib("class", "formDataElement"); $interviewer_id->setAttrib('title', 'Interviewer'); $interview_mode = new Zend_Form_Element_Select("interview_mode"); $interview_mode->setRegisterInArrayValidator(true); $interview_mode->setAttrib("class", "formDataElement"); $interview_mode->addMultiOptions(array('' => 'Select Interview Type', 'In person' => 'In person', 'Phone' => 'Phone', 'Video conference' => 'Video conference')); $interview_mode->setAttrib('title', 'Interview Type'); $int_location = new Zend_Form_Element_Text('int_location'); $int_location->setAttrib('maxLength', 100); $int_location->setAttrib('title', 'Location'); $int_location->addFilter(new Zend_Filter_StringTrim()); $job_title = new Zend_Form_Element_Text('job_title'); $job_title->setAttrib('readonly', 'readonly'); $country = new Zend_Form_Element_Select('country'); $country->setLabel('country'); $country->setAttrib('onchange', 'displayParticularState_normal(this,"state","state","city")'); $country->setRegisterInArrayValidator(false); $countryModal = new Default_Model_Countries(); $countriesData = $countryModal->fetchAll('isactive=1', 'country'); $country->addMultiOption('', 'Select country'); foreach ($countriesData->toArray() as $data) { $country->addMultiOption(trim($data['country_id_org']), $data['country']); } $state = new Zend_Form_Element_Select('state'); $state->setAttrib('onchange', 'displayParticularCity_normal(this,"city","city","")'); $state->setRegisterInArrayValidator(false); $state->addMultiOption('', 'Select State'); $city = new Zend_Form_Element_Select('city'); $city->setAttrib('class', 'selectoption'); $city->setAttrib('onchange', 'displayCityCode(this)'); $city->setRegisterInArrayValidator(false); $city->addMultiOption('', 'Select City'); $interview_time = new Zend_Form_Element_Text('interview_time'); $interview_time->setAttrib('title', 'Interview Time'); $interview_time->setAttrib('readonly', 'readonly'); $interview_time->setAttrib('onfocus', 'this.blur()'); $interview_time->setAttrib('class', 'time'); $interview_time->addFilter(new Zend_Filter_StringTrim()); $interview_date = new Zend_Form_Element_Text('interview_date'); $interview_date->setAttrib('readonly', 'readonly'); $interview_date->setAttrib('onfocus', 'this.blur()'); $interview_date->setAttrib('title', 'Interview Date'); $interview_date->addFilter(new Zend_Filter_StringTrim()); $interview_round = new Zend_Form_Element_Text('interview_round'); $interview_round->setAttrib('title', 'Interview Round'); $interview_round->addFilter(new Zend_Filter_StringTrim()); $interview_round->setAttrib('maxlength', 45); $interview_feedback = new Zend_Form_Element_Textarea('interview_feedback'); $interview_feedback->setAttrib('rows', 10); $interview_feedback->setAttrib('cols', 50); $interview_feedback->setAttrib('maxlength', 300); $interview_feedback->setAttrib('title', 'Feedback.'); $interview_comments = new Zend_Form_Element_Textarea('interview_comments'); $interview_comments->setAttrib('rows', 10); $interview_comments->setAttrib('cols', 50); $interview_comments->setAttrib('maxlength', 300); $interview_comments->setAttrib('title', 'Comments.'); $round_status = new Zend_Form_Element_Select('round_status'); $round_status->setRegisterInArrayValidator(false); $round_status->setLabel('Round status'); $round_status->addMultiOptions(array('' => 'Select status', 'Schedule for next round' => 'Schedule for next round', 'Qualified' => 'Qualified', 'Selected' => 'Selected', 'Disqualified' => 'Disqualified', 'Incompetent' => 'Incompetent', 'Ineligible' => 'Ineligible', 'Candidate no show' => 'Candidate no show')); $hid_round_status_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('hid_round_status', null); $interview_status = new Zend_Form_Element_Select('interview_status'); $interview_status->setLabel('Interview status')->setMultiOptions(array('' => 'Select status', 'In process' => 'In process', 'Completed' => 'Complete', 'On hold' => 'On hold')); $interview_status->setRegisterInArrayValidator(false); $cand_status = new Zend_Form_Element_Select('cand_status'); $cand_status->setLabel('Candidate status')->setMultiOptions(array('' => 'Select status')); $cand_status->setRegisterInArrayValidator(false); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserGroup = $auth->getStorage()->read()->group_id; } $intrvid_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('intrvid', null); if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP) && $intrvid_val == $loginUserId) { $round_status->setRequired(true); $round_status->addValidator('NotEmpty', false, array('messages' => 'Please select status.')); $interview_comments->setRequired(true); $interview_comments->addValidator('NotEmpty', false, array('messages' => 'Please select comments.')); $interview_feedback->setRequired(true); $interview_feedback->addValidator('NotEmpty', false, array('messages' => 'Please select feedback.')); } if (($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP || $loginuserGroup == '') && $intrvid_val != $loginUserId) { if ($hid_round_status_val != '' && ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP || $loginuserGroup == '')) { $round_status->setRequired(true); $round_status->addValidator('NotEmpty', false, array('messages' => 'Please select status.')); } else { $interview_status->setRequired(true); $interview_status->addValidator('NotEmpty', false, array('messages' => 'Please select interview status.')); $cand_status->setRequired(true); $cand_status->addValidator('NotEmpty', false, array('messages' => 'Please select candidate status.')); $interviewer_id->setRequired(true); $interviewer_id->addValidator('NotEmpty', false, array('messages' => 'Please select interviewer.')); $interview_mode->setRequired(true); $interview_mode->addValidator('NotEmpty', false, array('messages' => 'Please select interview type.')); $int_location->setRequired(true); $int_location->addValidator('NotEmpty', false, array('messages' => 'Please enter location.')); $country->setRequired(true); $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $state->setRequired(true); $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $city->setRequired(true); $city->addValidator('NotEmpty', false, array('messages' => 'Please select city.')); $interview_time->setRequired(true); $interview_time->addValidator('NotEmpty', false, array('messages' => 'Please select interview time.')); $interview_date->setRequired(true); $interview_date->addValidator('NotEmpty', false, array('messages' => 'Please select interview date.')); $interview_round->setRequired(true); $interview_round->addValidator('NotEmpty', false, array('messages' => 'Please select interview name.')); } } $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Update'); $int_location->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid location.'))); $interview_round->addValidator("regex", true, array('pattern' => '/^[0-9a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please select valid interview name.'))); $this->addElements(array($req_id, $id, $candidate_name, $job_title, $interviewer_id, $interview_mode, $int_location, $country, $state, $city, $interview_time, $interview_date, $round_status, $interview_feedback, $interview_comments, $interview_round, $interview_status, $cand_status, $submit)); $this->setElementDecorators(array('ViewHelper')); }
/** Initialize this form. */ public function init() { $this->setName('dicomserver_admin'); $this->setMethod('POST'); $csrf = new Midas_Form_Element_Hash('csrf'); $csrf->setSalt('sAfDFebTDemATWR4gGrYGMSE'); $csrf->setDecorators(array('ViewHelper')); $dcm2xmlCommand = new Zend_Form_Element_Text(MIDAS_DICOMSERVER_DCM2XML_COMMAND_KEY); $dcm2xmlCommand->setLabel('dcm2xml Command'); $dcm2xmlCommand->setRequired(true); $dcm2xmlCommand->addValidator('NotEmpty', true); $storescpCommand = new Zend_Form_Element_Text(MIDAS_DICOMSERVER_STORESCP_COMMAND_KEY); $storescpCommand->setLabel('storescp Command'); $storescpCommand->setRequired(true); $storescpCommand->addValidator('NotEmpty', true); $storescpPort = new Zend_Form_Element_Text(MIDAS_DICOMSERVER_STORESCP_PORT_KEY); $storescpPort->setLabel('storescp Port'); $storescpPort->setRequired(true); $storescpPort->addValidator('NotEmpty', true); $storescpPort->addValidator('Digits', true); $storescpPort->addValidator('Between', true, array('min' => 1, 'max' => 65535)); $storescpPort->setAttrib('maxlength', 5); $storescpStudyTimeout = new Zend_Form_Element_Text(MIDAS_DICOMSERVER_STORESCP_STUDY_TIMEOUT_KEY); $storescpStudyTimeout->setLabel('storescp Study Timeout (in Seconds)'); $storescpStudyTimeout->setRequired(true); $storescpStudyTimeout->addValidator('NotEmpty', true); $storescpStudyTimeout->addValidator('Digits', true); $storescpStudyTimeout->addValidator('GreaterThan', true, array('min' => 0)); $receptionDirectory = new Zend_Form_Element_Text(MIDAS_DICOMSERVER_RECEPTION_DIRECTORY_KEY); $receptionDirectory->setLabel('Reception Directory for DICOM Files'); $receptionDirectory->setRequired(true); $receptionDirectory->addValidator('NotEmpty', true); $destinationFolder = new Zend_Form_Element_Text(MIDAS_DICOMSERVER_DESTINATION_FOLDER_KEY); $destinationFolder->setLabel('Upload Destination Folder'); $destinationFolder->setRequired(true); $destinationFolder->addValidator('NotEmpty', true); $dcmqrscpCommand = new Zend_Form_Element_Text(MIDAS_DICOMSERVER_DCMQRSCP_COMMAND_KEY); $dcmqrscpCommand->setLabel('dcmqrscp Command'); $dcmqrscpCommand->setRequired(true); $dcmqrscpCommand->addValidator('NotEmpty', true); $dcmqrscpPort = new Zend_Form_Element_Text(MIDAS_DICOMSERVER_DCMQRSCP_PORT_KEY); $dcmqrscpPort->setLabel('dcmqrscp Port'); $dcmqrscpPort->setRequired(true); $dcmqrscpPort->addValidator('NotEmpty', true); $dcmqrscpPort->addValidator('Digits', true); $dcmqrscpPort->addValidator('Between', true, array('min' => 1, 'max' => 65535)); $dcmqrscpPort->setAttrib('maxlength', 5); $dcmqridxCommand = new Zend_Form_Element_Text(MIDAS_DICOMSERVER_DCMQRIDX_COMMAND_KEY); $dcmqridxCommand->setLabel('dcmqridx Command'); $dcmqridxCommand->setRequired(true); $dcmqridxCommand->addValidator('NotEmpty', true); $serverAeTitle = new Zend_Form_Element_Text(MIDAS_DICOMSERVER_SERVER_AE_TITLE_KEY); $serverAeTitle->setLabel('Server Application Entity Title'); $serverAeTitle->setRequired(true); $serverAeTitle->addValidator('NotEmpty', true); $peerAes = new Zend_Form_Element_Textarea(MIDAS_DICOMSERVER_PEER_AES_KEY); $peerAes->setLabel('Peer Application Entities Allowed to Use Query/Retrieve Services'); $peerAes->addValidator('NotEmpty', true); $this->addDisplayGroup(array($dcm2xmlCommand, $storescpCommand, $storescpPort, $storescpStudyTimeout, $receptionDirectory, $destinationFolder, $dcmqrscpCommand, $dcmqrscpPort, $dcmqridxCommand, $serverAeTitle, $peerAes), 'global'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Save'); $this->addElements(array($csrf, $dcm2xmlCommand, $storescpCommand, $storescpPort, $storescpStudyTimeout, $receptionDirectory, $destinationFolder, $dcmqrscpCommand, $dcmqrscpPort, $dcmqridxCommand, $serverAeTitle, $peerAes, $submit)); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('enctype', 'multipart/form-data'); $this->setAttrib('name', 'organisationinfo'); $this->setAttrib('action', DOMAIN . 'organisationinfo/edit'); $id = new Zend_Form_Element_Hidden('id'); $orgname = new Zend_Form_Element_Text('organisationname'); $orgname->setAttrib('maxLength', 50); $orgname->addFilter(new Zend_Filter_StringTrim()); $orgname->setRequired(true); $orgname->addValidator('NotEmpty', false, array('messages' => 'Please enter organization name.')); $orgname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid organization name.'))); $domain = new Zend_Form_Element_Multiselect('domain'); $domain->setRequired(true); $domain->addValidator('NotEmpty', false, array('messages' => 'Please select domain.')); $domain->setLabel('domain')->setMultiOptions(array('1' => 'Admin/Secretarial', '2' => 'Customer Service/ Call Centre/ BPO', '3' => 'Finance & Accounts', '4' => 'Human Resources', '5' => 'IT', '6' => 'Legal', '7' => 'Marketing & Communications', '8' => 'Purchase/ Logistics/ Supply Chain', '9' => 'Sales/ Business Development', '10' => 'Sales & Marketing & Advertisement')); $org_image_value = new Zend_Form_Element_Hidden('org_image_value'); $imgerr = new Zend_Form_Element_Hidden('imgerr'); $imgerrmsg = new Zend_Form_Element_Hidden('imgerrmsg'); $orgdescription = new Zend_Form_Element_Textarea('orgdescription'); $orgdescription->setAttrib('rows', 10); $orgdescription->setAttrib('cols', 50); $orgdescription->setRequired(true); $orgdescription->addValidator('NotEmpty', false, array('messages' => 'Please enter organization description.')); $website = new Zend_Form_Element_Text('website'); $website->setAttrib('maxLength', 50); $website->addFilter(new Zend_Filter_StringTrim()); $website->setRequired(true); $website->addValidator('NotEmpty', false, array('messages' => 'Please enter website.')); $website->addValidator(new Zend_Validate_Uri()); $totalemployees = new Zend_Form_Element_Select('totalemployees'); $totalemployees->setRegisterInArrayValidator(false); $totalemployees->setMultiOptions(array('1' => '20-50', '2' => '51-100', '3' => '101-500', '4' => '501 -1000', '5' => '> 1000')); $totalemployees->setRequired(true); $totalemployees->addValidator('NotEmpty', false, array('messages' => 'Please enter total employees.')); $org_startdate = new ZendX_JQuery_Form_Element_DatePicker('org_startdate'); $org_startdate->setAttrib('readonly', 'true'); $org_startdate->setAttrib('onfocus', 'this.blur()'); $org_startdate->setOptions(array('class' => 'brdr_none')); $phonenumber = new Zend_Form_Element_Text('phonenumber'); $phonenumber->addFilter(new Zend_Filter_StringTrim()); $phonenumber->setRequired(true); $phonenumber->setAttrib('maxLength', 15); $phonenumber->addValidator('NotEmpty', false, array('messages' => 'Please enter phone number.')); $phonenumber->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Phone number must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Phone number must contain at least %min% characters.'))))); $phonenumber->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9-]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.'))))); $secondaryphone = new Zend_Form_Element_Text('secondaryphone'); $secondaryphone->setAttrib('maxLength', 15); $secondaryphone->addFilter(new Zend_Filter_StringTrim()); $secondaryphone->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Secondary phone number must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Secondary phone number must contain at least %min% characters.'))))); $secondaryphone->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9-]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.'))))); $faxnumber = new Zend_Form_Element_Text('faxnumber'); $faxnumber->setAttrib('maxLength', 15); $faxnumber->addFilter(new Zend_Filter_StringTrim()); $faxnumber->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Fax number must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Fax number must contain at least %min% characters.'))))); $faxnumber->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9-]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid fax number.'))))); $country = new Zend_Form_Element_Select('country'); $country->setLabel('country'); $country->setRequired(true); $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $country->setAttrib('onchange', 'displayParticularState(this,"state","state","")'); $countryModal = new Default_Model_Countries(); $countriesData = $countryModal->fetchAll('isactive=1', 'country'); $country->addMultiOption('', 'Select country'); foreach ($countriesData->toArray() as $data) { $country->addMultiOption($data['country_id_org'], $data['country']); } $country->setRegisterInArrayValidator(false); $state = new Zend_Form_Element_Select('state'); $state->setAttrib('class', 'selectoption'); $state->setAttrib('onchange', 'displayParticularCity(this,"city","city","")'); $state->setRegisterInArrayValidator(false); $state->addMultiOption('', 'Select State'); $state->setRequired(true); $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $city = new Zend_Form_Element_Select('city'); $city->setAttrib('class', 'selectoption'); $city->setAttrib('onchange', 'displayCityCode(this)'); $city->setRegisterInArrayValidator(false); $city->addMultiOption('', 'Select City'); $city->setRequired(true); $city->addValidator('NotEmpty', false, array('messages' => 'Please select city.')); $address1 = new Zend_Form_Element_Textarea('address1'); $address1->setAttrib('rows', 10); $address1->setAttrib('cols', 50); $address1->setRequired(true); $address1->addValidator('NotEmpty', false, array('messages' => 'Please enter main branch address.')); $address2 = new Zend_Form_Element_Textarea('address2'); $address2->setAttrib('rows', 10); $address2->setAttrib('cols', 50); $address3 = new Zend_Form_Element_Textarea('address3'); $address3->setAttrib('rows', 10); $address3->setAttrib('cols', 50); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $orghead = new Zend_Form_Element_Select('orghead'); $orghead->setLabel('orghead'); $orghead->setRequired(true); $orghead->addValidator('NotEmpty', false, array('messages' => 'Please select organization head.')); $orghead->setAttrib('onchange', 'getdetailsoforghead(this)'); $orghead->setRegisterInArrayValidator(false); $prevorgheadrm = new Zend_Form_Element_Select('prevorgheadrm'); $prevorgheadrm->setLabel('orghead'); $prevorgheadrm->setRegisterInArrayValidator(false); $rmflag = Zend_Controller_Front::getInstance()->getRequest()->getParam('rmflag', null); if ($rmflag == '1') { $prevorgheadrm->setRequired(true); $prevorgheadrm->addValidator('NotEmpty', false, array('messages' => 'Please select reporting manager for current organization head.')); } $designation = new Zend_Form_Element_Text('designation'); $designation->setAttrib('maxLength', 50); $designation->addFilter(new Zend_Filter_StringTrim()); $designation->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid designation.'))); $employeeId = new Zend_Form_Element_Text("employeeId"); $employeeId->setRequired("true"); $employeeId->setLabel("Employee ID"); $employeeId->setAttrib("class", "formDataElement"); $employeeId->setAttrib("readonly", "readonly"); $employeeId->setAttrib('onfocus', 'this.blur()'); $employeeId->addValidator('NotEmpty', false, array('messages' => 'Identity codes are not configured yet.')); $prefix_id = new Zend_Form_Element_Select('prefix_id'); $prefix_id->setLabel("Prefix"); $prefix_id->setRegisterInArrayValidator(false); $emprole = new Zend_Form_Element_Select("emprole"); $emprole->setRegisterInArrayValidator(false); $emprole->setRequired(true); $emprole->setLabel("Role"); $emprole->setAttrib("class", "formDataElement"); $emprole->addValidator('NotEmpty', false, array('messages' => 'Please select role.')); $emailaddress = new Zend_Form_Element_Text("emailaddress"); $emailaddress->setRequired(true); $emailaddress->addValidator('NotEmpty', false, array('messages' => 'Please enter email.')); $emailaddress->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid email.'))); $emailaddress->setLabel("Email"); $emailaddress->setAttrib("class", "formDataElement"); $emailaddress->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_users', 'field' => 'emailaddress', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('orghead', 0) . '" and isactive!=0'))); $emailaddress->getValidator('Db_NoRecordExists')->setMessage('Email already exists.'); $jobtitle = new Zend_Form_Element_Select('jobtitle_id'); $jobtitle->setLabel("Job Title"); $jobtitle->addMultiOption('', 'Select Job Title'); $jobtitle->setAttrib('onchange', 'displayPositions(this,"position_id","")'); $jobtitle->setRegisterInArrayValidator(false); $position = new Zend_Form_Element_Select('position_id'); $position->setLabel("Position"); $position->addMultiOption('', 'Select Position'); $position->setRegisterInArrayValidator(false); $date_of_joining = new ZendX_JQuery_Form_Element_DatePicker('date_of_joining'); $date_of_joining->setLabel("Date Of Joining"); $date_of_joining->setOptions(array('class' => 'brdr_none')); $date_of_joining->setRequired(true); $date_of_joining->setAttrib('readonly', 'true'); $date_of_joining->setAttrib('onfocus', 'this.blur()'); $date_of_joining->addValidator('NotEmpty', false, array('messages' => 'Please select date of joining.')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $prevorgheadrm, $orgname, $imgerrmsg, $imgerr, $org_image_value, $domain, $orgdescription, $website, $totalemployees, $org_startdate, $phonenumber, $secondaryphone, $faxnumber, $country, $state, $city, $address1, $address2, $address3, $description, $orghead, $designation, $employeeId, $prefix_id, $emprole, $emailaddress, $jobtitle, $position, $date_of_joining, $submit)); //$email,$secondaryemail, $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('File'), array('org_image')); $this->setElementDecorators(array('UiWidgetElement'), array('org_startdate', 'date_of_joining')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'agencylist'); $this->setAttrib('action', BASE_URL . 'agencylist/edit/id/1'); $id = new Zend_Form_Element_Hidden('id'); $pocid_1 = new Zend_Form_Element_Hidden('pocid_1'); $pocid_2 = new Zend_Form_Element_Hidden('pocid_2'); $pocid_3 = new Zend_Form_Element_Hidden('pocid_3'); $agencyname = new Zend_Form_Element_Text('agencyname'); $agencyname->setAttrib('maxLength', 50); $agencyname->addFilter(new Zend_Filter_StringTrim()); $agencyname->setRequired(true); $agencyname->addValidator('NotEmpty', false, array('messages' => 'Please enter agency name.')); $agencyname->addValidator("regex", true, array('pattern' => '/^(?![0-9]{4})[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid agency name.'))); $address = new Zend_Form_Element_Textarea('address'); $address->setAttrib('rows', 10); $address->setAttrib('cols', 50); $address->setRequired(true); $address->addValidator('NotEmpty', false, array('messages' => 'Please enter address.')); $primaryphone = new Zend_Form_Element_Text('primaryphone'); $primaryphone->setAttrib('maxLength', 15); $primaryphone->addFilter(new Zend_Filter_StringTrim()); $primaryphone->setRequired(true); $primaryphone->addValidator('NotEmpty', false, array('messages' => 'Please enter primary phone number.')); $primaryphone->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Primary phone number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Primary phone number must contain at least %min% characters.'))))); $primaryphone->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.'))); $primaryphone->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_bgagencylist', 'field' => 'primaryphone', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $primaryphone->getValidator('Db_NoRecordExists')->setMessage('Primary phone number already exists.'); $secondaryphone = new Zend_Form_Element_Text('secondaryphone'); $secondaryphone->setAttrib('maxLength', 15); $secondaryphone->addFilter(new Zend_Filter_StringTrim()); $secondaryphone->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Secondary phone number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Secondary phone number must contain at least %min% characters.'))))); $secondaryphone->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.'))); $checktype = new Zend_Form_Element_Multiselect('bg_checktype'); $checktype->setRequired(true)->addErrorMessage('Please select screening type.'); $checktype->addValidator('NotEmpty', false, array('messages' => 'Please select screening type.')); $checktypeModal = new Default_Model_Bgscreeningtype(); $typesData = $checktypeModal->fetchAll('isactive=1', 'type'); foreach ($typesData->toArray() as $data) { $checktype->addMultiOption($data['id'], $data['type']); } $checktype->setRegisterInArrayValidator(false); $emprole = new Zend_Form_Element_Select('emprole'); $emprole->setRequired(true)->addErrorMessage('Please select role.'); $emprole->addValidator('NotEmpty', false, array('messages' => 'Please select role.')); $emprole->addMultiOption('', 'Select Role'); $agencyModal = new Default_Model_Agencylist(); $roleData = $agencyModal->getagencyrole(); foreach ($roleData as $data) { $emprole->addMultiOption($data['id'], $data['rolename']); } $emprole->setRegisterInArrayValidator(false); $website = new Zend_Form_Element_Text('website_url'); $website->setAttrib('maxLength', 50); $website->addFilter(new Zend_Filter_StringTrim()); $website->setRequired(true); $website->addValidator('NotEmpty', false, array('messages' => 'Please enter website URL.')); $website->addValidator("regex", true, array('pattern' => '/^(http:\\/\\/www|https:\\/\\/www|www)+\\.([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]{2,3})$/', 'messages' => array('regexNotMatch' => 'Please enter valid URL.'))); $firstname_1 = new Zend_Form_Element_Text('firstname_1'); $firstname_1->setAttrib('maxLength', 50); $firstname_1->addFilter(new Zend_Filter_StringTrim()); $firstname_1->setRequired(true); $firstname_1->addValidator('NotEmpty', false, array('messages' => 'Please enter first name.')); $firstname_1->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))); $lastname_1 = new Zend_Form_Element_Text('lastname_1'); $lastname_1->setAttrib('maxLength', 50); $lastname_1->addFilter(new Zend_Filter_StringTrim()); $lastname_1->setRequired(true); $lastname_1->addValidator('NotEmpty', false, array('messages' => 'Please enter last name.')); $lastname_1->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))); $mobile_1 = new Zend_Form_Element_Text('mobile_1'); $mobile_1->setAttrib('maxLength', 10); $mobile_1->addFilter(new Zend_Filter_StringTrim()); $mobile_1->setRequired(true); $mobile_1->addValidator('NotEmpty', false, array('messages' => 'Please enter 10 digit mobile number.')); $mobile_1->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Mobile number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Mobile number must contain at least %min% characters.'))))); $mobile_1->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.'))); $email_1 = new Zend_Form_Element_Text('email_1'); $email_1->setAttrib('maxLength', 50); $email_1->addFilter(new Zend_Filter_StringTrim()); $email_1->setRequired(true); $email_1->addValidator('NotEmpty', false, array('messages' => 'Please enter email.')); $location_1 = new Zend_Form_Element_Text('location_1'); $location_1->setAttrib('maxLength', 50); $location_1->addFilter(new Zend_Filter_StringTrim()); $location_1->setRequired(true); $location_1->addValidator('NotEmpty', false, array('messages' => 'Please enter location.')); $country_1 = new Zend_Form_Element_Select('country_1'); $country_1->setLabel('country'); $country_1->setRequired(true); $country_1->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $country_1->setAttrib('onchange', 'displayParticularState_normal(this,"","state_1","city_1")'); $countryModal = new Default_Model_Countries(); $countriesData = $countryModal->getTotalCountriesList('isactive=1', 'country_name'); $country_1->addMultiOption('', 'Select country'); foreach ($countriesData as $data) { $country_1->addMultiOption($data['id'], utf8_encode($data['country_name'])); } $country_1->setRegisterInArrayValidator(false); $state_1 = new Zend_Form_Element_Select('state_1'); $state_1->setAttrib('class', 'selectoption'); $state_1->setAttrib('onchange', 'displayParticularCity_normal(this,"","city_1","")'); $state_1->setRegisterInArrayValidator(false); $state_1->addMultiOption('', 'Select State'); $state_1->setRequired(true); $state_1->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $city_1 = new Zend_Form_Element_Select('city_1'); $city_1->setAttrib('class', 'selectoption'); $city_1->setAttrib('onchange', 'displayCityCode(this)'); $city_1->setRegisterInArrayValidator(false); $city_1->addMultiOption('', 'Select City'); $city_1->setRequired(true); $city_1->addValidator('NotEmpty', false, array('messages' => 'Please select city.')); $contact_type_1 = new Zend_Form_Element_Select('contact_type_1'); $contact_type_1->setLabel('contact_type_1')->setMultiOptions(array('' => 'Select Contact Type', '1' => 'Primary', '2' => 'Secondary')); $contact_type_1->setRegisterInArrayValidator(false); $contact_type_1->setRequired(true); $contact_type_1->addValidator('NotEmpty', false, array('messages' => 'Please select contact type.')); $firstname_2 = new Zend_Form_Element_Text('firstname_2'); $firstname_2->setAttrib('maxLength', 50); $firstname_2->addFilter(new Zend_Filter_StringTrim()); $lastname_2 = new Zend_Form_Element_Text('lastname_2'); $lastname_2->setAttrib('maxLength', 50); $lastname_2->addFilter(new Zend_Filter_StringTrim()); $mobile_2 = new Zend_Form_Element_Text('mobile_2'); $mobile_2->setAttrib('maxLength', 10); $mobile_2->addFilter(new Zend_Filter_StringTrim()); $email_2 = new Zend_Form_Element_Text('email_2'); $email_2->setAttrib('maxLength', 50); $email_2->addFilter(new Zend_Filter_StringTrim()); $location_2 = new Zend_Form_Element_Text('location_2'); $location_2->setAttrib('maxLength', 50); $location_2->addFilter(new Zend_Filter_StringTrim()); $country_2 = new Zend_Form_Element_Select('country_2'); $country_2->setLabel('country'); $country_2->setAttrib('onchange', 'displayParticularState_normal(this,"","state_2","city_2")'); $countryModal = new Default_Model_Countries(); $countriesData = $countryModal->getTotalCountriesList('isactive=1', 'country_name'); $country_2->addMultiOption('', 'Select country'); foreach ($countriesData as $data) { $country_2->addMultiOption($data['id'], utf8_encode($data['country_name'])); } $state_2 = new Zend_Form_Element_Select('state_2'); $state_2->setAttrib('class', 'selectoption'); $state_2->setAttrib('onchange', 'displayParticularCity_normal(this,"","city_2","")'); $state_2->addMultiOption('', 'Select State'); $city_2 = new Zend_Form_Element_Select('city_2'); $city_2->setAttrib('class', 'selectoption'); $city_2->setAttrib('onchange', 'displayCityCode(this)'); $city_2->addMultiOption('', 'Select City'); $contact_type_2 = new Zend_Form_Element_Select('contact_type_2'); $contact_type_2->setLabel('contact_type_2')->setMultiOptions(array('' => 'select contact type', '1' => 'Primary', '2' => 'Secondary')); $secondpocid = new Zend_Form_Element_Hidden('secondpocid'); $valfirstname_2 = Zend_Controller_Front::getInstance()->getRequest()->getParam('firstname_2', null); $vallastname_2 = Zend_Controller_Front::getInstance()->getRequest()->getParam('lastname_2', null); $valmobile_2 = Zend_Controller_Front::getInstance()->getRequest()->getParam('mobile_2', null); $valemail_2 = Zend_Controller_Front::getInstance()->getRequest()->getParam('email_2', null); $vallocation_2 = Zend_Controller_Front::getInstance()->getRequest()->getParam('location_2', null); $valcountry_2 = Zend_Controller_Front::getInstance()->getRequest()->getParam('country_2', null); $valstate_2 = Zend_Controller_Front::getInstance()->getRequest()->getParam('state_2', null); $valcity_2 = Zend_Controller_Front::getInstance()->getRequest()->getParam('city_2', null); $valcontact_type_2 = Zend_Controller_Front::getInstance()->getRequest()->getParam('contact_type_2', null); if ($valfirstname_2 != '' || $vallastname_2 != '' || $valmobile_2 != '' || $valemail_2 != '' || $vallocation_2 != '' || $valcountry_2 != '' || $valstate_2 != '' || $valcity_2 != '' || $valcontact_type_2 != '') { $firstname_2->setRequired(true); $firstname_2->addValidator('NotEmpty', false, array('messages' => 'Please enter first name.')); $lastname_2->setRequired(true); $lastname_2->addValidator('NotEmpty', false, array('messages' => 'Please enter last name.')); $mobile_2->setRequired(true); $mobile_2->addValidator('NotEmpty', false, array('messages' => 'Please enter 10 digit mobile number.')); $email_2->setRequired(true); $email_2->addValidator('NotEmpty', false, array('messages' => 'Please enter email.')); $location_2->setRequired(true); $location_2->addValidator('NotEmpty', false, array('messages' => 'Please enter location.')); $country_2->setRequired(true); $country_2->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $country_2->setRegisterInArrayValidator(false); $state_2->setRequired(true); $state_2->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $state_2->setRegisterInArrayValidator(false); $city_2->setRequired(true); $city_2->addValidator('NotEmpty', false, array('messages' => 'Please select city.')); $city_2->setRegisterInArrayValidator(false); $contact_type_2->setRequired(true); $contact_type_2->addValidator('NotEmpty', false, array('messages' => 'Please select contact type.')); $contact_type_2->setRegisterInArrayValidator(false); } $firstname_2->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))); $lastname_2->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))); $mobile_2->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Mobile number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Mobile number must contain at least %min% characters.'))))); $mobile_2->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.'))); $firstname_3 = new Zend_Form_Element_Text('firstname_3'); $firstname_3->setAttrib('maxLength', 50); $firstname_3->addFilter(new Zend_Filter_StringTrim()); $lastname_3 = new Zend_Form_Element_Text('lastname_3'); $lastname_3->setAttrib('maxLength', 50); $lastname_3->addFilter(new Zend_Filter_StringTrim()); $mobile_3 = new Zend_Form_Element_Text('mobile_3'); $mobile_3->setAttrib('maxLength', 10); $mobile_3->addFilter(new Zend_Filter_StringTrim()); $email_3 = new Zend_Form_Element_Text('email_3'); $email_3->setAttrib('maxLength', 50); $email_3->addFilter(new Zend_Filter_StringTrim()); $location_3 = new Zend_Form_Element_Text('location_3'); $location_3->setAttrib('maxLength', 50); $location_3->addFilter(new Zend_Filter_StringTrim()); $country_3 = new Zend_Form_Element_Select('country_3'); $country_3->setLabel('country'); $country_3->setAttrib('onchange', 'displayParticularState_normal(this,"","state_3","city_3")'); $countryModal = new Default_Model_Countries(); $countriesData = $countryModal->getTotalCountriesList('isactive=1', 'country_name'); $country_3->addMultiOption('', 'Select country'); foreach ($countriesData as $data) { $country_3->addMultiOption($data['id'], utf8_encode($data['country_name'])); } $state_3 = new Zend_Form_Element_Select('state_3'); $state_3->setAttrib('class', 'selectoption'); $state_3->setAttrib('onchange', 'displayParticularCity_normal(this,"","city_3","")'); $state_3->addMultiOption('', 'Select State'); $city_3 = new Zend_Form_Element_Select('city_3'); $city_3->setAttrib('class', 'selectoption'); $city_3->setAttrib('onchange', 'displayCityCode(this)'); $city_3->addMultiOption('', 'Select City'); $contact_type_3 = new Zend_Form_Element_Select('contact_type_3'); $contact_type_3->setLabel('contact_type_3')->setMultiOptions(array('' => 'select contact type', '1' => 'Primary', '2' => 'Secondary')); $thirdpocid = new Zend_Form_Element_Hidden('thirdpocid'); $thirdData = Zend_Controller_Front::getInstance()->getRequest()->getParam('thirdpocid', null); $valfirstname_3 = Zend_Controller_Front::getInstance()->getRequest()->getParam('firstname_3', null); $vallastname_3 = Zend_Controller_Front::getInstance()->getRequest()->getParam('lastname_3', null); $valmobile_3 = Zend_Controller_Front::getInstance()->getRequest()->getParam('mobile_3', null); $valemail_3 = Zend_Controller_Front::getInstance()->getRequest()->getParam('email_3', null); $vallocation_3 = Zend_Controller_Front::getInstance()->getRequest()->getParam('location_3', null); $valcountry_3 = Zend_Controller_Front::getInstance()->getRequest()->getParam('country_3', null); $valstate_3 = Zend_Controller_Front::getInstance()->getRequest()->getParam('state_3', null); $valcity_3 = Zend_Controller_Front::getInstance()->getRequest()->getParam('city_3', null); $valcontact_type_3 = Zend_Controller_Front::getInstance()->getRequest()->getParam('contact_type_3', null); if ($valfirstname_3 != '' || $vallastname_3 != '' || $valmobile_3 != '' || $valemail_3 != '' || $vallocation_3 != '' || $valcountry_3 != '' || $valstate_3 != '' || $valcity_3 != '' || $valcontact_type_3 != '') { $firstname_3->setRequired(true); $firstname_3->addValidator('NotEmpty', false, array('messages' => 'Please enter first name.')); $lastname_3->setRequired(true); $lastname_3->addValidator('NotEmpty', false, array('messages' => 'Please enter last name.')); $mobile_3->setRequired(true); $mobile_3->addValidator('NotEmpty', false, array('messages' => 'Please enter 10 digit mobile number.')); $email_3->setRequired(true); $email_3->addValidator('NotEmpty', false, array('messages' => 'Please enter email.')); $location_3->setRequired(true); $location_3->addValidator('NotEmpty', false, array('messages' => 'Please enter location.')); $country_3->setRequired(true); $country_3->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $country_3->setRegisterInArrayValidator(false); $state_3->setRequired(true); $state_3->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $state_3->setRegisterInArrayValidator(false); $city_3->setRequired(true); $city_3->addValidator('NotEmpty', false, array('messages' => 'Please select city.')); $city_3->setRegisterInArrayValidator(false); $contact_type_3->setRequired(true); $contact_type_3->addValidator('NotEmpty', false, array('messages' => 'Please select contact type.')); $contact_type_3->setRegisterInArrayValidator(false); } $firstname_3->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))); $lastname_3->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))); $mobile_3->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Mobile number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Mobile number must contain at least %min% characters.'))))); $mobile_3->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.'))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $pocid_1, $pocid_2, $pocid_3, $agencyname, $address, $primaryphone, $secondaryphone, $checktype, $website, $firstname_1, $lastname_1, $mobile_1, $email_1, $location_1, $country_1, $state_1, $city_1, $contact_type_1, $firstname_2, $lastname_2, $mobile_2, $email_2, $location_2, $country_2, $state_2, $city_2, $contact_type_2, $secondpocid, $firstname_3, $lastname_3, $mobile_3, $email_3, $location_3, $country_3, $state_3, $city_3, $contact_type_3, $thirdpocid, $emprole, $submit)); $this->setElementDecorators(array('ViewHelper')); }