public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'workeligibilitydoctypes/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'workeligibilitydoctypes');
     $id = new Zend_Form_Element_Hidden('id');
     $documenttype = new Zend_Form_Element_Text('documenttype');
     $documenttype->setAttrib('maxLength', 50);
     $documenttype->setRequired(true);
     $documenttype->addValidator('NotEmpty', false, array('messages' => 'Please enter document type.'));
     $documenttype->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\\-\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid document type.')));
     $documenttype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_workeligibilitydoctypes', 'field' => 'documenttype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $documenttype->getValidator('Db_NoRecordExists')->setMessage('Document type already exists.');
     $issuingauthority = new Zend_Form_Element_Select('issuingauthority');
     $issuingauthority->setRegisterInArrayValidator(false);
     $issuingauthority->setMultiOptions(array('' => 'Select issuing authority', '1' => 'Country', '2' => 'State', '3' => 'City'));
     $issuingauthority->setRequired(true);
     $issuingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select issuing authority.'));
     $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, $documenttype, $issuingauthority, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #2
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'positions');
     $id = new Zend_Form_Element_Hidden('id');
     $emptyflag = new Zend_Form_Element_Hidden('emptyFlag');
     $positionname = new Zend_Form_Element_Text('positionname');
     $positionname->setAttrib('maxLength', 50);
     $positionname->setRequired(true);
     $positionname->addValidator('NotEmpty', false, array('messages' => 'Please enter position.'));
     $positionname->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 position.')))));
     $positionname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_positions', 'field' => 'positionname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $positionname->getValidator('Db_NoRecordExists')->setMessage('Position already exists.');
     $jobtitleid = new Zend_Form_Element_Select('jobtitleid');
     $jobtitleid->setAttrib('class', 'selectoption');
     $jobtitleid->setRegisterInArrayValidator(false);
     $jobtitleid->addMultiOption('', 'Select Job Title');
     $jobtitleid->setRequired(true);
     $jobtitleid->addValidator('NotEmpty', false, array('messages' => 'Please select job title.'));
     $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, $positionname, $jobtitleid, $description, $emptyflag, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #3
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'timemanagement/expensecategory/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'expensecategory');
     $id = new Zend_Form_Element_Hidden('id');
     $category = new Zend_Form_Element_Text('expense_category');
     $category->setAttrib('maxLength', 200);
     $category->setLabel("Category");
     $category->setRequired(true);
     $category->addValidator('NotEmpty', false, array('messages' => 'Please enter Category.'));
     $category->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid Category.')));
     $category->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'tm_expense_categories', 'field' => 'expense_category', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and is_active=1')));
     $category->getValidator('Db_NoRecordExists')->setMessage('Category already exists.');
     //http://stackoverflow.com/questions/9299012/using-for-decimals-in-zend-validator-float
     $unitPrice = new Zend_Form_Element_Text('unit_price');
     $unitPrice->setAttrib('maxLength', 7);
     $unitPrice->setLabel("Unit Price");
     $unitPrice->addValidator("regex", true, array('pattern' => '/^[1-9]+(\\.\\d{1,2})?$/', 'messages' => array('regexNotMatch' => 'Please enter valid price.')));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $category, $unitPrice, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #4
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'monthslist/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'monthslist');
     $id = new Zend_Form_Element_Hidden('id');
     $monthname = new Zend_Form_Element_Select('month_id');
     $monthname->setAttrib('class', 'selectoption');
     $monthname->setRegisterInArrayValidator(false);
     $monthname->setRequired(true);
     $monthname->addValidator('NotEmpty', false, array('messages' => 'Please select month name.'));
     $monthcode = new Zend_Form_Element_Text('monthcode');
     $monthcode->setAttrib('maxLength', 20);
     $monthcode->addFilter(new Zend_Filter_StringTrim());
     $monthcode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_monthslist', 'field' => 'monthcode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $monthcode->getValidator('Db_NoRecordExists')->setMessage('Month code already exists.');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $url = "'monthslist/saveupdate/format/json'";
     $dialogMsg = "''";
     $toggleDivId = "''";
     $jsFunction = "'redirecttocontroller(\\'monthslist\\');'";
     $this->addElements(array($id, $monthname, $monthcode, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
 private function _setupElements()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setAttrib('id', 'signupForm');
     $this->setTranslator($translate);
     $email = new Zend_Form_Element_Text('email');
     $email->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'email')->addValidator('EmailAddress');
     $email->addValidator(new Ziown_Form_Validate_EmailAddress(), false);
     $email->getValidator('NotEmpty')->setMessage('Email Address is Required', 'isEmpty');
     $username = new Zend_Form_Element_Text('username');
     $username->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'username');
     $username->addValidator(new Ziown_Form_Validate_UserName());
     $username->getValidator('NotEmpty')->setMessage('User name is Required', 'isEmpty');
     $password = new Zend_Form_Element_Password('password');
     $password->setRequired(true)->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'txt-password')->setErrorMessages(array('Password is required'));
     $identValidator = new Zend_Validate_Identical($_POST['password']);
     $identValidator->setMessages(array('notSame' => 'Password doesn\'t match!', 'missingToken' => 'Password doesn\'t match!'));
     $confirm_password = new Zend_Form_Element_Password('confirm_password');
     $confirm_password->setRequired(true)->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'txt-confirm-password')->addValidator($identValidator);
     $signup = new Zend_Form_Element_Submit('signup');
     $signup->setLabel('Sign Up');
     $signup->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'u-login');
     $this->setDecorators(array(array('ViewScript', array('script' => 'signup.phtml'))));
     $this->addElements(array($username, $password, $confirm_password, $signup, $email));
 }
