public static function update_QsParmas_Allemps($questions, $categoryids = '') { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $appraisalQsModel = new Default_Model_Appraisalquestions(); $appraisalCategoryModel = new Default_Model_Appraisalcategory(); if ($questions != '') { $QsdataArr = array('isused' => 1, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $Qswhere = " id IN({$questions}) "; $QsId = $appraisalQsModel->SaveorUpdateAppraisalQuestionData($QsdataArr, $Qswhere); } if ($categoryids != '') { $CatdataArr = array('isused' => 1, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $Catwhere = " id IN({$categoryids}) "; $CatId = $appraisalCategoryModel->SaveorUpdateAppraisalCategoryData($CatdataArr, $Catwhere); } ?> <?php }
public function deleteAction() { $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->_request->getParam('objid'); $messages['message'] = ''; $messages['msgtype'] = ''; $count = 0; $actionflag = 3; if ($id) { $appraisalquestionsmodel = new Default_Model_Appraisalquestions(); $menumodel = new Default_Model_Menu(); $appraisalquestionsdata = $appraisalquestionsmodel->getAppraisalQuestionbyID($id); if ($appraisalquestionsdata[0]['isused'] == 0) { $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifiedby' => $loginUserId); $where = array('id=?' => $id); $Id = $appraisalquestionsmodel->SaveorUpdateAppraisalQuestionData($data, $where); if ($Id == 'update') { $menuidArr = $menumodel->getMenuObjID('/appraisalquestions'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $configmail = sapp_Global::send_configuration_mail('Question', $appraisalquestionsdata[0]['question']); $messages['message'] = 'Question deleted successfully.'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'Question cannot be deleted.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Question cannot be deleted as its using in appraisal process.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Question cannot be deleted.'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); }
public function savequestionpopupAction() { $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('savequestionpopup', 'json')->initContext(); $this->_helper->layout->disableLayout(); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $appraisalquestionsmodel = new Default_Model_Appraisalquestions(); $result['result'] = ''; $result['id'] = ''; $result['question'] = ''; $result['description'] = ''; try { $categoryval = $this->_request->getParam('categoryval'); $questionval = urldecode($this->_request->getParam('questionval')); $description = trim($this->_request->getParam('description')); $moduleflag = trim($this->_request->getParam('moduleflag')); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('pa_category_id' => $categoryval, 'question' => $questionval, 'description' => $description != '' ? $description : NULL, 'module_flag' => $moduleflag, 'createdby_role' => $loginuserRole, 'createdby_group' => $loginuserGroup, 'createdby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifiedby' => $loginUserId, 'isactive' => 1, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = ''; $actionflag = 1; if ($questionval != '' && $categoryval != '' && $moduleflag != '' && preg_match('/^[a-zA-Z0-9.\\- ?\',\\/#@$&*()!]+$/', $questionval)) { $Id = $appraisalquestionsmodel->SaveorUpdateAppraisalQuestionData($data, $where); $menuidArr = $menumodel->getMenuObjID('/appraisalquestions'); $menuID = $menuidArr[0]['id']; $logresult = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $result['msg'] = 'success'; $result['id'] = $Id; $result['question'] = $questionval; $result['description'] = $description; } else { $result['msg'] = 'error'; $result['id'] = ''; $result['question'] = ''; $result['description'] = ''; } } catch (Exception $e) { $result['msg'] = $e->getMessage(); $result['id'] = ''; $result['question'] = ''; $result['description'] = ''; } $this->_helper->json($result); }
public function savequestions($hrWizardData) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $appraisalquestionsmodel = new Default_Model_Appraisalquestions(); $msgarray = array(); $errorflag = 'true'; $categoryNameId = $this->_request->getParam('category_name_id'); $questionarr = $this->_request->getParam('question'); $descriptionarr = $this->_request->getParam('description'); if (!empty($questionarr)) { for ($i = 0; $i < sizeof($questionarr); $i++) { if ($questionarr[$i] == '') { $msgarray['question_name'][$i] = 'Please enter question.'; $errorflag = 'false'; } else { if (!preg_match('/^[a-zA-Z0-9.\\- ?\',\\/#@$&*()!]+$/', $questionarr[$i])) { $msgarray['question_name'][$i] = 'Please enter valid holiday.'; $errorflag = 'false'; } } if ($categoryNameId == '') { $msgarray['category_name_error'] = 'Please select category name.'; $errorflag = 'false'; } } $msgarray['categoryerrorsize'] = sizeof($questionarr); } if ($errorflag == 'true') { try { $actionflag = 1; $tableid = ''; $where = ''; $date = new Zend_Date(); for ($i = 0; $i < sizeof($questionarr); $i++) { $data = array('pa_category_id' => $categoryNameId, 'question' => trim($questionarr[$i]), 'description' => $descriptionarr[$i] != '' ? trim($descriptionarr[$i]) : NULL, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'createdby_role' => $loginuserRole, 'createdby_group' => $loginuserGroup, 'createdby' => $loginUserId, 'module_flag' => 1, 'createddate' => gmdate("Y-m-d H:i:s"), 'isactive' => 1); $Id = $appraisalquestionsmodel->SaveorUpdateAppraisalQuestionData($data, $where); $tableid = $Id; $menuID = APPRAISALQUESTIONS; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); } $hrWizardModel = new Default_Model_Hrwizard(); $hrwizardarray = array('perf_appraisal' => 2, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($hrWizardData['leavetypes'] == 2 && $hrWizardData['holidays'] == 2) { $hrwizardarray['iscomplete'] = 2; } $hrWizardModel->SaveorUpdateHrWizardData($hrwizardarray, ''); $this->_helper->getHelper("FlashMessenger")->addMessage("Questions added successfully."); $this->_redirect('hrwizard/configureperformanceappraisal'); } catch (Exception $e) { $msgarray['category_name_error'] = "Something went wrong, please try again."; return $msgarray; } } else { return $msgarray; } }