Exemplo n.º 1
1
 public function init()
 {
     // Init settings object
     $translate = Zend_Registry::get('Zend_Translate');
     // Init form
     $this->setTitle('Email To Friends')->setDescription('Send message to your followers.')->setLegend('');
     $this->setAttrib('class', 'global_form_popup');
     $followerTable = Engine_Api::_()->getDbTable('follow', 'advgroup');
     $followers = $followerTable->getUserFollow($this->_group->getIdentity());
     $arrValue = array();
     foreach ($followers as $follower) {
         $user = Engine_Api::_()->getItem('user', $follower->user_id);
         $arrValue[$follower->user_id] = $user->getTitle();
     }
     $multi = new Zend_Form_Element_Multiselect('followers');
     $multi->setMultiOptions($arrValue);
     $this->addElement($multi);
     // Init custom message
     $this->addElement('Textarea', 'message', array('label' => 'Custom Message', 'style' => 'width:450px', 'required' => true, 'allowEmpty' => false, 'filters' => array(new Engine_Filter_Censor())));
     $this->message->getDecorator('Description')->setOptions(array('placement' => 'APPEND'));
     $this->addElement('Button', 'submit', array('label' => 'Send Emails', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
     $buttons[] = 'submit';
     $onclick = 'parent.Smoothbox.close();';
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'href' => '', 'onclick' => $onclick, 'decorators' => array('ViewHelper')));
     $buttons[] = 'cancel';
     $this->addDisplayGroup($buttons, 'buttons');
     $button_group = $this->getDisplayGroup('buttons');
 }
Exemplo n.º 2
0
 public function renderFormElement()
 {
     $elm = new Zend_Form_Element_Multiselect($this->getName(), array('label' => $this->getLabel() . ':'));
     $elm->setDescription($this->getDescription());
     $elm->setMultiOptions($this->getOptions());
     $elm->setValue($this->getValue());
     $elm->setRequired($this->getRequired());
     $elm->setAttrib('style', 'width:300px;height:100px');
     return $elm;
 }
Exemplo n.º 3
0
 /**
  * @group ZF-11667
  */
 public function testSimilarErrorMessagesForMultiElementAreNotDuplicated()
 {
     $this->element->setConcatJustValuesInErrorMessage(true);
     // create element with 4 checkboxes
     $this->element->setMultiOptions(array('multiOptions' => array(array('key' => 'a', 'value' => 'A'), array('key' => 'b', 'value' => 'B'), array('key' => 'c', 'value' => 'C'), array('key' => 'd', 'value' => 'D'))));
     // check 3 of them
     $this->element->setValue(array('A', 'B', 'D'));
     // later on, fails some validation on submit
     $this->element->addError('some error! %value%');
     $this->assertEquals(array('some error! A; B; D'), $this->element->getMessages());
 }
Exemplo n.º 4
0
 /**
  * Inserts two selections and buttons to control the elements between them.
  *
  * @param string $name - Define elements id. Important to javascript interaction
  * @param string $label
  * @param array $start_itens
  * @param array $end_itens
  */
 public function setSelectBox($name, $label, $start_itens, $end_itens = false)
 {
     $i18n = Zend_Registry::get("i18n");
     $header = new Zend_Form_Element_Hidden('elementHeader');
     $header->removeDecorator("DtDdWrapper")->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selects', 'openOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::PREPEND));
     $start_box = new Zend_Form_Element_Multiselect("box");
     $start_box->setLabel($i18n->translate($label))->setMultiOptions($start_itens)->removeDecorator('DtDdWrapper')->setAttrib('id', $name . '_box')->setRegisterInArrayValidator(false);
     $end_box = new Zend_Form_Element_Multiselect("box_add");
     if ($end_itens) {
         $end_box->setMultiOptions($end_itens);
         $end_box->setValue(array_keys($end_itens));
     }
     $end_box->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setAttrib('id', $name . '_box_add')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selects', 'closeOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::APPEND))->setRegisterInArrayValidator(false);
     $add_action = new Zend_Form_Element_Button($i18n->translate('Add'));
     $add_action->removeDecorator("DtDdWrapper")->addDecorator('HtmlTag', array('tag' => 'li'))->setAttrib('id', $name . '_add_bt')->setAttrib('class', 'add_item')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selectActions', 'openOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::PREPEND));
     $remove_action = new Zend_Form_Element_Button($i18n->translate('Remove'));
     $remove_action->removeDecorator("DtDdWrapper")->addDecorator('HtmlTag', array('tag' => 'li'))->setAttrib('id', $name . '_remove_bt')->setAttrib('class', 'remove_item')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selectActions', 'closeOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::APPEND));
     $this->addElements(array($header, $start_box, $add_action, $remove_action, $end_box));
 }
