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', DOMAIN . 'employee/add'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'empskills'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $skillname = new Zend_Form_Element_Text('skillname'); $skillname->setRequired(true); $skillname->setAttrib('maxLength', 50); $skillname->addFilter('StripTags'); $skillname->addFilter('StringTrim'); $skillname->addValidator('NotEmpty', false, array('messages' => 'Please enter skill.')); $yearsofexp = new Zend_Form_Element_Text('yearsofexp'); $yearsofexp->setAttrib('maxLength', 5); $yearsofexp->addFilter(new Zend_Filter_StringTrim()); $yearsofexp->setRequired(true); $yearsofexp->addValidator('NotEmpty', false, array('messages' => 'Please enter years of experience.')); $yearsofexp->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]\\d{0,1}(\\.\\d*)?$/', 'messages' => array('regexNotMatch' => 'Please enter numbers less than 100.'))))); $competencylevelid = new Zend_Form_Element_Select('competencylevelid'); $competencylevelid->setRequired(true)->addErrorMessage('Please select competency level.'); $competencylevelid->addValidator('NotEmpty', false, array('messages' => 'Please select competency level.')); $competencylevelid->setRegisterInArrayValidator(false); $year_skill = new ZendX_JQuery_Form_Element_DatePicker('year_skill_last_used'); $year_skill->setOptions(array('class' => 'brdr_none')); $year_skill->setAttrib('readonly', 'true'); $year_skill->setAttrib('onfocus', 'this.blur()'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $userid, $skillname, $yearsofexp, $competencylevelid, $year_skill, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('year_skill_last_used')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'businessunitsreport'); $this->setAttrib('action', BASE_URL . 'reports/businessunits'); $bunitname = new Zend_Form_Element_Text('bunitname'); $bunitname->setLabel('Business Unit'); $bunitname->setAttrib('onblur', 'clearbuname(this)'); $bunitcode = new Zend_Form_Element_Text('bunitcode'); $bunitcode->setLabel('Code'); $bunitcode->setAttrib('onblur', 'clearbuname(this)'); $bunitcode->setAttrib('class', 'selectoption'); $startdate = new ZendX_JQuery_Form_Element_DatePicker('startdate'); $startdate->setLabel('Started On'); $startdate->setAttrib('readonly', 'true'); $startdate->setOptions(array('class' => 'brdr_none')); $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date'); $start_date->setAttrib('readonly', 'true'); $start_date->setAttrib('onfocus', 'this.blur()'); $start_date->setOptions(array('class' => 'brdr_none')); $country = new Zend_Form_Element_Select('country'); $country->setLabel('Country'); $this->addElements(array($bunitname, $bunitcode, $startdate, $country)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('startdate')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'leavereport'); $id = new Zend_Form_Element_Hidden('id'); $employeename = new Zend_Form_Element_Text('employeename'); $employeename->setLabel('Leave Applied By'); $employeename->setAttrib('onblur', 'clearautocompletename(this)'); $department = new Zend_Form_Element_Select('department'); $department->setLabel('Department'); $department->addMultiOption('', 'Select Department'); $department->setAttrib('class', 'selectoption'); $department->setRegisterInArrayValidator(false); $leavestatus = new Zend_Form_Element_Select('leavestatus'); $leavestatus->setLabel('Leave Status'); $leavestatus->setMultiOptions(array('' => 'Select Leave Status', '1' => 'Pending for approval', '2' => 'Approved', '3' => 'Rejected', '4' => 'Cancel')); $leavestatus->setRegisterInArrayValidator(false); $from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date'); $from_date->setLabel('Applied Date'); $from_date->setAttrib('readonly', 'true'); $from_date->setAttrib('onfocus', 'this.blur()'); $from_date->setOptions(array('class' => 'brdr_none')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $employeename, $department, $leavestatus, $from_date, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('from_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'departmentsreport'); $this->setAttrib('action', BASE_URL . 'reports/departments'); $deptname = new Zend_Form_Element_Text('deptname'); $deptname->setLabel('Department'); $deptname->setAttrib('onblur', 'clearautocompletenames(this)'); $dcode = new Zend_Form_Element_Text('dcode'); $dcode->setLabel('Code'); $dcode->setAttrib('class', 'selectoption'); $dcode->addValidator("regex", true, array('pattern' => '/^([a-zA-Z0-9.\\-]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alpha numeric characters.'))); $dcode->setAttrib('onblur', 'clearautocompletenames(this)'); $bname = new Zend_Form_Element_Text('bname'); $bname->setLabel('Business Unit'); $bname->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.\\-]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))); $bname->setAttrib('onblur', 'clearautocompletenames(this)'); $startdate = new ZendX_JQuery_Form_Element_DatePicker('startdate'); $startdate->setLabel('Started On'); $startdate->setAttrib('readonly', 'true'); $startdate->setOptions(array('class' => 'brdr_none')); $country = new Zend_Form_Element_Select('country'); $country->setLabel('Country'); $this->addElements(array($deptname, $dcode, $bname, $startdate, $country)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('startdate')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'emppersonaldetails'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $genderid = new Zend_Form_Element_Select('genderid'); $genderid->addMultiOption('', 'Select Gender'); $genderid->setRegisterInArrayValidator(false); $genderid->setRequired(true); $genderid->addValidator('NotEmpty', false, array('messages' => 'Please select gender.')); $maritalstatusid = new Zend_Form_Element_Select('maritalstatusid'); $maritalstatusid->addMultiOption('', 'Select Marital Status'); $maritalstatusid->setRegisterInArrayValidator(false); $maritalstatusid->setRequired(true); $maritalstatusid->addValidator('NotEmpty', false, array('messages' => 'Please select marital status.')); $ethniccodeid = new Zend_Form_Element_Select('ethniccodeid'); $ethniccodeid->addMultiOption('', 'Select Ethnic Code'); $ethniccodeid->setLabel('Ethnic Code'); $ethniccodeid->setRegisterInArrayValidator(false); $racecodeid = new Zend_Form_Element_Select('racecodeid'); $racecodeid->addMultiOption('', 'Select Race Code'); $racecodeid->setLabel('Race Code'); $racecodeid->setRegisterInArrayValidator(false); $languageid = new Zend_Form_Element_Select('languageid'); $languageid->addMultiOption('', 'Select Language'); $languageid->setLabel('Language'); $languageid->setRegisterInArrayValidator(false); $nationalityid = new Zend_Form_Element_Select('nationalityid'); $nationalityid->addMultiOption('', 'Select Nationality'); $nationalityid->setRegisterInArrayValidator(false); $nationalityid->setRequired(true); $nationalityid->addValidator('NotEmpty', false, array('messages' => 'Please select nationality.')); $dob = new ZendX_JQuery_Form_Element_DatePicker('dob'); $dob->setOptions(array('class' => 'brdr_none')); $dob->setRequired(true); $dob->setAttrib('readonly', 'true'); $dob->setAttrib('onfocus', 'this.blur()'); $dob->addValidator('NotEmpty', false, array('messages' => 'Please select date of birth.')); //DOB should not be current date.... $celebrated_dob = new ZendX_JQuery_Form_Element_DatePicker('celebrated_dob'); $celebrated_dob->setOptions(array('class' => 'brdr_none')); $celebrated_dob->setAttrib('readonly', 'true'); $celebrated_dob->setAttrib('onfocus', 'this.blur()'); $bloodgroup = new Zend_Form_Element_Text('bloodgroup'); $bloodgroup->setAttrib('size', 5); $bloodgroup->setAttrib('maxlength', 10); /*$submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save');*/ $submitadd = new Zend_Form_Element_Button('submitbutton'); $submitadd->setAttrib('id', 'submitbuttons'); $submitadd->setAttrib('onclick', 'validatedocumentonsubmit(this)'); $submitadd->setLabel('Save'); $this->addElements(array($id, $userid, $genderid, $maritalstatusid, $nationalityid, $ethniccodeid, $racecodeid, $languageid, $dob, $celebrated_dob, $bloodgroup, $submitadd)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('dob', 'celebrated_dob')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'empsalarydetails'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $currencyid = new Zend_Form_Element_Select('currencyid'); $currencyid->setLabel('Salary Currency'); $currencyid->setRegisterInArrayValidator(false); $salarytype = new Zend_Form_Element_Select('salarytype'); $salarytype->setLabel("Pay Frequency"); $salarytype->setAttrib('id', 'jobpayfrequency'); //$salarytype->setAttrib('onchange', 'changesalarytext(this)'); $salarytype->setRegisterInArrayValidator(false); /* $salarytype->setMultiOptions(array( '' => 'Select Salary Type', '1'=>'Yearly' , '2'=>'Hourly', )); */ $salary = new Zend_Form_Element_Text('salary'); $salary->setLabel("Salary"); $salary->setAttrib('maxLength', 8); $salary->addFilter(new Zend_Filter_StringTrim()); $salary->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9\\.]*$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); $bankname = new Zend_Form_Element_Text('bankname'); $bankname->setAttrib('maxlength', 40); $bankname->setLabel('Bank Name'); $bankname->addFilters(array('StringTrim')); $bankname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\. ]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid bank name.'))); $accountholder_name = new Zend_Form_Element_Text('accountholder_name'); $accountholder_name->setAttrib('maxlength', 40); $accountholder_name->setLabel('Account Holder Name'); $accountholder_name->addFilters(array('StringTrim')); $accountholder_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); $accountholding = new ZendX_JQuery_Form_Element_DatePicker('accountholding'); $accountholding->setLabel('Account Holding Since'); $accountholding->setAttrib('readonly', 'true'); $accountholding->setAttrib('onfocus', 'this.blur()'); $accountholding->setOptions(array('class' => 'brdr_none')); $accountclasstypeid = new Zend_Form_Element_Select('accountclasstypeid'); $accountclasstypeid->setLabel('Account Class Type'); $accountclasstypeid->setRegisterInArrayValidator(false); $bankaccountid = new Zend_Form_Element_Select('bankaccountid'); $bankaccountid->setLabel('Account Type'); $bankaccountid->setRegisterInArrayValidator(false); $accountnumber = new Zend_Form_Element_Text('accountnumber'); $accountnumber->setAttrib('maxlength', 20); $accountnumber->setLabel('Account Number'); $accountnumber->addFilters(array('StringTrim')); $accountnumber->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9 ]*$/', 'messages' => array('regexNotMatch' => 'Please enter only alphanumeric characters.'))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $userid, $currencyid, $salarytype, $salary, $bankname, $accountholder_name, $accountholding, $accountclasstypeid, $bankaccountid, $accountnumber, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('accountholding')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'workeligibilitydetails'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $emptyflag = new Zend_Form_Element_Hidden('emptyFlag'); $issuingauthflag = new Zend_Form_Element_Hidden('issuingauthflag'); //Document type Id.... $docType = new Zend_Form_Element_Select('documenttype_id'); $docType->setRegisterInArrayValidator(false); $docType->setAttrib('onchange', 'checkissuingauthority(this)'); $docType->addMultiOption('', 'Select Document Type'); //Document Issue Date... $doc_issue_date = new ZendX_JQuery_Form_Element_DatePicker('doc_issue_date'); $doc_issue_date->setOptions(array('class' => 'brdr_none')); $doc_issue_date->setAttrib('readonly', 'true'); $doc_issue_date->setAttrib('onfocus', 'this.blur()'); // Document Expiry Date... $doc_expiry_date = new ZendX_JQuery_Form_Element_DatePicker('doc_expiry_date'); $doc_expiry_date->setAttrib('readonly', 'true'); $doc_expiry_date->setAttrib('onfocus', 'this.blur()'); $doc_expiry_date->setOptions(array('class' => 'brdr_none')); // Expiration Date should be greater than today's date... // issuing authority name... $issueAuth_name = new Zend_Form_Element_Text('issuingauth_name'); $issueAuth_name->setAttrib('maxLength', 50); $issueAuth_name->addFilter(new Zend_Filter_StringTrim()); $issueAuth_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\&\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))))); //issuing authority country..... $country = new Zend_Form_Element_Select('issuingauth_country'); $country->setAttrib('onchange', 'displayParticularState(this,"","issuingauth_state","")'); $country->setRegisterInArrayValidator(false); //issuing authority state..... $state = new Zend_Form_Element_Select('issuingauth_state'); $state->setAttrib('onchange', 'displayParticularCity(this,"","issuingauth_city","")'); $state->setRegisterInArrayValidator(false); $state->addMultiOption('', 'Select State'); //issuing authority city..... $city = new Zend_Form_Element_Select('issuingauth_city'); $city->setRegisterInArrayValidator(false); $city->addMultiOption('', 'Select City'); //issuing authority postal code ..... $issuingAuth_pcode = new Zend_Form_Element_Text('issuingauth_postalcode'); $issuingAuth_pcode->addFilter(new Zend_Filter_StringTrim()); $issuingAuth_pcode->setAttrib("maxlength", 10); $issuingAuth_pcode->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Issuing authority postal code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Issuing authority postal code must contain at least %min% characters.'))))); $issuingAuth_pcode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?!0{3})[0-9a-zA-Z]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid postal code.'))))); // Form Submit ......... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $userid, $issuingauthflag, $docType, $doc_issue_date, $doc_expiry_date, $issueAuth_name, $country, $state, $city, $issuingAuth_pcode, $emptyflag, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('doc_issue_date', 'doc_expiry_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'empjobhistory'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $positionheld = new Zend_Form_Element_Select('positionheld'); $positionheld->setLabel('Position'); $positionheld->setRegisterInArrayValidator(false); // $positionheld->setRequired(true); // $positionheld->addValidator('NotEmpty', false, array('messages' => 'Please select position.')); $department = new Zend_Form_Element_Select('department'); $department->setLabel('Department'); $department->setRegisterInArrayValidator(false); // $department->setRequired(true); // $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.')); $jobtitleid = new Zend_Form_Element_Select('jobtitleid'); $jobtitleid->setLabel('Job Title'); $jobtitleid->setRegisterInArrayValidator(false); // $jobtitleid->setRequired(true); // $jobtitleid->addValidator('NotEmpty', false, array('messages' => 'Please select job title.')); $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date'); $start_date->setLabel('From'); $start_date->setOptions(array('class' => 'brdr_none')); $start_date->setAttrib('readonly', 'true'); $start_date->setAttrib('onfocus', 'this.blur()'); $start_date->setRequired(true); $start_date->addValidator('NotEmpty', false, array('messages' => 'Please enter start date.')); $end_date = new ZendX_JQuery_Form_Element_DatePicker('end_date'); $end_date->setLabel('To'); $end_date->setOptions(array('class' => 'brdr_none')); $end_date->setAttrib('readonly', 'true'); $end_date->setAttrib('onfocus', 'this.blur()'); $received_amount = new Zend_Form_Element_Text("received_amount"); $received_amount->setLabel("Amount Received"); $received_amount->setAttrib('maxLength', 10); $received_amount->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9\\.]*$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); $paid_amount = new Zend_Form_Element_Text("paid_amount"); $paid_amount->setLabel("Amount Paid"); $paid_amount->setAttrib('maxLength', 10); $paid_amount->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9\\.]*$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); $client = new Zend_Form_Element_Select('client'); $client->setLabel('Client'); $client->setRegisterInArrayValidator(false); $client->setRequired(true); $client->addValidator('NotEmpty', false, array('messages' => 'Please select a client.')); $vendor = new Zend_Form_Element_Text("vendor"); $vendor->setLabel("Vendor"); $vendor->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.&\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter a valid vendor name.'))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $userid, $positionheld, $jobtitleid, $department, $start_date, $end_date, $received_amount, $paid_amount, $client, $vendor, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'educationdetails'); $this->setAttrib('action', DOMAIN . 'educationdetails/addpopup/'); $id = new Zend_Form_Element_Hidden('id'); $user_id = new Zend_Form_Element_Hidden('user_id'); $educationlevel = new Zend_Form_Element_Select('educationlevel'); $educationlevel->setLabel("Education Level"); $educationlevel->setRegisterInArrayValidator(false); $educationlevel->setRequired(true); $educationlevel->addValidator('NotEmpty', false, array('messages' => 'Please select educational level.')); //institution_name ... $institution_name = new Zend_Form_Element_Text('institution_name'); $institution_name->addFilter(new Zend_Filter_StringTrim()); $institution_name->setRequired(true); $institution_name->setAttrib("maxlength", 50); $institution_name->addValidator('NotEmpty', false, array('messages' => 'Please enter institution name.')); $institution_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); //course ... $course = new Zend_Form_Element_Text('course'); $course->addFilter(new Zend_Filter_StringTrim()); $course->setRequired(true); $course->setAttrib("maxlength", 50); $course->addValidator('NotEmpty', false, array('messages' => 'Please enter course name.')); $course->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\.\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course name.'))))); //from_date.. $from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date'); $from_date->setOptions(array('class' => 'brdr_none')); $from_date->setRequired(true); $from_date->setAttrib('readonly', 'true'); $from_date->setAttrib('onfocus', 'this.blur()'); $from_date->addValidator('NotEmpty', false, array('messages' => 'Please select from date.')); //to_date $to_date = new ZendX_JQuery_Form_Element_DatePicker('to_date'); $to_date->setOptions(array('class' => 'brdr_none')); $to_date->setRequired(true); $to_date->setAttrib('readonly', 'true'); $to_date->setAttrib('onfocus', 'this.blur()'); $to_date->addValidator('NotEmpty', false, array('messages' => 'Please select to date.')); // percentage... $percentage = new Zend_Form_Element_Text('percentage'); $percentage->addFilter(new Zend_Filter_StringTrim()); $percentage->setRequired(true); $percentage->setAttrib("maxlength", 2); $percentage->addValidator('NotEmpty', false, array('messages' => 'Please enter percentage.')); $percentage->addValidator("regex", true, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))); //Form Submit.... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $user_id, $educationlevel, $from_date, $to_date, $percentage, $course, $institution_name, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('from_date', 'to_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'trainingandcertificationdetails'); $id = new Zend_Form_Element_Hidden('id'); $user_id = new Zend_Form_Element_Hidden('user_id'); //course_name ... $course_name = new Zend_Form_Element_Text('course_name'); $course_name->addFilter(new Zend_Filter_StringTrim()); $course_name->setRequired(true); $course_name->setAttrib('maxLength', 50); $course_name->addValidator('NotEmpty', false, array('messages' => 'Please enter course name.')); $course_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course name.'))))); // course_level... $course_level = new Zend_Form_Element_Text('course_level'); $course_level->addFilter(new Zend_Filter_StringTrim()); $course_level->setRequired(true); $course_level->setAttrib('maxLength', 50); $course_level->addValidator('NotEmpty', false, array('messages' => 'Please enter course level.')); $course_level->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\.\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course level.'))))); //issued_date $issued_date = new ZendX_JQuery_Form_Element_DatePicker('issued_date'); $issued_date->setOptions(array('class' => 'brdr_none')); $issued_date->setAttrib('readonly', 'true'); $issued_date->setAttrib('onfocus', 'this.blur()'); // description .... $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); //course_offered_by .... $course_offered_by = new Zend_Form_Element_Text('course_offered_by'); $course_offered_by->addFilter(new Zend_Filter_StringTrim()); $course_offered_by->setRequired(true); $course_offered_by->setAttrib('maxLength', 50); $course_offered_by->addValidator('NotEmpty', false, array('messages' => 'Please enter course offered by.')); $course_offered_by->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))))); //Referer mobile number .... $certification_name = new Zend_Form_Element_Text('certification_name'); $certification_name->addFilter(new Zend_Filter_StringTrim()); $certification_name->setAttrib('maxLength', 50); $certification_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-z0-9\\-\\#\\.\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid certification name.'))))); $certificationNameStr = Zend_Controller_Front::getInstance()->getRequest()->getParam('certification_name', null); //If certification is done then should enter the issue date...... if ($certificationNameStr != "") { $issued_date->setRequired(true); $issued_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); } //Form Submit.... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $user_id, $certification_name, $course_offered_by, $description, $issued_date, $course_level, $course_name, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('issued_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'currencyconverter'); $id = new Zend_Form_Element_Hidden('id'); $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); $basecurrency = new Zend_Form_Element_Select('basecurrency'); $basecurrency->setAttrib('class', 'selectoption'); $basecurrency->addMultiOption('', 'Select base currency'); $basecurrency->setAttrib('onchange', 'displayTargetCurrency(this)'); $basecurrency->setRegisterInArrayValidator(false); $basecurrency->setRequired(true); $basecurrency->addValidator('NotEmpty', false, array('messages' => 'Please select base currency.')); $targetcurrency = new Zend_Form_Element_Select('targetcurrency'); $targetcurrency->setAttrib('class', 'selectoption'); $targetcurrency->addMultiOption('', 'Select target currency'); $targetcurrency->setRegisterInArrayValidator(false); $targetcurrency->setRequired(true); $targetcurrency->addValidator('NotEmpty', false, array('messages' => 'Please select target currency.')); if ($id_val == '') { $targetcurrency->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currencyconverter', 'field' => 'targetcurrency', 'exclude' => 'basecurrency="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('basecurrency') . '" AND targetcurrency="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('targetcurrency') . '" and isactive=1'))); $targetcurrency->getValidator('Db_NoRecordExists')->setMessage('Currency combination already exists.'); } $exchangerate = new Zend_Form_Element_Text("exchangerate"); $exchangerate->setAttrib('maxLength', 15); $exchangerate->addFilter(new Zend_Filter_StringTrim()); $exchangerate->setRequired(true); $exchangerate->addValidator('NotEmpty', false, array('messages' => 'Please enter exchange rate.')); $exchangerate->addValidator("regex", false, array("/^[0-9]+(\\.[0-9]{1,6})?\$/", "messages" => "Please enter valid exchange rate.")); $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date'); $start_date->setAttrib('readonly', 'true'); $start_date->setAttrib('onfocus', 'this.blur()'); $start_date->setOptions(array('class' => 'brdr_none')); $start_date->setRequired(true); $start_date->addValidator('NotEmpty', false, array('messages' => 'Please select start date.')); $end_date = new ZendX_JQuery_Form_Element_DatePicker('end_date'); $end_date->setAttrib('readonly', 'true'); $end_date->setAttrib('onfocus', 'this.blur()'); $end_date->setOptions(array('class' => 'brdr_none')); $end_date->setRequired(true); $end_date->addValidator('NotEmpty', false, array('messages' => 'Please select end 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, $basecurrency, $targetcurrency, $exchangerate, $start_date, $end_date, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'creditcarddetails'); $id = new Zend_Form_Element_Hidden('id'); $user_id = new Zend_Form_Element_Hidden('user_id'); //Card Type....(only alphabets) $cardType = new Zend_Form_Element_Text('card_type'); $cardType->addFilter(new Zend_Filter_StringTrim()); $cardType->setAttrib('maxLength', 50); $cardType->addValidators(array(array('StringLength', false, array('min' => 2, 'max' => 50, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Card type must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Card type must contain at least %min% characters.'))))); $cardType->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); //Card Number.... $cardNum = new Zend_Form_Element_Text('card_number'); $cardNum->addFilters(array('StringTrim', 'StripTags')); $cardNum->setAttrib("maxlength", 16); $cardNum->addValidators(array(array('StringLength', false, array('min' => 16, 'max' => 16, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Card number must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Card number must contain at least %min% characters.'))))); $cardNum->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_empcreditcarddetails', 'field' => 'card_number', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '"'))); $cardNum->getValidator('Db_NoRecordExists')->setMessage('Card number already exists.'); $cardNum->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); //Name on the card .... (only Alphabets) $nameoncard = new Zend_Form_Element_Text('nameoncard'); $nameoncard->addFilter(new Zend_Filter_StringTrim()); $nameoncard->setAttrib('maxLength', 50); $nameoncard->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); // Card Expiration Date .... $card_expired_date = new ZendX_JQuery_Form_Element_DatePicker('card_expiration'); $card_expired_date->setOptions(array('class' => 'brdr_none')); $card_expired_date->setAttrib('readonly', 'true'); $card_expired_date->setAttrib('onfocus', 'this.blur()'); // Expiration Date should be greater than today's date... $card_expired_date->addValidator(new sapp_DateGreaterThanToday()); //Card Code ... $card_code = new Zend_Form_Element_Text('card_code'); $card_code->addFilter(new Zend_Filter_StringTrim()); $card_code->setAttrib('maxLength', 4); $card_code->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 4, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Card code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Card code must contain at least %min% characters.'))))); $card_code->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); //Card issued by....(company name) $card_issuedBy = new Zend_Form_Element_Text('card_issuedby'); $card_issuedBy->addFilter(new Zend_Filter_StringTrim()); $card_issuedBy->setAttrib('maxLength', 50); $card_issuedBy->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); // Form Submit ......... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $user_id, $cardType, $cardNum, $nameoncard, $card_expired_date, $card_issuedBy, $card_code, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('card_expiration')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'reports/userlogreport'); $this->setAttrib('id', 'logreport'); $this->setAttrib('name', 'logreport'); $emprole = new Zend_Form_Element_Select('emp_role'); $emprole->setLabel('Employee Role'); $emprole->setAttrib('onchange', 'changeelement(this)'); $roleModel = new Default_Model_Roles(); $roleList = $roleModel->getRolesList_USERLOG(); $emprole->addMultiOption('', 'Select Employee Role'); foreach ($roleList as $roleid => $rolename) { $emprole->addMultiOption($roleid, $rolename); } $group = new Zend_Form_Element_Select('group'); $group->setLabel('Group'); $group->setAttrib('onchange', 'changeelement(this)'); $groupModel = new Default_Model_Groups(); $groupList = $groupModel->getGroupList(); $group->addMultiOption('', 'Select Group'); foreach ($groupList as $groupid => $groupname) { $group->addMultiOption($groupid, $groupname); } $employeeId = new Zend_Form_Element_Text('employeeIdf'); $employeeId->setAttrib('onblur', 'clearautocompleteuserlog(this)'); $employeeId->addFilter(new Zend_Filter_StringTrim()); $employeeId->setLabel("Employee ID"); $username = new Zend_Form_Element_Text('username'); $username->setAttrib('class', 'formelement'); $username->setAttrib('onblur', 'clearautocompleteuserlog(this)'); $username->addFilter(new Zend_Filter_StringTrim()); $username->setLabel("User Name"); $emailId = new Zend_Form_Element_Text('emailId'); $emailId->setAttrib('onblur', 'clearautocompleteuserlog(this)'); $emailId->addFilter(new Zend_Filter_StringTrim()); $emailId->setLabel("Email"); $logindate = new ZendX_JQuery_Form_Element_DatePicker('logindate'); $logindate->setAttrib('onblur', 'blurelement(this)'); $logindate->setLabel("Login Date"); $logindate->setAttrib('readonly', 'true'); $logindate->setAttrib('onfocus', 'this.blur()'); $logindate->setOptions(array('class' => 'brdr_none')); $ipaddress = new Zend_Form_Element_Text('ipaddress'); $ipaddress->setAttrib('onblur', 'clearautocompleteuserlog(this)'); $ipaddress->addFilter(new Zend_Filter_StringTrim()); $ipaddress->setLabel("Ip Address"); $this->addElements(array($emprole, $group, $employeeId, $username, $emailId, $logindate, $ipaddress)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('logindate')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'dependencydetails'); $id = new Zend_Form_Element_Hidden('id'); $user_id = new Zend_Form_Element_Hidden('user_id'); //Dependent Name ... $dependent_name = new Zend_Form_Element_Text('dependent_name'); $dependent_name->addFilter(new Zend_Filter_StringTrim()); $dependent_name->setRequired(true); $dependent_name->setAttrib("maxlength", 50); $dependent_name->addValidator('NotEmpty', false, array('messages' => 'Please enter dependent name.')); $dependent_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); //Disablity Type $dependent_relation = new Zend_Form_Element_Select('dependent_relation'); $dependent_relation->setRequired(true)->addErrorMessage('Please select dependent relation.'); $dependent_relation->addValidator('NotEmpty', false, array('messages' => 'Please select dependent relation.')); //dependent_custody.... $dependent_custody = new Zend_Form_Element_Select('dependent_custody'); $dependent_custody->addValidator('NotEmpty', false, array('messages' => 'Please select dependent custody code.')); $dependent_custody->setRequired(true)->addErrorMessage('Please select dependent custody code.'); $dependent_custody->addMultiOptions(array('' => 'Select Dependent Custody Code', 'both parents' => 'Both Parents', 'former spouse' => 'Former Spouse', 'subscriber only' => 'Subscriber Only', 'other Or unknown' => 'Other Or Unknown')); //Dependent DOB... $dependent_dob = new ZendX_JQuery_Form_Element_DatePicker('dependent_dob'); $dependent_dob->setOptions(array('class' => 'brdr_none')); $dependent_dob->setAttrib('onchange', 'calcDays("dependent_dob","",this,1)'); $dependent_dob->setRequired(true); $dependent_dob->setAttrib('readonly', 'true'); $dependent_dob->setAttrib('onfocus', 'this.blur()'); $dependent_dob->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); //dependent_age ... $dependent_age = new Zend_Form_Element_Text('dependent_age'); $dependent_age->addFilter(new Zend_Filter_StringTrim()); $dependent_age->setAttrib("maxlength", 3); $dependent_age->setAttrib('readonly', 'true'); $dependent_age->setAttrib('onfocus', 'this.blur()'); //Form Submit.... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $user_id, $dependent_name, $dependent_relation, $dependent_custody, $dependent_dob, $dependent_age, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('dependent_dob')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'empjobhistory'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $positionheld = new Zend_Form_Element_Select('positionheld'); $positionheld->setLabel('Position'); $positionheld->setRegisterInArrayValidator(false); $positionheld->setRequired(true); $positionheld->addValidator('NotEmpty', false, array('messages' => 'Please select position.')); $department = new Zend_Form_Element_Select('department'); $department->setLabel('Department'); $department->setRegisterInArrayValidator(false); $department->setRequired(true); $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.')); $jobtitleid = new Zend_Form_Element_Select('jobtitleid'); $jobtitleid->setLabel('Job Title'); $jobtitleid->setRegisterInArrayValidator(false); $jobtitleid->setRequired(true); $jobtitleid->addValidator('NotEmpty', false, array('messages' => 'Please select job title.')); $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date'); $start_date->setLabel('From'); $start_date->setOptions(array('class' => 'brdr_none')); $start_date->setAttrib('readonly', 'true'); $start_date->setAttrib('onfocus', 'this.blur()'); $end_date = new ZendX_JQuery_Form_Element_DatePicker('end_date'); $end_date->setLabel('To'); $end_date->setOptions(array('class' => 'brdr_none')); $end_date->setAttrib('readonly', 'true'); $end_date->setAttrib('onfocus', 'this.blur()'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $userid, $positionheld, $jobtitleid, $department, $start_date, $end_date, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'reports/activitylogreport'); $this->setAttrib('id', 'activitylog'); $this->setAttrib('name', 'activitylog'); $username = new Zend_Form_Element_Text('username'); $username->setAttrib('onblur', 'clearautoactivity(this)'); $username->addFilter(new Zend_Filter_StringTrim()); $username->setLabel("User Name"); $menu = new Zend_Form_Element_Select('menu'); $menu->setLabel('Menu'); $menu->setAttrib('onchange', 'changeelement(this)'); $menuModel = new Default_Model_Menu(); $menuList = $menuModel->getMenuArrayActivityLogReport(); $menu->addMultiOption('', 'Select Menu'); foreach ($menuList as $menuitem) { $menu->addMultiOption($menuitem['id'], $menuitem['menuName']); } $useraction = new Zend_Form_Element_Select('useraction'); $useraction->setLabel('User Action'); $useraction->setAttrib('onchange', 'changeelement(this)'); $useraction->addMultiOption('', 'Select Action'); $useraction->addMultiOption('1', 'Add'); $useraction->addMultiOption('5', 'Cancel'); $useraction->addMultiOption('3', 'Delete'); $useraction->addMultiOption('2', 'Edit'); $modifieddate = new ZendX_JQuery_Form_Element_DatePicker('modifieddate'); $modifieddate->setAttrib('onblur', 'blurelement(this)'); $modifieddate->setLabel("Modified Date"); $modifieddate->setAttrib('readonly', 'true'); $modifieddate->setAttrib('onfocus', 'this.blur()'); $modifieddate->setOptions(array('class' => 'brdr_none')); $this->addElements(array($username, $menu, $useraction, $modifieddate)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('modifieddate')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'empprobationreview'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $reviewdate = new ZendX_JQuery_Form_Element_DatePicker('reviewdate'); $reviewdate->setOptions(array('class' => 'brdr_none')); $reviewdate->setAttrib('readonly', 'false'); $reviewdate->setRequired(true); $reviewdate->addValidator('NotEmpty', false, array('messages' => 'Please select review date.')); $next_reviewdate = new ZendX_JQuery_Form_Element_DatePicker('next_reviewdate'); $next_reviewdate->setOptions(array('class' => 'brdr_none')); $next_reviewdate->setAttrib('readonly', 'false'); $next_reviewdate->setRequired(true); $next_reviewdate->addValidator('NotEmpty', false, array('messages' => 'Please select next review date.')); $feedback = new Zend_Form_Element_Textarea('feedback'); $feedback->setAttrib('rows', 10); $feedback->setAttrib('cols', 50); $feedback->setAttrib('maxlength', '2000'); $feedback->setRequired(true); $feedback->addValidator('NotEmpty', false, array('messages' => 'Please enter feedback or comments.')); $probationstatus = new Zend_Form_Element_Select("probationstatus"); $probationstatus->setRegisterInArrayValidator(true); $probationstatus->setAttrib("class", "formDataElement"); $probationstatus->addMultiOptions(array('' => 'Select Probation Status', 'Performance Review' => 'Performance Review', 'Probation Complete' => 'Probation Complete', 'Extended' => 'Extended')); $probationstatus->setAttrib('title', 'Probation Status'); $probationstatus->setRequired(true); $probationstatus->addValidator('NotEmpty', false, array('messages' => 'Please select status.')); $submitadd = new Zend_Form_Element_Button('submitbutton'); $submitadd->setAttrib('id', 'submitbuttons'); $submitadd->setAttrib('onclick', 'validatedocumentonsubmit(this)'); $submitadd->setLabel('Save'); $this->addElements(array($id, $userid, $reviewdate, $feedback, $probationstatus, $next_reviewdate, $submitadd)); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'myemployees/add'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'myteamemployee'); $controller_name = Zend_Controller_Front::getInstance()->getRequest()->getControllerName(); $id = new Zend_Form_Element_Hidden('id'); $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null); $userid = new Zend_Form_Element_Hidden('user_id'); $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.')); $employeeId->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_users', 'field' => 'employeeId', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('user_id', 0) . '" '))); $employeeId->getValidator('Db_NoRecordExists')->setMessage('Employee ID already exists. Please try again.'); $prefix_id = new Zend_Form_Element_Select('prefix_id'); $prefix_id->addMultiOption('', 'Select Prefix'); $prefix_id->setLabel("Prefix"); $prefix_id->setRegisterInArrayValidator(false); $prefix_id->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_prefix', 'field' => 'id', 'exclude' => 'isactive = 1'))); $prefix_id->getValidator('Db_RecordExists')->setMessage('Selected prefix is deleted.'); $first_name = new Zend_Form_Element_Text("firstname"); $first_name->setLabel("First Name"); $first_name->setRequired(true); $first_name->addValidator('NotEmpty', false, array('messages' => 'Please enter first name.')); $first_name->setAttrib("class", "formDataElement"); $first_name->setAttrib('maxlength', 50); $first_name->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))); $last_name = new Zend_Form_Element_Text("lastname"); $last_name->setLabel("Last Name"); $last_name->setRequired(true); $last_name->addValidator('NotEmpty', false, array('messages' => 'Please enter last name.')); $last_name->setAttrib("class", "formDataElement"); $last_name->setAttrib('maxlength', 50); $last_name->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))); $modeofentry = new Zend_Form_Element_Select("modeofentry"); $modeofentry->setLabel("Mode of Employment")->addMultiOptions(array('Direct' => 'Direct')); $modeofentry->setAttrib("class", "formDataElement"); if ($id_val == '') { $modeofentry->setRequired(true); $modeofentry->addValidator('NotEmpty', false, array('messages' => 'Please select mode of employment.')); } $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.')); $emprole->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_roles', 'field' => 'id', 'exclude' => 'isactive = 1'))); $emprole->getValidator('Db_RecordExists')->setMessage('Selected role is deleted.'); $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('user_id', 0) . '" '))); $emailaddress->getValidator('Db_NoRecordExists')->setMessage('Email already exists.'); $businessunit = new Zend_Form_Element_Select('businessunit_id'); $businessunit->setRegisterInArrayValidator(false); $businessunit->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_businessunits', 'field' => 'id', 'exclude' => 'isactive = 1'))); $businessunit->getValidator('Db_RecordExists')->setMessage('Selected business unit is deleted.'); $department = new Zend_Form_Element_Select('department_id'); $department->setRegisterInArrayValidator(false); $department->setRequired(true); $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.')); $department->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_departments', 'field' => 'id', 'exclude' => 'isactive = 1'))); $department->getValidator('Db_RecordExists')->setMessage('Selected department is deleted.'); $reportingmanager = new Zend_Form_Element_Select('reporting_manager'); $reportingmanager->setRegisterInArrayValidator(false); $reportingmanager->setRequired(true); $reportingmanager->addValidator('NotEmpty', false, array('messages' => 'Please select reporting manager.')); $reportingmanager->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_users', 'field' => 'id', 'exclude' => 'isactive = 1'))); $reportingmanager->getValidator('Db_RecordExists')->setMessage('Selected reporting manager is inactivated.'); $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); $jobtitle->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_jobtitles', 'field' => 'id', 'exclude' => 'isactive = 1'))); $jobtitle->getValidator('Db_RecordExists')->setMessage('Selected job title is deleted.'); $position = new Zend_Form_Element_Select('position_id'); $position->setLabel("Position"); $position->addMultiOption('', 'Select Position'); $position->setRegisterInArrayValidator(false); $position->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_positions', 'field' => 'id', 'exclude' => 'isactive = 1'))); $position->getValidator('Db_RecordExists')->setMessage('Selected position is deleted.'); $empstatus = new Zend_Form_Element_Select('emp_status_id'); $empstatus->setAttrib('onchange', 'displayempstatusmessage()'); $empstatus->setRegisterInArrayValidator(false); $empstatus->setRequired(true); $empstatus->addValidator('NotEmpty', false, array('messages' => 'Please select employment status.')); $empstatus->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_employmentstatus', 'field' => 'workcodename', 'exclude' => 'isactive = 1'))); $empstatus->getValidator('Db_RecordExists')->setMessage('Selected employment status is deleted.'); $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.')); $date_of_leaving = new ZendX_JQuery_Form_Element_DatePicker('date_of_leaving'); $date_of_leaving->setOptions(array('class' => 'brdr_none')); $date_of_leaving->setAttrib('onchange', 'validatejoiningdate(this)'); $date_of_leaving->setAttrib('readonly', 'true'); $date_of_leaving->setAttrib('onfocus', 'this.blur()'); $yearsofexp = new Zend_Form_Element_Text('years_exp'); $yearsofexp->setAttrib('maxLength', 2); $yearsofexp->addFilter(new Zend_Filter_StringTrim()); $yearsofexp->addValidator("regex", true, array('pattern' => '/^[0-9]\\d{0,1}(\\.\\d*)?$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))); $extension_number = new Zend_Form_Element_Text('extension_number'); $extension_number->setAttrib('maxLength', 4); $extension_number->setLabel("Extension"); $extension_number->addFilter(new Zend_Filter_StringTrim()); $extension_number->addValidator("regex", true, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))); $office_number = new Zend_Form_Element_Text('office_number'); $office_number->setAttrib('maxLength', 10); $office_number->setLabel("Work Telephone Number"); $office_number->addFilter(new Zend_Filter_StringTrim()); $office_number->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9\\+\\-\\)\\(]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.'))); $office_faxnumber = new Zend_Form_Element_Text('office_faxnumber'); $office_faxnumber->setAttrib('maxLength', 15); $office_faxnumber->setLabel("Fax"); $office_faxnumber->addFilter(new Zend_Filter_StringTrim()); $office_faxnumber->addValidator("regex", true, array('pattern' => '/^[0-9\\+\\-\\)\\(]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid fax number.'))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $userid, $reportingmanager, $empstatus, $businessunit, $department, $jobtitle, $position, $prefix_id, $extension_number, $office_number, $office_faxnumber, $yearsofexp, $date_of_joining, $date_of_leaving, $submit, $employeeId, $modeofentry, $emailaddress, $emprole, $first_name, $last_name)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('date_of_joining', 'date_of_leaving')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'timemanagement/expenses/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'expensecategory'); $id = new Zend_Form_Element_Hidden('id'); $client = new Zend_Form_Element_Select('client_id'); $client->addMultiOption('', 'Select Client'); $client->setRegisterInArrayValidator(false); $client->setAttrib('onchange', 'loadProjects(this)'); $client->setRequired(true); $client->addValidator('NotEmpty', false, array('messages' => 'Please select Client.')); $client->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_clients', 'field' => 'id', 'exclude' => 'is_active = 1'))); $client->getValidator('Db_RecordExists')->setMessage('Selected Client is inactivated.'); $project = new Zend_Form_Element_Select('project_id'); $project->addMultiOption('', 'Select Project'); $project->setRegisterInArrayValidator(false); $project->setRequired(true); $project->addValidator('NotEmpty', false, array('messages' => 'Please select Project.')); $project->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_projects', 'field' => 'id', 'exclude' => 'is_active = 1'))); $project->getValidator('Db_RecordExists')->setMessage('Selected Project is inactivated.'); $category = new Zend_Form_Element_Select('expense_cat_id'); $category->addMultiOption('', 'Select Category'); $category->setRegisterInArrayValidator(false); $category->setRequired(true); $category->addValidator('NotEmpty', false, array('messages' => 'Please select Category.')); $category->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_expense_categories', 'field' => 'id', 'exclude' => 'is_active = 1'))); $category->getValidator('Db_RecordExists')->setMessage('Selected Category is inactivated.'); $expenseDate = new ZendX_JQuery_Form_Element_DatePicker('expense_date'); $expenseDate->setOptions(array('class' => 'brdr_none')); //$date_of_leaving->setAttrib('onchange', 'validatejoiningdate(this)'); $expenseDate->setAttrib('readonly', 'true'); $expenseDate->setAttrib('onfocus', 'this.blur()'); $expenseAmount = new Zend_Form_Element_Text('expense_amount'); $expenseAmount->setAttrib('maxLength', 8); $expenseAmount->setLabel("Unit Price"); $expenseAmount->addValidator("regex", true, array('pattern' => '/^[1-9]\\d{1,4}(\\.\\d{1,2})?$/', 'messages' => array('regexNotMatch' => 'Please enter valid Amount.'))); $note = new Zend_Form_Element_Text('note'); $note->setAttrib('maxLength', 200); $note->setLabel("Note"); $billable = new Zend_Form_Element_Radio('is_billable'); $billable->setLabel("Type"); $billable->addMultiOptions(array('1' => 'Yes', '0' => 'No')); $billable->setSeparator(''); $billable->setValue('billable'); $billable->setRegisterInArrayValidator(false); $billable->setRequired(true); $billable->addValidator('NotEmpty', false, array('messages' => 'Please select Type.')); /* client_idbigint(20) unsigned NOT NULL project_idbigint(20) unsigned NOT NULL expense_cat_idint(10) unsigned NOT NULL expense_datetimestamp NOT NULL expense_amountdecimal(8,2) unsigned NOT NULL notevarchar(200) NULL is_billabletinyint(1) unsigned NOT NULL receipt_filevarchar(200) NULL expense_statusenum('saved','submitted','approved','rejected') NULL status_update_datetimestamp NOT NULL status_update_byint(11) NULL reject_notevarchar(200) NULL */ $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $client, $project, $category, $expenseDate, $expenseAmount, $note, $billable, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('expense_date')); }
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('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->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); $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->setAttrib('maxLength', 15); $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); $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); $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.'))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $orgname, $imgerrmsg, $imgerr, $org_image_value, $domain, $orgdescription, $website, $totalemployees, $org_startdate, $phonenumber, $secondaryphone, $faxnumber, $country, $state, $city, $address1, $address2, $address3, $description, $designation, $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('action', DOMAIN . 'employee/add'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'employee'); $controller_name = Zend_Controller_Front::getInstance()->getRequest()->getControllerName(); $id = new Zend_Form_Element_Hidden('id'); $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null); $userid = new Zend_Form_Element_Hidden('user_id'); $reportingmanager = new Zend_Form_Element_Select('reporting_manager'); $reportingmanager->addMultiOption('', 'Select Reporting Manager'); $reportingmanager->setRegisterInArrayValidator(false); if ($controller_name != 'organisationinfo') { $reportingmanager->setRequired(true); $reportingmanager->addValidator('NotEmpty', false, array('messages' => 'Please select reporting manager.')); } $reportingmanager->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_users', 'field' => 'id', 'exclude' => 'isactive = 1'))); $reportingmanager->getValidator('Db_RecordExists')->setMessage('Selected reporting manager is inactivated.'); $emproleStr = Zend_Controller_Front::getInstance()->getRequest()->getParam('emprole', null); $empstatus = new Zend_Form_Element_Select('emp_status_id'); $empstatus->setAttrib('onchange', 'displayempstatusmessage()'); $empstatus->setRegisterInArrayValidator(false); if ($controller_name != 'organisationinfo') { $empstatus->setRequired(true); $empstatus->addValidator('NotEmpty', false, array('messages' => 'Please select employment status.')); } $empstatus->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_employmentstatus', 'field' => 'workcodename', 'exclude' => 'isactive = 1'))); $empstatus->getValidator('Db_RecordExists')->setMessage('Selected employment status is deleted.'); $businessunit = new Zend_Form_Element_Select('businessunit_id'); $businessunit->setAttrib('onchange', 'displayEmployeeDepartments(this,"department_id","")'); $businessunit->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_businessunits', 'field' => 'id', 'exclude' => 'isactive = 1'))); $businessunit->getValidator('Db_RecordExists')->setMessage('Selected business unit is deleted.'); $department = new Zend_Form_Element_Select('department_id'); $department->addMultiOption('', 'Select Department'); $department->setRegisterInArrayValidator(false); $roleArr = array(); if ($controller_name != 'organisationinfo') { //For management 'department is not manditory'...... if ($emproleStr != "") { $roleArr = explode('_', $emproleStr); if (!empty($roleArr)) { if (isset($roleArr[1]) && $roleArr[1] != MANAGEMENT_GROUP) { $department->setRequired(true); $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.')); } } } else { $department->setRequired(true); $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.')); } } $department->setAttrib("onchange", "displayReportingmanagers_emp('department_id','reporting_manager','emprole','id')"); $department->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_departments', 'field' => 'id', 'exclude' => 'isactive = 1'))); $department->getValidator('Db_RecordExists')->setMessage('Selected department is deleted.'); $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); $jobtitle->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_jobtitles', 'field' => 'id', 'exclude' => 'isactive = 1'))); $jobtitle->getValidator('Db_RecordExists')->setMessage('Selected job title is deleted.'); $position = new Zend_Form_Element_Select('position_id'); $position->setLabel("Position"); $position->addMultiOption('', 'Select Position'); $position->setRegisterInArrayValidator(false); $position->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_positions', 'field' => 'id', 'exclude' => 'isactive = 1'))); $position->getValidator('Db_RecordExists')->setMessage('Selected position is deleted.'); $prefix_id = new Zend_Form_Element_Select('prefix_id'); $prefix_id->addMultiOption('', 'Select Prefix'); $prefix_id->setLabel("Prefix"); $prefix_id->setRegisterInArrayValidator(false); $prefix_id->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_prefix', 'field' => 'id', 'exclude' => 'isactive = 1'))); $prefix_id->getValidator('Db_RecordExists')->setMessage('Selected prefix is deleted.'); $extension_number = new Zend_Form_Element_Text('extension_number'); $extension_number->setAttrib('maxLength', 4); $extension_number->setLabel("Extension"); $extension_number->addFilter(new Zend_Filter_StringTrim()); $extension_number->addValidator("regex", true, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))); $office_number = new Zend_Form_Element_Text('office_number'); $office_number->setAttrib('maxLength', 10); $office_number->setLabel("Work Telephone Number"); $office_number->addFilter(new Zend_Filter_StringTrim()); $office_number->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9\\+\\-\\)\\(]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.'))); $office_faxnumber = new Zend_Form_Element_Text('office_faxnumber'); $office_faxnumber->setAttrib('maxLength', 15); $office_faxnumber->setLabel("Fax"); $office_faxnumber->addFilter(new Zend_Filter_StringTrim()); $office_faxnumber->addValidator("regex", true, array('pattern' => '/^[0-9\\+\\-\\)\\(]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid fax number.'))); $yearsofexp = new Zend_Form_Element_Text('years_exp'); $yearsofexp->setAttrib('maxLength', 2); $yearsofexp->addFilter(new Zend_Filter_StringTrim()); $yearsofexp->addValidator("regex", true, array('pattern' => '/^[0-9]\\d{0,1}(\\.\\d*)?$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))); $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.')); $date_of_leaving = new ZendX_JQuery_Form_Element_DatePicker('date_of_leaving'); $date_of_leaving->setOptions(array('class' => 'brdr_none')); $date_of_leaving->setAttrib('onchange', 'validatejoiningdate(this)'); $date_of_leaving->setAttrib('readonly', 'true'); $date_of_leaving->setAttrib('onfocus', 'this.blur()'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); //fields from user management $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.')); $employeeId->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_users', 'field' => 'employeeId', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('user_id', 0) . '" '))); $employeeId->getValidator('Db_NoRecordExists')->setMessage('Employee ID already exists. Please try again.'); /*$userfullname = new Zend_Form_Element_Text("userfullname"); $userfullname->setLabel("Full Name"); $userfullname->setAttrib("class", "formDataElement"); $userfullname->setAttrib('maxlength', 50);*/ $first_name = new Zend_Form_Element_Text("firstname"); $first_name->setLabel("First Name"); $first_name->setAttrib("class", "formDataElement"); $first_name->setAttrib('maxlength', 50); $last_name = new Zend_Form_Element_Text("lastname"); $last_name->setLabel("Last Name"); $last_name->setAttrib("class", "formDataElement"); $last_name->setAttrib('maxlength', 50); $other_modeofentry = new Zend_Form_Element_Text("other_modeofentry"); $other_modeofentry->setLabel("Mode of Employment(Other)"); $other_modeofentry->setAttrib("class", "formDataElement"); $other_modeofentry->setAttrib('maxlength', 50); $modeofentry = new Zend_Form_Element_Select("modeofentry"); $modeofentry->setLabel("Mode of Employment")->addMultiOptions(array('' => 'Select mode of entry', 'Direct' => 'Direct', 'Interview' => 'Interview', 'Other' => 'Other', 'Reference' => 'Reference')); $modeofentry->setAttrib("class", "formDataElement"); if ($controller_name != 'organisationinfo') { if ($id_val == '') { $modeofentry->setRequired(true); $modeofentry->addValidator('NotEmpty', false, array('messages' => 'Please select mode of employment.')); } } $candidatereferredby = new Zend_Form_Element_Select("candidatereferredby"); $candidatereferredby->setRegisterInArrayValidator(false); $candidatereferredby->setLabel("Referred By"); $candidatereferredby->setAttrib("class", "formDataElement"); $rccandidatename = new Zend_Form_Element_Select("rccandidatename"); $rccandidatename->setRegisterInArrayValidator(false); $rccandidatename->setLabel("Candidate Name"); $rccandidatename->setAttrib("class", "formDataElement"); $rccandidatename->setAttrib("onchange", "disp_requisition(this.value,'disp_requi')"); $emailaddress = new Zend_Form_Element_Text("emailaddress"); $modeofentry_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('modeofentry', null); $hid_modeofentry_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('hid_modeofentry', null); if ($modeofentry_val != '' || $hid_modeofentry_val != '') { if ($modeofentry_val == 'Direct' || $hid_modeofentry_val == 'Direct') { /*$userfullname->setRequired(true); $userfullname->addValidator('NotEmpty', false, array('messages' => 'Please enter full name.'));*/ $first_name->setRequired(true); $first_name->addValidator('NotEmpty', false, array('messages' => 'Please enter first name.')); $last_name->setRequired(true); $last_name->addValidator('NotEmpty', false, array('messages' => 'Please enter last name.')); } else { if ($modeofentry_val == 'Other' || $hid_modeofentry_val == 'Direct') { $other_modeofentry->setRequired(true); $other_modeofentry->addValidator('NotEmpty', false, array('messages' => 'Please enter mode of employment(Other).')); $rccandidatename->setRequired(true); $rccandidatename->addValidator('NotEmpty', false, array('messages' => 'Please select candidate name.')); } else { if ($modeofentry_val == 'Reference' || $hid_modeofentry_val == 'Direct') { $candidatereferredby->setRequired(true); $candidatereferredby->addValidator('NotEmpty', false, array('messages' => 'Please select referred by.')); $rccandidatename->setRequired(true); $rccandidatename->addValidator('NotEmpty', false, array('messages' => 'Please select candidate name.')); } else { $empid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null); if ($empid == '') { $rccandidatename->setRequired(true); $rccandidatename->addValidator('NotEmpty', false, array('messages' => 'Please select candidate name.')); } } } } } /*$userfullname->addValidator("regex",true,array( 'pattern'=>'/^([a-zA-Z.]+ ?)+$/', 'messages'=>array( 'regexNotMatch'=>'Please enter only alphabets.' ) ));*/ $first_name->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))); $last_name->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))); $other_modeofentry->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))); $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('user_id', 0) . '" '))); $emailaddress->getValidator('Db_NoRecordExists')->setMessage('Email already exists.'); $role_id = ''; if ($emproleStr) { $rolArr = explode('_', $emproleStr); if (!empty($rolArr)) { if (isset($rolArr[0])) { $role_id = $rolArr[0]; } } } $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.')); $emprole->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'main_roles', 'field' => 'id', 'exclude' => 'isactive = 1 and id="' . $role_id . '" '))); $emprole->getValidator('Db_RecordExists')->setMessage('Selected role is deleted.'); $hid_modeofentry = new Zend_Form_Element_Hidden('hid_modeofentry'); $hid_rccandidatename = new Zend_Form_Element_Hidden('hid_rccandidatename'); $act_inact = new Zend_Form_Element_Checkbox("act_inact"); $disp_requi = new Zend_Form_Element_Text('disp_requi'); $disp_requi->setAttrib('readonly', 'readonly'); $disp_requi->setAttrib('onfocus', 'this.blur()'); //end of fields from user management $this->addElements(array($id, $userid, $reportingmanager, $empstatus, $businessunit, $department, $jobtitle, $position, $prefix_id, $extension_number, $office_number, $office_faxnumber, $yearsofexp, $date_of_joining, $date_of_leaving, $submit, $employeeId, $modeofentry, $candidatereferredby, $rccandidatename, $emailaddress, $emprole, $hid_modeofentry, $hid_rccandidatename, $other_modeofentry, $act_inact, $disp_requi, $first_name, $last_name)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('date_of_joining', 'date_of_leaving')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'visaandimmigrationdetails'); $id = new Zend_Form_Element_Hidden('id'); $user_id = new Zend_Form_Element_Hidden('user_id'); //Passport number....(only alphanumerics) $passport_num = new Zend_Form_Element_Text('passport_number'); $passport_num->addFilter(new Zend_Filter_StringTrim()); $passport_num->setAttrib('maxLength', 20); $passport_num->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid passport number.'))))); $passport_num->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_empvisadetails', 'field' => 'passport_number', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '"'))); $passport_num->getValidator('Db_NoRecordExists')->setMessage('Passport number already exists.'); //passport_issue_date.... $passport_issue_date = new ZendX_JQuery_Form_Element_DatePicker('passport_issue_date'); $passport_issue_date->setOptions(array('class' => 'brdr_none')); $passport_issue_date->setAttrib('readonly', 'true'); $passport_issue_date->setAttrib('onfocus', 'this.blur()'); //Passport Expiration Date .... $passport_expiry_date = new ZendX_JQuery_Form_Element_DatePicker('passport_expiry_date'); $passport_expiry_date->setOptions(array('class' => 'brdr_none')); $passport_expiry_date->setAttrib('readonly', 'true'); $passport_expiry_date->setAttrib('onfocus', 'this.blur()'); // Expiration Date should be greater than today's date... $passport_expiry_date->addValidator(new sapp_DateGreaterThanToday()); //Visa Number ..... $visaNum = new Zend_Form_Element_Text('visa_number'); $visaNum->addFilters(array('StringTrim', 'StripTags')); $visaNum->setAttrib('maxLength', 20); $visaNum->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_empvisadetails', 'field' => 'visa_number', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '"'))); $visaNum->getValidator('Db_NoRecordExists')->setMessage('Visa number already exists.'); //visa_type....(alphanumerics with '-' as only spl character) $visaType = new Zend_Form_Element_Text('visa_type'); $visaType->addFilter(new Zend_Filter_StringTrim()); $visaType->setAttrib('maxLength', 3); $visaType->addValidators(array(array('StringLength', false, array('min' => 2, 'max' => 3, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Visa type code must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Visa type code must contain at least %min% characters'))))); $visaType->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid visa type code.'))))); //Visa issue_date.... $visa_issue_date = new ZendX_JQuery_Form_Element_DatePicker('visa_issue_date'); $visa_issue_date->setOptions(array('class' => 'brdr_none')); $visa_issue_date->setAttrib('readonly', 'true'); $visa_issue_date->setAttrib('onfocus', 'this.blur()'); //Visa Expiration Date .... $visa_expiry_date = new ZendX_JQuery_Form_Element_DatePicker('visa_expiry_date'); $visa_expiry_date->setOptions(array('class' => 'brdr_none')); $visa_expiry_date->setAttrib('readonly', 'true'); $visa_expiry_date->setAttrib('onfocus', 'this.blur()'); // Expiration Date should be greater than today's date... $visa_expiry_date->addValidator(new sapp_DateGreaterThanToday()); //Inine_status ..... $i_nine_status = new Zend_Form_Element_Text('inine_status'); $i_nine_status->addFilter(new Zend_Filter_StringTrim()); $i_nine_status->setAttrib('maxLength', 50); $i_nine_status->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); // Inine_review_date.... $i_nine_review_date = new ZendX_JQuery_Form_Element_DatePicker('inine_review_date'); $i_nine_review_date->setOptions(array('class' => 'brdr_none')); $i_nine_review_date->setAttrib('readonly', 'true'); $i_nine_review_date->setAttrib('onfocus', 'this.blur()'); //issuing_authority ... (only alphabets with spaces) $issue_auth = new Zend_Form_Element_Text('issuing_authority'); $issue_auth->addFilter(new Zend_Filter_StringTrim()); $issue_auth->setAttrib('maxLength', 50); $issue_auth->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); //Ininetyfour_status.... $i_ninetyfour_status = new Zend_Form_Element_Text('ininetyfour_status'); $i_ninetyfour_status->addFilter(new Zend_Filter_StringTrim()); $i_ninetyfour_status->setAttrib('maxLength', 50); $i_nine_status->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))))); //Ininetyfour_expiry_date ... $i_ninetyfour_expiry_date = new ZendX_JQuery_Form_Element_DatePicker('ininetyfour_expiry_date'); $i_ninetyfour_expiry_date->setOptions(array('class' => 'brdr_none')); $i_ninetyfour_expiry_date->setAttrib('readonly', 'true'); $i_ninetyfour_expiry_date->setAttrib('onfocus', 'this.blur()'); // Expiration Date should be greater than today's date... $i_ninetyfour_expiry_date->addValidator(new sapp_DateGreaterThanToday()); // Form Submit ......... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $user_id, $passport_num, $passport_issue_date, $passport_expiry_date, $visaNum, $visaType, $visa_issue_date, $visa_expiry_date, $i_nine_status, $i_nine_review_date, $issue_auth, $i_ninetyfour_status, $i_ninetyfour_expiry_date, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('inine_review_date', 'ininetyfour_expiry_date', 'passport_issue_date', 'passport_expiry_date', 'visa_issue_date', 'visa_expiry_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('enctype', 'multipart/form-data'); $this->setAttrib('name', 'organisationinfo'); $this->setAttrib('action', BASE_URL . 'organisationinfo/addorghead'); $id = new Zend_Form_Element_Hidden('id'); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $firstname_orghead = new Zend_Form_Element_Text('firstname_orghead'); $firstname_orghead->setAttrib('maxLength', 50); $firstname_orghead->addFilter(new Zend_Filter_StringTrim()); $firstname_orghead->setRequired(true); $firstname_orghead->addValidator('NotEmpty', false, array('messages' => 'Please enter first name of organization head.')); $firstname_orghead->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid first name.'))); $lastname_orghead = new Zend_Form_Element_Text('lastname_orghead'); $lastname_orghead->setAttrib('maxLength', 50); $lastname_orghead->addFilter(new Zend_Filter_StringTrim()); $lastname_orghead->setRequired(true); $lastname_orghead->addValidator('NotEmpty', false, array('messages' => 'Please enter last name of organization head.')); $lastname_orghead->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid last name.'))); $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('user_id', 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_head'); $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, $description, $lastname_orghead, $firstname_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_head')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'businessunits/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'businessunits'); $id = new Zend_Form_Element_Hidden('id'); $unitname = new Zend_Form_Element_Text('unitname'); $unitname->setAttrib('maxLength', 50); $unitname->addFilter(new Zend_Filter_StringTrim()); $unitname->setRequired(true); $unitname->addValidator('NotEmpty', false, array('messages' => 'Please enter name.')); $unitname->addValidator("regex", true, array('pattern' => '/^(?![0-9]{4})[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))); $unitname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_businessunits', 'field' => 'unitname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $unitname->getValidator('Db_NoRecordExists')->setMessage('Name already exists.'); $unitcode = new Zend_Form_Element_Text('unitcode'); $unitcode->addFilter(new Zend_Filter_StringTrim()); $unitcode->setRequired(true); $unitcode->setAttrib("maxlength", 4); $unitcode->addValidator('NotEmpty', false, array('messages' => 'Please enter code.')); $unitcode->addValidators(array(array('StringLength', false, array('min' => 2, 'max' => 4, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Code must contain at least %min% characters.'))))); $unitcode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\&\'\\.\\s]+$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid code.'))))); $unitcode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_businessunits', 'field' => 'unitcode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $unitcode->getValidator('Db_NoRecordExists')->setMessage('Code already exists.'); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date'); $start_date->setAttrib('readonly', 'true'); $start_date->setAttrib('onfocus', 'this.blur()'); $start_date->setOptions(array('class' => 'brdr_none')); $country = new Zend_Form_Element_Select('country'); $country->setLabel('country'); $country->setRequired(true); $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $country->setAttrib('onchange', 'displayParticularState_normal(this,"state","state","city")'); $countryModal = new Default_Model_Countries(); $countriesData = $countryModal->fetchAll('isactive=1', 'country'); $country->addMultiOption('', 'Select country'); foreach ($countriesData->toArray() as $data) { $country->addMultiOption($data['country_id_org'], $data['country']); } $country->setRegisterInArrayValidator(false); $state = new Zend_Form_Element_Select('state'); $state->setAttrib('onchange', 'displayParticularCity_normal(this,"city","city","")'); $state->setRegisterInArrayValidator(false); $state->addMultiOption('', 'Select State'); $state->setRequired(true); $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $city = new Zend_Form_Element_Select('city'); $city->setAttrib('class', 'selectoption'); $city->setAttrib('onchange', 'displayCityCode(this)'); $city->setRegisterInArrayValidator(false); $city->addMultiOption('', 'Select City'); $city->setRequired(true); $city->addValidator('NotEmpty', false, array('messages' => 'Please select city.')); $address1 = new Zend_Form_Element_Textarea('address1'); $address1->setAttrib('rows', 10); $address1->setAttrib('cols', 50); $address1->setRequired(true); $address1->addValidator('NotEmpty', false, array('messages' => 'Please enter street address.')); $address2 = new Zend_Form_Element_Textarea('address2'); $address2->setAttrib('rows', 10); $address2->setAttrib('cols', 50); $address3 = new Zend_Form_Element_Textarea('address3'); $address3->setAttrib('rows', 10); $address3->setAttrib('cols', 50); $timezone = new Zend_Form_Element_Select('timezone'); $timezone->setLabel('timezone'); $timezone->setRequired(true); $timezone->addValidator('NotEmpty', false, array('messages' => 'Please select time zone.')); $timezoneModel = new Default_Model_Timezone(); $timezonedata = $timezoneModel->fetchAll('isactive=1', 'timezone'); $timezone->addMultiOption('', 'Select Time zone'); foreach ($timezonedata->toArray() as $data) { $timezone->addMultiOption($data['id'], $data['timezone'] . ' [' . $data['timezone_abbr'] . ']'); } $timezone->setRegisterInArrayValidator(false); $unithead = new Zend_Form_Element_Text('unithead'); $unithead->setLabel('timezone'); $unithead->setAttrib('maxlength', '50'); $unithead->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $unitname, $unitcode, $description, $start_date, $country, $state, $city, $address1, $address2, $address3, $timezone, $unithead, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('start_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'medicalclaims'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); // Type of Injury .... $type = new Zend_Form_Element_Select('type'); $type->setRequired(true)->addErrorMessage('Please select medical claim type.'); $type->addValidator('NotEmpty', false, array('messages' => 'Please select medical claim type.')); $type->addMultiOptions(array('' => 'Select Medical Claim Type', 3 => "Disability", 4 => "Injury", 2 => "Maternity", 1 => "Paternity")); $type->setAttrib('onchange', 'showformFields(this.id,"' . DATE_DESCRIPTION . '")'); // Description or Injury Reason .... $desc = new Zend_Form_Element_Textarea('description'); $desc->setAttrib('rows', 10); $desc->setAttrib('cols', 50); // Injured Date .. $injured_date = new ZendX_JQuery_Form_Element_DatePicker('injured_date'); $injured_date->setAttrib('readonly', 'true'); $injured_date->setAttrib('onfocus', 'this.blur()'); $injured_date->setOptions(array('class' => 'brdr_none')); $injured_date->setRequired(true); $injured_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $injured_date->setAttrib('onchange', 'medicalclaimDates_validation("injured_date","leavebyemp_from_date",this,"",1)'); //Injury Name ... (disable for maternity & paternity types) $injury_name = new Zend_Form_Element_Text('injury_name'); $injury_name->addFilter(new Zend_Filter_StringTrim()); $injury_name->setAttrib('maxLength', 50); $injury_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabetic characters.'))))); // Injury Severity....(enable only for injury type) $injury_severity = new Zend_Form_Element_Select('injury_severity'); $injury_severity->addMultiOptions(array('' => "Select injury severity", 1 => "Major", 2 => "Minor")); $injury_severity->addValidator('NotEmpty', false, array('messages' => 'Please select severity type.')); //Disablity Type (Only for type - 'disablity') $disabilityType = new Zend_Form_Element_Select('disability_type'); $disabilityType->addMultiOptions(array('' => 'Select disability type', 'blindness and visual impairments' => "Blindness and visual impairments", 'health impairments' => "Health Impairments", 'hearing impairments' => "Hearing impairments", 'learning disabilities' => "Learning Disabilities", 'mental illness or emotional disturbances' => "Mental illness or emotional disturbances", 'mobility or orthopedic impairments' => "Mobility or Orthopedic Impairments", 'other impairments' => "Other impairments", 'speech or language impairments' => "Speech or language impairments")); $disabilityType->setAttrib('onchange', 'showdisabilityField(this.id)'); //Other field for disability type.... $other_disability_type = new Zend_Form_Element_Text('other_disability_type'); $other_disability_type->addFilter(new Zend_Filter_StringTrim()); $other_disability_type->setAttrib('maxLength', 50); $other_disability_type->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabetic characters.'))))); //Medical insurer name.... $insurer_name = new Zend_Form_Element_Text('insurer_name'); $insurer_name->addFilter(new Zend_Filter_StringTrim()); $insurer_name->setRequired(true); $insurer_name->setAttrib('maxLength', 50); $insurer_name->addValidator('NotEmpty', false, array('messages' => 'Please enter insurer name.')); $insurer_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid insurer name.'))))); // Date to join... $expected_date_join = new ZendX_JQuery_Form_Element_DatePicker('expected_date_join'); $expected_date_join->setAttrib('readonly', 'true'); $expected_date_join->setAttrib('onfocus', 'this.blur()'); $expected_date_join->setOptions(array('class' => 'brdr_none')); $expected_date_join->setRequired(true); $expected_date_join->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); /* date of joining should be greater than injured/paternity/maternity/disability date */ $expected_date_join->setAttrib('onchange', 'medicalclaimDates_validation("injured_date","expected_date_join",this,"leavebyemp_from_date",5)'); //Leave by Employeer .. to date (approved leave to date) $leavebyemp_to_date = new ZendX_JQuery_Form_Element_DatePicker('leavebyemp_to_date'); $leavebyemp_to_date->setAttrib('readonly', 'true'); $leavebyemp_to_date->setAttrib('onfocus', 'this.blur()'); $leavebyemp_to_date->setOptions(array('class' => 'brdr_none')); $leavebyemp_to_date->setRequired(true); $leavebyemp_to_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); /* Employee applied leave end date should be greater than or equal to start date */ $leavebyemp_to_date->setAttrib('onchange', 'medicalclaimDates_validation("leavebyemp_from_date","leavebyemp_to_date",this,"",2)'); //Leave by Employeer .. from date (approved leave from date) $leavebyemp_from_date = new ZendX_JQuery_Form_Element_DatePicker('leavebyemp_from_date'); $leavebyemp_from_date->setAttrib('readonly', 'true'); $leavebyemp_from_date->setAttrib('onfocus', 'this.blur()'); $leavebyemp_from_date->setOptions(array('class' => 'brdr_none')); $leavebyemp_from_date->setRequired(true); $leavebyemp_from_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); /* Employee applied leave start date should be greater than or equal to injured/paternity/maternity/disability date */ $leavebyemp_from_date->setAttrib('onchange', 'medicalclaimDates_validation("injured_date","leavebyemp_from_date",this,"",1)'); // No of days... $leavebyemp_days = new Zend_Form_Element_Text('leavebyemp_days'); $leavebyemp_days->addFilter(new Zend_Filter_StringTrim()); $leavebyemp_days->setAttrib('readonly', 'true'); $leavebyemp_days->setAttrib('onfocus', 'this.blur()'); //Employee Leave to date.... (employee applied leave to date) $empleave_to_date = new ZendX_JQuery_Form_Element_DatePicker('empleave_to_date'); $empleave_to_date->setAttrib('readonly', 'true'); $empleave_to_date->setAttrib('onfocus', 'this.blur()'); $empleave_to_date->setOptions(array('class' => 'brdr_none')); //Employee Leave from date....(employee applied leave from date) $empleave_from_date = new ZendX_JQuery_Form_Element_DatePicker('empleave_from_date'); $empleave_from_date->setAttrib('readonly', 'true'); $empleave_from_date->setAttrib('onfocus', 'this.blur()'); $empleave_from_date->setOptions(array('class' => 'brdr_none')); // No of days... $empleave_days = new Zend_Form_Element_Text('empleave_days'); $empleave_days->setAttrib('maxLength', 10); $empleave_days->setAttrib('readonly', 'true'); $empleave_days->addFilter(new Zend_Filter_StringTrim()); $empleave_days->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only numeric characters.'))))); //Hospital Name.. $hosp_name = new Zend_Form_Element_Text('hospital_name'); $hosp_name->setAttrib('maxLength', 50); $hosp_name->addFilter(new Zend_Filter_StringTrim()); $hosp_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-z0-9\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid hospital name.'))))); // Hospital Address ....... $hosp_addr = new Zend_Form_Element_Textarea('hospital_addr'); $hosp_addr->setAttrib('rows', 10); $hosp_addr->setAttrib('cols', 50); // Room or ward number...... $room_num = new Zend_Form_Element_Text('room_num'); $room_num->addFilter(new Zend_Filter_StringTrim()); $room_num->setAttrib('maxLength', 5); $room_num->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Room/Ward number must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Room/Ward number must contain at least %min% characters.'))))); $room_num->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\d]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid room number.'))))); // Name of general physician.. $gp_name = new Zend_Form_Element_Text('gp_name'); $gp_name->setAttrib('maxLength', 50); $gp_name->addFilter(new Zend_Filter_StringTrim()); $gp_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-z\\.\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabetic characters.'))))); // Deatils pf treatement provided .. $treatment_details = new Zend_Form_Element_Textarea('treatment_details'); $treatment_details->setAttrib('rows', 10); $treatment_details->setAttrib('cols', 50); // total cost...... $total_cost = new Zend_Form_Element_Text('total_cost'); $total_cost->setAttrib('maxLength', 10); $total_cost->addFilter(new Zend_Filter_StringTrim()); $total_cost->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); // Amount claimed for..... $amount_claimed = new Zend_Form_Element_Text('amount_claimed'); $amount_claimed->setAttrib('maxLength', 10); $amount_claimed->addFilter(new Zend_Filter_StringTrim()); $amount_claimed->setAttrib('onblur', 'validatecost()'); $amount_claimed->setRequired(true); $amount_claimed->addValidator('NotEmpty', false, array('messages' => 'Please enter amount claimed.')); $amount_claimed->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); // Amount approved .... $amount_approved = new Zend_Form_Element_Text('amount_approved'); $amount_approved->setAttrib('maxLength', 10); $amount_approved->addFilter(new Zend_Filter_StringTrim()); $amount_approved->setRequired(true); $amount_approved->addValidator('NotEmpty', false, array('messages' => 'Please enter amount approved.')); $amount_approved->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))))); //Form Submit.... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $userid, $type, $desc, $injured_date, $injury_name, $injury_severity, $insurer_name, $expected_date_join, $leavebyemp_to_date, $leavebyemp_from_date, $leavebyemp_days, $empleave_to_date, $empleave_from_date, $empleave_days, $disabilityType, $other_disability_type, $hosp_name, $hosp_addr, $room_num, $gp_name, $treatment_details, $total_cost, $amount_claimed, $amount_approved, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('injured_date', 'expected_date_join', 'leavebyemp_to_date', 'leavebyemp_from_date', 'empleave_to_date', 'empleave_from_date')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'leaverequest'); $id = new Zend_Form_Element_Hidden('id'); $availableleaves = new Zend_Form_Element_Text('no_of_days'); $availableleaves->setAttrib('readonly', 'true'); $availableleaves->setAttrib('onfocus', 'this.blur()'); $appliedleavesdaycount = new Zend_Form_Element_Text('appliedleavesdaycount'); $appliedleavesdaycount->setAttrib('readonly', 'true'); $appliedleavesdaycount->setAttrib('onfocus', 'this.blur()'); $repmanagerid = new Zend_Form_Element_Text('rep_mang_id'); $repmanagerid->setAttrib('readonly', 'true'); $repmanagerid->setAttrib('onfocus', 'this.blur()'); $issatholiday = new Zend_Form_Element_Hidden('is_sat_holiday'); $leavetypeid = new Zend_Form_Element_Select('leavetypeid'); $leavetypeid->setAttrib('class', 'selectoption'); $leavetypeid->addMultiOption('', 'Select Leave Type'); $leavetypeid->setRegisterInArrayValidator(false); $leavetypeid->setRequired(true); $leavetypeid->addValidator('NotEmpty', false, array('messages' => 'Please select leave type.')); $leaveday = new Zend_Form_Element_Select('leaveday'); $leaveday->setRegisterInArrayValidator(false); $leaveday->setAttrib('onchange', 'hidetodatecalender(this)'); $leaveday->setMultiOptions(array('1' => 'Full Day', '2' => 'Half Day')); $leaveday->setRequired(true); $leaveday->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date'); $from_date->setAttrib('readonly', 'true'); $from_date->setAttrib('onfocus', 'this.blur()'); $from_date->setOptions(array('class' => 'brdr_none')); $from_date->setRequired(true); $from_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $to_date = new ZendX_JQuery_Form_Element_DatePicker('to_date'); $to_date->setAttrib('readonly', 'true'); $to_date->setAttrib('onfocus', 'this.blur()'); $to_date->setAttrib('onblur', 'validate_todate()'); $to_date->setOptions(array('class' => 'brdr_none')); $reason = new Zend_Form_Element_Textarea('reason'); $reason->setAttrib('rows', 10); $reason->setAttrib('cols', 50); $reason->setAttrib('maxlength', '400'); $reason->setRequired(true); $reason->addValidator('NotEmpty', false, array('messages' => 'Please enter reason.')); $leavestatus = new Zend_Form_Element_Text('leavestatus'); $leavestatus->setAttrib('readonly', 'true'); $leavestatus->setAttrib('onfocus', 'this.blur()'); $createddate = new Zend_Form_Element_Text('createddate'); $createddate->setAttrib('readonly', 'true'); $createddate->setAttrib('onfocus', 'this.blur()'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Apply'); $url = "'leaverequest/saveleaverequestdetails/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "''"; $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});")); $this->addElements(array($id, $reason, $availableleaves, $repmanagerid, $leaveday, $from_date, $to_date, $leavetypeid, $issatholiday, $appliedleavesdaycount, $leavestatus, $createddate, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('from_date', 'to_date')); }