예제 #1
0
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $actionflag = 3;
     $completedDetails = 0;
     $onholdDetails = 0;
     $specimen_id = 0;
     $flag = 1;
     if ($id) {
         $empscreeningModel = new Default_Model_Empscreening();
         $menumodel = new Default_Model_Menu();
         $empmodel = new Default_Model_Empscreening();
         $emparraydata = $empmodel->checkdetailedbgstatus('', '', '', $id);
         if ($emparraydata['isactive'] != '0' && $emparraydata['isactive'] != 0) {
             $checkemparraydata = $empmodel->checkdetailedbgstatus('', '', '', $id, 'findcompleted');
             for ($i = 0; $i < sizeof($checkemparraydata); $i++) {
                 $specimen_id = $checkemparraydata[0]['specimen_id'];
                 $flag = $checkemparraydata[0]['flag'];
                 if ($checkemparraydata[$i]['process_status'] == 'Complete') {
                     $completedDetails = $completedDetails + 1;
                 } else {
                     if ($checkemparraydata[$i]['process_status'] == 'On hold') {
                         $onholdDetails = $onholdDetails + 1;
                     }
                 }
             }
             if ($completedDetails == sizeof($checkemparraydata)) {
                 $empmodel->updatebgstatus('complete', $specimen_id, $flag);
             }
             if ($onholdDetails == sizeof($checkemparraydata)) {
                 $empmodel->updatebgstatus('onhold', $specimen_id, $flag);
             }
             $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $where = array('id=?' => $id);
             $Id = $empscreeningModel->SaveorUpdateDetails($data, $where);
             if ($Id == 'update') {
                 $menuidArr = $menumodel->getMenuObjID('/empscreening');
                 $menuID = $menuidArr[0]['id'];
                 $messages['message'] = 'Process deleted successfully';
                 $messages['msgtype'] = 'success';
                 $messages['flagtype'] = 'process';
             } else {
                 $messages['message'] = 'Process cannot be deleted';
                 $messages['msgtype'] = 'error';
                 $messages['flagtype'] = 'process';
             }
         } else {
             $messages['message'] = 'As the process has been made inactive, you cannot delete it.';
             $messages['msgtype'] = 'error';
             $messages['flagtype'] = 'process';
             $messages['redirect'] = 'no';
         }
     } else {
         $messages['message'] = 'Process cannot be deleted';
         $messages['msgtype'] = 'error';
         $messages['flagtype'] = 'process';
     }
     $this->_helper->json($messages);
 }
예제 #2
0
 public function updatecontactnumberAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('id');
     $contactnumber = $this->_request->getParam('contactnumber');
     $messages['message'] = '';
     $actionflag = 2;
     if ($id) {
         $usersModal = new Default_Model_Users();
         $menumodel = new Default_Model_Menu();
         $data = array('contactnumber' => $contactnumber);
         $where = array('id=?' => $id);
         $Id = $usersModal->addOrUpdateUserModel($data, $where);
         if ($Id == 'update') {
             $menuidArr = $menumodel->getMenuObjID('/employee');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
             $messages['message'] = 'Contact number updated successfully.';
         } else {
             $messages['message'] = 'Contact number cannot be updated.';
         }
     } else {
         $messages['message'] = 'Contact number cannot be updated.';
     }
     $this->_helper->json($messages);
 }
 public function comsave($empcommdetailsform, $userid)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $perm_country = $this->_request->getParam('perm_country');
     $perm_stateparam = $this->_request->getParam('perm_state');
     $perm_stateArr = explode("!@#", $this->_request->getParam('perm_state'));
     $perm_state = $perm_stateArr[0];
     $perm_cityparam = $this->_request->getParam('perm_city');
     $perm_cityArr = explode("!@#", $this->_request->getParam('perm_city'));
     $perm_city = $perm_cityArr[0];
     $address_flag = $this->_request->getParam('address_flag');
     $current_country = $this->_request->getParam('current_country');
     $current_stateparam = $this->_request->getParam('current_state');
     $current_stateArr = explode("!@#", $this->_request->getParam('current_state'));
     $current_state = $current_stateArr[0];
     $current_cityparam = $this->_request->getParam('current_city');
     $current_cityArr = explode("!@#", $this->_request->getParam('current_city'));
     $current_city = $current_cityArr[0];
     if ($empcommdetailsform->isValid($this->_request->getPost())) {
         $post_values = $this->_request->getPost();
         if (isset($post_values['id'])) {
             unset($post_values['id']);
         }
         if (isset($post_values['user_id'])) {
             unset($post_values['user_id']);
         }
         if (isset($post_values['submit'])) {
             unset($post_values['submit']);
         }
         $new_post_values = array_filter($post_values);
         if (!empty($new_post_values)) {
             $empcommdetailsModal = new Default_Model_Empcommunicationdetails();
             $id = $this->_request->getParam('id');
             $user_id = $userid;
             $personalemail = $this->_request->getParam('personalemail');
             $perm_streetaddress = $this->_request->getParam('perm_streetaddress');
             $perm_pincode = $this->_request->getParam('perm_pincode');
             $current_streetaddress = $this->_request->getParam('current_streetaddress');
             $current_pincode = $this->_request->getParam('current_pincode');
             $emergency_number = $this->_request->getParam('emergency_number');
             $emergency_name = $this->_request->getParam('emergency_name');
             $emergency_email = $this->_request->getParam('emergency_email');
             $date = new Zend_Date();
             $menumodel = new Default_Model_Menu();
             $actionflag = '';
             $tableid = '';
             $data = array('user_id' => $user_id, 'personalemail' => $personalemail, 'perm_streetaddress' => $perm_streetaddress, 'perm_country' => $perm_country != '' ? $perm_country : NULL, 'perm_state' => $perm_state != '' ? $perm_state : NULL, 'perm_city' => $perm_city != '' ? $perm_city : NULL, 'perm_pincode' => $perm_pincode, 'current_streetaddress' => $current_streetaddress != '' ? $current_streetaddress : NULL, 'current_country' => $current_country != '' ? $current_country : NULL, 'current_state' => $current_state != '' ? $current_state : NULL, 'current_city' => $current_city != '' ? $current_city : NULL, 'current_pincode' => $current_pincode != '' ? $current_pincode : NULL, 'emergency_number' => $emergency_number != '' ? $emergency_number : NULL, 'emergency_name' => $emergency_name != '' ? $emergency_name : NULL, 'emergency_email' => $emergency_email != '' ? $emergency_email : NULL, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             if ($id != '') {
                 $where = array('user_id=?' => $user_id);
                 $actionflag = 2;
             } else {
                 $data['createdby'] = $loginUserId;
                 $data['createddate'] = gmdate("Y-m-d H:i:s");
                 $data['isactive'] = 1;
                 $where = '';
                 $actionflag = 1;
             }
             $Id = $empcommdetailsModal->SaveorUpdateEmpcommData($data, $where);
             if ($Id == 'update') {
                 $tableid = $id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee contact details updated successfully."));
             } else {
                 $tableid = $Id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee contact details added successfully."));
             }
             $menuidArr = $menumodel->getMenuObjID('/employee');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id);
         } else {
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => FIELDMSG));
         }
         $this->_redirect('myemployees/comedit/userid/' . $userid);
     } else {
         $messages = $empcommdetailsform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         if (isset($perm_country) && $perm_country != 0 && $perm_country != '') {
             $statesmodel = new Default_Model_States();
             $statesmodeldata = $statesmodel->getStatesList($perm_country);
             $empcommdetailsform->perm_state->clearMultiOptions();
             $empcommdetailsform->perm_city->clearMultiOptions();
             $empcommdetailsform->perm_state->addMultiOption('', 'Select State');
             foreach ($statesmodeldata as $res) {
                 $empcommdetailsform->perm_state->addMultiOption($res['id'] . '!@#' . utf8_encode($res['state_name']), utf8_encode($res['state_name']));
             }
             if (isset($perm_stateparam) && $perm_stateparam != 0 && $perm_stateparam != '') {
                 $empcommdetailsform->setDefault('perm_state', $perm_stateparam);
             }
         }
         if (isset($perm_stateparam) && $perm_stateparam != 0 && $perm_stateparam != '') {
             $citiesmodel = new Default_Model_Cities();
             $citiesmodeldata = $citiesmodel->getCitiesList($perm_state);
             $empcommdetailsform->perm_city->addMultiOption('', 'Select City');
             foreach ($citiesmodeldata as $res) {
                 $empcommdetailsform->perm_city->addMultiOption($res['id'] . '!@#' . utf8_encode($res['city_name']), utf8_encode($res['city_name']));
             }
             if (isset($perm_cityparam) && $perm_cityparam != 0 && $perm_cityparam != '') {
                 $empcommdetailsform->setDefault('perm_city', $perm_cityparam);
             }
         }
         if (isset($current_country) && $current_country != 0 && $current_country != '') {
             $statesmodel = new Default_Model_States();
             $statesmodeldata = $statesmodel->getStatesList($current_country);
             $empcommdetailsform->current_state->addMultiOption('', 'Select State');
             foreach ($statesmodeldata as $res) {
                 $empcommdetailsform->current_state->addMultiOption($res['id'] . '!@#' . utf8_encode($res['state_name']), utf8_encode($res['state_name']));
             }
             if (isset($current_stateparam) && $current_stateparam != 0 && $current_stateparam != '') {
                 $empcommdetailsform->setDefault('current_state', $current_stateparam);
             }
         }
         if (isset($current_stateparam) && $current_stateparam != 0 && $current_stateparam != '') {
             $citiesmodel = new Default_Model_Cities();
             $citiesmodeldata = $citiesmodel->getCitiesList($current_state);
             $empcommdetailsform->current_city->addMultiOption('', 'Select City');
             foreach ($citiesmodeldata as $res) {
                 $empcommdetailsform->current_city->addMultiOption($res['id'] . '!@#' . utf8_encode($res['city_name']), utf8_encode($res['city_name']));
             }
             if (isset($current_cityparam) && $current_cityparam != 0 && $current_cityparam != '') {
                 $empcommdetailsform->setDefault('current_city', $current_cityparam);
             }
         }
         return $msgarray;
     }
 }
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $actionflag = 3;
     if ($id) {
         $departmentsmodel = new Default_Model_Departments();
         $checkemployees = $departmentsmodel->checkemployeestodepartment($id);
         if ($checkemployees == 0) {
             $menumodel = new Default_Model_Menu();
             $data = array('isactive' => 0);
             $where = array('id=?' => $id);
             $Id = $departmentsmodel->SaveorUpdateDepartmentsUnits($data, $where);
             if ($Id == 'update') {
                 $menuidArr = $menumodel->getMenuObjID('/departments');
                 $menuID = $menuidArr[0]['id'];
                 $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
                 $messages['message'] = 'Department deleted successfully.';
                 $messages['msgtype'] = 'success';
             } else {
                 $messages['message'] = 'Department cannot be deleted.';
                 $messages['msgtype'] = 'error';
             }
         } else {
             $messages['message'] = 'Please re-assign the employees to another department';
             $messages['msgtype'] = 'error';
         }
     } else {
         $messages['message'] = 'Department cannot be deleted.';
         $messages['msgtype'] = 'error';
     }
     $this->_helper->json($messages);
 }
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $messages['msgtype'] = '';
     $actionflag = 3;
     if ($id) {
         $leavemanagementmodel = new Default_Model_Leavemanagement();
         $menumodel = new Default_Model_Menu();
         $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s"));
         $where = array('id=?' => $id);
         $Id = $leavemanagementmodel->SaveorUpdateLeaveManagementData($data, $where);
         if ($Id == 'update') {
             $menuidArr = $menumodel->getMenuObjID('/leavemanagement');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
             $messages['message'] = 'Leave management deleted successfully.';
             $messages['msgtype'] = 'success';
         } else {
             $messages['message'] = 'Leave management cannot be deleted.';
             $messages['msgtype'] = 'error';
         }
     } else {
         $messages['message'] = 'Leave management cannot be deleted.';
         $messages['msgtype'] = 'succerroress';
     }
     $this->_helper->json($messages);
 }
