public function __construct(array $dataBusinessId, $options = null)
 {
     parent::__construct($options);
     $this->setName('frmEmployee');
     $this->setMethod('post');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Employee name');
     $name->setAttrib('maxlength', 80);
     $name->setRequired(true);
     $name->addValidator(new Zend_Validate_NotEmpty());
     $this->addElement($name);
     $age = new Zend_Form_Element_Text('age');
     $age->setLabel('Employee age');
     $age->addValidator(new Zend_Validate_Int());
     $this->addElement($age);
     $businessId = new Zend_Form_Element_Select('business_id');
     $businessId->setLabel('Business');
     $businessId->setRequired(true);
     $businessId->addValidator(new Zend_Validate_NotEmpty());
     $businessId->addValidator(new Zend_Validate_Int());
     $businessId->addMultiOptions($dataBusinessId);
     $this->addElement($businessId);
     $submit = new Zend_Form_Element_Submit('bt_submit');
     $submit->setLabel('Save');
     $this->addElement($submit);
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'currencyconverter');
     $id = new Zend_Form_Element_Hidden('id');
     $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $basecurrency = new Zend_Form_Element_Select('basecurrency');
     $basecurrency->setAttrib('class', 'selectoption');
     $basecurrency->addMultiOption('', 'Select base currency');
     $basecurrency->setAttrib('onchange', 'displayTargetCurrency(this)');
     $basecurrency->setRegisterInArrayValidator(false);
     $basecurrency->setRequired(true);
     $basecurrency->addValidator('NotEmpty', false, array('messages' => 'Please select base currency.'));
     $targetcurrency = new Zend_Form_Element_Select('targetcurrency');
     $targetcurrency->setAttrib('class', 'selectoption');
     $targetcurrency->addMultiOption('', 'Select target currency');
     $targetcurrency->setRegisterInArrayValidator(false);
     $targetcurrency->setRequired(true);
     $targetcurrency->addValidator('NotEmpty', false, array('messages' => 'Please select target currency.'));
     if ($id_val == '') {
         $targetcurrency->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currencyconverter', 'field' => 'targetcurrency', 'exclude' => 'basecurrency="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('basecurrency') . '" AND targetcurrency="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('targetcurrency') . '" and isactive=1')));
         $targetcurrency->getValidator('Db_NoRecordExists')->setMessage('Currency combination already exists.');
     }
     $exchangerate = new Zend_Form_Element_Text("exchangerate");
     $exchangerate->setAttrib('maxLength', 15);
     $exchangerate->addFilter(new Zend_Filter_StringTrim());
     $exchangerate->setRequired(true);
     $exchangerate->addValidator('NotEmpty', false, array('messages' => 'Please enter exchange rate.'));
     $exchangerate->addValidator("regex", false, array("/^[0-9]+(\\.[0-9]{1,6})?\$/", "messages" => "Please enter valid exchange rate."));
     $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date');
     $start_date->setAttrib('readonly', 'true');
     $start_date->setAttrib('onfocus', 'this.blur()');
     $start_date->setOptions(array('class' => 'brdr_none'));
     $start_date->setRequired(true);
     $start_date->addValidator('NotEmpty', false, array('messages' => 'Please select start date.'));
     $end_date = new ZendX_JQuery_Form_Element_DatePicker('end_date');
     $end_date->setAttrib('readonly', 'true');
     $end_date->setAttrib('onfocus', 'this.blur()');
     $end_date->setOptions(array('class' => 'brdr_none'));
     $end_date->setRequired(true);
     $end_date->addValidator('NotEmpty', false, array('messages' => 'Please select end date.'));
     $description = new Zend_Form_Element_Textarea('description');
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setAttrib('maxlength', '200');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $basecurrency, $targetcurrency, $exchangerate, $start_date, $end_date, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date'));
 }
Exemple #3
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'employee/add');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'empskills');
     $id = new Zend_Form_Element_Hidden('id');
     $userid = new Zend_Form_Element_Hidden('user_id');
     $skillname = new Zend_Form_Element_Text('skillname');
     $skillname->setRequired(true);
     $skillname->setAttrib('maxLength', 50);
     $skillname->addFilter('StripTags');
     $skillname->addFilter('StringTrim');
     $skillname->addValidator('NotEmpty', false, array('messages' => 'Please enter skill.'));
     $yearsofexp = new Zend_Form_Element_Text('yearsofexp');
     $yearsofexp->setAttrib('maxLength', 5);
     $yearsofexp->addFilter(new Zend_Filter_StringTrim());
     $yearsofexp->setRequired(true);
     $yearsofexp->addValidator('NotEmpty', false, array('messages' => 'Please enter years of experience.'));
     $yearsofexp->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]\\d{0,1}(\\.\\d*)?$/', 'messages' => array('regexNotMatch' => 'Please enter numbers less than 100.')))));
     $competencylevelid = new Zend_Form_Element_Select('competencylevelid');
     $competencylevelid->setRequired(true)->addErrorMessage('Please select competency level.');
     $competencylevelid->addValidator('NotEmpty', false, array('messages' => 'Please select competency level.'));
     $competencylevelid->setRegisterInArrayValidator(false);
     $year_skill = new ZendX_JQuery_Form_Element_DatePicker('year_skill_last_used');
     $year_skill->setOptions(array('class' => 'brdr_none'));
     $year_skill->setAttrib('readonly', 'true');
     $year_skill->setAttrib('onfocus', 'this.blur()');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $userid, $skillname, $yearsofexp, $competencylevelid, $year_skill, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('year_skill_last_used'));
 }
