/** * * Edit function to prepopulate the data. * */ public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $appraisalconfigform = new Default_Form_Appraisalconfig(); $bunitModel = new Default_Model_Businessunits(); $appraisalconfigmodel = new Default_Model_Appraisalconfig(); $departmentsmodel = new Default_Model_Departments(); $msgarray = array(); $appraisalconfigform->submit->setLabel('Update'); try { if ($id) { if (is_numeric($id) && $id > 0) { /** to show/hide edit button **/ $chkFlagForEdit = $appraisalconfigmodel->checkInitializationData($id); $this->view->chkFlagForEdit = $chkFlagForEdit; if (empty($chkFlagForEdit)) { $data = $appraisalconfigmodel->getAppraisalConfigbyID($id); if (!empty($data)) { $data = $data[0]; if ($data['department_id'] != '' && $data['department_id'] != 'NULL') { $deptdata = $departmentsmodel->getSingleDepartmentData($data['department_id']); if (sizeof($deptdata) > 0) { $appraisalconfigform->department_id->addMultiOption($deptdata['id'], utf8_encode($deptdata['deptname'])); } } $bunitData = $bunitModel->getSingleUnitData($data['businessunit_id']); if (!empty($bunitData)) { $appraisalconfigform->businessunit_id->addMultiOption($bunitData['id'], utf8_encode($bunitData['unitname'])); } if ($data['department_id'] != '' && $data['department_id'] != 'NULL') { $departmentlistArr = $departmentsmodel->getDepartmentList($data['businessunit_id']); $departmentlistArr = $departmentsmodel->getSingleDepartmentData($data['department_id']); } else { $departmentlistArr = array(); } // Disable 'Business unit wise' option when 'No Business Unit' was selected if ($data["businessunit_id"] == 0) { $appraisalconfigform->performance_app_flag->setOptions(array('disable' => array(1))); } $appraisalconfigform->populate($data); $appraisalconfigform->setDefault('businessunit_id', $data['businessunit_id']); if (sizeof($departmentlistArr) > 0) { $appraisalconfigform->setDefault('department_id', $data['department_id']); } $this->view->performance_app_flag = $data['performance_app_flag']; $appraisalconfigform->setAttrib('action', DOMAIN . 'appraisalconfig/edit/id/' . $id); $this->view->data = $data; /**** $chk_cnt = $appraisalconfigmodel->check_act_init($id); $this->view->chk_cnt = $chk_cnt; if($chk_cnt > 0) { $appraisalconfigform->businessunit_id->setAttrib("disabled", "disabled"); $appraisalconfigform->performance_app_flag->setAttrib("disabled", "disabled"); $appraisalconfigform->department_id->setAttrib("disabled", "disabled"); $appraisalconfigform->appraisal_mode->setAttrib("disabled", "disabled"); $appraisalconfigform->appraisal_ratings->setAttrib("disabled", "disabled"); //added on 13-04-2015 by soujanya } *****/ } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'noedit'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'nodata'; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $appraisalconfigform; if ($this->getRequest()->getPost()) { $result = $this->save($appraisalconfigform); $this->view->msgarray = $result; } $this->render('form'); }
/** * * Edit function to prepopulate the data. * In this action service desk id, department, request recievers, cc mail recivers and approver list is populated. */ public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $appraisalconfigform = new Default_Form_Appraisalconfig(); $bunitModel = new Default_Model_Businessunits(); $appraisalconfigmodel = new Default_Model_Appraisalconfig(); $departmentsmodel = new Default_Model_Departments(); $msgarray = array(); $appraisalconfigform->submit->setLabel('Update'); try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $appraisalconfigmodel->getAppraisalConfigbyID($id); if (!empty($data)) { $data = $data[0]; if ($data['department_id'] != '' && $data['department_id'] != 'NULL') { $deptdata = $departmentsmodel->getSingleDepartmentData($data['department_id']); if (sizeof($deptdata) > 0) { $appraisalconfigform->department_id->addMultiOption($deptdata['id'], utf8_encode($deptdata['deptname'])); } } $bunitData = $bunitModel->getSingleUnitData($data['businessunit_id']); if (!empty($bunitData)) { $appraisalconfigform->businessunit_id->addMultiOption($bunitData['id'], utf8_encode($bunitData['unitname'])); } if ($data['department_id'] != '' && $data['department_id'] != 'NULL') { $departmentlistArr = $departmentsmodel->getDepartmentList($data['businessunit_id']); $departmentlistArr = $departmentsmodel->getSingleDepartmentData($data['department_id']); } else { $departmentlistArr = array(); } $appraisalconfigform->populate($data); $appraisalconfigform->setDefault('businessunit_id', $data['businessunit_id']); if (sizeof($departmentlistArr) > 0) { $appraisalconfigform->setDefault('department_id', $data['department_id']); } $this->view->performance_app_flag = $data['performance_app_flag']; $appraisalconfigform->setAttrib('action', DOMAIN . 'appraisalconfig/edit/id/' . $id); $this->view->data = $data; $appraisalconfigform->businessunit_id->setAttrib("disabled", "disabled"); $appraisalconfigform->performance_app_flag->setAttrib("disabled", "disabled"); $appraisalconfigform->department_id->setAttrib("disabled", "disabled"); $appraisalconfigform->appraisal_mode->setAttrib("disabled", "disabled"); //$approval_selection_edit = $appraisalconfigmodel->checkEnablestatus($businessunit_id,$performance_app_flag,$department_id); $appraisalconfigform->approval_selection->setAttrib("disabled", "disabled"); } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'nodata'; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $appraisalconfigform; //echo "<pre>";print_r($appraisalconfigform);echo "</pre>"; if ($this->getRequest()->getPost()) { $result = $this->save($appraisalconfigform); $this->view->msgarray = $result; } $this->render('form'); }