예제 #6
0
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $messages['msgtype'] = '';
     $messages['flagtype'] = '';
     $actionflag = 3;
     if ($id) {
         $positionsmodel = new Default_Model_Positions();
         $menumodel = new Default_Model_Menu();
         $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s"));
         $where = array('id=?' => $id);
         $position_data = $positionsmodel->getsinglePositionData($id);
         $Id = $positionsmodel->SaveorUpdatePositionData($data, $where);
         if ($Id == 'update') {
             sapp_Global::send_configuration_mail("Positions", $position_data[0]['positionname']);
             $menuidArr = $menumodel->getMenuObjID('/positions');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
             $messages['message'] = 'Position deleted successfully.';
             $messages['msgtype'] = 'success';
         } else {
             $messages['message'] = 'Position cannot be deleted.';
             $messages['msgtype'] = 'error';
         }
     } else {
         $messages['message'] = 'Position cannot be deleted.';
         $messages['msgtype'] = 'error';
     }
     $this->_helper->json($messages);
 }
 public function save($empsalarydetailsform, $userid)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     if ($empsalarydetailsform->isValid($this->_request->getPost())) {
         $empsalarydetailsModal = new Default_Model_Empsalarydetails();
         $id = $this->_request->getParam('id');
         $user_id = $userid;
         $currencyid = $this->_request->getParam('currencyid');
         $salarytype = $this->_request->getParam('salarytype');
         $salary = $this->_request->getParam('salary');
         $bankname = trim($this->_request->getParam('bankname'));
         $accountholder_name = trim($this->_request->getParam('accountholder_name'));
         $accountclasstypeid = $this->_request->getParam('accountclasstypeid');
         $bankaccountid = $this->_request->getParam('bankaccountid');
         $accountnumber = trim($this->_request->getParam('accountnumber'));
         $accountholding = $this->_request->getParam('accountholding');
         $accountholding = sapp_Global::change_date($accountholding, 'database');
         $date = new Zend_Date();
         $menumodel = new Default_Model_Menu();
         $actionflag = '';
         $tableid = '';
         $data = array('user_id' => $user_id, 'currencyid' => $currencyid, 'salarytype' => $salarytype, 'salary' => $salary, 'bankname' => $bankname != '' ? $bankname : NULL, 'accountholder_name' => $accountholder_name != '' ? $accountholder_name : NULL, 'accountclasstypeid' => $accountclasstypeid != '' ? $accountclasstypeid : NULL, 'bankaccountid' => $bankaccountid != '' ? $bankaccountid : NULL, 'accountnumber' => $accountnumber != '' ? $accountnumber : NULL, 'accountholding' => $accountholding != '' ? $accountholding : NULL, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
         if ($id != '') {
             $where = array('user_id=?' => $user_id);
             $actionflag = 2;
         } else {
             $data['createdby'] = $loginUserId;
             $data['createddate'] = gmdate("Y-m-d H:i:s");
             $data['isactive'] = 1;
             $where = '';
             $actionflag = 1;
         }
         $Id = $empsalarydetailsModal->SaveorUpdateEmpSalaryData($data, $where);
         if ($Id == 'update') {
             $tableid = $id;
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee salary details updated successfully."));
         } else {
             $tableid = $Id;
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee salary details added successfully."));
         }
         $menuidArr = $menumodel->getMenuObjID('/employee');
         $menuID = $menuidArr[0]['id'];
         $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id);
         $this->_redirect('empsalarydetails/edit/userid/' . $user_id);
     } else {
         $messages = $empsalarydetailsform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
예제 #8
0
 /**
  * This function is used to active/inactive employees.
  */
 public function makeactiveinactiveAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $emp_id = $this->_getParam('emp_id', null);
     $status = trim($this->_getParam('status', null));
     $hasteam = trim($this->_getParam('hasteam', null));
     $employeeModal = new Default_Model_Employee();
     $user_model = new Default_Model_Usermanagement();
     $usermodel = new Default_Model_Users();
     $role_model = new Default_Model_Roles();
     $logmanagermodel = new Default_Model_Logmanager();
     $menumodel = new Default_Model_Menu();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $empData = $employeeModal->getsingleEmployeeData($emp_id);
     if ($hasteam == 'true') {
         $employessunderEmpId = array();
         $reportingmanagersList = array();
         $employessunderEmpId = $employeeModal->getEmployeesUnderRM($emp_id);
         if ($empData[0]['is_orghead'] == 1) {
             $reportingmanagersList = $usermodel->getReportingManagerList_employees('', '', MANAGEMENT_GROUP);
         } else {
             $role_data = $role_model->getRoleDataById($empData[0]['emprole']);
             $reportingmanagersList = $usermodel->getReportingManagerList_employees($empData[0]['department_id'], $emp_id, $role_data['group_id']);
         }
         $reportingmanagersList = sapp_Global::removeElementWithValue($reportingmanagersList, 'id', $emp_id);
         $this->view->emp_id = $emp_id;
         $this->view->status = $status;
         $this->view->ishead = $empData[0]['is_orghead'];
         $this->view->empName = $empData[0]['userfullname'];
         $this->view->employessunderEmpId = $employessunderEmpId;
         $this->view->reportingmanagersList = $reportingmanagersList;
     } else {
         $db = Zend_Db_Table::getDefaultAdapter();
         $db->beginTransaction();
         try {
             if ($status == 'active') {
                 $data = array('isactive' => 1, 'emptemplock' => 0);
                 $empdata = array('isactive' => 1);
                 $logarr = array('userid' => $loginUserId, 'recordid' => $emp_id, 'date' => gmdate("Y-m-d H:i:s"), 'isactive' => 1);
                 $jsonlogarr = json_encode($logarr);
             } else {
                 if ($status == 'inactive') {
                     $data = array('isactive' => 0, 'emptemplock' => 1);
                     $empdata = array('isactive' => 0);
                     $logarr = array('userid' => $loginUserId, 'recordid' => $emp_id, 'date' => gmdate("Y-m-d H:i:s"), 'isactive' => 0);
                     $jsonlogarr = json_encode($logarr);
                 }
             }
             $where = "id = " . $emp_id;
             $user_model->SaveorUpdateUserData($data, $where);
             $employeeModal->SaveorUpdateEmployeeData($empdata, "user_id =" . $emp_id);
             if ($empData[0]['is_orghead'] == '1') {
                 $headData = array('is_orghead' => 0);
                 $headWhere = "user_id = " . $emp_id;
                 $employeeModal->SaveorUpdateEmployeeData($headData, $headWhere);
             }
             $menuidArr = $menumodel->getMenuObjID('/employee');
             $menuID = $menuidArr[0]['id'];
             $id = $logmanagermodel->addOrUpdateLogManager($menuID, 4, $jsonlogarr, $loginUserId, $emp_id);
             $db->commit();
             $result = 'update';
         } catch (Exception $e) {
             $db->rollBack();
             $result = 'failed';
         }
         $this->_helper->json(array('result' => $result == 'update' ? "yes" : "no"));
     }
 }
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $actionflag = 3;
     if ($id) {
         $assignmententryreasoncodemodel = new Default_Model_Assignmententryreasoncode();
         $menumodel = new Default_Model_Menu();
         $data = array('isactive' => 0);
         $where = array('id=?' => $id);
         $Id = $assignmententryreasoncodemodel->SaveorUpdateAssignmentEntryData($data, $where);
         if ($Id == 'update') {
             $menuidArr = $menumodel->getMenuObjID('/assignmententryreasoncode');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
             $messages['message'] = 'Assignment entry reason code deleted successfully.';
         } else {
             $messages['message'] = 'Assignment entry reason code cannot be deleted.';
         }
     } else {
         $messages['message'] = 'Assignment entry reason code cannot be deleted.';
     }
     $this->_helper->json($messages);
 }
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $actionflag = 3;
     if ($id) {
         $leaverequestmodel = new Default_Model_Leaverequest();
         $menumodel = new Default_Model_Menu();
         $data = array('leavestatus' => 4);
         $where = array('id=?' => $id);
         $Id = $leaverequestmodel->SaveorUpdateLeaveRequest($data, $where);
         if ($Id == 'update') {
             $menuidArr = $menumodel->getMenuObjID('/pendingleaves');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
             $messages['message'] = 'Leave request cancelled.';
         } else {
             $messages['message'] = 'Leave request cannot be cancelled.';
         }
     } else {
         $messages['message'] = 'Leave request cannot be cancelled.';
     }
     $this->_helper->json($messages);
 }
 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 = 'servicedeskdepartment';
     $servicedeskdepartmentform = new Default_Form_servicedeskdepartment();
     $servicedeskdepartmentmodel = new Default_Model_Servicedeskdepartment();
     $servicedeskdepartmentform->setAction(DOMAIN . 'servicedeskdepartment/addpopup');
     if ($this->getRequest()->getPost()) {
         if ($servicedeskdepartmentform->isValid($this->_request->getPost())) {
             $id = $this->_request->getParam('id');
             $service_desk_name = $this->_request->getParam('service_desk_name');
             $description = $this->_request->getParam('description');
             $menumodel = new Default_Model_Menu();
             $actionflag = '';
             $tableid = '';
             $data = array('service_desk_name' => $service_desk_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 = $servicedeskdepartmentmodel->SaveorUpdateServiceDeskDepartmentData($data, $where);
             $tableid = $Id;
             $menuidArr = $menumodel->getMenuObjID('/servicedeskdepartment');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             $servicedeskdepartmentData = $servicedeskdepartmentmodel->getSDDepartmentData();
             $opt = '';
             foreach ($servicedeskdepartmentData as $record) {
                 $opt .= sapp_Global::selectOptionBuilder($record['id'], utf8_encode($record['service_desk_name']));
             }
             $this->view->departmentData = $opt;
             $this->view->eventact = 'added';
             $close = 'close';
             $this->view->popup = $close;
         } else {
             $messages = $servicedeskdepartmentform->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 = $servicedeskdepartmentform;
     $this->view->ermsg = '';
     $this->render('form');
 }
 public function deleteAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('dependency_details', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->_request->getParam('objid');
             $messages['message'] = '';
             $messages['msgtype'] = '';
             $actionflag = 3;
             if ($id) {
                 $dependencydetailsModel = new Default_Model_Dependencydetails();
                 $menumodel = new Default_Model_Menu();
                 $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $where = array('id=?' => $id);
                 $Id = $dependencydetailsModel->SaveorUpdateEmployeedependencyData($data, $where);
                 if ($Id == 'update') {
                     $menuidArr = $menumodel->getMenuObjID('/employee');
                     $menuID = $menuidArr[0]['id'];
                     $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
                     $messages['message'] = 'Employee dependency details deleted successfully.';
                     $messages['msgtype'] = 'success';
                 } else {
                     $messages['message'] = 'Employee dependency details  cannot be deleted.';
                     $messages['msgtype'] = 'error';
                 }
             } else {
                 $messages['message'] = 'Employee dependency details cannot be deleted.';
                 $messages['msgtype'] = 'error';
             }
             $this->_helper->json($messages);
         } else {
             $this->_redirect('error');
         }
     }
 }