Exemple #4
0
 public function __construct($options = null)
 {
     $baseDir = $options['baseDir'];
     parent::__construct($options);
     /****************************************/
     // PARAMETERS
     /****************************************/
     // Build the select to choose the associated form (Parameter #1)
     $blockForm = new Zend_Form_Element_Select('Param1');
     $blockForm->setLabel('Formulaire associé à ce bloc')->setAttrib('class', 'largeSelect');
     $forms = new Form();
     $select = $forms->getFormList();
     $formsArray = $forms->fetchAll($select);
     // Set the default value
     $blockForm->addMultiOption('0', 'Choisir un formulaire');
     //Fill the dropdown list
     foreach ($formsArray as $form) {
         $blockForm->addMultiOption($form['F_ID'], $form['FI_Title']);
     }
     // Test if a value has been chosen
     $at_least_one = new Zend_Validate_GreaterThan('0');
     $at_least_one->setMessage('Vous devez choisir un élément dans la liste.');
     $blockForm->addValidator($at_least_one);
     $this->addElements(array($blockForm));
     $this->removeDisplayGroup('parameters');
     $this->addDisplayGroup(array('Param999', 'Param1'), 'parameters');
     $parameters = $this->getDisplayGroup('parameters');
 }
 public function init()
 {
     $this->setMethod('post')->setAttrib('id', 'frmVenta')->setAttrib('style', 'width: 300px;margin:auto;');
     // Producto
     $e = new Zend_Form_Element_Select('id_producto');
     $e->setLabel('Producto');
     $e->setRequired();
     $_producto = new Application_Model_Producto();
     $e->addMultiOption(-1, '--Producto--');
     $e->addMultiOptions($_producto->getComboValues());
     $e->addValidator(new Zend_Validate_InArray($_producto->getComboValidValues()));
     $this->addElement($e);
     // Cantidad
     $e = new Zend_Form_Element_Text('cantidad');
     $e->setLabel('Cantidad');
     $e->setRequired();
     $e->addValidator(new Zend_Validate_Int(new Zend_Locale('US')));
     $e->addValidator(new Zend_Validate_GreaterThan(0));
     $e->addValidator(new Zend_Validate_LessThan(100));
     $this->addElement($e);
     // AddVentaDetalles
     $e = new Zend_Form_Element_Hidden('is_detalle');
     $e->setValue(true);
     $e->setRequired();
     $this->addElement($e);
     //Submit
     $e = new Zend_Form_Element_Submit('submit');
     $e->setLabel('Agregar');
     $this->addElement($e);
 }
Exemple #6
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'states/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'states');
     $id = new Zend_Form_Element_Hidden('id');
     $country = new Zend_Form_Element_Select('countryid');
     $country->setAttrib('class', 'selectoption');
     $country->setAttrib('onchange', 'displayParticularState(this,"otheroption","state","")');
     $country->setRegisterInArrayValidator(false);
     $country->addMultiOption('', 'Select Country');
     $country->setRequired(true);
     $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
     $state = new Zend_Form_Element_Multiselect('state');
     $state->setAttrib('onchange', 'displayStateCode(this)');
     $state->setRegisterInArrayValidator(false);
     $state->setRequired(true);
     $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.'));
     $state->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_states', 'field' => 'state_id_org', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $state->getValidator('Db_NoRecordExists')->setMessage('State already exists.');
     $otherstatename = new Zend_Form_Element_Text('otherstatename');
     $otherstatename->setAttrib('maxLength', 20);
     $otherstatename->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[^ ][a-zA-Z\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid state name.')))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $country, $state, $otherstatename, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Exemple #7
0
 /** Initialize this form. */
 public function init()
 {
     $this->setName('sizequota_admin');
     $this->setMethod('POST');
     $csrf = new Midas_Form_Element_Hash('csrf');
     $csrf->setSalt('f6g5NzqPWAunkSykbBpmTmpH');
     $csrf->setDecorators(array('ViewHelper'));
     $defaultUserQuotaValue = new Zend_Form_Element_Text(MIDAS_SIZEQUOTA_DEFAULT_USER_QUOTA_VALUE_KEY);
     $defaultUserQuotaValue->setLabel('Default User Quota');
     $defaultUserQuotaValue->addValidator('Float', true);
     $defaultUserQuotaValue->addValidator('Between', true, array('min' => 0, 'max' => PHP_INT_MAX));
     $defaultUserQuotaUnit = new Zend_Form_Element_Select(MIDAS_SIZEQUOTA_DEFAULT_USER_QUOTA_UNIT_KEY);
     $defaultUserQuotaUnit->setLabel('Unit');
     $defaultUserQuotaUnit->setRequired(true);
     $defaultUserQuotaUnit->addValidator('NotEmpty', true);
     $defaultUserQuotaUnit->addMultiOptions(array(MIDAS_SIZE_B => 'B', MIDAS_SIZE_KB => 'KB', MIDAS_SIZE_MB => 'MB', MIDAS_SIZE_GB => 'GB', MIDAS_SIZE_TB => 'TB'));
     $this->addDisplayGroup(array($defaultUserQuotaValue, $defaultUserQuotaUnit), 'default_user_quota');
     $defaultCommunityQuotaValue = new Zend_Form_Element_Text(MIDAS_SIZEQUOTA_DEFAULT_COMMUNITY_QUOTA_VALUE_KEY);
     $defaultCommunityQuotaValue->setLabel('Default Community Quota');
     $defaultCommunityQuotaValue->addValidator('Float', true);
     $defaultCommunityQuotaValue->addValidator('Between', true, array('min' => 0, 'max' => PHP_INT_MAX));
     $defaultCommunityQuotaUnit = new Zend_Form_Element_Select(MIDAS_SIZEQUOTA_DEFAULT_COMMUNITY_QUOTA_UNIT_KEY);
     $defaultCommunityQuotaUnit->setLabel('Unit');
     $defaultCommunityQuotaUnit->setRequired(true);
     $defaultCommunityQuotaUnit->addValidator('NotEmpty', true);
     $defaultCommunityQuotaUnit->addMultiOptions(array(MIDAS_SIZE_B => 'B', MIDAS_SIZE_KB => 'KB', MIDAS_SIZE_MB => 'MB', MIDAS_SIZE_GB => 'GB', MIDAS_SIZE_TB => 'TB'));
     $this->addDisplayGroup(array($defaultCommunityQuotaValue, $defaultCommunityQuotaUnit), 'default_community_quota');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Save');
     $this->addElements(array($csrf, $defaultUserQuotaValue, $defaultUserQuotaUnit, $defaultCommunityQuotaValue, $defaultCommunityQuotaUnit, $submit));
 }
Exemple #8
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'));
 }
 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'));
 }
