public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'holidaygroups'); $id = new Zend_Form_Element_Hidden('id'); $holidayname = new Zend_Form_Element_Text('holidayname'); $holidayname->setAttrib('maxLength', 20); $holidayname->addFilter(new Zend_Filter_StringTrim()); $holidayname->setRequired(true); $holidayname->addValidator('NotEmpty', false, array('messages' => 'Please enter holiday.')); $holidayname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid holiday.'))); $groupid = new Zend_Form_Element_Multiselect('groupid'); $groupid->setAttrib('class', 'selectoption'); $groupid->setRegisterInArrayValidator(false); $groupid->setRequired(true); $groupid->addValidator('NotEmpty', false, array('messages' => 'Please select holiday group.')); $holiday_date = new ZendX_JQuery_Form_Element_DatePicker('holidaydate'); $holiday_date->setAttrib('readonly', 'true'); $holiday_date->setAttrib('onfocus', 'this.blur()'); $holiday_date->setOptions(array('class' => 'brdr_none')); $holiday_date->setRequired(true); $holiday_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $holidayname, $groupid, $holiday_date, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('holidaydate')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'timezone/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'timezone'); $id = new Zend_Form_Element_Hidden('id'); $timezone = new Zend_Form_Element_Multiselect('timezone'); $timezone->setRegisterInArrayValidator(false); $timezone->setRequired(true); $timezone->addValidator('NotEmpty', false, array('messages' => 'Please select time zone.')); $timezoneModal = new Default_Model_Timezone(); $timezoneData = $timezoneModal->getalltimezones(); foreach ($timezoneData as $data) { $timezone->addMultiOption($data['id'], $data['timezone'] . ' [' . $data['timezone_abbr'] . ']'); } $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $url = "'timezone/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'timezone\\');'"; $this->addElements(array($id, $timezone, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
/** * Prepare form * * @param Uni_Core_Form $form */ protected function _prepareForm(Uni_Core_Form $form) { $form->setName('menu')->setMethod('post'); $subForm1 = new Zend_Form_SubForm(); $subForm1->setLegend('Menu Item Information'); $subForm1->setDescription('Menu Item Information'); $idField = new Zend_Form_Element_Hidden('id'); $title = new Zend_Form_Element_Text('title', array('class' => 'required', 'maxlength' => 200)); $title->setRequired(true)->setLabel('Title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $link = new Zend_Form_Element_Text('link', array('maxlength' => 200)); $link->setLabel('Link')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDescription('Use module/controller/action for internal links or http://www.example.com for external links'); $open_window = new Zend_Form_Element_Select('open_window', array('class' => 'required', 'maxlength' => 200)); $open_window->setRequired(true)->setLabel('Open Window')->setMultiOptions(Fox::getModel('navigation/menu')->getAllTargetWindows()); $status = new Zend_Form_Element_Select('status', array('class' => 'required', 'maxlength' => 200)); $status->setRequired(true)->setLabel('Status')->setMultiOptions(Fox::getModel('navigation/menu')->getAllStatuses()); $sort_order = new Zend_Form_Element_Text('sort_order', array('class' => 'required', 'maxlength' => 200)); $sort_order->setRequired(true)->setLabel('Sort Order')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $style_class = new Zend_Form_Element_Text('style_class'); $style_class->setLabel('Style Class')->addFilter('StripTags')->addFilter('StringTrim'); $menugroup = new Zend_Form_Element_Multiselect('menu_group', array('class' => 'required')); $menugroup->setRequired(true)->setLabel('Menu Group')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setMultiOptions(Fox::getModel('navigation/menugroup')->getMenuGroupOptions()); $subForm1->addElements(array($idField, $title, $link, $open_window, $sort_order, $style_class, $status, $menugroup)); $form->addSubForm($subForm1, 'subform1'); parent::_prepareForm($form); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'heirarchy/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'heirarchy'); $id = new Zend_Form_Element_Hidden('id'); $level_1 = new Zend_Form_Element_Multiselect('level_1'); $level_1->setLabel('Level one'); $level_1->setRequired(true); $level_1->addValidator('NotEmpty', false, array('messages' => 'Please select level one employees.')); $level_1->setRegisterInArrayValidator(false); $level_2 = new Zend_Form_Element_Multiselect('level_2'); $level_2->setLabel('Level two'); $level_2->setRequired(true); $level_2->addValidator('NotEmpty', false, array('messages' => 'Please select level two employees.')); $level_2->setRegisterInArrayValidator(false); $level_3 = new Zend_Form_Element_Multiselect('level_3'); $level_3->setLabel('Level three'); $level_3->setRequired(true); $level_3->addValidator('NotEmpty', false, array('messages' => 'Please select level three employees.')); $level_3->setRegisterInArrayValidator(false); $level_4 = new Zend_Form_Element_Multiselect('level_4'); $level_4->setLabel('Level four'); $level_4->setRegisterInArrayValidator(false); $level_5 = new Zend_Form_Element_Multiselect('level_5'); $level_5->setLabel('Level five'); $level_5->setRegisterInArrayValidator(false); $level_6 = new Zend_Form_Element_Multiselect('level_6'); $level_6->setLabel('Level six'); $level_6->setRegisterInArrayValidator(false); $level_7 = new Zend_Form_Element_Multiselect('level_7'); $level_7->setLabel('Level seven'); $level_7->setRegisterInArrayValidator(false); $level_8 = new Zend_Form_Element_Multiselect('level_8'); $level_8->setLabel('Level eight'); $level_8->setRegisterInArrayValidator(false); $level_9 = new Zend_Form_Element_Multiselect('level_9'); $level_9->setLabel('Level nine'); $level_9->setRegisterInArrayValidator(false); $level_10 = new Zend_Form_Element_Multiselect('level_10'); $level_10->setLabel('Level ten'); $level_10->setRegisterInArrayValidator(false); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $level_1, $level_2, $level_3, $level_4, $level_5, $level_6, $level_7, $level_8, $level_9, $level_10, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('start_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'addempleaves'); $id = new Zend_Form_Element_Hidden('id'); $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null); $emp_leave_limit = new Zend_Form_Element_Text('leave_limit'); $emp_leave_limit->setLabel("Allot Leave Limit"); $emp_leave_limit->setAttrib('maxLength', 3); $emp_leave_limit->addFilter(new Zend_Filter_StringTrim()); if ($id_val == '') { $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.')); $user_id = new Zend_Form_Element_Multiselect("user_id"); $user_id->setLabel("Employees"); $user_id->setRegisterInArrayValidator(false); $user_id->setRequired(true); $user_id->addValidator('NotEmpty', false, array('messages' => 'Please select employees.')); } else { $businessunit_id = new Zend_Form_Element_Hidden('businessunit_id'); $department_id = new Zend_Form_Element_Hidden('department_id'); $user_id = new Zend_Form_Element_Hidden('user_id'); $emp_leave_limit->setRequired(true); $emp_leave_limit->addValidator('NotEmpty', false, array('messages' => 'Please enter leave limit for current year.')); } $emp_leave_limit->addValidator("regex", true, array('pattern' => '/^(\\-?[1-9]|\\-?[1-9][0-9])$/', 'messages' => array('regexNotMatch' => 'Leave limit must be in the range of 0 to 100.'))); $alloted_year = new Zend_Form_Element_Text('alloted_year'); $alloted_year->setLabel("Year"); $alloted_year->setAttrib('maxLength', 4); $alloted_year->setAttrib('disabled', 'disabled'); $alloted_year->setAttrib('onfocus', 'this.blur()'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $submitbutton = new Zend_Form_Element_Button('submitbutton'); $submitbutton->setAttrib('id', 'submitbuttons'); $submitbutton->setAttrib('onclick', 'validateEmployeLeaves()'); $submitbutton->setLabel('Save'); $this->addElements(array($id, $user_id, $businessunit_id, $department_id, $emp_leave_limit, $alloted_year, $submit, $submitbutton)); $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); $oTableName = new Zend_Form_Element_Multiselect("table_name"); $oTableName->addMultiOptions($this->_aTableName); $oTableName->addValidator(new Zend_Validate_InArray(array_keys($this->_aTableName))); $oTableName->setRequired(FALSE); $oTableName->setLabel("Nazwa tabeli:"); $oTableName->setAttrib("class", "multiselect"); $this->addElement($oTableName); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "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->setAttrib('action', DOMAIN . 'states/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'states'); $id = new Zend_Form_Element_Hidden('id'); $country = new Zend_Form_Element_Select('countryid'); $country->setAttrib('class', 'selectoption'); $country->setAttrib('onchange', 'displayParticularState(this,"otheroption","state","")'); $country->setRegisterInArrayValidator(false); $country->addMultiOption('', 'Select Country'); $country->setRequired(true); $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $state = new Zend_Form_Element_Multiselect('state'); $state->setAttrib('onchange', 'displayStateCode(this)'); $state->setRegisterInArrayValidator(false); $state->setRequired(true); $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $state->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_states', 'field' => 'state_id_org', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $state->getValidator('Db_NoRecordExists')->setMessage('State already exists.'); $otherstatename = new Zend_Form_Element_Text('otherstatename'); $otherstatename->setAttrib('maxLength', 20); $otherstatename->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[^ ][a-zA-Z\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid state name.'))))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $country, $state, $otherstatename, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function renderFormElement() { $elm = new Zend_Form_Element_Multiselect($this->getName(), array('label' => $this->getLabel() . ':')); $elm->setDescription($this->getDescription()); $elm->setMultiOptions($this->getOptions()); $elm->setValue($this->getValue()); $elm->setRequired($this->getRequired()); $elm->setAttrib('style', 'width:300px;height:100px'); return $elm; }
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); $oRobots = new Zend_Form_Element_Select("site_seo_robots_id"); $oRobots->setLabel("Tryb indeksowania przez roboty:"); $oRobots->setRequired(FALSE); $oRobots->addMultiOptions($this->_aAllSiteSeoRobots); $oRobots->setValue(1); $this->addElement($oRobots); $oSeoTagTitle = new Zend_Form_Element_Textarea("head_title"); $oSeoTagTitle->setLabel("Tytuł strony (meta titile):")->setFilters($this->_aFilters); $oSeoTagTitle->setRequired(FALSE); $this->addElement($oSeoTagTitle); $oAdditionalSeoTagKeywords = new Zend_Form_Element_Text("additional_seo_tag_keywords"); $oAdditionalSeoTagKeywords->setLabel("Dodaj nowe słowo kluczowe:"); $oAdditionalSeoTagKeywords->setRequired(FALSE); $oAdditionalSeoTagKeywords->addValidator(new Zend_Validate_StringLength(array("min" => 1, "max" => 45))); $oAdditionalSeoTagKeywords->setAttrib("class", "valid"); $this->addElement($oAdditionalSeoTagKeywords); $oAddAdditionalSeoTagKeywords = new Zend_Form_Element_Button("add_additional_seo_tag_keywords"); $oAddAdditionalSeoTagKeywords->setLabel("Dodaj"); $oAddAdditionalSeoTagKeywords->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oAddAdditionalSeoTagKeywords); $oSeoTagKeywords = new Zend_Form_Element_Multiselect("keywords"); $oSeoTagKeywords->addMultiOptions($this->_aAllSiteSeoKeywords); $oSeoTagKeywords->setRequired(FALSE); $oSeoTagKeywords->setLabel("Słowa kluczowe (meta keywords):"); $oSeoTagKeywords->setAttrib("class", "chosen"); $this->addElement($oSeoTagKeywords); $oSeoTagDescription = new Zend_Form_Element_Textarea("description"); $oSeoTagDescription->setLabel("Opis strony (meta description):")->setFilters($this->_aFilters); $oSeoTagDescription->setRequired(FALSE); $this->addElement($oSeoTagDescription); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "submit"); $oSubmit->setLabel("Zapisz"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/siteseo.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', '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->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'appraisalinit'); $id = new Zend_Form_Element_Hidden('id'); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $businessunit_id = $auth->getStorage()->read()->businessunit_id; $department_id = $auth->getStorage()->read()->department_id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } if ($loginuserRole != SUPERADMINROLE && $loginuserGroup != MANAGEMENT_GROUP) { $businessunit_id = new Zend_Form_Element_Hidden('businessunit_id'); $department_id = new Zend_Form_Element_Hidden('department_id'); $businessunit_name = new Zend_Form_Element_Text('businessunit_name'); $businessunit_name->setLabel("Business Unit"); $businessunit_name->setAttrib('readonly', 'true'); $businessunit_name->setAttrib('onfocus', 'this.blur()'); $businessunit_name->setOptions(array('class' => 'brdr_none')); $department_name = new Zend_Form_Element_Text('department_name'); $department_name->setLabel("Department"); $department_name->setAttrib('readonly', 'true'); $department_name->setAttrib('onfocus', 'this.blur()'); $department_name->setOptions(array('class' => 'brdr_none')); } else { $businessunit_id = new Zend_Form_Element_Select('businessunit_id'); $businessunit_id->setLabel("Business Unit"); $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_Select('department_id'); $department_id->setLabel("Department"); $department_id->setRegisterInArrayValidator(false); $department_id->addMultiOptions(array('' => 'Select Department')); $performance_app_flag = Zend_Controller_Front::getInstance()->getRequest()->getParam('performance_app_flag', null); if ($performance_app_flag != '' && $performance_app_flag == 0) { $department_id->setRequired(true); $department_id->addValidator('NotEmpty', false, array('messages' => 'Please select department')); } } // $appraisal_mode = new Zend_Form_Element_Text('appraisal_mode'); // $appraisal_mode->setLabel("Appraisal Mode"); // $appraisal_mode->setAttrib('readonly', 'readonly'); // $appraisal_mode->setAttrib('onfocus', 'this.blur()'); // $appraisal_mode->setOptions(array('class' => 'brdr_none')); $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode'); $appraisal_mode->setLabel("Appraisal Mode"); $appraisal_mode->setAttrib('class', 'selectoption'); $appraisal_mode->addMultiOptions(array('' => 'Select appraisal mode', 'Quarterly' => 'Quarterly', 'Half-yearly' => 'Half-yearly', 'Yearly' => 'Yearly')); $appraisal_mode->setRegisterInArrayValidator(false); $appraisal_mode->setRequired(true); $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal mode')); $status = new Zend_Form_Element_Select('status'); $status->setLabel("Appraisal Status"); $status->setAttrib('class', 'selectoption'); $status->setMultiOptions(array('1' => 'Open')); $status->setRegisterInArrayValidator(false); $status->setRequired(true); $status->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal status.')); $from_year = new Zend_Form_Element_Select('from_year'); $from_year->setAttrib('class', 'selectoption'); $from_year->setRegisterInArrayValidator(false); $from_year->setRequired(true); $from_year->setLabel("From Year"); $from_year->addMultiOption("", "From Year"); $from_year->addValidator('NotEmpty', false, array('messages' => 'Please select from year')); $current_date = date('Y-m-d'); $previous_year = date('Y', strtotime("{$current_date} -1 year")); for ($i = $previous_year; $i <= $previous_year + 5; $i++) { $from_year->addMultiOption($i, $i); } $to_year = new Zend_Form_Element_Select('to_year'); $to_year->setAttrib('class', 'selectoption'); $to_year->setRegisterInArrayValidator(false); $to_year->setRequired(true); $to_year->setLabel("To Year"); $to_year->addMultiOption("", "To Year"); $to_year->addValidator('NotEmpty', false, array('messages' => 'Please select to year')); /* Limit 'To Year' field years * upto following year of 'From Year' * upto 5 years from current last year i.e.$previous_year */ $post_from_year = Zend_Controller_Front::getInstance()->getRequest()->getParam('from_year', null); if (!empty($post_from_year)) { for ($i = $post_from_year; $i <= $post_from_year + 1 && $i <= $previous_year + 5; $i++) { $to_year->addMultiOption($i, $i); } } $appraisal_period = new Zend_Form_Element_Text('appraisal_period'); $appraisal_period->setLabel("Period"); $appraisal_period->setAttrib('readonly', 'readonly'); $appraisal_period->setAttrib('onfocus', 'this.blur()'); $appraisal_period->setOptions(array('class' => 'brdr_none')); // $appraisal_period->setRequired(true); // $appraisal_period->addValidator('NotEmpty', false, array('messages' => 'Please enter period')); $eligibility = new Zend_Form_Element_Multiselect('eligibility'); $eligibility->setLabel("Eligibility"); $eligibility->setAttrib('class', 'selectoption'); $eligibility->setMultiOptions(array('' => 'Select Eligibility')); /*$eligibility->setRegisterInArrayValidator(false); $eligibility->setRequired(true); $eligibility->addValidator('NotEmpty', false, array('messages' => 'Please select eligiblity'));*/ $eligibility_hidden = new Zend_Form_Element_Multiselect('eligibility_hidden'); $eligibility_hidden->setLabel("Eligibility"); $eligibility_hidden->setAttrib('class', 'selectoption'); $eligibility_hidden->setRegisterInArrayValidator(false); $eligibilityflag = new Zend_Form_Element_Hidden('eligibilityflag'); $eligibility_value = new Zend_Form_Element_Hidden('eligibility_value'); $category_id = new Zend_Form_Element_Multiselect('category_id'); $category_id->setLabel("Parameters"); $category_id->setMultiOptions(array('' => 'Select Parameters')); $category_id->setRegisterInArrayValidator(false); $category_id->setRequired(true); $category_id->addValidator('NotEmpty', false, array('messages' => 'Please select parameters')); $enable = new Zend_Form_Element_Select('enable_step'); $enable->setLabel("Enable To"); $enable->setAttrib('onchange', 'changeduedatetext(this.value)'); $enable->setMultiOptions(array('1' => 'Managers', '2' => 'Employees')); $enable->setRegisterInArrayValidator(false); $enable->setRequired(true); $enable->addValidator('NotEmpty', false, array('messages' => 'Please select enable to')); $enable_to_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('enable_step', null); $mgr_due_date = new Zend_Form_Element_Text('managers_due_date'); $mgr_due_date->setLabel("Managers Due Date"); $emp_due_date = new Zend_Form_Element_Text('employee_due_date'); $emp_due_date->setLabel("Employees Due Date"); if ($enable_to_val == '' || $enable_to_val == 1) { $mgr_due_date->setRequired(true); $mgr_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select managers due date')); } else { $emp_due_date->setRequired(true); $emp_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select employees due date')); } $management_appraisal = new Zend_Form_Element_Checkbox('management_appraisal'); $management_appraisal->setLabel("Consider management"); // $appraisal_ratings = new Zend_Form_Element_Text('appraisal_ratings'); // $appraisal_ratings->setAttrib('readonly', 'readonly'); // $appraisal_ratings->setAttrib('onfocus', 'this.blur()'); // $appraisal_ratings->setLabel("Ratings"); $appraisal_ratings = new Zend_Form_Element_Select('appraisal_ratings'); $appraisal_ratings->setLabel("Appraisal Ratings"); $appraisal_ratings->setAttrib('class', 'selectoption'); $appraisal_ratings->addMultiOptions(array('' => 'Select ratings', '1' => '1-5', '2' => '1-10')); $appraisal_ratings->setRegisterInArrayValidator(false); $appraisal_ratings->setRequired(true); $appraisal_ratings->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal ratings')); $app_period_hid = new Zend_Form_Element_Hidden('app_period_hid'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); if ($loginuserRole != SUPERADMINROLE && $loginuserGroup != MANAGEMENT_GROUP) { $this->addElements(array($appraisal_ratings, $management_appraisal, $id, $appraisal_period, $from_year, $to_year, $businessunit_id, $department_id, $businessunit_name, $department_name, $appraisal_mode, $category_id, $status, $eligibility, $eligibility_hidden, $eligibility_value, $eligibilityflag, $enable, $mgr_due_date, $emp_due_date, $app_period_hid, $submit)); } else { $this->addElements(array($appraisal_ratings, $management_appraisal, $id, $appraisal_period, $from_year, $to_year, $businessunit_id, $department_id, $appraisal_mode, $category_id, $status, $eligibility, $eligibility_hidden, $eligibility_value, $eligibilityflag, $enable, $mgr_due_date, $emp_due_date, $app_period_hid, $submit)); } $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); $oLayoutName = new Zend_Form_Element_Hidden("layout_name"); $oLayoutName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oLayoutName); $oLabel = new Zend_Form_Element_Text("label"); $oLabel->setLabel("Etykieta:")->setFilters($this->_aFilters); $oLabel->setRequired(TRUE); $this->addElement($oLabel); $oDesc = new Zend_Form_Element_Text("desc"); $oDesc->setLabel("Opis:")->setFilters($this->_aFilters); $oDesc->setRequired(FALSE); $this->addElement($oDesc); $oImageId = new Zend_Form_Element_Select("image_id"); $oImageId->setLabel("Ikona menu:")->setFilters($this->_aFilters); $oImageId->setRequired(FALSE); $oImageId->addMultiOptions($this->_aAllImage); $this->addElement($oImageId); $oModuleId = new Zend_Form_Element_Select("navigation_module_id"); $oModuleId->setLabel("Moduł:"); $oModuleId->setRequired(TRUE)->setAttrib("class", "valid"); $oModuleId->addMultiOptions($this->_aAllModule); $this->addElement($oModuleId); $oSiteLayout = new Zend_Form_Element_Select("site_layout_id"); $oSiteLayout->setLabel("Szablon:"); $oSiteLayout->setRequired(TRUE)->setAttrib("class", "valid"); $oSiteLayout->addMultiOptions($this->_aAllSiteLayout); $this->addElement($oSiteLayout); $oControllerId = new Zend_Form_Element_Select("navigation_controller_id"); $oControllerId->setLabel("Kontroler:"); $oControllerId->setRequired(TRUE)->setAttrib("class", "valid"); $oControllerId->addMultiOptions($this->_aAllController); $this->addElement($oControllerId); $oActionId = new Zend_Form_Element_Select("navigation_action_id"); $oActionId->setLabel("Akcja:"); $oActionId->setRequired(TRUE)->setAttrib("class", "valid"); $oActionId->addMultiOptions($this->_aAllAction); $this->addElement($oActionId); $oResourceId = new Zend_Form_Element_Select("navigation_resource_id"); $oResourceId->setLabel("Kwalifikator zasobu:"); $oResourceId->setRequired(TRUE); $oResourceId->addMultiOptions($this->_aAllResource); //$this->addElement($oResourceId); $oPrivilegeId = new Zend_Form_Element_Select("navigation_privilege_id"); $oPrivilegeId->setLabel("Kwalifikator dostępu:"); $oPrivilegeId->setRequired(TRUE)->setAttrib("class", "valid"); $oPrivilegeId->addMultiOptions($this->_aAllPrivilege); $this->addElement($oPrivilegeId); $oVisible = new Zend_Form_Element_Select("visible"); $oVisible->setLabel("Widoczne w menu:"); $oVisible->setRequired(TRUE)->setAttrib("class", "valid"); $oVisible->addMultiOptions(array(1 => "Tak", 0 => "Nie")); $this->addElement($oVisible); $oPrivilege = new Zend_Form_Element_Multiselect("user_role"); $oPrivilege->addMultiOptions($this->_aAllUserRole); $oPrivilege->setRequired(FALSE); $oPrivilege->setLabel("Dostęp do zasobu dla grupy użytkowników:"); $oPrivilege->setAttrib("class", "multiselect"); $this->addElement($oPrivilege); $oNavigationMenuCopy = new Zend_Form_Element_Hidden("navigation_menu_edit_id"); $oNavigationMenuCopy->setValue(0); $oNavigationMenuCopy->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oNavigationMenuCopy); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "submit"); $oSubmit->setLabel("Zapisz"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/navigationmenu.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"); $this->addElement($oFormName); $oNewsEditId = new Zend_Form_Element_Hidden("news_edit_id"); $oNewsEditId->setValue(0); $oNewsEditId->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oNewsEditId); $oTranslation = new Zend_Form_Element_Select("translation"); $oTranslation->setLabel("Tłumaczenie:"); $oTranslation->setRequired(TRUE)->setAttrib("class", "valid"); $oTranslation->addMultiOptions($this->_aAllLang); $this->addElement($oTranslation); $oImagePreview = new Zend_Form_Element_Hidden("image_preview"); $oImagePreview->setValue(0); $oImagePreview->setRequired(FALSE)->removeDecorator("Label"); $this->addElement($oImagePreview); $oImageId = new Zend_Form_Element_Select("image_id"); $oImageId->setLabel("Zdjęcie:")->setFilters($this->_aFilters); $oImageId->setRequired(FALSE); $oImageId->addMultiOptions($this->_aAllImage); $this->addElement($oImageId); $oCreatedDate = new Zend_Form_Element_Text("created_date"); $oCreatedDate->setLabel("Data utworzenia:"); $oCreatedDate->setRequired(TRUE); $oCreatedDate->setAttrib("class", "valid"); $this->addElement($oCreatedDate); $oName = new Zend_Form_Element_Text("news_title"); $oName->setLabel("Tytuł:"); $oName->addValidator(new Zend_Validate_StringLength(array("min" => 3, "max" => 255))); $oName->setRequired(TRUE)->setAttrib("class", "valid"); $this->addElement($oName); $oContent = new Zend_Form_Element_Textarea("news_content"); $oContent->setLabel("Treść:"); $oContent->setRequired(FALSE); $oContent->setAttrib("class", "ckeditor"); $this->addElement($oContent); $oAdditionalCategoryTag = new Zend_Form_Element_Text("additional_category_tag"); $oAdditionalCategoryTag->setLabel("Dodaj nowe tagi:"); $oAdditionalCategoryTag->setRequired(FALSE); $oAdditionalCategoryTag->addValidator(new Zend_Validate_StringLength(array("min" => 1, "max" => 45))); $oAdditionalCategoryTag->setAttrib("class", "valid"); $this->addElement($oAdditionalCategoryTag); $oAddAdditionalCategoryTag = new Zend_Form_Element_Button("add_additional_category_tag"); $oAddAdditionalCategoryTag->setLabel("Dodaj"); $oAddAdditionalCategoryTag->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oAddAdditionalCategoryTag); $oCategoryTag = new Zend_Form_Element_Multiselect("category_tag"); $oCategoryTag->addMultiOptions(array()); $oCategoryTag->setRequired(FALSE); $oCategoryTag->setLabel("Tagi:"); $oCategoryTag->setAttrib("class", "chosen"); $this->addElement($oCategoryTag); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "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->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', 'appraisalinit'); $id = new Zend_Form_Element_Hidden('id'); $businessunit_id = new Zend_Form_Element_Hidden('businessunit_id'); $department_id = new Zend_Form_Element_Hidden('department_id'); $businessunit_name = new Zend_Form_Element_Text('businessunit_name'); $businessunit_name->setLabel("Business Unit"); $businessunit_name->setAttrib('readonly', 'true'); $businessunit_name->setAttrib('onfocus', 'this.blur()'); $businessunit_name->setOptions(array('class' => 'brdr_none')); $department_name = new Zend_Form_Element_Text('department_name'); $department_name->setLabel("Department"); $department_name->setAttrib('readonly', 'true'); $department_name->setAttrib('onfocus', 'this.blur()'); $department_name->setOptions(array('class' => 'brdr_none')); $appraisal_mode = new Zend_Form_Element_Text('appraisal_mode'); $appraisal_mode->setLabel("Mode"); $appraisal_mode->setAttrib('readonly', 'readonly'); $appraisal_mode->setAttrib('onfocus', 'this.blur()'); $appraisal_mode->setOptions(array('class' => 'brdr_none')); $status = new Zend_Form_Element_Select('status'); $status->setLabel("Status"); $status->setAttrib('class', 'selectoption'); $status->setMultiOptions(array('1' => 'Open')); $status->setRegisterInArrayValidator(false); $status->setRequired(true); $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.')); $from_year = new Zend_Form_Element_Select('from_year'); $from_year->setAttrib('class', 'selectoption'); $from_year->setRegisterInArrayValidator(false); $from_year->setRequired(true); $from_year->setLabel("From Year"); $from_year->addMultiOption("", "Select from year"); $from_year->addValidator('NotEmpty', false, array('messages' => 'Please select starting year.')); for ($i = date('Y'); $i <= date('Y') + 5; $i++) { $from_year->addMultiOption($i, $i); } $to_year = new Zend_Form_Element_Select('to_year'); $to_year->setAttrib('class', 'selectoption'); $to_year->setRegisterInArrayValidator(false); $to_year->setRequired(true); $to_year->setLabel("To Year"); $to_year->addMultiOption("", "Select to year"); $to_year->addValidator('NotEmpty', false, array('messages' => 'Please select ending year.')); for ($i = date('Y'); $i <= date('Y') + 5; $i++) { $to_year->addMultiOption($i, $i); } $appraisal_period = new Zend_Form_Element_Text('appraisal_period'); $appraisal_period->setLabel("Period"); $appraisal_period->setAttrib('readonly', 'readonly'); $eligibility = new Zend_Form_Element_Multiselect('eligibility'); $eligibility->setLabel("Eligibility"); $eligibility->setAttrib('class', 'selectoption'); $eligibility->setMultiOptions(array('' => 'Select Eligibility')); $eligibility->setRegisterInArrayValidator(false); $eligibility->setRequired(true); $eligibility->addValidator('NotEmpty', false, array('messages' => 'Please select eliblity.')); $enable = new Zend_Form_Element_Select('enable_step'); $enable->setLabel("Enable To"); $enable->setAttrib('class', 'selectoption'); $enable->setMultiOptions(array('' => 'Select Enable To', '1' => 'Managers', '2' => 'Employees')); $enable->setRegisterInArrayValidator(false); $enable->setRequired(true); $enable->addValidator('NotEmpty', false, array('messages' => 'Please select enable to.')); $mgr_due_date = new Zend_Form_Element_Text('manager_due_date'); $mgr_due_date->setLabel("Due Date"); $mgr_due_date->setAttrib('readonly', 'true'); $mgr_due_date->setAttrib('onfocus', 'this.blur()'); $mgr_due_date->setOptions(array('class' => 'brdr_none')); $mgr_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.')); $emp_due_date = new Zend_Form_Element_Text('employee_due_date'); $emp_due_date->setLabel("Due Date"); $emp_due_date->setAttrib('readonly', 'true'); $emp_due_date->setAttrib('onfocus', 'this.blur()'); $emp_due_date->setOptions(array('class' => 'brdr_none')); $emp_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $appraisal_period, $from_year, $to_year, $businessunit_id, $department_id, $businessunit_name, $department_name, $appraisal_mode, $status, $eligibility, $enable, $mgr_due_date, $emp_due_date, $submit)); $this->setElementDecorators(array('ViewHelper')); }
function init() { // Set the method for the display form to POST $this->setMethod('post'); $this->setAction(WEBROOT . 'statistics'); $this->addAttribs(array('id' => 'filterComplexForm', 'class' => '')); $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART); //BEGIN:Id Category Expenses $idCategoryE = new Zend_Form_Element_Multiselect('idCategoryE'); $options = array('1' => strtoupper(Zend_Registry::get('translate')->_('admin_expenses'))); $categories = new Default_Model_Groups(); $select = $categories->getMapper()->getDbTable()->select()->where('NOT deleted')->where('type=?', 0)->order('name ASC'); $result = $categories->fetchAll($select); if (NULL != $result) { foreach ($result as $value) { $options[$value->getId()] = $value->getName(); } } $idCategoryE->setMultiOptions($options); $idCategoryE->addValidator(new Zend_Validate_InArray(array_keys($options))); $idCategoryE->setAttribs(array('class' => 'rightAdd form_selector', 'id' => 'idCategoryE')); $idCategoryE->setRequired(false); $this->addElement($idCategoryE); //END:Id Category Expenses //BEGIN:Id Category Income $idCategoryI = new Zend_Form_Element_Multiselect('idCategoryI'); $options = array('2' => strtoupper(Zend_Registry::get('translate')->_('admin_income'))); $categories = new Default_Model_Groups(); $select = $categories->getMapper()->getDbTable()->select()->where('NOT deleted')->where('type=?', 1)->order('name ASC'); $result = $categories->fetchAll($select); if (NULL != $result) { foreach ($result as $value) { $options[$value->getId()] = " " . $value->getName(); } } $idCategoryI->setMultiOptions($options); $idCategoryI->addValidator(new Zend_Validate_InArray(array_keys($options))); $idCategoryI->setAttribs(array('class' => 'rightAdd form_selector', 'id' => 'idCategoryI')); $idCategoryI->setRequired(false); $this->addElement($idCategoryI); //END:Id Category Income //BEGIN:Timeframe $timeframe = new Zend_Form_Element_Select('timeframe'); $options = array('m' => Zend_Registry::get('translate')->_('admin_monthly'), 'w' => Zend_Registry::get('translate')->_('admin_weekly'), 'd' => Zend_Registry::get('translate')->_('admin_daily')); $timeframe->setMultiOptions($options); $timeframe->addValidator(new Zend_Validate_InArray(array_keys($options))); $timeframe->setAttribs(array('class' => 'rightAdd validate[required] form_selector', 'id' => 'timeframe')); $timeframe->setRequired(true); $timeframe->setValue('m'); $this->addElement($timeframe); //END:Timeframe // BEGIN: data $dataStart = new Zend_Form_Element_Text('dataStartC'); $dataStart->setAttribs(array('class' => 'data_inceput_c validate[required]', 'placeholder' => Zend_Registry::get('translate')->_('admin_from_date'))); $dataStart->setRequired(true); $this->addElement($dataStart); $dataEnd = new Zend_Form_Element_Text('dataEndC'); $dataEnd->setAttribs(array('class' => 'data_sfarsit_c validate[required]', 'placeholder' => Zend_Registry::get('translate')->_('admin_to_date'))); $this->addElement($dataEnd); // END: data $submit = new Zend_Form_Element_Submit('submitC'); $submit->setValue(Zend_Registry::get('translate')->_('admin_menu_form_search')); $submit->setAttribs(array('class' => 'submit')); $submit->setRequired(true); $this->addElement($submit); $submitReportE = new Zend_Form_Element_Submit('submitReportE'); $submitReportE->setAttribs(array('class' => 'submitReport')); $submitReportE->setRequired(true); $this->addElement($submitReportE); $submitReportI = new Zend_Form_Element_Submit('submitReportI'); $submitReportI->setAttribs(array('class' => 'submitReport')); $submitReportI->setRequired(true); $this->addElement($submitReportI); }
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')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'systempreference'); $id = new Zend_Form_Element_Hidden('id'); $currencyid = new Zend_Form_Element_Hidden('currencyid'); $organisationid = new Zend_Form_Element_Hidden('organisationid'); $empcodeid = new Zend_Form_Element_Hidden('empcodeid'); $dateformatid = new Zend_Form_Element_Select('dateformatid'); $dateformatid->setAttrib('class', 'selectoption'); $dateformatid->setRegisterInArrayValidator(false); $dateformatid->setRequired(true); $dateformatid->addValidator('NotEmpty', false, array('messages' => 'Please select date format.')); $timeformatid = new Zend_Form_Element_Select('timeformatid'); $timeformatid->setAttrib('class', 'selectoption'); $timeformatid->setRegisterInArrayValidator(false); $timeformatid->setRequired(true); $timeformatid->addValidator('NotEmpty', false, array('messages' => 'Please select time format.')); $timezoneid = new Zend_Form_Element_Select('timezoneid'); $timezoneid->setAttrib('class', 'selectoption'); $timezoneid->setRegisterInArrayValidator(false); $timezoneid->setRequired(true); $timezoneid->addValidator('NotEmpty', false, array('messages' => 'Please select time zone preference.')); $timezoneid->addMultiOption('', 'Select Time zone'); $timezoneModal = new Default_Model_Timezone(); $timezoneData = $timezoneModal->fetchAll('isactive=1', 'timezone')->toArray(); foreach ($timezoneData as $data) { $timezoneid->addMultiOption($data['id'], $data['timezone'] . ' [' . $data['timezone_abbr'] . ']'); } $currencyname = new Zend_Form_Element_Text('currencyname'); $currencyname->setAttrib('maxLength', 50); $currencyname->addFilter(new Zend_Filter_StringTrim()); $currencyname->setRequired(true); $currencyname->addValidator('NotEmpty', false, array('messages' => 'Please enter currency.')); $currencyname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid currency.'))); $currencyname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currency', 'field' => 'currencyname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('currencyid') . '" and isactive=1'))); $currencyname->getValidator('Db_NoRecordExists')->setMessage('Currency already exists.'); $currencycode = new Zend_Form_Element_Text('currencycode'); $currencycode->setAttrib('maxLength', 20); $currencycode->addFilter(new Zend_Filter_StringTrim()); $currencycode->setRequired(true); $currencycode->addValidator('NotEmpty', false, array('messages' => 'Please enter currency code.')); $currencycode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid currency code.'))); $currencycode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currency', 'field' => 'currencycode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('currencyid') . '" and isactive=1'))); $currencycode->getValidator('Db_NoRecordExists')->setMessage('Currency code already exists.'); $passwordid = new Zend_Form_Element_Select('passwordid'); $passwordid->setAttrib('class', 'selectoption'); $passwordid->setAttrib('onchange', 'displayPasswordDesc(this)'); $passwordid->setRegisterInArrayValidator(false); $passwordid->setRequired(true); $passwordid->addValidator('NotEmpty', false, array('messages' => 'Please select default password.')); $perm_country = new Zend_Form_Element_Select('perm_country'); $perm_country->setAttrib('onchange', 'displayParticularState(this,"","perm_state","")'); $perm_country->setRegisterInArrayValidator(false); $countriesModel = new Default_Model_Countries(); $countrieslistArr = $countriesModel->getTotalCountriesList('addcountry'); if (sizeof($countrieslistArr) > 0) { $perm_country->addMultiOption('', 'Select Country'); foreach ($countrieslistArr as $countrieslistres) { $perm_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); } } $perm_country->setRequired(true); $perm_country->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $perm_state = new Zend_Form_Element_Select('perm_state'); $perm_state->setAttrib('onchange', 'displayParticularCity(this,"","perm_city","")'); $perm_state->setRegisterInArrayValidator(false); $perm_state->addMultiOption('', 'Select State'); $perm_state->setRequired(true); $perm_state->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $perm_city = new Zend_Form_Element_Select('perm_city'); $perm_city->setRegisterInArrayValidator(false); $perm_city->addMultiOption('', 'Select City'); $perm_city->setRequired(true); $perm_city->addValidator('NotEmpty', false, array('messages' => 'Please select city.')); $workcodename = new Zend_Form_Element_Multiselect('workcodename'); $workcodename->setRegisterInArrayValidator(false); $workcodename->setRequired(true); $workcodename->addValidator('NotEmpty', false, array('messages' => 'Please select employment status.')); $empCode = new Zend_Form_Element_Text('employee_code'); $empCode->addFilter(new Zend_Filter_StringTrim()); $empCode->setAttrib('maxLength', 5); $empCode->setRequired(true); $empCode->addValidator('NotEmpty', false, array('messages' => 'Please enter employee code.')); $empCode->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Employee code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Employee code must contain at least %min% characters.'))))); $empCode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid employee code.'))))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($timezoneid, $id, $currencyid, $organisationid, $empcodeid, $dateformatid, $timeformatid, $currencycode, $currencyname, $passwordid, $perm_country, $perm_state, $perm_city, $workcodename, $empCode, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); //$this->setAttrib('action',DOMAIN.'language/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'servicedeskrequests'); $id = new Zend_Form_Element_Hidden('id'); $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); $businessunit_id = new Zend_Form_Element_Select('businessunit_id'); $businessunit_id->setLabel("Business Unit"); $businessunit_id->setAttrib('class', 'selectoption'); if ($postid == '') { $businessunit_id->setAttrib('onchange', 'displayemployees(this)'); $bunitModel = new Default_Model_Businessunits(); $bunitdata = $bunitModel->fetchAll('isactive=1', 'unitname'); $businessunit_id->addMultiOptions(array('' => 'Select Business unit', '0' => 'No Business Unit')); foreach ($bunitdata->toArray() as $data) { $businessunit_id->addMultiOption($data['id'], $data['unitname']); } } else { $businessunit_id->addMultiOptions(array('' => 'Select Business unit')); } $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_Select('department_id'); $department_id->setLabel("Department"); $department_id->setAttrib('class', 'selectoption'); $department_id->addMultiOption('', 'Select Department'); if ($postid == '') { $department_id->setAttrib('onchange', 'displayemployees(this)'); } $department_id->setRegisterInArrayValidator(false); $service_desk_flag = new Zend_Form_Element_Radio('service_desk_flag'); $service_desk_flag->setLabel("Applicability"); $service_desk_flag->setAttrib('onclick', 'changeimplementation(this)'); $service_desk_flag->addMultiOptions(array('1' => 'Business unit wise', '0' => 'Department wise')); $service_desk_flag->setSeparator(''); $service_desk_flag->setValue(1); $service_desk_flag->setRegisterInArrayValidator(false); $service_desk_flag->setRequired(true); $service_desk_flag->addValidator('NotEmpty', false, array('messages' => 'Please select applicability.')); $service_desk_id = new Zend_Form_Element_Select('service_desk_id'); $service_desk_id->setLabel("Category"); $service_desk_id->setAttrib('class', 'selectoption'); $service_desk_id->addMultiOption('', 'Select category'); $service_desk_id->setRegisterInArrayValidator(false); $service_desk_id->setRequired(true); $service_desk_id->addValidator('NotEmpty', false, array('messages' => 'Please select category.')); $request_recievers = new Zend_Form_Element_Multiselect('request_recievers'); $request_recievers->setLabel("Executors"); $request_recievers->setAttrib('class', 'selectoption'); $request_recievers->setRegisterInArrayValidator(false); $request_recievers->setRequired(true); $request_recievers->addValidator('NotEmpty', false, array('messages' => 'Please select executor.')); $approvingauthority = new Zend_Form_Element_Select('approvingauthority'); $approvingauthority->setLabel("No. of Approvers"); $approvingauthority->setAttrib('class', 'selectoption'); $approvingauthority->setAttrib('onchange', 'displayapprovingauthority(this)'); $approvingauthority->addMultiOptions(array('' => 'Select no. of approvers', '1' => '1', '2' => '2', '3' => '3')); $approvingauthority->setRegisterInArrayValidator(false); $approvingauthority->setRequired(true); $approvingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select no. of approvers.')); $approver_1 = new Zend_Form_Element_Select('approver_1'); $approver_1->setLabel("Approver 1"); $approver_1->setAttrib('class', 'selectoption'); $approver_1->addMultiOption('', 'Select Approver 1'); $approver_1->setAttrib('onchange', 'displayapprovingauthority(this)'); $approver_1->setRegisterInArrayValidator(false); $approver_2 = new Zend_Form_Element_Select('approver_2'); $approver_2->setLabel("Approver 2"); $approver_2->setAttrib('class', 'selectoption'); $approver_2->addMultiOption('', 'Select Approver 2'); $approver_2->setAttrib('onchange', 'displayapprovingauthority(this)'); $approver_2->setRegisterInArrayValidator(false); $approver_3 = new Zend_Form_Element_Select('approver_3'); $approver_3->setLabel("Approver 3"); $approver_3->setAttrib('class', 'selectoption'); $approver_3->addMultiOption('', 'Select Approver 3'); $approver_3->setRegisterInArrayValidator(false); $cc_mail_recievers = new Zend_Form_Element_Multiselect('cc_mail_recievers'); $cc_mail_recievers->setLabel("Request Viewers"); $cc_mail_recievers->setAttrib('class', 'selectoption'); $cc_mail_recievers->setRegisterInArrayValidator(false); $attachment = new Zend_Form_Element_Radio('attachment'); $attachment->setLabel("Attachment"); $attachment->addMultiOptions(array('1' => 'Yes', '0' => 'No')); $attachment->setSeparator(''); $attachment->setValue(0); $attachment->setRegisterInArrayValidator(false); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel("Description"); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $businessunit_id, $department_id, $description, $service_desk_flag, $service_desk_id, $request_recievers, $approvingauthority, $approver_1, $approver_2, $approver_3, $cc_mail_recievers, $attachment, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'policies'); $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")'); /* * added New $ipbusiness_unit and $ipdepartment controls */ //start--------------- $ipbusiness_unit = new Zend_Form_Element_Select("ipbusiness_unit"); $ipbusiness_unit->setAttrib("class", "formDataElement"); $ipbusiness_unit->setAttrib("onchange", "getdepts_req(this,'ipdepartment','position_id');"); $ipbusiness_unit->setAttrib('title', 'Business Unit.'); $ipdepartment = new Zend_Form_Element_Select("ipdepartment"); $ipdepartment->setAttrib("class", "formDataElement"); $ipdepartment->setAttrib('title', 'Department.'); $ipdepartment->addMultiOptions(array('' => 'Select Department')); $ipdepartment->setAttrib('onchange', 'displayEmpReportingmanagers(this,"ipreporting_id","req")'); $ipdepartment->setRegisterInArrayValidator(false); //$ipdepartment->setRequired(true); $ipdepartment->addValidator('NotEmpty', false, array('messages' => 'Please select department.')); //$ipreporting_id = new Zend_Form_Element_Select("ipreporting_id"); $ipreporting_id = new Zend_Form_Element_Multiselect("ipreporting_id"); $ipreporting_id->setAttrib('title', 'Interview Panel Member.'); $ipreporting_id->setAttrib("class", "formDataElement"); $ipreporting_id->addMultiOptions(array('' => 'Select Interview Panel Member')); $ipreporting_id->setRegisterInArrayValidator(false); $ipreporting_id->setRequired(true); $ipreporting_id->addValidator('NotEmpty', false, array('messages' => 'Please select Interview Panel Member.')); //end--------------- $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')); /* * added New $ipbusiness_unit and $ipdepartment controls */ $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, $ipbusiness_unit, $ipdepartment, $ipreporting_id)); $this->setElementDecorators(array('ViewHelper')); }