예제 #13
0
 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');
     $controllername = 'timezone';
     $timezoneform = new Default_Form_timezone();
     $timezonemodel = new Default_Model_Timezone();
     $timezoneform->setAction(DOMAIN . 'timezone/addpopup');
     if ($this->getRequest()->getPost()) {
         if ($timezoneform->isValid($this->_request->getPost())) {
             $id = $this->_request->getParam('id');
             $timezones = $this->_request->getParam('timezone');
             $description = $this->_request->getParam('description');
             $menumodel = new Default_Model_Menu();
             $date = new Zend_Date();
             $actionflag = '';
             $tableid = '';
             if (is_array($timezones)) {
                 $timezonesStr = implode(",", $timezones);
             } else {
                 $timezonesStr = '';
             }
             $count = count($timezones);
             $Id = $timezonemodel->savetimezonedetails($timezonesStr, $description, $loginUserId);
             $where = '';
             $actionflag = 1;
             $tableid = $Id;
             $menuidArr = $menumodel->getMenuObjID('/timezone');
             $menuID = $menuidArr[0]['id'];
             for ($i = 0; $i < $count; $i++) {
                 $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
                 $tableid = $tableid + 1;
             }
             $timezonesData = $timezonemodel->fetchAll('isactive = 1', 'timezone')->toArray();
             $opt = '';
             foreach ($timezonesData as $record) {
                 $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['timezone'] . ' [' . $record['timezone_abbr'] . ']');
             }
             $this->view->timezonesData = $opt;
             $this->view->eventact = 'added';
             $close = 'close';
             $this->view->popup = $close;
         } else {
             $messages = $timezoneform->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 = $timezoneform;
     $this->view->ermsg = '';
 }