Exemple #10
0
 /** Initialize this form. */
 public function init()
 {
     $this->setName('sizequota_folder');
     $this->setAction($this->getView()->baseUrl('/sizequota/folder/submit'));
     $this->setMethod('POST');
     $csrf = new Midas_Form_Element_Hash('csrf');
     $csrf->setSalt('FDXuUnSDkUE7Anh2kqgca8zv');
     $csrf->setDecorators(array('ViewHelper'));
     $folderId = new Zend_Form_Element_Hidden('folder_id');
     $folderId->setDecorators(array('ViewHelper'));
     $useDefaultFolderQuota = new Zend_Form_Element_Checkbox('use_default_folder_quota');
     $useDefaultFolderQuota->setLabel('Use Default Folder Quota');
     $folderQuotaValue = new Zend_Form_Element_Text('folder_quota_value');
     $folderQuotaValue->setLabel('Quota');
     $folderQuotaValue->addValidator('Float', true);
     $folderQuotaValue->addValidator('Between', true, array('min' => 0, 'max' => PHP_INT_MAX));
     $folderQuotaUnit = new Zend_Form_Element_Select('folder_quota_unit');
     $folderQuotaUnit->setLabel('Unit');
     $folderQuotaUnit->setRequired(true);
     $folderQuotaUnit->addValidator('NotEmpty', true);
     $folderQuotaUnit->addMultiOptions(array(MIDAS_SIZE_B => 'B', MIDAS_SIZE_KB => 'KB', MIDAS_SIZE_MB => 'MB', MIDAS_SIZE_GB => 'GB', MIDAS_SIZE_TB => 'TB'));
     $this->addDisplayGroup(array($useDefaultFolderQuota, $folderQuotaValue, $folderQuotaUnit), 'global');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Save');
     $this->addElements(array($csrf, $folderId, $useDefaultFolderQuota, $folderQuotaValue, $folderQuotaUnit, $submit));
 }
Exemple #11
0
 function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->addAttribs(array('id' => 'addGroup', 'class' => ''));
     $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
     $control = new Zend_Form_Element_Hidden('control');
     $control->setValue('addGroup');
     $this->addElement($control);
     // begin inputs
     $name = new Zend_Form_Element_Text('name');
     $name->setAttribs(array('class' => 'text validate[required] rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_category_name')));
     $name->setRequired(true);
     $this->addElement($name);
     // begin inputs
     $color = new Zend_Form_Element_Text('color');
     $color->setAttribs(array('class' => 'text validate[required] rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_color_for_charts')));
     $color->setRequired(true);
     $this->addElement($color);
     // begin inputs
     $type = new Zend_Form_Element_Select('type');
     $options = array('' => Zend_Registry::get('translate')->_('admin_category_select_type'), '0' => Zend_Registry::get('translate')->_('admin_expenses'), '1' => Zend_Registry::get('translate')->_('admin_income'));
     $type->setMultiOptions($options);
     $type->addValidator(new Zend_Validate_InArray(array_keys($options)));
     $type->setAttribs(array('class' => 'select', 'id' => 'type'));
     $type->setRequired(true);
     $this->addElement($type);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setValue(Zend_Registry::get('translate')->_('admin_add'));
     $submit->setAttribs(array('class' => 'submit'));
     $submit->setIgnore(true);
     $this->addElement($submit);
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'employmentstatus/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'employmentstatus');
     $id = new Zend_Form_Element_Hidden('id');
     $workcode = new Zend_Form_Element_Text('workcode');
     $workcode->setAttrib('maxLength', 20);
     $workcode->setRequired(true);
     $workcode->addValidator('NotEmpty', false, array('messages' => 'Please enter work short code.'));
     $workcode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid work short code.')));
     $workcodename = new Zend_Form_Element_Select('workcodename');
     $workcodename->setAttrib('class', 'selectoption');
     $workcodename->setRegisterInArrayValidator(false);
     $workcodename->setRequired(true);
     $workcodename->addValidator('NotEmpty', false, array('messages' => 'Please select work code.'));
     $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, $workcode, $workcodename, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
 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'));
 }
Exemple #14
0
 public function init()
 {
     $model_countries = new Locale_Model_Languages();
     $model_t_keys = new Locale_Model_TranslateKeys();
     $key_id = new Zend_Form_Element_Select('key_id');
     $key_id->addValidator(new Zend_Validate_Digits(), true);
     $key_id->setLabel('Key');
     $key_id->setRequired(true);
     $key_id->setMultiOptions($model_t_keys->getIdAndKeyArray(true));
     $this->addElement($key_id);
     $country_id = new Zend_Form_Element_Select('language_id');
     $country_id->addValidator(new Zend_Validate_Digits(), true);
     $country_id->setLabel('Language');
     $country_id->setRequired(true);
     $country_id->setMultiOptions($model_countries->getIdAndNameArray());
     $this->addElement($country_id);
     $value = new My_Form_Element_CKEditor('value');
     $value->setLabel('Translation');
     $value->setDescription('Tags for dynamic values: {1}, {2}, {3}...Double quotes (")are not allowed');
     $this->addElement($value);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setLabel('Cancel');
     $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black');
     $cancel->setAttrib("onClick", "window.location = window.location.origin+'/locale/translate-messages/'");
     $this->addElement($cancel);
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setAttrib('class', 'btn btn-primary');
     $submit->setLabel('Confirm');
     $this->setAction('')->setMethod('post')->addElement($submit);
 }