Beispiel #6
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'veteranstatus/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'veteranstatus');
     $id = new Zend_Form_Element_Hidden('id');
     $veteranstatus = new Zend_Form_Element_Text('veteranstatus');
     $veteranstatus->setAttrib('maxLength', 20);
     $veteranstatus->setRequired(true);
     $veteranstatus->addValidator('NotEmpty', false, array('messages' => 'Please enter veteran status.'));
     $veteranstatus->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid veteran status.')))));
     $veteranstatus->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_veteranstatus', 'field' => 'veteranstatus', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $veteranstatus->getValidator('Db_NoRecordExists')->setMessage('Veteran status already exists.');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $url = "'gender/saveupdate/format/json'";
     $dialogMsg = "''";
     $toggleDivId = "''";
     $jsFunction = "'redirecttocontroller(\\'gender\\');'";
     $this->addElements(array($id, $veteranstatus, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     $this->setMethod('post');
     //$this->setAttrib('action',DOMAIN.'language/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'servicedeskdepartment');
     $id = new Zend_Form_Element_Hidden('id');
     $servicedeskdepartment = new Zend_Form_Element_Text("service_desk_name");
     $servicedeskdepartment->setLabel("Category");
     $servicedeskdepartment->setAttrib('maxLength', 30);
     $servicedeskdepartment->addFilter(new Zend_Filter_StringTrim());
     $servicedeskdepartment->setRequired(true);
     $servicedeskdepartment->addValidator('NotEmpty', false, array('messages' => 'Please enter category.'));
     $servicedeskdepartment->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9\\- ]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid category.')));
     $servicedeskdepartment->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_sd_depts', 'field' => 'service_desk_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1')));
     $servicedeskdepartment->getValidator('Db_NoRecordExists')->setMessage('Category name already exists.');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel("Description");
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $servicedeskdepartment, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #8
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'pdcategories');
     $this->setAttrib('name', 'pdcategories');
     $categoryName = new Zend_Form_Element_Text('category');
     $categoryName->setAttrib('id', 'category');
     $categoryName->setAttrib('name', 'category');
     $categoryName->setAttrib('maxlength', '30');
     $categoryName->setAttrib('onblur', 'chkCategory()');
     $categoryName->setAttrib('onkeypress', 'chkCategory()');
     $categoryName->addFilter(new Zend_Filter_StringTrim());
     $categoryName->setRequired(true);
     $categoryName->addValidator('NotEmpty', false, array("messages" => 'Please enter category'));
     $categoryName->addValidator('regex', true, array('pattern' => '/^[a-zA-Z0-9][\\s+[a-zA-Z0-9]+]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid category')));
     $categoryName->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_pd_categories', 'field' => 'category', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive = 1')));
     $categoryName->getValidator('Db_NoRecordExists')->setMessage('Category already exists');
     $categoryDesc = new Zend_Form_Element_Textarea('description');
     $categoryDesc->setAttrib('id', 'description');
     $categoryDesc->setAttrib('name', 'description');
     $categoryDesc->setAttrib('rows', 10);
     $categoryDesc->setAttrib('cols', 50);
     $categoryDesc->setAttrib('maxlength', 250);
     $submitBtn = new Zend_Form_Element_Submit('submit');
     $submitBtn->setAttrib('id', 'submitBtn');
     $submitBtn->setLabel('Add');
     $this->addElements(array($categoryName, $categoryDesc, $submitBtn));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #9
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'emailcontacts');
     $this->setAttrib('action', BASE_URL . 'emailcontacts/add/');
     $id = new Zend_Form_Element_Hidden('id');
     $group_id = new Zend_Form_Element_Select("group_id");
     $group_id->setRegisterInArrayValidator(false);
     $group_id->setRequired(true);
     $group_id->addValidator('NotEmpty', false, array('messages' => 'Please select group.'));
     $business_unit_id = new Zend_Form_Element_Select("business_unit_id");
     $business_unit_id->setRegisterInArrayValidator(false);
     $business_unit_id->setRequired(true);
     $business_unit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
     $business_unit_id->setAttrib('onchange', "bunit_emailcontacts('business_unit_id');");
     //Group Email....
     $grpEmail = new Zend_Form_Element_Text('groupEmail');
     $grpEmail->addFilters(array('StringTrim', 'StripTags'));
     $grpEmail->setRequired(true);
     $grpEmail->addValidator('NotEmpty', false, array('messages' => 'Please enter group email.'));
     $grpEmail->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.')));
     $grpEmail->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_emailcontacts', 'field' => 'groupEmail', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive = 1')));
     $grpEmail->getValidator('Db_NoRecordExists')->setMessage('Group email already exists.');
     // Form Submit .........
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $group_id, $grpEmail, $submit, $business_unit_id));
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'attendancestatuscode/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'attendancestatuscode');
     $id = new Zend_Form_Element_Hidden('id');
     $attendancestatuscode = new Zend_Form_Element_Text('attendancestatuscode');
     $attendancestatuscode->setAttrib('maxLength', 20);
     //$attendancestatuscode->addFilter(new Zend_Filter_StringTrim());
     $attendancestatuscode->setRequired(true);
     $attendancestatuscode->addValidator('NotEmpty', false, array('messages' => 'Please enter attendance status.'));
     $attendancestatuscode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid attendance status.')));
     $attendancestatuscode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_attendancestatuscode', 'field' => 'attendancestatuscode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $attendancestatuscode->getValidator('Db_NoRecordExists')->setMessage('Attendance status already exists.');
     $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, $attendancestatuscode, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #11
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'dashboard/viewprofile');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'profileview');
     $id = new Zend_Form_Element_Hidden('id');
     $userfullname = new Zend_Form_Element_Text("userfullname");
     $userfullname->setLabel("User Name");
     $userfullname->setAttrib("class", "formDataElement");
     $userfullname->setAttrib('length', 70);
     $userfullname->setRequired(true);
     $userfullname->addValidator('NotEmpty', false, array('messages' => 'Please enter user name.'));
     $userfullname->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')));
     $emailaddress = new Zend_Form_Element_Text('emailaddress');
     $emailaddress->setRequired(true);
     $emailaddress->setAttrib('maxLength', 50);
     $emailaddress->setLabel("Email");
     $emailaddress->addFilter('StripTags');
     $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->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_users', 'field' => 'emailaddress', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '"')));
     $emailaddress->getValidator('Db_NoRecordExists')->setMessage('Email already exists.');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $userfullname, $emailaddress, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #12
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'appraisalcategory');
     $id = new Zend_Form_Element_Hidden('id');
     $appraisalcategory = new Zend_Form_Element_Text("category_name");
     $appraisalcategory->setLabel('Parameter');
     $appraisalcategory->setAttrib('maxLength', 30);
     $appraisalcategory->addFilter(new Zend_Filter_StringTrim());
     $appraisalcategory->setRequired(true);
     $appraisalcategory->addValidator('NotEmpty', false, array('messages' => 'Please enter parameter.'));
     $appraisalcategory->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?\',\\/#@$&*()!+]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid parameter.')));
     $appraisalcategory->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_pa_category', 'field' => 'category_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1')));
     $appraisalcategory->getValidator('Db_NoRecordExists')->setMessage('Parameter name already exists.');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel("Description");
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $appraisalcategory, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #13
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'payfrequency/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'payfrequency');
     $id = new Zend_Form_Element_Hidden('id');
     $freqtype = new Zend_Form_Element_Text('freqtype');
     $freqtype->setAttrib('maxLength', 20);
     $freqtype->setLabel("Pay Frequency");
     $freqtype->setRequired(true);
     $freqtype->addValidator('NotEmpty', false, array('messages' => 'Please enter pay frequency type.'));
     $freqtype->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid pay frequency type.')));
     $freqtype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_payfrequency', 'field' => 'freqtype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $freqtype->getValidator('Db_NoRecordExists')->setMessage('Pay frequency type already exists.');
     $freqshortcode = new Zend_Form_Element_Text('freqcode');
     $freqshortcode->setLabel("Short Code");
     $freqshortcode->setAttrib('maxLength', 20);
     $freqshortcode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid pay frequency short code.')));
     $freqshortcode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_payfrequency', 'field' => 'freqcode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $freqshortcode->getValidator('Db_NoRecordExists')->setMessage('Pay frequency short code already exists.');
     $description = new Zend_Form_Element_Textarea('freqdescription');
     $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, $freqtype, $freqshortcode, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #14
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'roles');
     $id = new Zend_Form_Element_Hidden('id');
     $rolename = new Zend_Form_Element_Text('rolename');
     $rolename->setAttrib('maxLength', 50);
     $rolename->setAttrib('title', 'Role name');
     $rolename->addFilter(new Zend_Filter_StringTrim());
     $rolename->setRequired(true);
     $rolename->addValidator('NotEmpty', false, array('messages' => 'Please enter role name.'));
     $rolename->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9 ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid role name.')));
     $rolename->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'rolename', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive!=0')));
     $rolename->getValidator('Db_NoRecordExists')->setMessage('Role name already exists.');
     $rolename->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 50, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role name must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role name must contain at least %min% characters.')))));
     $roletype = new Zend_Form_Element_Text('roletype');
     $roletype->setRequired(true);
     $roletype->setAttrib('maxLength', 25);
     $roletype->setAttrib('title', 'Role type');
     $roletype->addFilter(new Zend_Filter_StringTrim());
     $roletype->addValidator('NotEmpty', false, array('messages' => 'Please enter role type.'));
     $roletype->addValidator("regex", true, array('pattern' => '/^[a-zA-Z]+?$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')));
     $roletype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'roletype', 'exclude' => 'id != "' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive != 0')));
     $roletype->getValidator('Db_NoRecordExists')->setMessage('Role type already exists.');
     $roletype->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 25, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role type must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role type must contain at least %min% characters.')))));
     $roledescription = new Zend_Form_Element_Textarea('roledescription');
     $roledescription->setAttrib('rows', 10);
     $roledescription->setAttrib('cols', 50);
     $roledescription->setAttrib('maxlength', '100');
     $roledescription->setAttrib('title', 'Role description');
     $levelid = new Zend_Form_Element_Hidden('levelid');
     $levelid->addFilter(new Zend_Filter_StringTrim());
     $levelid->setRequired(true);
     $levelid->addValidator('NotEmpty', false, array('messages' => 'Please select level.'));
     $istimeActive = Zend_Controller_Front::getInstance()->getRequest()->getParam('istimeactive');
     $prev_cnt = new Zend_Form_Element_Hidden('prev_cnt');
     $prev_cnt->setRequired(true);
     if ($istimeActive) {
         $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges other than time management.'));
     } else {
         $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges.'));
     }
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $url = "'roles/saveupdate/format/json'";
     $dialogMsg = "''";
     $toggleDivId = "''";
     $jsFunction = "'redirecttocontroller(\\'roles\\');'";
     $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});"));
     $this->addElements(array($id, $rolename, $roletype, $roledescription, $levelid, $submit, $prev_cnt));
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     $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'));
 }