예제 #14
0
 public function addnewcityAction()
 {
     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');
     $selectedcountryid = $this->_request->getParam('selectcountryid');
     $selectedstateid = $this->_request->getParam('selectstateid');
     $msgarray = array();
     $setDefaultString = '';
     $citystring = '';
     $controllername = 'cities';
     $citiesform = new Default_Form_cities();
     $citiesmodel = new Default_Model_Cities();
     $countriesModel = new Default_Model_Countries();
     $statesmodel = new Default_Model_States();
     /* Changing the form */
     $citiesform->setAction(BASE_URL . 'cities/addnewcity/selectcountryid/' . $selectedcountryid . '/selectstateid/' . $selectedstateid);
     $citiesform->removeElement('city');
     $citiesform->addElement('text', 'city', array('label' => 'City', 'maxlength' => '20', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Please enter city name.')))));
     /* END */
     $countrieslistArr = $countriesModel->getTotalCountriesList('');
     if (sizeof($countrieslistArr) > 0) {
         $citiesform->countryid->addMultiOption('', 'Select Country');
         foreach ($countrieslistArr as $countrieslistres) {
             if ($selectedcountryid != '') {
                 if ($countrieslistres['id'] == $selectedcountryid) {
                     $citiesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                     $citiesform->setDefault('countryid', $selectedcountryid);
                 }
             } else {
                 $citiesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
             }
             $citiesform->countryid->setAttrib('onchange', 'displayParticularState_normal(this,"","state","city")');
         }
     } else {
         $msgarray['countryid'] = 'Countries are not configured yet.';
     }
     $countryid = $this->_request->getParam('countryid');
     if (isset($selectedcountryid) && $selectedcountryid != '' || isset($countryid) && $countryid != '') {
         if ($countryid) {
             $statesmodeldata = $statesmodel->getStatesList($countryid, '');
         } else {
             $statesmodeldata = $statesmodel->getStatesList($selectedcountryid, '');
         }
         $citiesform->state->addMultiOption('', 'Select State');
         foreach ($statesmodeldata as $res) {
             $citiesform->state->addMultiOption($res['id'], utf8_encode($res['state_name']));
             if ($selectedstateid != '') {
                 if ($res['id'] == $selectedstateid) {
                     $setDefaultString = $res['id'];
                 }
             } else {
                 if ($countryid != '') {
                     if ($res['id'] == $countryid) {
                         $setDefaultString = $res['id'];
                     }
                 }
             }
         }
         $citiesform->setDefault('state', $setDefaultString);
     } else {
         $citiesform->state->addMultiOption('', 'Select State');
     }
     if ($this->getRequest()->getPost()) {
         $id = $this->_request->getParam('id');
         $errorflag = "true";
         $msgarray = array();
         $dbstate = '';
         $dbcountryid = '';
         $stateidstr = $this->_request->getParam('state');
         $stateid = intval($stateidstr);
         $city = $this->_request->getParam('city');
         if (isset($stateid)) {
             $isDuplicateCityNameArr = $citiesmodel->getDuplicateCityName($city, $stateid);
             if ($isDuplicateCityNameArr[0]['count'] > 0) {
                 $errorflag = "false";
                 $msgarray['city'] = "City already exists.";
             }
         } else {
             $errorflag = "false";
             $msgarray['state'] = "Please select state.";
         }
         if ($citiesform->isValid($this->_request->getPost()) && $errorflag == "true") {
             $menumodel = new Default_Model_Menu();
             $city = $this->_request->getParam('city');
             $actionflag = '';
             $tableid = '';
             $NewCityId = $citiesmodel->SaveMainCityData($stateid, $city);
             $actionflag = 1;
             $tableid = $NewCityId;
             $menuidArr = $menumodel->getMenuObjID('/cities');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             if (isset($selectedstateid) && isset($selectedcountryid)) {
                 $cityData = $citiesmodel->getCitiesList($selectedstateid, 'city');
             } else {
                 $cityData = array();
             }
             $opt = '';
             foreach ($cityData as $record) {
                 $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['city_name']);
             }
             $this->view->cityData = $opt;
             $this->view->eventact = 'added';
             $close = 'close';
             $this->view->popup = $close;
         } else {
             $messages = $citiesform->getMessages();
             foreach ($messages as $key => $val) {
                 foreach ($val as $key2 => $val2) {
                     $msgarray[$key] = $val2;
                     break;
                 }
             }
             if (isset($countryid) && $countryid != 0 && $countryid != '') {
                 $statesmodel = new Default_Model_States();
                 $statesmodeldata = $statesmodel->getBasicStatesList($countryid);
                 foreach ($statesmodeldata as $res) {
                     $citiesform->state->addMultiOption($res['state_id_org'] . '!@#' . utf8_encode($res['state']), utf8_encode($res['state']));
                 }
                 if (isset($stateidstr) && $stateidstr != 0 && $stateidstr != '') {
                     $citiesform->setDefault('state', $stateidstr);
                 }
             }
         }
     }
     $this->view->controllername = $controllername;
     $this->view->ermsg = '';
     $this->view->form = $citiesform;
     $this->view->msgarray = $msgarray;
 }
예제 #15
0
 public function updateempdetails($employeeform)
 {
     $emproleStr = '';
     $roleArr = array();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $usersModel = new Default_Model_Usermanagement();
     $employeeModal = new Default_Model_Employee();
     $businessunit_id = $this->_request->getParam('businessunit_id', null);
     $department_id = $this->_request->getParam('department_id', null);
     $reporting_manager = $this->_request->getParam('reporting_manager', null);
     $jobtitle_id = $this->_request->getParam('jobtitle_id', null);
     $position_id = $this->_request->getParam('position_id', null);
     $user_id = $this->_getParam('user_id', null);
     $prefix_id = $this->_getParam('prefix_id', null);
     $extension_number = $this->_getParam('extension_number', null);
     if ($employeeform->isValid($this->_request->getPost())) {
         $id = $this->_request->getParam('id');
         $emp_status_id = $this->_request->getParam('emp_status_id', null);
         $date_of_joining = $this->_request->getParam('date_of_joining', null);
         $date_of_joining = sapp_Global::change_date($date_of_joining, 'database');
         $date_of_leaving = $this->_request->getParam('date_of_leaving', null);
         $date_of_leaving = sapp_Global::change_date($date_of_leaving, 'database');
         $years_exp = $this->_request->getParam('years_exp');
         //FOR USER table
         $employeeId = $this->_getParam('employeeId', null);
         $modeofentry = $this->_getParam('modeofentry', null);
         $hid_modeofentry = $this->_getParam('hid_modeofentry', null);
         $other_modeofentry = $this->_getParam('other_modeofentry', null);
         $userfullname = $this->_getParam('userfullname', null);
         $candidatereferredby = $this->_getParam('candidatereferredby', null);
         $rccandidatename = $this->_getParam('rccandidatename', null);
         $emprole = $this->_getParam('emprole', null);
         //roleid_group_id
         if ($emprole != "") {
             $roleArr = explode('_', $emprole);
             if (!empty($roleArr)) {
                 $emproleStr = $roleArr[0];
             }
         }
         $emailaddress = $this->_getParam('emailaddress', null);
         $tmp_name = $this->_request->getParam('tmp_emp_name', null);
         $act_inact = $this->_request->getParam("act_inact", null);
         //end of user table
         $date = new Zend_Date();
         $menumodel = new Default_Model_Menu();
         $empstatusarray = array(8, 9, 10);
         $actionflag = '';
         $tableid = '';
         if ($modeofentry == 'Direct' || $hid_modeofentry == 'Direct') {
             $candidate_key = 'userfullname';
             $candidate_value = $userfullname;
             $emp_name = $userfullname;
             $candidate_flag = 'no';
         } else {
             $candidate_key = 'rccandidatename';
             $candidate_value = $rccandidatename;
             $emp_name = $tmp_name;
             $candidate_flag = 'yes';
         }
         $trDb = Zend_Db_Table::getDefaultAdapter();
         // starting transaction
         $trDb->beginTransaction();
         try {
             $emppassword = sapp_Global::generatePassword();
             $user_data = array('emprole' => $emproleStr, $candidate_key => $candidate_value, 'emailaddress' => $emailaddress, 'modifiedby' => $loginUserId, 'modifieddate' => Zend_Registry::get('currentdate'), 'emppassword' => md5($emppassword), 'employeeId' => $employeeId, 'modeofentry' => $id == '' ? $modeofentry : "", 'selecteddate' => $date_of_joining, 'candidatereferredby' => $candidatereferredby, 'userstatus' => 'old', 'other_modeofentry' => $other_modeofentry);
             if ($id != '') {
                 $where = array('user_id=?' => $user_id);
                 $actionflag = 2;
                 $user_where = "id = " . $user_id;
                 unset($user_data['candidatereferredby']);
                 unset($user_data['userstatus']);
                 unset($user_data['emppassword']);
                 unset($user_data['employeeId']);
                 unset($user_data['modeofentry']);
                 unset($user_data['other_modeofentry']);
             } else {
                 $data['createdby'] = $loginUserId;
                 $data['createddate'] = gmdate("Y-m-d H:i:s");
                 $data['isactive'] = 1;
                 $user_data['createdby'] = $loginUserId;
                 $user_data['createddate'] = gmdate("Y-m-d H:i:s");
                 $user_data['isactive'] = 1;
                 if ($modeofentry != 'Direct') {
                     $user_data['userfullname'] = $emp_name;
                 }
                 $where = '';
                 $actionflag = 1;
                 $user_where = '';
             }
             $user_status = $usersModel->SaveorUpdateUserData($user_data, $user_where);
             if ($id == '') {
                 $user_id = $user_status;
             }
             $data = array('user_id' => $user_id, 'reporting_manager' => $reporting_manager, 'emp_status_id' => $emp_status_id, 'businessunit_id' => $businessunit_id, 'department_id' => $department_id, 'jobtitle_id' => $jobtitle_id, 'position_id' => $position_id, 'prefix_id' => $prefix_id, 'extension_number' => $extension_number, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'years_exp' => $years_exp == '' ? null : $years_exp, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $Id = $employeeModal->SaveorUpdateEmployeeData($data, $where);
             $statuswhere = array('id=?' => $user_id);
             if (in_array($emp_status_id, $empstatusarray)) {
                 $isactivestatus = '';
                 if ($emp_status_id == 8) {
                     $isactivestatus = 2;
                 } else {
                     if ($emp_status_id == 9) {
                         $isactivestatus = 3;
                     } else {
                         if ($emp_status_id == 10) {
                             $isactivestatus = 4;
                         }
                     }
                 }
                 $statusdata = array('isactive' => $isactivestatus);
                 $empstatusId = $usersModel->SaveorUpdateUserData($statusdata, $statuswhere);
             } else {
                 $statusdata = array('isactive' => 1);
                 $empstatusId = $usersModel->SaveorUpdateUserData($statusdata, $statuswhere);
             }
             if ($Id == 'update') {
                 $tableid = $id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee details updated successfully."));
             } else {
                 //start of mailing
                 $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                 $view = $this->getHelper('ViewRenderer')->view;
                 $this->view->emp_name = $emp_name;
                 $this->view->password = $emppassword;
                 $this->view->emp_id = $employeeId;
                 $this->view->base_url = $base_url;
                 $text = $view->render('mailtemplates/newpassword.phtml');
                 $options['subject'] = APPLICATION_NAME . ' login credentials';
                 $options['header'] = 'Greetings from Sentrifugo';
                 $options['toEmail'] = $emailaddress;
                 $options['toName'] = $this->view->emp_name;
                 $options['message'] = $text;
                 $result = sapp_Global::_sendEmail($options);
                 //end of mailing
                 $tableid = $Id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee details added successfully."));
             }
             $menuidArr = $menumodel->getMenuObjID('/employee');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             $menuidArr = $menumodel->getMenuObjID('/usermanagement');
             $menuID_user = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id);
             if ($act_inact == 1) {
                 if ($user_data['isactive'] == 1) {
                     $act_str = array("Activated" => Zend_Registry::get('currentdate'));
                 } else {
                     $act_str = array("Inactivated" => Zend_Registry::get('currentdate'));
                 }
                 $result = sapp_Global::logManager($menuID_user, 4, $loginUserId, $user_id, '', $act_str);
             }
             $trDb->commit();
             $this->_redirect('employee/edit/id/' . $user_id);
         } catch (Exception $e) {
             $trDb->rollBack();
             $msgarray['employeeId'] = "Something went wrong,please try again later.";
             return $msgarray;
         }
     } else {
         $messages = $employeeform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         $usersModel = new Default_Model_Users();
         if (isset($businessunit_id) && $businessunit_id != 0 && $businessunit_id != '') {
             $departmentsmodel = new Default_Model_Departments();
             $departmentlistArr = $departmentsmodel->getDepartmentList($businessunit_id);
             $employeeform->department_id->clearMultiOptions();
             $employeeform->reporting_manager->clearMultiOptions();
             $employeeform->department_id->addMultiOption('', 'Select Department');
             foreach ($departmentlistArr as $departmentlistresult) {
                 $employeeform->department_id->addMultiOption($departmentlistresult['id'], utf8_encode($departmentlistresult['deptname']));
             }
             if (isset($department_id) && $department_id != 0 && $department_id != '') {
                 $employeeform->setDefault('department_id', $department_id);
             }
         }
         if (isset($department_id) && $department_id != 0 && $department_id != '') {
             $reportingManagerArr = $usersModel->getReportingManagerList($department_id, $user_id);
             $employeeform->reporting_manager->addMultiOption('', 'Select Reporting Manager');
             foreach ($reportingManagerArr as $reportingManagerresult) {
                 $employeeform->reporting_manager->addMultiOption($reportingManagerresult['id'], utf8_encode($reportingManagerresult['userfullname']));
             }
             if (isset($reporting_manager) && $reporting_manager != 0 && $reporting_manager != '') {
                 $employeeform->setDefault('reporting_manager', $reporting_manager);
             }
         }
         if (isset($jobtitle_id) && $jobtitle_id != 0 && $jobtitle_id != '') {
             $positionsmodel = new Default_Model_Positions();
             $positionlistArr = $positionsmodel->getPositionList($jobtitle_id);
             $employeeform->position_id->clearMultiOptions();
             $employeeform->position_id->addMultiOption('', 'Select Position');
             foreach ($positionlistArr as $positionlistRes) {
                 $employeeform->position_id->addMultiOption($positionlistRes['id'], utf8_encode($positionlistRes['positionname']));
             }
             if (isset($position_id) && $position_id != 0 && $position_id != '') {
                 $employeeform->setDefault('position_id', $position_id);
             }
         }
         return $msgarray;
     }
 }
 public function addpopupAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $controllername = 'bgscreeningtype';
     $msgarray = array();
     $bgscreeningtypeform = new Default_Form_bgscreeningtype();
     $bgscreeningtypeform->setAttrib('action', DOMAIN . 'bgscreeningtype/addpopup');
     $this->view->form = $bgscreeningtypeform;
     if ($this->getRequest()->getPost()) {
         $id = $this->_request->getParam('id');
         $type = $this->_request->getParam('type');
         $bgscreeningtypemodel = new Default_Model_Bgscreeningtype();
         $typeExistance = $bgscreeningtypemodel->checktypeduplicates($type, $id);
         $flag = 'true';
         if ($typeExistance) {
             $msgarray['type'] = 'Screening type already exists.';
             $flag = 'false';
         }
         if ($bgscreeningtypeform->isValid($this->_request->getPost()) && $flag == 'true') {
             $id = $this->_request->getParam('id');
             $type = $this->_request->getParam('type');
             $description = $this->_request->getParam('description');
             if (!$typeExistance) {
                 $date = new Zend_Date();
                 $menumodel = new Default_Model_Menu();
                 $actionflag = '';
                 $tableid = '';
                 $data = array('type' => $type, '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 = $bgscreeningtypemodel->SaveorUpdateScreeningtype($data, $where);
                 $tableid = $Id;
                 $menuidArr = $menumodel->getMenuObjID('/bgscreeningtype');
                 $menuID = $menuidArr[0]['id'];
                 $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
                 $screeningData = $bgscreeningtypemodel->fetchAll('isactive = 1', 'type')->toArray();
                 $opt = '';
                 foreach ($screeningData as $record) {
                     $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['type']);
                 }
                 $this->view->screeningData = $opt;
                 $this->view->eventact = 'added';
                 $close = 'close';
                 $this->view->popup = $close;
             } else {
                 $msgarray['message'] = 'Screening type already exists.';
                 $msgarray['msgtype'] = 'error';
             }
         } else {
             $messages = $bgscreeningtypeform->getMessages();
             foreach ($messages as $key => $val) {
                 foreach ($val as $key2 => $val2) {
                     $msgarray[$key] = $val2;
                     break;
                 }
             }
         }
     }
     $this->view->controllername = $controllername;
     $this->view->msgarray = $msgarray;
     $this->view->messages = $msgarray;
 }
 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);
 }
