コード例 #1
0
ファイル: Appriciation.php プロジェクト: riteshsahu1981/we
 public function init()
 {
     $model = new Application_Model_User();
     $arr = $model->getAllUsers();
     $arr = array_merge(array('' => 'Select'), $arr);
     $this->addElement('select', 'userId', array('label' => 'Employee:', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select employee')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arr));
     $model = new Application_Model_AppriciationType();
     $arr = $model->getAppriciationType();
     //$arr=array_merge(array(''=>'Select'),$arr);
     $this->addElement('select', 'appriciationTypeId', array('label' => 'Appriciation Type:', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select type')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arr));
     $this->addElement('text', 'appriciationDate', array('label' => 'Date:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter date')))), 'class' => 'text-input small-input', 'readonly' => 'true', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('textarea', 'remarks', array('label' => 'Remarks:', 'class' => 'text-input textarea address', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter remarks.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators));
 }
コード例 #2
0
ファイル: HrController.php プロジェクト: riteshsahu1981/we
 public function editAppriciationTypeAction()
 {
     $id = $this->_getParam('id');
     $this->view->user_id = $id;
     $model1 = new Application_Model_AppriciationType();
     $model = $model1->find($id);
     if (false === $model) {
         $this->_flashMessenger->addMessage(array('error' => 'Invalid request! Please try again.'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/hr/appriciation-type'));
     }
     $options['title'] = $model->getTitle();
     $request = $this->getRequest();
     $form = new Application_Form_AppriciationType();
     $form->populate($options);
     $options = $request->getPost();
     if ($request->isPost()) {
         /*---- email validation ----*/
         if ($options['title'] == $model->getTitle()) {
             $form->getElement('title')->removeValidator("Db_NoRecordExists");
         }
         /*-------------------------*/
         if ($form->isValid($options)) {
             $model->setOptions($options);
             $model->save();
             $this->_flashMessenger->addMessage(array('success' => 'Appriciation type title has been updated successfully!'));
             $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/hr/edit-appriciation-type/id/' . $id));
         } else {
             $this->_flashMessenger->addMessage(array('error' => 'Unable to save the data. Please provide valid inputs and try again.'));
             $form->reset();
             $form->populate($options);
         }
     }
     $this->view->form = $form;
 }
コード例 #3
0
 public function getAppriciationType()
 {
     $obj = new Application_Model_AppriciationType();
     $entries = $obj->fetchAll();
     $arrUserLevel = array();
     foreach ($entries as $entry) {
         $arrUserLevel[$entry->getId()] = $entry->getTitle();
     }
     return $arrUserLevel;
 }