Beispiel #16
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'jobtitles/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'jobtitles');
     $id = new Zend_Form_Element_Hidden('id');
     $emptyflag = new Zend_Form_Element_Hidden('emptyFlag');
     $jobtitlecode = new Zend_Form_Element_Text('jobtitlecode');
     $jobtitlecode->setAttrib('maxLength', 20);
     $jobtitlecode->setRequired(true);
     $jobtitlecode->addValidator('NotEmpty', false, array('messages' => 'Please enter job title code.'));
     $jobtitlecode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid job title code.')));
     $jobtitlecode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_jobtitles', 'field' => 'jobtitlecode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $jobtitlecode->getValidator('Db_NoRecordExists')->setMessage('Job title code already exists.');
     $jobtitlename = new Zend_Form_Element_Text('jobtitlename');
     $jobtitlename->setAttrib('maxLength', 50);
     $jobtitlename->setRequired(true);
     $jobtitlename->addValidator('NotEmpty', false, array('messages' => 'Please enter job title.'));
     $jobtitlename->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\&\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid job title.')));
     $jobdescription = new Zend_Form_Element_Textarea('jobdescription');
     $jobdescription->setAttrib('rows', 10);
     $jobdescription->setAttrib('cols', 50);
     $jobdescription->setAttrib('maxlength', '200');
     $minexperiencerequired = new Zend_Form_Element_Text('minexperiencerequired');
     $minexperiencerequired->setAttrib('maxLength', 4);
     $minexperiencerequired->addFilter(new Zend_Filter_StringTrim());
     $minexperiencerequired->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]\\d{0,1}(\\.\\d*)?$/', 'messages' => array('regexNotMatch' => 'Please enter only numeric characters.')))));
     $jobpaygradecode = new Zend_Form_Element_Text('jobpaygradecode');
     $jobpaygradecode->setAttrib('maxLength', 20);
     $jobpaygradecode->addFilter(new Zend_Filter_StringTrim());
     $jobpaygradecode->setRequired(true);
     $jobpaygradecode->addValidator('NotEmpty', false, array('messages' => 'Please enter job pay grade code.'));
     $jobpayfrequency = new Zend_Form_Element_Select('jobpayfrequency');
     $jobpayfrequency->setLabel('Job pay frequency');
     $jobpayfrequency->addMultiOption('', 'Select Pay Frequency');
     $jobpayfrequency->setRequired(true);
     $jobpayfrequency->addValidator('NotEmpty', false, array('messages' => 'Please select job pay frequency.'));
     $jobpayfrequency->setRegisterInArrayValidator(false);
     $comments = new Zend_Form_Element_Textarea('comments');
     $comments->setAttrib('rows', 10);
     $comments->setAttrib('cols', 50);
     $comments->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $jobtitlecode, $jobtitlename, $jobdescription, $minexperiencerequired, $emptyflag, $jobpaygradecode, $jobpayfrequency, $comments, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #17