예제 #18
0
 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');
     $controllername = 'nationality';
     $nationalityform = new Default_Form_nationality();
     $nationalitymodel = new Default_Model_Nationality();
     $nationalityform->setAction(BASE_URL . 'nationality/addpopup');
     if ($this->getRequest()->getPost()) {
         if ($nationalityform->isValid($this->_request->getPost())) {
             $nationalitycode = $this->_request->getParam('nationalitycode');
             $description = $this->_request->getParam('description');
             $date = new Zend_Date();
             $menumodel = new Default_Model_Menu();
             $actionflag = '';
             $tableid = '';
             $data = array('nationalitycode' => trim($nationalitycode), 'description' => trim($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 = $nationalitymodel->SaveorUpdateNationalityData($data, $where);
             $tableid = $Id;
             $menuidArr = $menumodel->getMenuObjID('/nationality');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             $nationalitycodeData = $nationalitymodel->fetchAll('isactive = 1', 'nationalitycode')->toArray();
             $opt = '';
             foreach ($nationalitycodeData as $record) {
                 $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['nationalitycode']);
             }
             $this->view->nationalitycodeData = $opt;
             $this->view->eventact = 'added';
             $close = 'close';
             $this->view->popup = $close;
         } else {
             $messages = $nationalityform->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 = $nationalityform;
 }
예제 #19
0
 public static function _getPageShortcutFlag($controllerName)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $menumodel = new Default_Model_Menu();
     $settingsmodel = new Default_Model_Settings();
     $settingsdiv = '';
     $menuidArr = $menumodel->getMenuObjID('/' . $controllerName);
     if (!empty($menuidArr) && $controllerName != 'servicerequests') {
         $menuID = $menuidArr[0]['id'];
         if ($menuID != '') {
             $settingsmenuArr = $settingsmodel->getMenuIds($loginUserId, 2);
             if (!empty($settingsmenuArr)) {
                 $settingsmenustring = $settingsmenuArr[0]['menuid'];
                 $settingsmenuArray = explode(",", $settingsmenustring);
                 if (sizeof($settingsmenuArray) <= 16) {
                     if (in_array($menuID, $settingsmenuArray)) {
                         $settingsdiv = '<div id="pageshortcut" class = "sprite remove-shortcut-icon" onclick="createorremoveshortcut(' . $menuID . ',2)">Unpin from shortcuts';
                         $settingsdiv .= '</div>';
                     } else {
                         $settingsdiv = '<div id="pageshortcut" class ="sprite shortcut-icon" onclick="createorremoveshortcut(' . $menuID . ',1)">Pin to shortcuts';
                         $settingsdiv .= '</div>';
                     }
                 }
             } else {
                 $settingsdiv = '<div id="pageshortcut" class ="sprite shortcut-icon" onclick="createorremoveshortcut(' . $menuID . ',3)">Pin to shortcuts';
                 $settingsdiv .= '</div>';
             }
         }
     }
     return $settingsdiv;
 }
 public function save($appraisalconfigform)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $appraisalconfigmodel = new Default_Model_Appraisalconfig();
     $departmentsmodel = new Default_Model_Departments();
     $businessunitsmodel = new Default_Model_Businessunits();
     $msgarray = array();
     $resultArr = array();
     $arrData = array();
     $prevBusinessunit = '';
     $errorflag = "true";
     $id = $this->_request->getParam('id');
     $businessunit_id = $this->_request->getParam('businessunit_id');
     $performance_app_flag = $this->_request->getParam('performance_app_flag');
     $department_id = $this->_request->getParam('department_id');
     $appraisal_mode = $this->_request->getParam('appraisal_mode');
     $approval_selection = $this->_request->getParam('approval_selection');
     $appraisal_ratings = $this->_request->getParam('appraisal_ratings');
     // Validation to check duplicate combinations
     $arrData = array("business_unit_id" => $businessunit_id, "department_id" => $department_id, "id" => $id);
     if ($appraisalconfigmodel->combinationExists($arrData)) {
         $msgarray['businessunit_id'] = 'Business unit or department configuration already exists.';
         $errorflag = "false";
     }
     /** Start
      * Validating selection of department if implementaion is department wise
      */
     if ($performance_app_flag == 0) {
         if ($department_id == '') {
             $msgarray['department_id'] = 'Please select department.';
             $errorflag = "false";
         }
     }
     /**
     			End validating selection of department
     */
     /** Start
                 Validating unique service desk department
         */
     if ($businessunit_id != '' && $id == '') {
         $appraisalconigfArr = $appraisalconfigmodel->checkuniqueAppraisalConfigData($businessunit_id, $performance_app_flag, $department_id);
         if (!empty($appraisalconigfArr)) {
             if ($appraisalconigfArr[0]['count'] > 0) {
                 $msgarray['department_id'] = 'Please select a different department.';
                 $errorflag = "false";
             }
         }
     }
     /** End
      * Validating uniques  department
      */
     $db = Zend_Db_Table::getDefaultAdapter();
     $db->beginTransaction();
     if ($appraisalconfigform->isValid($this->_request->getPost()) && $errorflag == 'true') {
         try {
             $menumodel = new Default_Model_Menu();
             $actionflag = '';
             $tableid = '';
             $data = array('businessunit_id' => $businessunit_id, 'department_id' => $department_id != '' ? $department_id : NULL, 'performance_app_flag' => $performance_app_flag, 'appraisal_mode' => $appraisal_mode, 'appraisal_ratings' => $appraisal_ratings, 'module_flag' => 1, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             if ($id != '') {
                 /* for Update record  */
                 $where = array('id=?' => $id);
                 $actionflag = 2;
             } else {
                 /* for Insert new record  */
                 $data['createdby'] = $loginUserId;
                 $data['createddate'] = gmdate("Y-m-d H:i:s");
                 $data['isactive'] = 1;
                 $where = '';
                 $actionflag = 1;
             }
             $Id = $appraisalconfigmodel->SaveorUpdateAppraisalConfigData($data, $where);
             if ($Id == 'update') {
                 $tableid = $id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Appraisal settings updated successfully"));
             } else {
                 $tableid = $Id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Appraisal settings added successfully"));
             }
             $menuidArr = $menumodel->getMenuObjID('/appraisalconfig');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             /** Start
              * Sending Mails to employees
              */
             /*    if($performance_app_flag == 0)
             						$employeeDetailsArr = $appraisalconfigmodel->getUserDetailsByID($businessunit_id,$department_id);
             						else
             						$employeeDetailsArr = $appraisalconfigmodel->getUserDetailsByID($businessunit_id,'');
             						
             						$msg_add_update = ($Id == 'update') ? "updated" : "added" ;
             
             								  //Sending mail to Super admin					
             								$options['subject'] = APPLICATION_NAME.': Performance Appraisal Settings '.ucfirst($msg_add_update);
                                             $options['header'] = 'Performance Appraisal Configuration';
                                             $options['toEmail'] = SUPERADMIN_EMAIL;  
                                             $options['toName'] = 'Super Admin';
                                             $options['message'] = 'Dear Super Admin, performance appraisal configuration '.$msg_add_update;
                                            // $mail_id =  sapp_Global::_sendEmail($options); 
             						//sending mail to others
             						if(!empty($employeeDetailsArr))
             						{
             							foreach($employeeDetailsArr as $emp)
             							{
             								$options['subject'] = APPLICATION_NAME.': Performance Appraisal Settings Added.';
                                             $options['header'] = 'Performance Appraisal Configuration';
                                             $options['toEmail'] = $emp['emailaddress'];  
                                             $options['toName'] = $emp['userfullname'];
                                             $options['message'] = 'Dear '.$emp['userfullname'].', performance appraisal configuration '.$msg_add_update;
                                            // $mail_id =  sapp_Global::_sendEmail($options); 
             							}
             						}
             					/**
             					 * End
             					 */
             $db->commit();
             $this->_redirect('appraisalconfig');
             throw new Exception("Some error message");
         } catch (Exception $e) {
             $db->rollBack();
             echo $e->getMessage();
             echo $e->getTraceAsString();
             return $msgarray;
         }
     } else {
         $messages = $appraisalconfigform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         if (isset($businessunit_id) && $businessunit_id != '') {
             if ($performance_app_flag == 0) {
                 $departmentlistArr = $departmentsmodel->getDepartmentList($businessunit_id);
                 if (!empty($departmentlistArr)) {
                     foreach ($departmentlistArr as $departmentlist) {
                         $appraisalconfigform->department_id->addMultiOption($departmentlist['id'], utf8_encode($departmentlist['deptname']));
                     }
                 }
             }
             if (isset($department_id) && $department_id != 0 && $department_id != '') {
                 $appraisalconfigform->setDefault('department_id', $department_id);
             }
         }
         return $msgarray;
     }
 }
 public function save($creditcardDetailsform)
 {
     $result = "";
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $date = new Zend_Date();
     if ($creditcardDetailsform->isValid($this->_request->getPost())) {
         $post_values = $this->_request->getPost();
         if (isset($post_values['id'])) {
             unset($post_values['id']);
         }
         if (isset($post_values['user_id'])) {
             unset($post_values['user_id']);
         }
         if (isset($post_values['submit'])) {
             unset($post_values['submit']);
         }
         $new_post_values = array_filter($post_values);
         $user_id = $this->_request->getParam('userid');
         if (!empty($new_post_values)) {
             $creditcardDetailsModel = new Default_Model_Creditcarddetails();
             $id = $this->_request->getParam('id');
             $card_type = $this->_request->getParam('card_type');
             $card_number = $this->_request->getParam('card_number');
             $card_name = $this->_request->getParam('nameoncard');
             $card_expiry_1 = $this->_request->getParam('card_expiration', null);
             $card_expiry = sapp_Global::change_date($card_expiry_1, 'database');
             $card_issuedBy = $this->_request->getParam('card_issuedby');
             $card_code = $this->_request->getParam('card_code');
             $data = array('card_type' => $card_type, 'card_number' => $card_number, 'nameoncard' => $card_name, 'card_expiration' => $card_expiry, 'card_issued_comp' => $card_issuedBy, 'card_code' => $card_code, 'user_id' => $user_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             if ($id != '') {
                 $where = array('user_id=?' => $user_id);
                 $actionflag = 2;
             } else {
                 $data['createdby'] = $loginUserId;
                 $data['createddate'] = gmdate("Y-m-d H:i:s");
                 $where = '';
                 $actionflag = 1;
             }
             $Id = $creditcardDetailsModel->SaveorUpdateCreditcardDetails($data, $where);
             if ($Id == 'update') {
                 $tableid = $id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee corporate card details updated successfully."));
             } else {
                 $tableid = $Id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee corporate card details added successfully."));
             }
             $menumodel = new Default_Model_Menu();
             $menuidArr = $menumodel->getMenuObjID('/employee');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id);
         } else {
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => FIELDMSG));
         }
         $this->_redirect('creditcarddetails/edit/userid/' . $user_id);
     } else {
         $messages = $creditcardDetailsform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
예제 #22
0
 public function addnewstateAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $msgarray = array();
     $controllername = 'states';
     $statestring = '';
     $id = $this->getRequest()->getParam('id');
     $selectedcountryid = $this->_request->getParam('selectcountryid', null);
     $statesform = new Default_Form_states();
     $statesmodel = new Default_Model_States();
     $countriesModel = new Default_Model_Countries();
     /* Changing the form */
     $statesform->setAction(BASE_URL . 'states/addnewstate/selectcountryid/' . $selectedcountryid);
     $statesform->removeElement('state');
     $statesform->addElement('text', 'state', array('label' => 'State', 'maxlength' => '20', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Please enter state name.')))));
     /* END */
     $countrieslistArr = $countriesModel->getTotalCountriesList('');
     if (sizeof($countrieslistArr) > 0) {
         $statesform->countryid->addMultiOption('', 'Select Country');
         foreach ($countrieslistArr as $countrieslistres) {
             if (isset($selectedcountryid)) {
                 if ($countrieslistres['id'] == $selectedcountryid) {
                     $statesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                     $statesform->setDefault('countryid', $selectedcountryid);
                 }
             } else {
                 $statesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
             }
         }
     } else {
         $msgarray['countryid'] = 'Countries are not configured yet';
     }
     if ($this->getRequest()->getPost()) {
         $errorflag = "true";
         $msgarray = array();
         $id = $this->_request->getParam('id');
         $dbstate = '';
         $dbcountryid = '';
         $state = trim($this->_request->getParam('state'));
         $countryid = $this->_request->getParam('countryid');
         if (isset($countryid) && $countryid != '') {
             $isDuplicateStateNameArr = $statesmodel->getDuplicateStateName($state, $countryid);
             if ($isDuplicateStateNameArr[0]['count'] > 0) {
                 $errorflag = "false";
                 $msgarray['state'] = "State already exists.";
             }
         } else {
             $errorflag = "false";
             $msgarray['countryid'] = "Please select country.";
         }
         if ($statesform->isValid($this->_request->getPost()) && $errorflag == "true") {
             $menumodel = new Default_Model_Menu();
             $actionflag = '';
             $tableid = '';
             $NewStateId = $statesmodel->SaveMainStateData($countryid, $state);
             $tableid = $NewStateId;
             $actionflag = 1;
             $menuidArr = $menumodel->getMenuObjID('/states');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             if (isset($selectedcountryid)) {
                 $stateData = $statesmodel->getStatesList($selectedcountryid, '');
             } else {
                 $stateData = array();
             }
             $opt = '';
             foreach ($stateData as $record) {
                 $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['state_name']);
             }
             $this->view->stateData = $opt;
             $this->view->eventact = 'added';
             $close = 'close';
             $this->view->popup = $close;
         } else {
             $messages = $statesform->getMessages();
             foreach ($messages as $key => $val) {
                 foreach ($val as $key2 => $val2) {
                     $msgarray[$key] = $val2;
                     break;
                 }
             }
         }
     }
     $this->view->ermsg = '';
     $this->view->form = $statesform;
     $this->view->msgarray = $msgarray;
     $this->view->controllername = $controllername;
 }
예제 #23
0
 public function save($empleavesform, $userid, $used_leaves, $leavetransfercount, $isleavetrasnferset, $currentyearleavecount)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     if ($empleavesform->isValid($this->_request->getPost())) {
         $employeeleavesModel = new Default_Model_Employeeleaves();
         $id = $this->_request->getParam('id');
         $user_id = $userid;
         $emp_leave_limit = $this->_request->getParam('leave_limit');
         if ($leavetransfercount != '' && $currentyearleavecount == '') {
             $emp_leave_limit = $emp_leave_limit + $leavetransfercount;
         } else {
             $emp_leave_limit = $emp_leave_limit + $currentyearleavecount;
         }
         $isleavetrasnfer = 0;
         if ($isleavetrasnferset == 1) {
             $isleavetrasnfer = 1;
         }
         $date = new Zend_Date();
         $menumodel = new Default_Model_Menu();
         $actionflag = '';
         $tableid = '';
         /* Save employee leaves in allotted leaves log */
         $postedArr = array();
         $postedArr = $_POST;
         $saveID = $employeeleavesModel->saveallotedleaves($postedArr, $emp_leave_limit, $user_id, $loginUserId);
         /* END */
         $Id = $employeeleavesModel->SaveorUpdateEmployeeLeaves($user_id, $emp_leave_limit, $isleavetrasnfer, $loginUserId);
         if ($id) {
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee Leave details updated successfully."));
             $actionflag = 2;
             $tableid = $id;
         } else {
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee Leave details added successfully."));
             $actionflag = 1;
             $tableid = $Id;
         }
         $menuidArr = $menumodel->getMenuObjID('/employee');
         $menuID = $menuidArr[0]['id'];
         $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id);
         $this->_redirect('empleaves/edit/userid/' . $user_id);
     } else {
         $messages = $empleavesform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
 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);
 }