Exemplo n.º 5
0
 public function setMultiOptions()
 {
     parent::setMultiOptions($this->generateMultiOptions());
 }
Exemplo n.º 6
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'appraisalinit');
     $id = new Zend_Form_Element_Hidden('id');
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $businessunit_id = $auth->getStorage()->read()->businessunit_id;
         $department_id = $auth->getStorage()->read()->department_id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     if ($loginuserRole != SUPERADMINROLE && $loginuserGroup != MANAGEMENT_GROUP) {
         $businessunit_id = new Zend_Form_Element_Hidden('businessunit_id');
         $department_id = new Zend_Form_Element_Hidden('department_id');
         $businessunit_name = new Zend_Form_Element_Text('businessunit_name');
         $businessunit_name->setLabel("Business Unit");
         $businessunit_name->setAttrib('readonly', 'true');
         $businessunit_name->setAttrib('onfocus', 'this.blur()');
         $businessunit_name->setOptions(array('class' => 'brdr_none'));
         $department_name = new Zend_Form_Element_Text('department_name');
         $department_name->setLabel("Department");
         $department_name->setAttrib('readonly', 'true');
         $department_name->setAttrib('onfocus', 'this.blur()');
         $department_name->setOptions(array('class' => 'brdr_none'));
     } else {
         $businessunit_id = new Zend_Form_Element_Select('businessunit_id');
         $businessunit_id->setLabel("Business Unit");
         $businessunit_id->setRegisterInArrayValidator(false);
         $businessunit_id->setRequired(true);
         $businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit'));
         $department_id = new Zend_Form_Element_Select('department_id');
         $department_id->setLabel("Department");
         $department_id->setRegisterInArrayValidator(false);
         $department_id->addMultiOptions(array('' => 'Select Department'));
         $performance_app_flag = Zend_Controller_Front::getInstance()->getRequest()->getParam('performance_app_flag', null);
         if ($performance_app_flag != '' && $performance_app_flag == 0) {
             $department_id->setRequired(true);
             $department_id->addValidator('NotEmpty', false, array('messages' => 'Please select department'));
         }
     }
     // $appraisal_mode = new Zend_Form_Element_Text('appraisal_mode');
     // $appraisal_mode->setLabel("Appraisal Mode");
     // $appraisal_mode->setAttrib('readonly', 'readonly');
     // $appraisal_mode->setAttrib('onfocus', 'this.blur()');
     // $appraisal_mode->setOptions(array('class' => 'brdr_none'));
     $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
     $appraisal_mode->setLabel("Appraisal Mode");
     $appraisal_mode->setAttrib('class', 'selectoption');
     $appraisal_mode->addMultiOptions(array('' => 'Select appraisal mode', 'Quarterly' => 'Quarterly', 'Half-yearly' => 'Half-yearly', 'Yearly' => 'Yearly'));
     $appraisal_mode->setRegisterInArrayValidator(false);
     $appraisal_mode->setRequired(true);
     $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal mode'));
     $status = new Zend_Form_Element_Select('status');
     $status->setLabel("Appraisal Status");
     $status->setAttrib('class', 'selectoption');
     $status->setMultiOptions(array('1' => 'Open'));
     $status->setRegisterInArrayValidator(false);
     $status->setRequired(true);
     $status->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal status.'));
     $from_year = new Zend_Form_Element_Select('from_year');
     $from_year->setAttrib('class', 'selectoption');
     $from_year->setRegisterInArrayValidator(false);
     $from_year->setRequired(true);
     $from_year->setLabel("From Year");
     $from_year->addMultiOption("", "From Year");
     $from_year->addValidator('NotEmpty', false, array('messages' => 'Please select from year'));
     $current_date = date('Y-m-d');
     $previous_year = date('Y', strtotime("{$current_date} -1 year"));
     for ($i = $previous_year; $i <= $previous_year + 5; $i++) {
         $from_year->addMultiOption($i, $i);
     }
     $to_year = new Zend_Form_Element_Select('to_year');
     $to_year->setAttrib('class', 'selectoption');
     $to_year->setRegisterInArrayValidator(false);
     $to_year->setRequired(true);
     $to_year->setLabel("To Year");
     $to_year->addMultiOption("", "To Year");
     $to_year->addValidator('NotEmpty', false, array('messages' => 'Please select to year'));
     /* Limit 'To Year' field years 
      * upto following year of 'From Year'
      * upto 5 years from current last year i.e.$previous_year
      */
     $post_from_year = Zend_Controller_Front::getInstance()->getRequest()->getParam('from_year', null);
     if (!empty($post_from_year)) {
         for ($i = $post_from_year; $i <= $post_from_year + 1 && $i <= $previous_year + 5; $i++) {
             $to_year->addMultiOption($i, $i);
         }
     }
     $appraisal_period = new Zend_Form_Element_Text('appraisal_period');
     $appraisal_period->setLabel("Period");
     $appraisal_period->setAttrib('readonly', 'readonly');
     $appraisal_period->setAttrib('onfocus', 'this.blur()');
     $appraisal_period->setOptions(array('class' => 'brdr_none'));
     // $appraisal_period->setRequired(true);
     // $appraisal_period->addValidator('NotEmpty', false, array('messages' => 'Please enter period'));
     $eligibility = new Zend_Form_Element_Multiselect('eligibility');
     $eligibility->setLabel("Eligibility");
     $eligibility->setAttrib('class', 'selectoption');
     $eligibility->setMultiOptions(array('' => 'Select Eligibility'));
     /*$eligibility->setRegisterInArrayValidator(false);
       $eligibility->setRequired(true);
       $eligibility->addValidator('NotEmpty', false, array('messages' => 'Please select eligiblity'));*/
     $eligibility_hidden = new Zend_Form_Element_Multiselect('eligibility_hidden');
     $eligibility_hidden->setLabel("Eligibility");
     $eligibility_hidden->setAttrib('class', 'selectoption');
     $eligibility_hidden->setRegisterInArrayValidator(false);
     $eligibilityflag = new Zend_Form_Element_Hidden('eligibilityflag');
     $eligibility_value = new Zend_Form_Element_Hidden('eligibility_value');
     $category_id = new Zend_Form_Element_Multiselect('category_id');
     $category_id->setLabel("Parameters");
     $category_id->setMultiOptions(array('' => 'Select Parameters'));
     $category_id->setRegisterInArrayValidator(false);
     $category_id->setRequired(true);
     $category_id->addValidator('NotEmpty', false, array('messages' => 'Please select parameters'));
     $enable = new Zend_Form_Element_Select('enable_step');
     $enable->setLabel("Enable To");
     $enable->setAttrib('onchange', 'changeduedatetext(this.value)');
     $enable->setMultiOptions(array('1' => 'Managers', '2' => 'Employees'));
     $enable->setRegisterInArrayValidator(false);
     $enable->setRequired(true);
     $enable->addValidator('NotEmpty', false, array('messages' => 'Please select enable to'));
     $enable_to_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('enable_step', null);
     $mgr_due_date = new Zend_Form_Element_Text('managers_due_date');
     $mgr_due_date->setLabel("Managers Due Date");
     $emp_due_date = new Zend_Form_Element_Text('employee_due_date');
     $emp_due_date->setLabel("Employees Due Date");
     if ($enable_to_val == '' || $enable_to_val == 1) {
         $mgr_due_date->setRequired(true);
         $mgr_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select managers due date'));
     } else {
         $emp_due_date->setRequired(true);
         $emp_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select employees due date'));
     }
     $management_appraisal = new Zend_Form_Element_Checkbox('management_appraisal');
     $management_appraisal->setLabel("Consider management");
     // $appraisal_ratings = new Zend_Form_Element_Text('appraisal_ratings');
     // $appraisal_ratings->setAttrib('readonly', 'readonly');
     // $appraisal_ratings->setAttrib('onfocus', 'this.blur()');
     // $appraisal_ratings->setLabel("Ratings");
     $appraisal_ratings = new Zend_Form_Element_Select('appraisal_ratings');
     $appraisal_ratings->setLabel("Appraisal Ratings");
     $appraisal_ratings->setAttrib('class', 'selectoption');
     $appraisal_ratings->addMultiOptions(array('' => 'Select ratings', '1' => '1-5', '2' => '1-10'));
     $appraisal_ratings->setRegisterInArrayValidator(false);
     $appraisal_ratings->setRequired(true);
     $appraisal_ratings->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal ratings'));
     $app_period_hid = new Zend_Form_Element_Hidden('app_period_hid');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     if ($loginuserRole != SUPERADMINROLE && $loginuserGroup != MANAGEMENT_GROUP) {
         $this->addElements(array($appraisal_ratings, $management_appraisal, $id, $appraisal_period, $from_year, $to_year, $businessunit_id, $department_id, $businessunit_name, $department_name, $appraisal_mode, $category_id, $status, $eligibility, $eligibility_hidden, $eligibility_value, $eligibilityflag, $enable, $mgr_due_date, $emp_due_date, $app_period_hid, $submit));
     } else {
         $this->addElements(array($appraisal_ratings, $management_appraisal, $id, $appraisal_period, $from_year, $to_year, $businessunit_id, $department_id, $appraisal_mode, $category_id, $status, $eligibility, $eligibility_hidden, $eligibility_value, $eligibilityflag, $enable, $mgr_due_date, $emp_due_date, $app_period_hid, $submit));
     }
     $this->setElementDecorators(array('ViewHelper'));
 }