0
 public function init()
 {
     $this->setMethod('post');
     //$this->setAttrib('action',BASE_URL.'timemanagement/projects/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'projects');
     $id = new Zend_Form_Element_Hidden('id');
     $invoice_method = new Zend_Form_Element_Hidden('invoice_method');
     $project_name = new Zend_Form_Element_Text('project_name');
     $project_name->setAttrib('maxLength', 100);
     $project_name->setRequired(true);
     $project_name->addValidator('NotEmpty', false, array('messages' => 'Please enter project name.'));
     $project_name->addValidator("regex", true, array('pattern' => '/^(?![0-9]*$)[a-zA-Z0-9.,&\\(\\)\\/\\-_\' ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter a valid project name.')));
     $project_name->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'tm_projects', 'field' => 'project_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and is_active=1')));
     $project_name->getValidator('Db_NoRecordExists')->setMessage('Project name already exists.');
     $projstatus = new Zend_Form_Element_Select('project_status');
     $projstatus->addMultiOption('', 'Select Status');
     $projstatus->addMultiOption('initiated', 'Initiated');
     $projstatus->addMultiOption('draft', 'Draft');
     $projstatus->addMultiOption('in-progress', 'In Progress');
     $projstatus->addMultiOption('hold', 'Hold');
     $projstatus->addMultiOption('completed', 'Completed');
     $projstatus->setRequired(true);
     $projstatus->setRegisterInArrayValidator(false);
     $projstatus->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
     $base_project = new Zend_Form_Element_Select('base_project');
     $base_project->addMultiOption('', 'Select Project');
     $base_project->setRegisterInArrayValidator(false);
     $client = new Zend_Form_Element_Select('client_id');
     $client->addMultiOption('', 'Select Client');
     $client->setRegisterInArrayValidator(false);
     $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.');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '500');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $invoice_method, $project_name, $projstatus, $base_project, $description, $client, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date'));
 }
Beispiel #18
0
 /**
  * A utility function for creating a standard username element for login forms.
  *
  * You must specify the type (`USERNAME_TYPE_EMAIL` or `USERNAME_TYPE_NONEMAIL` and
  * this will add additional validators, etc.
  *
  * @param string $type The type of username expected
  * @param string $name The element name
  * @return Zend_Form_Element_Text The username element
  */
 public static function createUsernameElement($type = self::USERNAME_TYPE_NONEMAIL, $name = 'username')
 {
     $un = new Zend_Form_Element_Text($name);
     $un->setRequired(true)->addValidator('NotEmpty', true)->addFilter('HtmlEntitiesDecode')->addFilter('StripSlashes')->addFilter('StripTags')->addFilter('StringToLower')->addFilter('StringTrim');
     switch ($type) {
         case self::USERNAME_TYPE_EMAIL:
             $un->addValidator('StringLength', false, array(5, 255))->addValidator('EmailAddress', true, array('mx' => false))->setAttrib('class', 'span5 required')->setLabel(_('Email'))->setAttrib('title', _('Email'));
             break;
         case self::USERNAME_TYPE_NONEMAIL:
             $un->setLabel(_('Username'))->setAttrib('title', _('Username'))->setAttrib('class', 'span3 required');
             break;
         default:
             die('Unknown username element type in OSS_Form_Auth_Login::getUsernameElement');
     }
     $un->getValidator('NotEmpty')->setMessage(_('You must enter your username'), Zend_Validate_NotEmpty::IS_EMPTY);
     return $un;
 }