예제 #25
0
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $messages['msgtype'] = '';
     $actionflag = 3;
     if ($id) {
         $systempreferencemodel = new Default_Model_Sitepreference();
         $menumodel = new Default_Model_Menu();
         $data = array('isactive' => 0);
         $where = array('id=?' => $id);
         $Id = $systempreferencemodel->SaveorUpdateSystemPreferanceData($data, $where);
         if ($Id == 'update') {
             $menuidArr = $menumodel->getMenuObjID('/sitepreference');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
             $messages['message'] = 'Site preferences deleted successfully.';
             $messages['msgtype'] = 'success';
         } else {
             $messages['message'] = 'Site preferences cannot be deleted.';
         }
         $messages['msgtype'] = 'error';
     } else {
         $messages['message'] = 'Site preferences cannot be deleted.';
         $messages['msgtype'] = 'error';
     }
     $this->_helper->json($messages);
 }
예제 #26
0
 public function savegroupedemployees()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $appraisalinitmodel = new Default_Model_Appraisalgroupemployeestemp();
     $menumodel = new Default_Model_Menu();
     $groupid = $this->_request->getParam('group_id');
     $appraisalid = $this->_request->getParam('appraisalid');
     $empids = $this->_request->getParam('empids');
     $id = '';
     $actionflag = '';
     $tableid = '';
     $msgarray = array();
     if (!isset($groupid) && $groupid == '') {
         $groupid = 0;
     }
     try {
         $ifrecordexists = $appraisalinitmodel->checkAppraisalRecordexists($groupid, $appraisalid);
         if (!empty($ifrecordexists)) {
             $id = $ifrecordexists[0]['id'];
         }
         $insertdata = array('pa_initialization_id' => $appraisalid, 'group_id' => $groupid, 'employee_ids' => $empids, 'isactive' => 1, 'createdby' => $loginUserId, 'createdby_role' => $loginuserRole, 'createdby_group' => $loginuserGroup, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"));
         $updatedata = array('employee_ids' => $empids, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s"));
         if ($id != '') {
             $where = array('id=?' => $id);
             $actionflag = 2;
             $tableid = $id;
             $appraisalinitmodel->SaveorUpdateAppraisalGroupsEmployeesTempData($updatedata, $where);
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employees updated successfully."));
         } else {
             $where = '';
             $actionflag = 1;
             $Id = $appraisalinitmodel->SaveorUpdateAppraisalGroupsEmployeesTempData($insertdata, $where);
             $tableid = $Id;
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employees added successfully."));
         }
         $menuidArr = $menumodel->getMenuObjID('/appraisalinit');
         $menuID = $menuidArr[0]['id'];
         $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
         $this->_redirect('appraisalinit/assigngroups/id/' . $appraisalid);
     } catch (Exception $e) {
         $msgarray = $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => $e->getMessage()));
     }
     return $msgarray;
 }
 public function multipleresumeAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginUserId = trim($loginUserId);
     }
     $priv_check = sapp_Global::_checkprivileges(CANDIDATEDETAILS, '', $auth->getStorage()->read()->emprole, 'add');
     if ($priv_check == 'Yes') {
         $msgarray = $req_options = array();
         $form = new Default_Form_Multipleresume();
         $form->setAction(DOMAIN . 'candidatedetails/multipleresume');
         // To show list of requisitions to user
         $req_model = new Default_Model_Requisition();
         $req_data = $req_model->getRequisitionsForCV("'Approved','In process'");
         foreach ($req_data as $req) {
             $req_options[$req['id']] = $req['requisition_code'] . ' - ' . $req['jobtitlename'];
         }
         if (count($req_options) == 0) {
             $msgarray['requisition_id'] = "No active requisitions are found.";
         }
         $form->requisition_id->addMultiOptions(array('' => 'Select Requisition ID') + $req_options);
         $form_post_status = $this->_request->getPost();
         if ($form_post_status) {
             $candidate_firstname = $this->_getParam('candidate_firstname', null);
             $candidate_lastname = $this->_getParam('candidate_lastname', null);
             $cand_resumes = $this->_getParam('cand_resume', null);
             if ($form->isValid($form_post_status)) {
                 $cand_details_model = new Default_Model_Candidatedetails();
                 $requisition_id = $this->_getParam('requisition_id', null);
                 $cand_status = $this->_getParam('cand_status', null);
                 $req_records = $cand_details_model->getcountofrecords($requisition_id);
                 $curr_date = gmdate("Y-m-d H:i:s");
                 if (empty($req_records)) {
                     $rdata = array('req_status' => 'In process', 'modifiedby' => $loginUserId, 'modifiedon' => $curr_date);
                     $rwhere = ' id = ' . $requisition_id;
                     $req_model->SaveorUpdateRequisitionData($rdata, $rwhere);
                 }
                 // To insert records in a single query
                 $records = array();
                 foreach ($candidate_firstname as $key => $candidate_fname) {
                     $cfull_name = $candidate_fname . ' ' . $candidate_lastname[$key];
                     $records[] = "({$requisition_id}, '{$candidate_fname}','{$candidate_lastname[$key]}','{$cfull_name}', '{$cand_resumes[$key]}', '{$cand_status}', 1, {$loginUserId}, {$loginUserId}, '{$curr_date}', '{$curr_date}')";
                 }
                 $data_fields = array('requisition_id', 'candidate_firstname', 'candidate_lastname', 'candidate_name', 'cand_resume', 'cand_status', 'isactive', 'createdby', 'modifiedby', 'createddate', 'modifieddate');
                 $last_insert_id = $cand_details_model->insertMultipleRecords($data_fields, $records);
                 // Log status to Log manager and redirect to Resource Pooling list page.
                 if ($last_insert_id != '') {
                     $menumodel = new Default_Model_Menu();
                     $objidArr = $menumodel->getMenuObjID('/candidatedetails');
                     $objID = $objidArr[0]['id'];
                     $log_status = sapp_Global::logManager($objID, 1, $loginUserId, $last_insert_id);
                     //$this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Candidate details added successfully.');
                     $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Candidate details added successfully."));
                     $this->_redirect('/candidatedetails');
                 }
             } else {
                 // To handle server validation, when Javascript is disabled
                 $messages = $form->getMessages();
                 foreach ($messages as $key => $val) {
                     foreach ($val as $key2 => $val2) {
                         $msgarray[$key] = $val2;
                         break;
                     }
                 }
                 $form->setDefault('candidate_firstname', $candidate_firstname[0]);
                 $form->setDefault('cand_resume', '');
             }
         }
         $this->view->form = $form;
         $this->view->msgarray = $msgarray;
     } else {
         $this->_redirect('error');
     }
 }