Exemple #15
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oFileName = new Zend_Form_Element_Select("file_name");
     $oFileName->setLabel("Plik css:");
     $oFileName->setRequired(TRUE);
     $oFileName->addValidator(new Zend_Validate_InArray(array_keys($this->_aAllFile)));
     $oFileName->addMultiOptions($this->_aAllFile);
     $oFileName->setAttrib("class", "valid");
     $this->addElement($oFileName);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "submit");
     $oSubmit->setLabel("Wczytaj plik");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
Exemple #16
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'));
 }
 function __construct($user)
 {
     parent::__construct();
     $this->setName('Registration');
     $this->setMethod('POST');
     $this->setAction('/user/update');
     $gender = new Zend_Form_Element_Select('gender');
     $gender->setLabel('Gender');
     $gender->setMultiOptions(array('Male' => 'Male', 'Female' => 'Female'));
     $gender->setValue($user->gender);
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email');
     $email->setValue($user->email);
     $email->setRequired(true);
     $email->addValidator('NotEmpty', true);
     $email->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
     $paymentEmail = new Zend_Form_Element_Text('paymentEmail');
     $paymentEmail->setLabel('Payment Email');
     $paymentEmail->setRequired(true);
     $paymentEmail->addValidator('NotEmpty', true);
     $paymentEmail->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
     $paymentEmail->setValue($user->paymentEmail);
     $countries = new Zend_Form_Element_Select('country');
     $countries->setMultiOptions(self::getCountries());
     $countries->setLabel('Country');
     $countries->addValidator('NotEmpty');
     $countries->setValue($user->country);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Update');
     $this->addElements(array($gender, $email, $paymentEmail, $countries, $submit));
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'emppersonaldetails');
     $id = new Zend_Form_Element_Hidden('id');
     $userid = new Zend_Form_Element_Hidden('user_id');
     $genderid = new Zend_Form_Element_Select('genderid');
     $genderid->addMultiOption('', 'Select Gender');
     $genderid->setRegisterInArrayValidator(false);
     $genderid->setRequired(true);
     $genderid->addValidator('NotEmpty', false, array('messages' => 'Please select gender.'));
     $maritalstatusid = new Zend_Form_Element_Select('maritalstatusid');
     $maritalstatusid->addMultiOption('', 'Select Marital Status');
     $maritalstatusid->setRegisterInArrayValidator(false);
     $maritalstatusid->setRequired(true);
     $maritalstatusid->addValidator('NotEmpty', false, array('messages' => 'Please select marital status.'));
     $ethniccodeid = new Zend_Form_Element_Select('ethniccodeid');
     $ethniccodeid->addMultiOption('', 'Select Ethnic Code');
     $ethniccodeid->setLabel('Ethnic Code');
     $ethniccodeid->setRegisterInArrayValidator(false);
     $racecodeid = new Zend_Form_Element_Select('racecodeid');
     $racecodeid->addMultiOption('', 'Select Race Code');
     $racecodeid->setLabel('Race Code');
     $racecodeid->setRegisterInArrayValidator(false);
     $languageid = new Zend_Form_Element_Select('languageid');
     $languageid->addMultiOption('', 'Select Language');
     $languageid->setLabel('Language');
     $languageid->setRegisterInArrayValidator(false);
     $nationalityid = new Zend_Form_Element_Select('nationalityid');
     $nationalityid->addMultiOption('', 'Select Nationality');
     $nationalityid->setRegisterInArrayValidator(false);
     $nationalityid->setRequired(true);
     $nationalityid->addValidator('NotEmpty', false, array('messages' => 'Please select nationality.'));
     $dob = new ZendX_JQuery_Form_Element_DatePicker('dob');
     $dob->setOptions(array('class' => 'brdr_none'));
     $dob->setRequired(true);
     $dob->setAttrib('readonly', 'true');
     $dob->setAttrib('onfocus', 'this.blur()');
     $dob->addValidator('NotEmpty', false, array('messages' => 'Please select date of birth.'));
     //DOB should not be current date....
     $celebrated_dob = new ZendX_JQuery_Form_Element_DatePicker('celebrated_dob');
     $celebrated_dob->setOptions(array('class' => 'brdr_none'));
     $celebrated_dob->setAttrib('readonly', 'true');
     $celebrated_dob->setAttrib('onfocus', 'this.blur()');
     $bloodgroup = new Zend_Form_Element_Text('bloodgroup');
     $bloodgroup->setAttrib('size', 5);
     $bloodgroup->setAttrib('maxlength', 10);
     /*$submit = new Zend_Form_Element_Submit('submit');
     		$submit->setAttrib('id', 'submitbutton');
     		$submit->setLabel('Save');*/
     $submitadd = new Zend_Form_Element_Button('submitbutton');
     $submitadd->setAttrib('id', 'submitbuttons');
     $submitadd->setAttrib('onclick', 'validatedocumentonsubmit(this)');
     $submitadd->setLabel('Save');
     $this->addElements(array($id, $userid, $genderid, $maritalstatusid, $nationalityid, $ethniccodeid, $racecodeid, $languageid, $dob, $celebrated_dob, $bloodgroup, $submitadd));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('dob', 'celebrated_dob'));
 }