Beispiel #19
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'geographygroup/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'geographygroup');
     $id = new Zend_Form_Element_Hidden('id');
     $geographygroupname = new Zend_Form_Element_Text('geographygroupname');
     $geographygroupname->setAttrib('maxLength', 50);
     $geographygroupname->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid geography group.')))));
     $geographygroupname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_geographygroup', 'field' => 'geographygroupname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $geographygroupname->getValidator('Db_NoRecordExists')->setMessage('Geography group name already exists.');
     $geographyregion = new Zend_Form_Element_Text('geographyregion');
     $geographyregion->setAttrib('maxLength', 20);
     $geographyregion->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid geography region.')));
     $geographycityname = new Zend_Form_Element_Text('geographycityname');
     $geographycityname->setAttrib('maxLength', 20);
     $geographycityname->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid geography city.')))));
     $defaultGeographyGroup = new Zend_Form_Element_Text('defaultGeographyGroup');
     $defaultGeographyGroup->setAttrib('maxLength', 20);
     $defaultGeographyGroup->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid default geography group.')));
     $geographycode = new Zend_Form_Element_Text('geographycode');
     $geographycode->setAttrib('maxLength', 20);
     $geographycode->setRequired(true);
     $geographycode->addValidator('NotEmpty', false, array('messages' => 'Please enter geography code.'));
     $geographycode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid geography code.')));
     $geographycode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_geographygroup', 'field' => 'geographycode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $geographycode->getValidator('Db_NoRecordExists')->setMessage('Geography code already exists.');
     $currency = new Zend_Form_Element_Select('currency');
     $currency->setAttrib('class', 'selectoption');
     $currency->setRegisterInArrayValidator(false);
     $currency->addMultiOption('', 'Select Currency');
     $currencymodel = new Default_Model_Currency();
     $currencymodeldata = $currencymodel->getCurrencyList();
     foreach ($currencymodeldata as $currencyres) {
         $currency->addMultiOption($currencyres['id'], utf8_encode($currencyres['currency']));
     }
     $currency->setRequired(true);
     $currency->addValidator('NotEmpty', false, array('messages' => 'Please select currency.'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $geographygroupname, $geographyregion, $geographycityname, $defaultGeographyGroup, $geographycode, $currency, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     $this->setMethod('post');
     //$this->setAttrib('action',DOMAIN.'language/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'servicedeskrequests');
     $id = new Zend_Form_Element_Hidden('id');
     $servicedeskdepartment = new Zend_Form_Element_Select('service_desk_id');
     $servicedeskdepartment->setLabel("Category");
     $servicedeskdepartment->setAttrib('class', 'selectoption');
     $servicedeskdepartment->addMultiOption('', 'Select category');
     $servicedeskdepartment->setRegisterInArrayValidator(false);
     $servicedeskdepartment->setRequired(true);
     $servicedeskdepartment->addValidator('NotEmpty', false, array('messages' => 'Please select category.'));
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     if ($postid != '') {
         $servicedeskrequest = new Zend_Form_Element_Text("service_request_name");
         $servicedeskrequest->setLabel("Request Type");
         $servicedeskrequest->setAttrib('maxLength', 30);
         $servicedeskrequest->addFilter(new Zend_Filter_StringTrim());
         $servicedeskrequest->setRequired(true);
         $servicedeskrequest->addValidator('NotEmpty', false, array('messages' => 'Please enter request type.'));
         $servicedeskrequest->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9\\- ]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid request type.')));
         $servicedeskrequest->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_sd_reqtypes', 'field' => 'service_request_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND service_desk_id="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('service_desk_id') . '" AND isactive=1')));
         $servicedeskrequest->getValidator('Db_NoRecordExists')->setMessage('Request type already exists for the category.');
         $description = new Zend_Form_Element_Textarea('description');
         $description->setLabel("Description");
         $description->setAttrib('rows', 10);
         $description->setAttrib('cols', 50);
         $description->setAttrib('maxlength', '200');
         $submit = new Zend_Form_Element_Submit('submitbutton');
         $submit->setAttrib('id', 'submitbutton');
         $submit->setLabel('Update');
     }
     $submitadd = new Zend_Form_Element_Button('submitbutton');
     $submitadd->setAttrib('id', 'submitbuttons');
     $submitadd->setAttrib('onclick', 'validaterequestsonsubmit(this)');
     $submitadd->setLabel('Save');
     if ($postid != '') {
         $this->addElements(array($id, $servicedeskdepartment, $servicedeskrequest, $description, $submit));
     } else {
         $this->addElements(array($id, $servicedeskdepartment, $submitadd));
     }
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'appraisalquestions');
     $id = new Zend_Form_Element_Hidden('id');
     $category = new Zend_Form_Element_Select('pa_category_id');
     $category->setLabel("Parameter");
     $category->setAttrib('class', 'selectoption');
     $category->addMultiOption('', 'Select parameter');
     $category->setRegisterInArrayValidator(false);
     $category->setRequired(true);
     $category->addValidator('NotEmpty', false, array('messages' => 'Please select parameter.'));
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     if ($postid != '') {
         $question = new Zend_Form_Element_Text("question");
         $question->setLabel('Question');
         $question->setAttrib('maxLength', 100);
         $question->addFilter(new Zend_Filter_StringTrim());
         $question->setRequired(true);
         $question->addValidator('NotEmpty', false, array('messages' => 'Please enter question.'));
         $question->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?\',\\/#@$&*()!]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid question.')));
         $question->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_pa_questions', 'field' => 'question', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND pa_category_id="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('pa_category_id') . '" AND isactive=1')));
         $question->getValidator('Db_NoRecordExists')->setMessage('Question already exists for the parameter.');
         $description = new Zend_Form_Element_Textarea('description');
         $description->setLabel("Description");
         $description->setAttrib('rows', 10);
         $description->setAttrib('cols', 50);
         $description->setAttrib('maxlength', '200');
     }
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $submitadd = new Zend_Form_Element_Button('submitbutton');
     $submitadd->setAttrib('id', 'submitbuttons');
     $submitadd->setAttrib('onclick', 'validatequestiononsubmit(this)');
     $submitadd->setLabel('Save');
     if ($postid != '') {
         $this->addElements(array($id, $category, $question, $description, $submit));
     } else {
         $this->addElements(array($id, $category, $submitadd));
     }
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #22
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'announcements');
     $this->setAttrib('name', 'announcements');
     $id = new Zend_Form_Element_Hidden('id');
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     if ($loginuserGroup == HR_GROUP) {
         $businessunit_id = new Zend_Form_Element_Select("businessunit_id");
     } else {
         $businessunit_id = new Zend_Form_Element_Multiselect("businessunit_id");
     }
     $businessunit_id->setLabel("Business Units");
     $businessunit_id->setRegisterInArrayValidator(false);
     $businessunit_id->setRequired(true);
     $businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
     $department_id = new Zend_Form_Element_Multiselect("department_id");
     $department_id->setLabel("Departments");
     $department_id->setRegisterInArrayValidator(false);
     $department_id->setRequired(true);
     $department_id->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
     $title = new Zend_Form_Element_Text("title");
     $title->setLabel("Title");
     $title->setAttrib('maxLength', 100);
     $title->addFilter(new Zend_Filter_StringTrim());
     $title->setRequired(true);
     $title->addValidator('NotEmpty', false, array('messages' => 'Please enter title.'));
     $title->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid title.')));
     $title->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_announcements', 'field' => 'title', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1')));
     // Validation for duplicate name is not required
     $title->getValidator('Db_NoRecordExists')->setMessage('Title name already exists.');
     $description = new Zend_Form_Element_Textarea('post_description');
     $description->setLabel("Description");
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setRequired(true);
     $description->addValidator('NotEmpty', false, array('messages' => 'Please enter post.'));
     $this->addElements(array($id, $businessunit_id, $department_id, $title, $description));
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'employeeleavetypes/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'employeeleavetypes');
     $id = new Zend_Form_Element_Hidden('id');
     $leavetype = new Zend_Form_Element_Text('leavetype');
     $leavetype->setAttrib('maxLength', 50);
     $leavetype->addFilter(new Zend_Filter_StringTrim());
     $leavetype->setRequired(true);
     $leavetype->addValidator('NotEmpty', false, array('messages' => 'Please enter leave type.'));
     $leavetype->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\\-\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid leave type.')))));
     $leavetype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_employeeleavetypes', 'field' => 'leavetype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $leavetype->getValidator('Db_NoRecordExists')->setMessage('Leave type already exists.');
     $numberofdays = new Zend_Form_Element_Text('numberofdays');
     $numberofdays->setAttrib('maxLength', 2);
     $numberofdays->addFilter(new Zend_Filter_StringTrim());
     $numberofdays->setRequired(true);
     $numberofdays->addValidator('NotEmpty', false, array('messages' => 'Please enter number of days.'));
     $numberofdays->addValidator("regex", true, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')));
     $leavecode = new Zend_Form_Element_Text('leavecode');
     $leavecode->setAttrib('maxLength', 50);
     $leavecode->addFilter(new Zend_Filter_StringTrim());
     $leavecode->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 leave short code.')))));
     $leavecode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_employeeleavetypes', 'field' => 'leavecode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $leavecode->getValidator('Db_NoRecordExists')->setMessage('Leave Code already exists.');
     $leavepreallocated = new Zend_Form_Element_Select('leavepreallocated');
     $leavepreallocated->setRegisterInArrayValidator(false);
     $leavepreallocated->setMultiOptions(array('1' => 'Yes', '2' => 'No'));
     $leavepredeductable = new Zend_Form_Element_Select('leavepredeductable');
     $leavepredeductable->setRegisterInArrayValidator(false);
     $leavepredeductable->setMultiOptions(array('1' => 'Yes', '2' => 'No'));
     $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, $leavetype, $numberofdays, $leavecode, $leavepreallocated, $leavepredeductable, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #24
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'timemanagement/defaulttasks/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'defaulttasks');
     $id = new Zend_Form_Element_Hidden('id');
     $task = new Zend_Form_Element_Text('task');
     $task->setAttrib('maxLength', 100);
     $task->setRequired(true);
     $task->addValidator('NotEmpty', false, array('messages' => 'Please enter default task.'));
     $task->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([a-zA-Z0-9& ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter a valid default task.')));
     $task->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'tm_tasks', 'field' => 'task', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and is_active=1')));
     $task->getValidator('Db_NoRecordExists')->setMessage('Default task already exists.');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $task, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #25
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'numberformats');
     $id = new Zend_Form_Element_Hidden('id');
     $numberformattype = new Zend_Form_Element_Text('numberformattype');
     $numberformattype->setAttrib('maxLength', 30);
     $numberformattype->setRequired(true);
     $numberformattype->addValidator('NotEmpty', false, array('messages' => 'Please enter number format type.'));
     $numberformattype->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(\\d?\\d?\\d(,\\d\\d\\d)*|\\d+)(\\.\\d\\d)?$/', 'messages' => array('regexNotMatch' => 'Please enter valid number format type.')))));
     $numberformattype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_numberformats', 'field' => 'numberformattype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $numberformattype->getValidator('Db_NoRecordExists')->setMessage('Number format type already exists.');
     $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, $numberformattype, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #26
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'currency/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'currency');
     $id = new Zend_Form_Element_Hidden('id');
     $currencyname = new Zend_Form_Element_Text('currencyname');
     $currencyname->setAttrib('maxLength', 50);
     $currencyname->addFilter(new Zend_Filter_StringTrim());
     $currencyname->setRequired(true);
     $currencyname->addValidator('NotEmpty', false, array('messages' => 'Please enter currency.'));
     $currencyname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid currency.')));
     $currencyname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currency', 'field' => 'currencyname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $currencyname->getValidator('Db_NoRecordExists')->setMessage('Currency already exists.');
     $currencycode = new Zend_Form_Element_Text('currencycode');
     $currencycode->setAttrib('maxLength', 20);
     $currencycode->addFilter(new Zend_Filter_StringTrim());
     $currencycode->setRequired(true);
     $currencycode->addValidator('NotEmpty', false, array('messages' => 'Please enter currency code.'));
     $currencycode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid currency code.')));
     $currencycode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currency', 'field' => 'currencycode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $currencycode->getValidator('Db_NoRecordExists')->setMessage('Currency code already exists.');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $url = "'gender/saveupdate/format/json'";
     $dialogMsg = "''";
     $toggleDivId = "''";
     $jsFunction = "'redirecttocontroller(\\'gender\\');'";
     $this->addElements(array($id, $currencyname, $currencycode, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #27
0
 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'));
 }
Beispiel #28
0
 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'));
 }
Beispiel #29
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'frm_candidate');
     $id = new Zend_Form_Element_Hidden('id');
     $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
     $requisition_id = new Zend_Form_Element_Select("requisition_id");
     $requisition_id->setRegisterInArrayValidator(false);
     $requisition_id->setLabel("Requisition ID");
     $requisition_id->setAttrib("class", "formDataElement");
     $requisition_id->setAttrib('onchange', 'displayParticularCandidates(this,"cand")');
     $requisition_id->setAttrib('title', 'Requisition ID');
     // To give option to user to select either file upload OR fill up form.
     $selected_option = Zend_Controller_Front::getInstance()->getRequest()->getParam('selected_option', null);
     // Below condition is used to skip form validation if the user opt for 'file upload'.
     if ($id_val == '') {
         $requisition_id->setRequired(true);
         $requisition_id->addValidator('NotEmpty', false, array('messages' => 'Please select requisition id.'));
     }
     /*$candidate_name = new Zend_Form_Element_Text('candidate_name');
       $candidate_name->setAttrib('maxLength', 90);
       $candidate_name->setAttrib('title', 'Candidate Name');        
       $candidate_name->addFilter(new Zend_Filter_StringTrim());
       $candidate_name->setRequired(true);
       $candidate_name->addValidator('NotEmpty', false, array('messages' => 'Please enter candidate name.'));  
       $candidate_name->addValidator("regex",true,array(                           
                          'pattern'=>'/^[a-zA-Z.\- ?]+$/',
                          'messages'=>array(
                              'regexNotMatch'=>'Please enter valid candidate name.'
                          )
       	));*/
     $candidate_firstname = new Zend_Form_Element_Text('candidate_firstname');
     $candidate_firstname->setAttrib('maxLength', 50);
     $candidate_firstname->setAttrib('title', 'Candidate First Name');
     $candidate_firstname->addFilter(new Zend_Filter_StringTrim());
     $candidate_firstname->setRequired(true);
     $candidate_firstname->addValidator('NotEmpty', false, array('messages' => 'Please enter candidate first name.'));
     $candidate_firstname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid candidate first name.')));
     $candidate_lastname = new Zend_Form_Element_Text('candidate_lastname');
     $candidate_lastname->setAttrib('maxLength', 50);
     $candidate_lastname->setAttrib('title', 'Candidate Last Name');
     $candidate_lastname->addFilter(new Zend_Filter_StringTrim());
     $candidate_lastname->setRequired(true);
     $candidate_lastname->addValidator('NotEmpty', false, array('messages' => 'Please enter candidate last name.'));
     $candidate_lastname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid candidate last name.')));
     $emailid = new Zend_Form_Element_Text('emailid');
     if ($selected_option == 'fill-up-form') {
         $emailid->setRequired(true);
     }
     $emailid->setAttrib('maxLength', 70);
     $emailid->setAttrib('title', 'Email');
     $emailid->addFilter(new Zend_Filter_StringTrim());
     $emailid->addValidator('NotEmpty', false, array('messages' => 'Please enter email.'));
     $emailid->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid email.')));
     $emailid->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_candidatedetails', 'field' => 'emailid', 'exclude' => 'id != "' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive != 0')));
     $emailid->getValidator('Db_NoRecordExists')->setMessage('Email already exists.');
     $contact_number = new Zend_Form_Element_Text('contact_number');
     if ($selected_option == 'fill-up-form') {
         $contact_number->setRequired(true);
     }
     $contact_number->setAttrib('maxLength', 10);
     $contact_number->setAttrib('title', 'Contact Number.');
     $contact_number->addFilter(new Zend_Filter_StringTrim());
     $contact_number->addValidator('NotEmpty', false, array('messages' => 'Please enter contact number.'));
     $contact_number->addValidator("regex", true, array('pattern' => '/^(?!0{10})([0-9\\+\\-\\)\\(]{10})+$/', 'messages' => array('regexNotMatch' => 'Please enter valid contact number.')));
     $contact_number->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_candidatedetails', 'field' => 'contact_number', 'exclude' => 'id != "' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive != 0')));
     $contact_number->getValidator('Db_NoRecordExists')->setMessage('Contact number already exists.');
     $qualification = new Zend_Form_Element_Text('qualification');
     $qualification->setAttrib('maxLength', 90);
     $qualification->setAttrib('title', 'Qualification.');
     $qualification->addFilter(new Zend_Filter_StringTrim());
     if ($selected_option == 'fill-up-form') {
         $qualification->setRequired(true);
     }
     $qualification->addValidator('NotEmpty', false, array('messages' => 'Please enter qualification.'));
     $qualification->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid qualification.')));
     $experience = new Zend_Form_Element_Text('experience');
     $experience->setAttrib('maxLength', 5);
     $experience->setAttrib('title', 'Work Experience.');
     $experience->addFilter(new Zend_Filter_StringTrim());
     if ($selected_option == 'fill-up-form') {
         $experience->setRequired(true);
     }
     $experience->addValidator('NotEmpty', false, array('messages' => 'Please enter work experience.'));
     $experience->addValidator("regex", true, array('pattern' => '/^([0-9]*\\.?[0-9]{1,2})$/', 'messages' => array('regexNotMatch' => 'Please enter valid experience.')));
     $skillset = new Zend_Form_Element_Textarea('skillset');
     $skillset->setAttrib('rows', 10);
     $skillset->setAttrib('cols', 50);
     $skillset->setAttrib('title', 'Skill Set');
     if ($selected_option == 'fill-up-form') {
         $skillset->setRequired(true);
     }
     $skillset->addValidator('NotEmpty', false, array('messages' => 'Please enter skill set.'));
     $education_summary = new Zend_Form_Element_Textarea('education_summary');
     $education_summary->setAttrib('rows', 10);
     $education_summary->setAttrib('cols', 50);
     $education_summary->setAttrib('title', 'Education Summary.');
     $summary = new Zend_Form_Element_Textarea('summary');
     $summary->setAttrib('rows', 10);
     $summary->setAttrib('cols', 50);
     $summary->setAttrib('title', 'Summary.');
     $cand_location = new Zend_Form_Element_Textarea('cand_location');
     $cand_location->setAttrib('rows', 10);
     $cand_location->setAttrib('cols', 50);
     $cand_location->setAttrib('maxlength', 150);
     $cand_location->setAttrib('title', 'Location.');
     if ($selected_option == 'fill-up-form') {
         $cand_location->setRequired(true);
     }
     $cand_location->addValidator('NotEmpty', false, array('messages' => 'Please enter location.'));
     $country = new Zend_Form_Element_Select("country");
     $country->setRegisterInArrayValidator(false);
     $country->setLabel("Country");
     $country->setAttrib("class", "formDataElement");
     $country->setAttrib('onchange', 'displayParticularState_normal(this,"","state","city")');
     $country->setAttrib('title', 'Country');
     if ($selected_option == 'fill-up-form') {
         $country->setRequired(true);
     }
     $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
     $state = new Zend_Form_Element_Select("state");
     $state->setRegisterInArrayValidator(false);
     if ($selected_option == 'fill-up-form') {
         $state->setRequired(true);
     }
     $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.'));
     $state->addMultiOptions(array('' => 'Select State'));
     $state->setLabel("State");
     $state->setAttrib("class", "formDataElement");
     $state->setAttrib('onchange', 'displayParticularCity_normal(this,"","city","")');
     $state->setAttrib('title', 'State');
     $city = new Zend_Form_Element_Select("city");
     $city->setRegisterInArrayValidator(false);
     $city->addMultiOptions(array('' => 'Select City'));
     $city->setLabel("City");
     $city->setAttrib("class", "formDataElement");
     $city->setAttrib('title', 'City');
     if ($selected_option == 'fill-up-form') {
         $city->setRequired(true);
     }
     $city->addValidator('NotEmpty', false, array('messages' => 'Please select city.'));
     $pincode = new Zend_Form_Element_Text('pincode');
     $pincode->setAttrib('maxLength', 10);
     $pincode->setAttrib('title', 'Postal Code.');
     $pincode->addFilter(new Zend_Filter_StringTrim());
     if ($selected_option == 'fill-up-form') {
         $pincode->setRequired(true);
     }
     $pincode->addValidator('NotEmpty', false, array('messages' => 'Please enter postal code.'));
     $pincode->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Postal code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Postal code must contain at least %min% characters.')))));
     $pincode->addValidator("regex", true, array('pattern' => '/^(?!0{3})[0-9a-zA-Z]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid postal code.')));
     $cand_status = new Zend_Form_Element_Select("cand_status");
     $cand_status->setRegisterInArrayValidator(false);
     $cand_status->setLabel("Status");
     $cand_status->setAttrib("class", "formDataElement");
     $cand_status->setAttrib('title', 'Candidate status');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setAttrib('class', 'cvsbmtbtn');
     $submit->setLabel('Save');
     //start of candidate work details.
     for ($i = 0; $i < 3; $i++) {
         $company_name[$i] = new Zend_Form_Element_Text('txt_cname[' . $i . ']');
         $company_name[$i]->setAttrib('id', 'idtxt_cname' . $i);
         $company_name[$i]->setAttrib('maxlength', 70);
         $company_name[$i]->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\-& ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid company name.')));
         $this->addElement($company_name[$i]);
         $cdesignation[$i] = new Zend_Form_Element_Text('txt_desig[' . $i . ']');
         $cdesignation[$i]->setAttrib('id', 'idtxt_desig' . $i);
         $cdesignation[$i]->setAttrib('maxlength', 40);
         $cdesignation[$i]->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\-& ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid designation.')));
         $this->addElement($cdesignation[$i]);
         $from_date[$i] = new Zend_Form_Element_Text('txt_from[' . $i . ']');
         $from_date[$i]->setAttrib('id', 'idtxt_from' . $i);
         $from_date[$i]->setAttrib('readonly', 'readonly');
         $this->addElement($from_date[$i]);
         $to_date[$i] = new Zend_Form_Element_Text('txt_to[' . $i . ']');
         $to_date[$i]->setAttrib('id', 'idtxt_to' . $i);
         $to_date[$i]->setAttrib('readonly', 'readonly');
         $this->addElement($to_date[$i]);
         $cnumber[$i] = new Zend_Form_Element_Text('txt_cnumber[' . $i . ']');
         $cnumber[$i]->setAttrib('id', 'idtxt_cnumber' . $i);
         $cnumber[$i]->setAttrib('maxlength', 10);
         $cnumber[$i]->addValidator("regex", true, array('pattern' => '/^(?!0{10})([0-9\\+\\-\\)\\(]{10})+$/', 'messages' => array('regexNotMatch' => 'Please enter valid contact number.')));
         $this->addElement($cnumber[$i]);
         $website[$i] = new Zend_Form_Element_Text('txt_website[' . $i . ']');
         $website[$i]->setAttrib('id', 'idtxt_website' . $i);
         $website[$i]->setAttrib('maxlength', 70);
         $website[$i]->addValidator("regex", true, array('pattern' => '/^(http:\\/\\/www|https:\\/\\/www|www)+\\.([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]{2,3})$/', 'messages' => array('regexNotMatch' => 'Please enter valid URL.')));
         $this->addElement($website[$i]);
         $comp_address[$i] = new Zend_Form_Element_Textarea('txt_address[' . $i . ']');
         $comp_address[$i]->setAttrib('id', 'idtxt_address' . $i);
         $this->addElement($comp_address[$i]);
     }
     //end of candidate work details.
     $job_title = new Zend_Form_Element_Text('job_title');
     $job_title->setAttrib('readonly', 'readonly');
     $this->addElements(array($job_title, $cand_status, $id, $requisition_id, $candidate_firstname, $candidate_lastname, $emailid, $contact_number, $qualification, $experience, $skillset, $education_summary, $summary, $cand_location, $country, $state, $city, $pincode, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #30
0
 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'));
 }