예제 #28
0
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $messages['msgtype'] = '';
     $actionflag = 3;
     if ($id) {
         $numberformatsmodel = new Default_Model_Numberformats();
         $menumodel = new Default_Model_Menu();
         $numberformatdata = $numberformatsmodel->getNumberFormatDataByID($id);
         $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s"));
         $where = array('id=?' => $id);
         $Id = $numberformatsmodel->SaveorUpdateNumberFormatData($data, $where);
         if ($Id == 'update') {
             $menuidArr = $menumodel->getMenuObjID('/numberformats');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
             $configmail = sapp_Global::send_configuration_mail('Number Format', $numberformatdata[0]['numberformattype']);
             $messages['message'] = 'Number format deleted successfully.';
             $messages['msgtype'] = 'success';
         } else {
             $messages['message'] = 'Number format cannot be deleted.';
             $messages['msgtype'] = 'success';
         }
     } else {
         $messages['message'] = 'Number format cannot be deleted.';
         $messages['msgtype'] = 'success';
     }
     $this->_helper->json($messages);
 }
 public function updateAction()
 {
     $empDocuModel = new Default_Model_Employeedocs();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('doc_id');
     $name = $this->_request->getParam('doc_name');
     $userid = $this->_request->getParam('userid');
     // Get attachments
     $file_original_names = $this->getRequest()->getParam('file_original_names');
     $file_new_names = $this->getRequest()->getParam('file_new_names');
     $org_names = explode(',', $file_original_names);
     $new_names = explode(',', $file_new_names);
     $attachment_array = array();
     for ($i = 0; $i < count($org_names); $i++) {
         if ($new_names[$i] != '') {
             $attachment_array[] = array("original_name" => $org_names[$i], "new_name" => $new_names[$i]);
         }
     }
     $data = array('name' => $name, 'attachments' => count($attachment_array) > 0 ? json_encode($attachment_array) : null, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
     // Validate duplicate document name
     $empDocuments = $empDocuModel->checkDocNameByUserIdAndDocId($userid, $name, $id);
     $count_emp_docs = count($empDocuments);
     if ($count_emp_docs == 0) {
         $where = array('id=?' => $id);
         $actionflag = 2;
         $recordId = $empDocuModel->SaveorUpdateEmpDocuments($data, $where);
         $menumodel = new Default_Model_Menu();
         $menuidArr = $menumodel->getMenuObjID('/employee');
         $menuID = $menuidArr[0]['id'];
         $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $userid);
         $this->_helper->json(array('result' => 'success'));
     } else {
         if ($count_emp_docs > 0) {
             $this->_helper->json(array('result' => 'exists'));
         } else {
             $this->_helper->json(array('result' => 'error'));
         }
     }
 }
