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 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(); } $appraisalquestionsform = new Default_Form_Appraisalquestions(); $appraisalCategoryModel = new Default_Model_Appraisalcategory(); $appraisalquestionsmodel = new Default_Model_Appraisalquestions(); $msgarray = array(); $popConfigPermission = array(); if (sapp_Global::_checkprivileges(APPRAISALQUESTIONS, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'appraisalquestions'); } $appraisalquestionsform->submit->setLabel('Update'); try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $appraisalquestionsmodel->getAppraisalQuestionbyID($id); if (!empty($data)) { $data = $data[0]; // When question is already question details can't be edited if ($data['isused'] == 1) { $this->view->ermsg = 'norecord'; } else { $appraisalCategoriesData = $appraisalCategoryModel->getAppraisalCategorysData(); if (sizeof($appraisalCategoriesData) > 0) { foreach ($appraisalCategoriesData as $ac) { $appraisalquestionsform->pa_category_id->addMultiOption($ac['id'], utf8_encode($ac['category_name'])); } } $appraisalquestionsform->populate($data); $appraisalquestionsform->setDefault('pa_category_id', $data['pa_category_id']); $appraisalquestionsform->setAttrib('action', BASE_URL . 'appraisalquestions/edit/id/' . $id); $this->view->data = $data; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = ''; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $appraisalquestionsform; if ($this->getRequest()->getPost()) { $result = $this->save($appraisalquestionsform); $this->view->msgarray = $result; } $this->render('form'); }
public function getappraisalcategoryAction() { $this->_helper->layout->disableLayout(); $appraisalCategoryModel = new Default_Model_Appraisalcategory(); $appraisalinitmodel = new Default_Model_Appraisalinit(); $result['result'] = 'success'; $result['data'] = "<option value=''>Select Parameter</option>"; $categoryids = ''; $appraisalid = $this->_request->getParam('appraisalid'); $data = $appraisalinitmodel->getConfigData($appraisalid); if (!empty($data)) { $categoryids = $data[0]['category_id']; } if ($categoryids) { $appraisalCategoriesData = $appraisalCategoryModel->getCategoryNameByIds($categoryids); if (!empty($appraisalCategoriesData)) { foreach ($appraisalCategoriesData as $data) { $result['data'] .= "<option value='" . $data['id'] . "'>" . utf8_encode($data['category_name']) . "</option>"; } } else { $result['result'] = 'error'; $result['data'] = "Category names are not configured yet."; } } else { $result['result'] = 'error'; $result['data'] = "Category names are not configured yet."; } $this->_helper->json($result); }
public function savecategoryAction() { $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('savecategory', '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; } $result['result'] = ''; $result['id'] = ''; $result['category_name'] = ''; $result['description'] = ''; $appraisalCategoryModel = new Default_Model_Appraisalcategory(); try { $categoryName = trim($this->_request->getParam('category_name')); $description = $this->_request->getParam('description'); $isParameterExist = $appraisalCategoryModel->checkDuplicateParameterName($categoryName); if (!empty($isParameterExist)) { if ($isParameterExist[0]['count'] > 0) { $result['msg'] = 'Parameter name already exists.'; $result['id'] = ''; $result['category_name'] = ''; $result['description'] = ''; } else { $actionflag = ''; $tableid = ''; $data = array('category_name' => $categoryName, 'description' => $description != '' ? trim($description) : NULL, 'createdby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = ''; $actionflag = 1; $Id = $appraisalCategoryModel->SaveorUpdateAppraisalCategoryData($data, $where); if ($Id) { $menuID = APPRAISALCATEGORIES; $logresult = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $Id); $result['msg'] = 'success'; $result['id'] = $Id; $result['category_name'] = $categoryName; $result['description'] = $description; } else { $result['msg'] = 'error'; $result['id'] = ''; $result['groupname'] = ''; $result['description'] = ''; } } } } catch (Exception $e) { $result['msg'] = $e->getMessage(); $result['id'] = ''; $result['groupname'] = ''; $result['description'] = ''; } $this->_helper->json($result); }
public function appraisalinitialized($data) { $employmentstatusModel = new Default_Model_Employmentstatus(); $category_model = new Default_Model_Appraisalcategory(); $eligibility = ''; $category = ''; $budeptArr = sapp_Global::getbudeptname($data['id']); $empstatusArr = $employmentstatusModel->getEmploymentStatusName($data['eligibility']); if (!empty($empstatusArr)) { foreach ($empstatusArr as $status) { $eligibility .= $status['statusname'] . ','; } $eligibility = rtrim($eligibility, ','); } $categoryArr = $category_model->getCategoryNameByIds($data['category_id']); if (!empty($categoryArr)) { foreach ($categoryArr as $catid) { $category .= $catid['category_name'] . ','; } $category = rtrim($category, ','); } $data['process_status'] = ''; if ($data['initialize_status'] == 1) { if ($data['enable_step'] == 1) { $data['process_status'] = 'Enabled to Managers'; } if ($data['enable_step'] == 2) { $data['process_status'] = 'Enabled to Employees'; } } else { if ($data['initialize_status'] == 2) { $data['process_status'] = 'Initialize Later'; } else { $data['process_status'] = 'In progress'; } } $this->view->ermsg = ''; $this->view->eligibility = $eligibility; $this->view->category = $category; $this->view->budeptArr = $budeptArr; $this->view->data = $data; }
public function addpopupAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->getRequest()->getParam('id'); $msgarray = array(); $controllername = 'appraisalcategory'; $appraisalCategoryForm = new Default_Form_Appraisalcategory(); $appraisalCategoryModel = new Default_Model_Appraisalcategory(); $appraisalCategoryForm->setAction(DOMAIN . 'appraisalcategory/addpopup'); if ($this->getRequest()->getPost()) { if ($appraisalCategoryForm->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $category_name = $this->_request->getParam('category_name'); $description = $this->_request->getParam('description'); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('category_name' => $category_name, 'description' => $description, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $appraisalCategoryModel->SaveorUpdateAppraisalCategoryData($data, $where); $tableid = $Id; $menuidArr = $menumodel->getMenuObjID('/appraisalcategory'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $appraisalcategoryData = $appraisalCategoryModel->getAppraisalCategorysData(); $opt = ''; foreach ($appraisalcategoryData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], utf8_encode($record['category_name'])); } $this->view->departmentData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $appraisalCategoryForm->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = $controllername; $this->view->form = $appraisalCategoryForm; $this->view->ermsg = ''; $this->render('form'); }