예제 #1
0
 public function disabilityAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('disabilitydetails', $empOrganizationTabs)) {
             $tabName = "disability";
             $objName = "mydetails";
             $employeeData = array();
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $loginUserId;
             $employeeModal = new Default_Model_Employee();
             $empdata = $employeeModal->getsingleEmployeeData($id);
             if ($empdata == 'norows') {
                 $this->view->rowexist = "norows";
                 $this->view->empdata = "";
             } else {
                 $this->view->rowexist = "rows";
                 if (!empty($empdata)) {
                     $empDisabilitydetailsform = new Default_Form_Disabilitydetails();
                     $empDisabilitydetailsModel = new Default_Model_Disabilitydetails();
                     if ($id) {
                         $data = $empDisabilitydetailsModel->getempDisabilitydetails($id);
                         if (!empty($data)) {
                             $empDisabilitydetailsform->setDefault("id", $data[0]["id"]);
                             $empDisabilitydetailsform->setDefault("disability_name", $data[0]["disability_name"]);
                             $empDisabilitydetailsform->setDefault("disability_type", $data[0]["disability_type"]);
                             $empDisabilitydetailsform->setDefault("disability_description", $data[0]["disability_description"]);
                             $empDisabilitydetailsform->setDefault("other_disability_type", $data[0]["other_disability_type"]);
                         }
                         $empDisabilitydetailsform->setAttrib('action', DOMAIN . 'mydetails/disability');
                     }
                     $this->view->form = $empDisabilitydetailsform;
                     $this->view->id = $id;
                     $this->view->data = $data;
                     if ($this->getRequest()->getPost()) {
                         $result = $this->save($empDisabilitydetailsform, $tabName);
                         $this->view->msgarray = $result;
                     }
                 }
                 $this->view->empdata = $empdata;
                 $this->view->messages = $this->_helper->flashMessenger->getMessages();
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('disabilitydetails', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             $emptyFlag = 0;
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
                 $loginUserGroup = $auth->getStorage()->read()->group_id;
                 $loginUserRole = $auth->getStorage()->read()->emprole;
             }
             $id = $this->getRequest()->getParam('userid');
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $isrowexist = $employeeModal->getsingleEmployeeData($id);
                     if ($isrowexist == 'norows') {
                         $this->view->rowexist = "norows";
                     } else {
                         $this->view->rowexist = "rows";
                     }
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     if (!empty($empdata)) {
                         $callval = $this->getRequest()->getParam('call');
                         if ($callval == 'ajaxcall') {
                             $this->_helper->layout->disableLayout();
                         }
                         $objName = 'disabilitydetails';
                         $employeeData = array();
                         $empDisabilitydetailsform = new Default_Form_Disabilitydetails();
                         $empDisabilitydetailsModel = new Default_Model_Disabilitydetails();
                         $empDisabilitydetailsform->removeElement("submit");
                         $elements = $empDisabilitydetailsform->getElements();
                         if (count($elements) > 0) {
                             foreach ($elements as $key => $element) {
                                 if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                                     $element->setAttrib("disabled", "disabled");
                                 }
                             }
                         }
                         $data = $empDisabilitydetailsModel->getempDisabilitydetails($id);
                         $usersModel = new Default_Model_Users();
                         $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                         if (!empty($data)) {
                             $empDisabilitydetailsform->setDefault('user_id', $data[0]['user_id']);
                             $empDisabilitydetailsform->setDefault('disability_name', $data[0]['disability_name']);
                             $empDisabilitydetailsform->setDefault('disability_type', $data[0]['disability_type']);
                             $empDisabilitydetailsform->setDefault('other_disability_type', $data[0]['other_disability_type']);
                             $empDisabilitydetailsform->setDefault('disability_description', $data[0]['disability_description']);
                         }
                         $this->view->controllername = $objName;
                         $this->view->id = $id;
                         $this->view->data = $data;
                         $this->view->employeedata = $employeeData[0];
                         $this->view->form = $empDisabilitydetailsform;
                     }
                     $this->view->empdata = $empdata;
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     }
 }