예제 #30
0
 /**
  * This action is used to delete roles and their child data.
  * @parameters
  * @param $objid    =   id of role.
  * 
  * @return   {String}   success/failure message 
  */
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $actionflag = 3;
     if ($id) {
         $roles_model = new Default_Model_Roles();
         $user_model = new Default_Model_Usermanagement();
         $user_cnt = $user_model->getUserCntByRole($id);
         if ($user_cnt == 0) {
             $previleges_model = new Default_Model_Privileges();
             $menumodel = new Default_Model_Menu();
             $data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $where = array('id=?' => $id);
             $Id = $roles_model->SaveorUpdateRolesData($data, $where);
             if ($Id == 'update') {
                 sapp_Global::generateAccessControl();
                 $prev_data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $where_prev = "role = " . $id;
                 $previleges_model->SaveorUpdatePrivilegesData($prev_data, $where_prev);
                 $objidArr = $menumodel->getMenuObjID('/roles');
                 $objID = $objidArr[0]['id'];
                 $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $id);
                 $messages['message'] = 'Role deleted successfully';
                 $messages['msgtype'] = 'success';
             } else {
                 $messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
                 $messages['msgtype'] = 'error';
             }
         } else {
             $messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
             $messages['msgtype'] = 'error';
         }
     } else {
         $messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
         $messages['msgtype'] = 'error';
     }
     $this->_helper->json($messages);
 }