Exemplo n.º 7
0
 function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setAction(WEBROOT . 'statistics');
     $this->addAttribs(array('id' => 'filterComplexForm', 'class' => ''));
     $this->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
     //BEGIN:Id Category Expenses
     $idCategoryE = new Zend_Form_Element_Multiselect('idCategoryE');
     $options = array('1' => strtoupper(Zend_Registry::get('translate')->_('admin_expenses')));
     $categories = new Default_Model_Groups();
     $select = $categories->getMapper()->getDbTable()->select()->where('NOT deleted')->where('type=?', 0)->order('name ASC');
     $result = $categories->fetchAll($select);
     if (NULL != $result) {
         foreach ($result as $value) {
             $options[$value->getId()] = $value->getName();
         }
     }
     $idCategoryE->setMultiOptions($options);
     $idCategoryE->addValidator(new Zend_Validate_InArray(array_keys($options)));
     $idCategoryE->setAttribs(array('class' => 'rightAdd form_selector', 'id' => 'idCategoryE'));
     $idCategoryE->setRequired(false);
     $this->addElement($idCategoryE);
     //END:Id Category Expenses
     //BEGIN:Id Category Income
     $idCategoryI = new Zend_Form_Element_Multiselect('idCategoryI');
     $options = array('2' => strtoupper(Zend_Registry::get('translate')->_('admin_income')));
     $categories = new Default_Model_Groups();
     $select = $categories->getMapper()->getDbTable()->select()->where('NOT deleted')->where('type=?', 1)->order('name ASC');
     $result = $categories->fetchAll($select);
     if (NULL != $result) {
         foreach ($result as $value) {
             $options[$value->getId()] = " " . $value->getName();
         }
     }
     $idCategoryI->setMultiOptions($options);
     $idCategoryI->addValidator(new Zend_Validate_InArray(array_keys($options)));
     $idCategoryI->setAttribs(array('class' => 'rightAdd form_selector', 'id' => 'idCategoryI'));
     $idCategoryI->setRequired(false);
     $this->addElement($idCategoryI);
     //END:Id Category Income
     //BEGIN:Timeframe
     $timeframe = new Zend_Form_Element_Select('timeframe');
     $options = array('m' => Zend_Registry::get('translate')->_('admin_monthly'), 'w' => Zend_Registry::get('translate')->_('admin_weekly'), 'd' => Zend_Registry::get('translate')->_('admin_daily'));
     $timeframe->setMultiOptions($options);
     $timeframe->addValidator(new Zend_Validate_InArray(array_keys($options)));
     $timeframe->setAttribs(array('class' => 'rightAdd validate[required] form_selector', 'id' => 'timeframe'));
     $timeframe->setRequired(true);
     $timeframe->setValue('m');
     $this->addElement($timeframe);
     //END:Timeframe
     // BEGIN: data
     $dataStart = new Zend_Form_Element_Text('dataStartC');
     $dataStart->setAttribs(array('class' => 'data_inceput_c validate[required]', 'placeholder' => Zend_Registry::get('translate')->_('admin_from_date')));
     $dataStart->setRequired(true);
     $this->addElement($dataStart);
     $dataEnd = new Zend_Form_Element_Text('dataEndC');
     $dataEnd->setAttribs(array('class' => 'data_sfarsit_c validate[required]', 'placeholder' => Zend_Registry::get('translate')->_('admin_to_date')));
     $this->addElement($dataEnd);
     // END: data
     $submit = new Zend_Form_Element_Submit('submitC');
     $submit->setValue(Zend_Registry::get('translate')->_('admin_menu_form_search'));
     $submit->setAttribs(array('class' => 'submit'));
     $submit->setRequired(true);
     $this->addElement($submit);
     $submitReportE = new Zend_Form_Element_Submit('submitReportE');
     $submitReportE->setAttribs(array('class' => 'submitReport'));
     $submitReportE->setRequired(true);
     $this->addElement($submitReportE);
     $submitReportI = new Zend_Form_Element_Submit('submitReportI');
     $submitReportI->setAttribs(array('class' => 'submitReport'));
     $submitReportI->setRequired(true);
     $this->addElement($submitReportI);
 }
 /**
  * Add form elements when a responseDatabase is present
  * @param  \Gems_Form $form existing form type
  * @param  array data existing options set in the form
  * @return array of form elements
  */
 protected function addResponseDatabaseForm($form, &$data, &$elements)
 {
     if (isset($data['tid']) && !empty($data['tid'])) {
         // If we have a responsedatabase and a track id, try something cool ;-)
         $responseDb = $this->project->getResponseDatabase();
         if ($this->db === $responseDb) {
             // We are in the same database, now put that to use by allowing to filter respondents based on an answer in any survey
             $empty = $this->util->getTranslated()->getEmptyDropdownArray();
             $allSurveys = $empty + $this->util->getDbLookup()->getSurveysForExport();
             $element = new \Zend_Form_Element_Select('filter_sid');
             $element->setLabel($this->_('Survey'))->setMultiOptions($allSurveys);
             $groupElements = array($element);
             if (isset($data['filter_sid']) && !empty($data['filter_sid'])) {
                 $filterSurvey = $this->loader->getTracker()->getSurvey($data['filter_sid']);
                 $filterQuestions = $empty + $filterSurvey->getQuestionList($this->locale->getLanguage());
                 $element = new \Zend_Form_Element_Select('filter_answer');
                 $element->setLabel($this->_('Question'))->setMultiOptions($filterQuestions);
                 $groupElements[] = $element;
             }
             if (isset($filterSurvey) && isset($data['filter_answer']) && !empty($data['filter_answer'])) {
                 $questionInfo = $filterSurvey->getQuestionInformation($this->locale->getLanguage());
                 if (array_key_exists($data['filter_answer'], $questionInfo)) {
                     $questionInfo = $questionInfo[$data['filter_answer']];
                 } else {
                     $questionInfo = array();
                 }
                 if (array_key_exists('answers', $questionInfo) && is_array($questionInfo['answers']) && count($questionInfo['answers']) > 1) {
                     $element = new \Zend_Form_Element_Multiselect('filter_value');
                     $element->setMultiOptions($empty + $questionInfo['answers']);
                     $element->setAttrib('size', count($questionInfo['answers']) + 1);
                 } else {
                     $element = new \Zend_Form_Element_Text('filter_value');
                 }
                 $element->setLabel($this->_('Value'));
                 $groupElements[] = $element;
             }
             $form->addDisplayGroup($groupElements, 'filter', array('showLabels' => true, 'Description' => $this->_('Filter')));
             array_shift($elements);
         }
     }
 }