Exemple #19
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'));
 }
Exemple #20
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'empjobhistory');
     $id = new Zend_Form_Element_Hidden('id');
     $userid = new Zend_Form_Element_Hidden('user_id');
     $positionheld = new Zend_Form_Element_Select('positionheld');
     $positionheld->setLabel('Position');
     $positionheld->setRegisterInArrayValidator(false);
     // $positionheld->setRequired(true);
     // $positionheld->addValidator('NotEmpty', false, array('messages' => 'Please select position.'));
     $department = new Zend_Form_Element_Select('department');
     $department->setLabel('Department');
     $department->setRegisterInArrayValidator(false);
     // $department->setRequired(true);
     // $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
     $jobtitleid = new Zend_Form_Element_Select('jobtitleid');
     $jobtitleid->setLabel('Job Title');
     $jobtitleid->setRegisterInArrayValidator(false);
     // $jobtitleid->setRequired(true);
     // $jobtitleid->addValidator('NotEmpty', false, array('messages' => 'Please select job title.'));
     $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date');
     $start_date->setLabel('From');
     $start_date->setOptions(array('class' => 'brdr_none'));
     $start_date->setAttrib('readonly', 'true');
     $start_date->setAttrib('onfocus', 'this.blur()');
     $start_date->setRequired(true);
     $start_date->addValidator('NotEmpty', false, array('messages' => 'Please enter start date.'));
     $end_date = new ZendX_JQuery_Form_Element_DatePicker('end_date');
     $end_date->setLabel('To');
     $end_date->setOptions(array('class' => 'brdr_none'));
     $end_date->setAttrib('readonly', 'true');
     $end_date->setAttrib('onfocus', 'this.blur()');
     $received_amount = new Zend_Form_Element_Text("received_amount");
     $received_amount->setLabel("Amount Received");
     $received_amount->setAttrib('maxLength', 10);
     $received_amount->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9\\.]*$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')))));
     $paid_amount = new Zend_Form_Element_Text("paid_amount");
     $paid_amount->setLabel("Amount Paid");
     $paid_amount->setAttrib('maxLength', 10);
     $paid_amount->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9\\.]*$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')))));
     $client = new Zend_Form_Element_Select('client');
     $client->setLabel('Client');
     $client->setRegisterInArrayValidator(false);
     $client->setRequired(true);
     $client->addValidator('NotEmpty', false, array('messages' => 'Please select a client.'));
     $vendor = new Zend_Form_Element_Text("vendor");
     $vendor->setLabel("Vendor");
     $vendor->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.&\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter a valid vendor name.')));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $userid, $positionheld, $jobtitleid, $department, $start_date, $end_date, $received_amount, $paid_amount, $client, $vendor, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date'));
 }
Exemple #21
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'countries/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'countries');
     $id = new Zend_Form_Element_Hidden('id');
     $country = new Zend_Form_Element_Select('country');
     $country->setAttrib('class', 'selectoption');
     $country->setAttrib('onchange', 'displayCountryCode(this)');
     $country->setRegisterInArrayValidator(false);
     $country->addMultiOption('', 'Select Country');
     $countrymodel = new Default_Model_Countries();
     $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
     $actionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     if ($id_val == '' || $actionName == 'view') {
         $countrymodeldata = $countrymodel->getTotalCountriesList('addcountry');
         foreach ($countrymodeldata as $countryres) {
             $country->addMultiOption($countryres['id'], utf8_encode($countryres['country_name']));
         }
         $country->addMultiOption('other', 'Other');
     }
     $country->setRequired(true);
     $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
     $country->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_countries', 'field' => 'country_id_org', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $country->getValidator('Db_NoRecordExists')->setMessage('Country already exists.');
     $countrycode = new Zend_Form_Element_Text('countrycode');
     $countrycode->setAttrib('maxLength', 20);
     $countrycode->setAttrib('readonly', true);
     $countrycode->setAttrib('onfocus', 'this.blur()');
     $countrycode->setRequired(true);
     $countrycode->addValidator('NotEmpty', false, array('messages' => 'Please enter country code.'));
     $countrycode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid country code.')));
     $citizenship = new Zend_Form_Element_Text('citizenship');
     $citizenship->setAttrib('maxLength', 20);
     $citizenship->setRequired(true);
     $citizenship->addValidator('NotEmpty', false, array('messages' => 'Please enter citizenship.'));
     $citizenship->addValidator("regex", true, array('pattern' => '/^[a-zA-Z\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid citizenship.')));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $country, $countrycode, $citizenship, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'educationdetails');
     $this->setAttrib('action', DOMAIN . 'educationdetails/addpopup/');
     $id = new Zend_Form_Element_Hidden('id');
     $user_id = new Zend_Form_Element_Hidden('user_id');
     $educationlevel = new Zend_Form_Element_Select('educationlevel');
     $educationlevel->setLabel("Education Level");
     $educationlevel->setRegisterInArrayValidator(false);
     $educationlevel->setRequired(true);
     $educationlevel->addValidator('NotEmpty', false, array('messages' => 'Please select educational level.'));
     //institution_name ...
     $institution_name = new Zend_Form_Element_Text('institution_name');
     $institution_name->addFilter(new Zend_Filter_StringTrim());
     $institution_name->setRequired(true);
     $institution_name->setAttrib("maxlength", 50);
     $institution_name->addValidator('NotEmpty', false, array('messages' => 'Please enter institution name.'));
     $institution_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')))));
     //course ...
     $course = new Zend_Form_Element_Text('course');
     $course->addFilter(new Zend_Filter_StringTrim());
     $course->setRequired(true);
     $course->setAttrib("maxlength", 50);
     $course->addValidator('NotEmpty', false, array('messages' => 'Please enter course name.'));
     $course->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\.\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course name.')))));
     //from_date..
     $from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date');
     $from_date->setOptions(array('class' => 'brdr_none'));
     $from_date->setRequired(true);
     $from_date->setAttrib('readonly', 'true');
     $from_date->setAttrib('onfocus', 'this.blur()');
     $from_date->addValidator('NotEmpty', false, array('messages' => 'Please select from date.'));
     //to_date
     $to_date = new ZendX_JQuery_Form_Element_DatePicker('to_date');
     $to_date->setOptions(array('class' => 'brdr_none'));
     $to_date->setRequired(true);
     $to_date->setAttrib('readonly', 'true');
     $to_date->setAttrib('onfocus', 'this.blur()');
     $to_date->addValidator('NotEmpty', false, array('messages' => 'Please select to date.'));
     // percentage...
     $percentage = new Zend_Form_Element_Text('percentage');
     $percentage->addFilter(new Zend_Filter_StringTrim());
     $percentage->setRequired(true);
     $percentage->setAttrib("maxlength", 2);
     $percentage->addValidator('NotEmpty', false, array('messages' => 'Please enter percentage.'));
     $percentage->addValidator("regex", true, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')));
     //Form Submit....
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $user_id, $educationlevel, $from_date, $to_date, $percentage, $course, $institution_name, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('from_date', 'to_date'));
 }
Exemple #23
0
 /**
  *
  */
 protected function initIdPersonElement()
 {
     $element = new \Zend_Form_Element_Select('id_person');
     $options = \Application\Query\PersonQuery::create()->find()->toCombo();
     $element->addMultiOptions($options);
     $element->setLabel($this->getTranslator()->_('IdPerson'));
     $element->addValidator($this->validator->getFor('id_person'));
     $element->addFilter($this->filter->getFor('id_person'));
     $element->setRequired(true);
     $this->addElement($element);
     $this->elements['id_person'] = $element;
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'emailsettings');
     $id = new Zend_Form_Element_Hidden("id");
     $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
     $username = new Zend_Form_Element_Text("username");
     $username->setLabel("User name");
     $username->setAttrib("class", "formDataElement");
     // $username->setRequired("true");
     $username->setAttrib('maxlength', '100');
     //$username->addValidator('NotEmpty', false, array('messages' => 'Please enter username.'));
     $tls = new Zend_Form_Element_Text("tls");
     $tls->setLabel("Secure Transport Layer");
     $tls->setAttrib("class", "formDataElement");
     // $tls->setRequired("true");
     $tls->setAttrib('maxlength', '40');
     //  $tls->addValidator('NotEmpty', false, array('messages' => 'Please enter secure transport layer.'));
     $auth = new Zend_Form_Element_Select("auth");
     $auth->setLabel("Authentication Type");
     $auth->setMultiOptions(array('true' => 'True', 'false' => 'False'));
     $auth->setAttrib("class", "formDataElement");
     $auth->setAttrib("onChange", "toggleAuth()");
     $auth->setRequired("true");
     $auth->setAttrib('maxlength', '50');
     $auth->addValidator('NotEmpty', false, array('messages' => 'Please enter authentication type.'));
     $port = new Zend_Form_Element_Text("port");
     $port->setLabel("Port");
     $port->setAttrib("class", "formDataElement");
     $port->setRequired("true");
     $port->setAttrib('maxlength', '50');
     $port->addValidator('NotEmpty', false, array('messages' => 'Please enter port.'));
     $password = new Zend_Form_Element_Text("password");
     $password->setLabel("Password");
     $password->setAttrib("class", "formDataElement");
     // $password->setRequired("true");
     $password->setAttrib('maxlength', '100');
     // $password->addValidator('NotEmpty', false, array('messages' => 'Please enter password.'));
     $server_name = new Zend_Form_Element_Text("server_name");
     $server_name->setLabel("SMTP Server");
     $server_name->setAttrib("class", "formDataElement");
     $server_name->setRequired("true");
     $server_name->setAttrib('maxlength', '100');
     $server_name->addValidator('NotEmpty', false, array('messages' => 'Please enter SMTP Server.'));
     $submit = new Zend_Form_Element_Submit("submit");
     $submit->setLabel("Save");
     $submit->setAttrib('id', 'submitbutton');
     $submit->setAttrib("class", "formSubmitButton");
     $this->addElements(array($id, $submit, $username, $tls, $auth, $port, $password, $server_name));
     $this->setElementDecorators(array('ViewHelper'));
 }
Exemple #25
0
 function init()
 {
     $this->setMethod('post');
     $this->addAttribs(array('id' => 'addUser', 'class' => ''));
     $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
     $action = new Zend_Form_Element_Hidden('action');
     $action->setValue('add');
     $this->addElement($action);
     // BEGIN: Name
     $name = new Zend_Form_Element_Text('name');
     $name->setAttribs(array('class' => 'text large rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_full_name'), 'id' => 'name'));
     $name->setRequired(true);
     $this->addElement($name);
     // END: Name
     // BEGIN: Account Name
     $accountName = new Zend_Form_Element_Text('accountName');
     $accountName->setAttribs(array('class' => 'text large rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_account_name'), 'id' => 'accountName'));
     $accountName->setRequired(true);
     $this->addElement($accountName);
     // END: Account Name
     // BEGIN: Email
     $email = new Zend_Form_Element_Text('email');
     $email->setAttribs(array('class' => 'text large rightAdd', 'placeholder' => Zend_Registry::get('translate')->_('admin_email_address'), 'id' => 'email'));
     $validatorEmail = new Zend_Validate_Db_NoRecordExists('users', 'email');
     $email->addValidator($validatorEmail);
     $email->setRequired(true);
     $this->addElement($email);
     // END: Email
     //BEGIN:Level
     $idLevel = new Zend_Form_Element_Select('idRole');
     $options = array('' => Zend_Registry::get('translate')->_('admin_select_user_level'));
     $levels = new Default_Model_Role();
     $select = $levels->getMapper()->getDbTable()->select()->where('id != ?', 1)->where('NOT deleted')->order('id DESC');
     $result = $levels->fetchAll($select);
     if (NULL != $result) {
         foreach ($result as $value) {
             $options[$value->getId()] = $value->getName();
         }
     }
     $idLevel->addMultiOptions($options);
     $idLevel->addValidator(new Zend_Validate_InArray(array_keys($options)));
     $idLevel->setAttribs(array('class' => 'rightAdd', 'id' => 'idRole'));
     $idLevel->setRequired(false);
     $this->addElement($idLevel);
     //END:Level
     $add = new Zend_Form_Element_Submit('add');
     $add->setValue(Zend_Registry::get('translate')->_('admin_add_user'));
     $add->setAttribs(array('class' => 'submit', 'id' => ''));
     $add->setIgnore(true);
     $this->addElement($add);
 }
Exemple #26
0
 /** Initialize this form. */
 public function init()
 {
     $this->setName('mail_admin');
     $this->setMethod('POST');
     $csrf = new Midas_Form_Element_Hash('csrf');
     $csrf->setSalt('5qzSHzCdNuPfYaT99Jq5WcKe');
     $csrf->setDecorators(array('ViewHelper'));
     $provider = new Zend_Form_Element_Select(MAIL_PROVIDER_KEY);
     $provider->setLabel('Provider');
     $provider->setRequired(true);
     $provider->addValidator('NotEmpty', true);
     $provider->addMultiOptions(array(MAIL_PROVIDER_APP_ENGINE => 'Google App Engine', MAIL_PROVIDER_MAIL => 'PHP Mail Function', MAIL_PROVIDER_SEND_GRID => 'SendGrid Service', MAIL_PROVIDER_SMTP => 'External SMTP Server'));
     $fromAddress = new Zend_Form_Element_Text(MAIL_FROM_ADDRESS_KEY);
     $fromAddress->setLabel('From email address');
     $fromAddress->setRequired(true);
     $fromAddress->addValidator('NotEmpty', true);
     $fromAddress->addValidator('EmailAddress', true);
     $addressVerification = new Zend_Form_Element_Checkbox(MAIL_ADDRESS_VERIFICATION_KEY);
     $addressVerification->setLabel('Require email address verification');
     $this->addDisplayGroup(array($provider, $fromAddress, $addressVerification), 'global');
     $sendGridUsername = new Zend_Form_Element_Text(MAIL_SEND_GRID_USERNAME_KEY);
     $sendGridUsername->setLabel('SendGrid User Name');
     $sendGridUsername->addValidator('NotEmpty', true);
     $sendGridPassword = new Zend_Form_Element_Password(MAIL_SEND_GRID_PASSWORD_KEY);
     $sendGridPassword->setLabel('SendGrid Password');
     $sendGridPassword->addValidator('NotEmpty', true);
     $this->addDisplayGroup(array($sendGridUsername, $sendGridPassword), 'send_grid');
     $smtpHost = new Zend_Form_Element_Text(MAIL_SMTP_HOST_KEY);
     $smtpHost->setLabel('Server name');
     $smtpHost->addValidator('NotEmpty', true);
     $smtpHost->addValidator('Hostname', true, array('allow' => Zend_Validate_Hostname::ALLOW_ALL, 'tld' => false));
     $smtpPort = new Zend_Form_Element_Text(MAIL_SMTP_PORT_KEY);
     $smtpPort->setLabel('Port');
     $smtpPort->addValidator('NotEmpty', true);
     $smtpPort->addValidator('Digits', true);
     $smtpPort->addValidator('Between', true, array('min' => 1, 'max' => 65535));
     $smtpPort->setAttrib('maxlength', 5);
     $smtpUseSsl = new Zend_Form_Element_Checkbox(MAIL_SMTP_USE_SSL_KEY);
     $smtpUseSsl->setLabel('Use SSL');
     $smtpUsername = new Zend_Form_Element_Text(MAIL_SMTP_USERNAME_KEY);
     $smtpUsername->setLabel('User name');
     $smtpUsername->addValidator('NotEmpty', true);
     $smtpPassword = new Zend_Form_Element_Password(MAIL_SMTP_PASSWORD_KEY);
     $smtpPassword->setLabel('Password');
     $smtpPassword->addValidator('NotEmpty', true);
     $this->addDisplayGroup(array($smtpHost, $smtpPort, $smtpUseSsl, $smtpUsername, $smtpPassword), 'smtp');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Save');
     $this->addElements(array($csrf, $provider, $fromAddress, $addressVerification, $sendGridUsername, $sendGridPassword, $smtpHost, $smtpPort, $smtpUseSsl, $smtpUsername, $smtpPassword, $submit));
 }
 public function __construct()
 {
     parent::__construct();
     $this->setName(get_class());
     $this->getElement("form_name")->setValue(get_class());
     $oContactForm = new Zend_Form_Element_Select("site_field_show_contact_form");
     $oContactForm->setLabel("Formularz kontaktowy:");
     $oContactForm->addValidator(new Zend_Validate_GreaterThan(-1));
     $oContactForm->addValidator(new Zend_Validate_LessThan(2));
     $oContactForm->setRequired(FALSE);
     $oContactForm->addMultiOptions(array(0 => "NIE", 1 => "TAK"));
     $this->addElement($oContactForm);
     $oGoogleMaps = new Zend_Form_Element_Select("site_field_show_google_maps");
     $oGoogleMaps->setLabel("Mapa Google Maps:");
     $oGoogleMaps->addValidator(new Zend_Validate_GreaterThan(-1));
     $oGoogleMaps->addValidator(new Zend_Validate_LessThan(2));
     $oGoogleMaps->setRequired(FALSE);
     $oGoogleMaps->addMultiOptions(array(0 => "NIE", 1 => "TAK"));
     $this->addElement($oGoogleMaps);
     $oSubmit = $this->createElement("submit", "submit");
     $oSubmit->setLabel("Zapisz");
     $this->addElement($oSubmit);
 }
Exemple #28
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'frm_multiple_resume');
     $this->setAttrib('name', 'frm_multiple_resume');
     $this->setAttrib('action', BASE_URL . 'candidatedetails/multipleresume');
     $id = new Zend_Form_Element_Hidden('id');
     $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
     $requisition_id = new Zend_Form_Element_Select("requisition_id");
     $requisition_id->setRegisterInArrayValidator(false);
     $requisition_id->setLabel("Requisition ID");
     $requisition_id->setAttrib("class", "formDataElement");
     $requisition_id->setAttrib('onchange', 'displayParticularCandidates(this,"cand")');
     $requisition_id->setAttrib('title', 'Requisition ID');
     if ($id_val == '') {
         $requisition_id->setRequired(true);
         $requisition_id->addValidator('NotEmpty', false, array('messages' => 'Please select requisition id.'));
     }
     $candidate_firstname = new Zend_Form_Element_Text('candidate_firstname');
     $candidate_firstname->setIsArray(TRUE);
     $candidate_firstname->setAttrib('maxLength', 90);
     $candidate_firstname->setAttrib('title', 'Candidate First Name');
     $candidate_firstname->setAttrib('class', 'candidate_firstname');
     $candidate_firstname->addFilter(new Zend_Filter_StringTrim());
     $candidate_firstname->setRequired(true);
     $candidate_firstname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid candidate first name.')));
     $candidate_lastname = new Zend_Form_Element_Text('candidate_lastname');
     $candidate_lastname->setIsArray(TRUE);
     $candidate_lastname->setAttrib('maxLength', 90);
     $candidate_lastname->setAttrib('title', 'Candidate Last Name');
     $candidate_lastname->setAttrib('class', 'candidate_lastname');
     $candidate_lastname->addFilter(new Zend_Filter_StringTrim());
     $candidate_lastname->setRequired(true);
     $candidate_lastname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid candidate last name.')));
     $candidate_resumes = new Zend_Form_Element_Hidden('cand_resume');
     $candidate_resumes->setIsArray(TRUE);
     $candidate_resumes->setRequired(true);
     $candidate_resumes->addValidator('NotEmpty', false, array('messages' => 'Please select file.'));
     $cand_status = new Zend_Form_Element_Select("cand_status");
     $cand_status->setRegisterInArrayValidator(false);
     $cand_status->setLabel("Status");
     $cand_status->setAttrib("class", "formDataElement");
     $cand_status->setAttrib('title', 'Candidate status');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'multiple-submit-button');
     $submit->setLabel('Save');
     $this->addElements(array($cand_status, $id, $requisition_id, $candidate_firstname, $candidate_lastname, $candidate_resumes, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Exemple #29
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'));
 }
Exemple #30
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'feedforwardinit');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
     $appraisal_mode->setLabel("Appraisal");
     $appraisal_mode->setMultiOptions(array('' => 'Select Appraisal'));
     $appraisal_mode->setAttrib('class', 'selectoption');
     $appraisal_mode->setRequired(true);
     $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal.'));
     $status = new Zend_Form_Element_Select('status');
     $status->setLabel("Status");
     $status->setAttrib('class', 'selectoption');
     $status->setMultiOptions(array('1' => 'Open'));
     //,'2' => 'Close'
     $status->setRegisterInArrayValidator(false);
     $status->setRequired(true);
     $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
     $employee_name_view = new Zend_Form_Element_Radio('employee_name_view');
     $employee_name_view->setLabel("Employee Details");
     $employee_name_view->addMultiOptions(array('1' => 'Show', '0' => 'Hide'));
     $employee_name_view->setSeparator('');
     $employee_name_view->setValue(0);
     $employee_name_view->setRegisterInArrayValidator(false);
     $enable_to = new Zend_Form_Element_MultiCheckbox('enable_to');
     $enable_to->setLabel("Enable To");
     $enable_to->addMultiOptions(array('0' => 'Appraisal Employees', '1' => 'All Employees'));
     $enable_to->setSeparator('');
     $enable_to->setValue(0);
     $enable_to->setRequired(true);
     $enable_to->setRegisterInArrayValidator(false);
     $enable_to->addValidator('NotEmpty', false, array('messages' => 'Please check enable to.'));
     $ff_due_date = new Zend_Form_Element_Text('ff_due_date');
     $ff_due_date->setLabel("Due Date");
     $ff_due_date->setOptions(array('class' => 'brdr_none'));
     $ff_due_date->setRequired(true);
     $ff_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
     $save = new Zend_Form_Element_Submit('submit');
     $save->setAttrib('id', 'submitbutton');
     $save->setLabel('Save & Initialize');
     $save_later = new Zend_Form_Element_Submit('submit');
     $save_later->setAttrib('id', 'submitbutton1');
     $save_later->setLabel('Save & Initialize Later');
     $this->addElements(array($id, $appraisal_mode, $status, $employee_name_view, $ff_due_date, $save, $save_later, $enable_to));
     $this->setElementDecorators(array('ViewHelper'));
 }