Exemplo n.º 9
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'appraisalinit');
     $id = new Zend_Form_Element_Hidden('id');
     $businessunit_id = new Zend_Form_Element_Hidden('businessunit_id');
     $department_id = new Zend_Form_Element_Hidden('department_id');
     $businessunit_name = new Zend_Form_Element_Text('businessunit_name');
     $businessunit_name->setLabel("Business Unit");
     $businessunit_name->setAttrib('readonly', 'true');
     $businessunit_name->setAttrib('onfocus', 'this.blur()');
     $businessunit_name->setOptions(array('class' => 'brdr_none'));
     $department_name = new Zend_Form_Element_Text('department_name');
     $department_name->setLabel("Department");
     $department_name->setAttrib('readonly', 'true');
     $department_name->setAttrib('onfocus', 'this.blur()');
     $department_name->setOptions(array('class' => 'brdr_none'));
     $appraisal_mode = new Zend_Form_Element_Text('appraisal_mode');
     $appraisal_mode->setLabel("Mode");
     $appraisal_mode->setAttrib('readonly', 'readonly');
     $appraisal_mode->setAttrib('onfocus', 'this.blur()');
     $appraisal_mode->setOptions(array('class' => 'brdr_none'));
     $status = new Zend_Form_Element_Select('status');
     $status->setLabel("Status");
     $status->setAttrib('class', 'selectoption');
     $status->setMultiOptions(array('1' => 'Open'));
     $status->setRegisterInArrayValidator(false);
     $status->setRequired(true);
     $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
     $from_year = new Zend_Form_Element_Select('from_year');
     $from_year->setAttrib('class', 'selectoption');
     $from_year->setRegisterInArrayValidator(false);
     $from_year->setRequired(true);
     $from_year->setLabel("From Year");
     $from_year->addMultiOption("", "Select from year");
     $from_year->addValidator('NotEmpty', false, array('messages' => 'Please select starting year.'));
     for ($i = date('Y'); $i <= date('Y') + 5; $i++) {
         $from_year->addMultiOption($i, $i);
     }
     $to_year = new Zend_Form_Element_Select('to_year');
     $to_year->setAttrib('class', 'selectoption');
     $to_year->setRegisterInArrayValidator(false);
     $to_year->setRequired(true);
     $to_year->setLabel("To Year");
     $to_year->addMultiOption("", "Select to year");
     $to_year->addValidator('NotEmpty', false, array('messages' => 'Please select ending year.'));
     for ($i = date('Y'); $i <= date('Y') + 5; $i++) {
         $to_year->addMultiOption($i, $i);
     }
     $appraisal_period = new Zend_Form_Element_Text('appraisal_period');
     $appraisal_period->setLabel("Period");
     $appraisal_period->setAttrib('readonly', 'readonly');
     $eligibility = new Zend_Form_Element_Multiselect('eligibility');
     $eligibility->setLabel("Eligibility");
     $eligibility->setAttrib('class', 'selectoption');
     $eligibility->setMultiOptions(array('' => 'Select Eligibility'));
     $eligibility->setRegisterInArrayValidator(false);
     $eligibility->setRequired(true);
     $eligibility->addValidator('NotEmpty', false, array('messages' => 'Please select eliblity.'));
     $enable = new Zend_Form_Element_Select('enable_step');
     $enable->setLabel("Enable To");
     $enable->setAttrib('class', 'selectoption');
     $enable->setMultiOptions(array('' => 'Select Enable To', '1' => 'Managers', '2' => 'Employees'));
     $enable->setRegisterInArrayValidator(false);
     $enable->setRequired(true);
     $enable->addValidator('NotEmpty', false, array('messages' => 'Please select enable to.'));
     $mgr_due_date = new Zend_Form_Element_Text('manager_due_date');
     $mgr_due_date->setLabel("Due Date");
     $mgr_due_date->setAttrib('readonly', 'true');
     $mgr_due_date->setAttrib('onfocus', 'this.blur()');
     $mgr_due_date->setOptions(array('class' => 'brdr_none'));
     $mgr_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
     $emp_due_date = new Zend_Form_Element_Text('employee_due_date');
     $emp_due_date->setLabel("Due Date");
     $emp_due_date->setAttrib('readonly', 'true');
     $emp_due_date->setAttrib('onfocus', 'this.blur()');
     $emp_due_date->setOptions(array('class' => 'brdr_none'));
     $emp_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $appraisal_period, $from_year, $to_year, $businessunit_id, $department_id, $businessunit_name, $department_name, $appraisal_mode, $status, $eligibility, $enable, $mgr_due_date, $emp_due_date, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }