/** * * Edit function to prepopulate the data. * */ public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $appraisalconfigform = new Default_Form_Appraisalconfig(); $bunitModel = new Default_Model_Businessunits(); $appraisalconfigmodel = new Default_Model_Appraisalconfig(); $departmentsmodel = new Default_Model_Departments(); $msgarray = array(); $appraisalconfigform->submit->setLabel('Update'); try { if ($id) { if (is_numeric($id) && $id > 0) { /** to show/hide edit button **/ $chkFlagForEdit = $appraisalconfigmodel->checkInitializationData($id); $this->view->chkFlagForEdit = $chkFlagForEdit; if (empty($chkFlagForEdit)) { $data = $appraisalconfigmodel->getAppraisalConfigbyID($id); if (!empty($data)) { $data = $data[0]; if ($data['department_id'] != '' && $data['department_id'] != 'NULL') { $deptdata = $departmentsmodel->getSingleDepartmentData($data['department_id']); if (sizeof($deptdata) > 0) { $appraisalconfigform->department_id->addMultiOption($deptdata['id'], utf8_encode($deptdata['deptname'])); } } $bunitData = $bunitModel->getSingleUnitData($data['businessunit_id']); if (!empty($bunitData)) { $appraisalconfigform->businessunit_id->addMultiOption($bunitData['id'], utf8_encode($bunitData['unitname'])); } if ($data['department_id'] != '' && $data['department_id'] != 'NULL') { $departmentlistArr = $departmentsmodel->getDepartmentList($data['businessunit_id']); $departmentlistArr = $departmentsmodel->getSingleDepartmentData($data['department_id']); } else { $departmentlistArr = array(); } // Disable 'Business unit wise' option when 'No Business Unit' was selected if ($data["businessunit_id"] == 0) { $appraisalconfigform->performance_app_flag->setOptions(array('disable' => array(1))); } $appraisalconfigform->populate($data); $appraisalconfigform->setDefault('businessunit_id', $data['businessunit_id']); if (sizeof($departmentlistArr) > 0) { $appraisalconfigform->setDefault('department_id', $data['department_id']); } $this->view->performance_app_flag = $data['performance_app_flag']; $appraisalconfigform->setAttrib('action', DOMAIN . 'appraisalconfig/edit/id/' . $id); $this->view->data = $data; /**** $chk_cnt = $appraisalconfigmodel->check_act_init($id); $this->view->chk_cnt = $chk_cnt; if($chk_cnt > 0) { $appraisalconfigform->businessunit_id->setAttrib("disabled", "disabled"); $appraisalconfigform->performance_app_flag->setAttrib("disabled", "disabled"); $appraisalconfigform->department_id->setAttrib("disabled", "disabled"); $appraisalconfigform->appraisal_mode->setAttrib("disabled", "disabled"); $appraisalconfigform->appraisal_ratings->setAttrib("disabled", "disabled"); //added on 13-04-2015 by soujanya } *****/ } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'noedit'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'nodata'; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $appraisalconfigform; if ($this->getRequest()->getPost()) { $result = $this->save($appraisalconfigform); $this->view->msgarray = $result; } $this->render('form'); }
public function savebusinessunitAction() { $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('savebusinessunit', '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; } $businessunitsmodel = new Default_Model_Businessunits(); $orgInfoModel = new Default_Model_Organisationinfo(); $systempreferencemodel = new Default_Model_Sitepreference(); $organisationData = $orgInfoModel->getOrganisationInfo(); $sitePreferenceData = $systempreferencemodel->SitePreferanceData(); $result['result'] = ''; $result['id'] = ''; $result['unitname'] = ''; $result['address'] = ''; $date = new Zend_Date(); try { $unitname = trim($this->_request->getParam('bunit')); $address = $this->_request->getParam('streetAddress'); $isUnitExist = $businessunitsmodel->checkDuplicateUnitName($unitname); if (!empty($isUnitExist)) { if ($isUnitExist[0]['count'] > 0) { $result['msg'] = 'Name already exists.'; $result['id'] = ''; $result['unitname'] = ''; $result['address'] = ''; } else { $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; if (strlen(trim($unitname)) > 3) { $unitCode = strtoupper(substr(trim($unitname), 0, 4)); } else { $unitCode = strtoupper(trim($unitname)); } $data = array('unitname' => $unitname, 'unitcode' => $unitCode, 'startdate' => NULL, 'country' => !empty($organisationData) ? $organisationData[0]['country'] : NULL, 'state' => !empty($organisationData) ? $organisationData[0]['state'] : NULL, 'city' => !empty($organisationData) ? $organisationData[0]['city'] : NULL, 'address1' => $address, 'timezone' => !empty($sitePreferenceData) ? $sitePreferenceData[0]['timezoneid'] : NULL, 'createdby' => $loginUserId, 'createddate' => $date->get('yyyy-MM-dd HH:mm:ss'), 'modifiedby' => $loginUserId, 'modifieddate' => $date->get('yyyy-MM-dd HH:mm:ss')); $where = ''; $actionflag = 1; $Id = $businessunitsmodel->SaveorUpdateBusinessUnits($data, $where); if ($Id) { $menuID = BUSINESSUNITS; $logresult = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $Id); $result['msg'] = 'success'; $result['id'] = $Id; $result['unitname'] = $unitname; $result['address'] = $address; } else { $result['msg'] = 'error'; $result['id'] = ''; $result['unitname'] = ''; $result['address'] = ''; } } } } catch (Exception $e) { $result['msg'] = $e->getMessage(); $result['id'] = ''; $result['unitname'] = ''; $result['address'] = ''; } $this->_helper->json($result); }
public function viewAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $objName = 'employee'; $employeeform = new Default_Form_employee(); $employeeform->removeElement("submit"); $elements = $employeeform->getElements(); if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") { $element->setAttrib("disabled", "disabled"); } } } try { if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) { $employeeModal = new Default_Model_Employee(); $usersModel = new Default_Model_Users(); $employmentstatusModel = new Default_Model_Employmentstatus(); $busineesUnitModel = new Default_Model_Businessunits(); $deptModel = new Default_Model_Departments(); $role_model = new Default_Model_Roles(); $user_model = new Default_Model_Usermanagement(); $candidate_model = new Default_Model_Candidatedetails(); $jobtitlesModel = new Default_Model_Jobtitles(); $positionsmodel = new Default_Model_Positions(); $prefixModel = new Default_Model_Prefix(); $data = array(); $data = $employeeModal->getsingleEmployeeData($id); if ($data == 'norows') { $this->view->rowexist = "norows"; } else { if (!empty($data)) { $this->view->rowexist = "rows"; $data = $data[0]; $employeeData = $usersModel->getUserDetailsByIDandFlag($data['user_id']); $roles_arr = $role_model->getRolesDataByID($data['emprole']); if (sizeof($roles_arr) > 0) { $employeeform->emprole->addMultiOption($roles_arr[0]['id'] . '_' . $roles_arr[0]['group_id'], utf8_encode($roles_arr[0]['rolename'])); } $referedby_options = $user_model->getRefferedByForUsers(); $reportingManagerData = $usersModel->getReportingManagerList_employees($data['department_id'], $data['id'], $roles_arr[0]['group_id']); if (!empty($reportingManagerData)) { $employeeform->reporting_manager->addMultiOption('', 'Select Reporting Manager'); foreach ($reportingManagerData as $reportingManagerres) { $employeeform->reporting_manager->addMultiOption($reportingManagerres['id'], $reportingManagerres['name']); } } $employeeform->setDefault('reporting_manager', $data['reporting_manager']); $employmentStatusData = $employmentstatusModel->getempstatuslist(); if (sizeof($employmentStatusData) > 0) { $employeeform->emp_status_id->addMultiOption('', 'Select Employment Status'); foreach ($employmentStatusData as $employmentStatusres) { $employeeform->emp_status_id->addMultiOption($employmentStatusres['workcodename'], $employmentStatusres['statusname']); } } $businessunitData = $busineesUnitModel->getDeparmentList(); if (sizeof($businessunitData) > 0) { $employeeform->businessunit_id->addMultiOption('0', 'No Business Unit'); foreach ($businessunitData as $businessunitres) { $employeeform->businessunit_id->addMultiOption($businessunitres['id'], $businessunitres['unitname']); } } $departmentsData = $deptModel->getDepartmentList($data['businessunit_id']); if (sizeof($departmentsData) > 0) { $employeeform->department_id->addMultiOption('', 'Select Department'); foreach ($departmentsData as $departmentsres) { $employeeform->department_id->addMultiOption($departmentsres['id'], $departmentsres['deptname']); } } $jobtitleData = $jobtitlesModel->getJobTitleList(); if (sizeof($jobtitleData) > 0) { $employeeform->jobtitle_id->addMultiOption('', 'Select Job Title'); foreach ($jobtitleData as $jobtitleres) { $employeeform->jobtitle_id->addMultiOption($jobtitleres['id'], $jobtitleres['jobtitlename']); } } $positionlistArr = $positionsmodel->getPositionList($data['jobtitle_id']); if (sizeof($positionlistArr) > 0) { $employeeform->position_id->addMultiOption('', 'Select a Position'); foreach ($positionlistArr as $positionlistres) { $employeeform->position_id->addMultiOption($positionlistres['id'], $positionlistres['positionname']); } } if (isset($data['prefix_id']) && $data['prefix_id'] != '') { $singlePrefixArr = $prefixModel->getsinglePrefixData($data['prefix_id']); if ($singlePrefixArr != 'norows') { $employeeform->prefix_id->addMultiOption($singlePrefixArr[0]['id'], $singlePrefixArr[0]['prefix']); } } $employeeform->populate($data); $employeeform->setDefault('user_id', $data['user_id']); $employeeform->setDefault('emp_status_id', $data['emp_status_id']); $employeeform->setDefault('businessunit_id', $data['businessunit_id']); $employeeform->setDefault('jobtitle_id', $data['jobtitle_id']); $employeeform->setDefault('department_id', $data['department_id']); $employeeform->setDefault('position_id', $data['position_id']); $date_of_joining = sapp_Global::change_date($data['date_of_joining'], 'view'); $employeeform->date_of_joining->setValue($date_of_joining); if ($data['date_of_leaving'] != '' && $data['date_of_leaving'] != '0000-00-00') { $date_of_leaving = sapp_Global::change_date($data['date_of_leaving'], 'view'); $employeeform->date_of_leaving->setValue($date_of_leaving); } if ($data['modeofentry'] != 'Direct') { $employeeform->rccandidatename->setValue($data['userfullname']); } if (sizeof($referedby_options) > 0 && $data['candidatereferredby'] != '' && $data['candidatereferredby'] != 0) { $employeeform->candidatereferredby->setValue($referedby_options[$data['candidatereferredby']]); } if ($data['rccandidatename'] != '' && $data['rccandidatename'] != 0) { $cand_data = $candidate_model->getCandidateById($data['rccandidatename']); $data['requisition_code'] = $cand_data['requisition_code']; } $employeeform->setAttrib('action', BASE_URL . 'employee/edit/id/' . $id); $this->view->id = $id; $this->view->form = $employeeform; $this->view->employeedata = !empty($employeeData) ? $employeeData[0] : ""; $this->view->messages = $this->_helper->flashMessenger->getMessages(); $this->view->data = $data; $this->view->controllername = $objName; $this->view->id = $id; } } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } }
public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $leavemanagementform = new Default_Form_leavemanagement(); $leavemanagementform->submit->setLabel('Update'); try { if ($id) { if (is_numeric($id) && $id > 0) { $leavemanagementmodel = new Default_Model_Leavemanagement(); $data = $leavemanagementmodel->getActiveleavemanagementId($id); if (!empty($data)) { $data = $data[0]; $monthslistmodel = new Default_Model_Monthslist(); $weekdaysmodel = new Default_Model_Weekdays(); $busineesUnitModel = new Default_Model_Businessunits(); $departmentsmodel = new Default_Model_Departments(); $businessunitData = $busineesUnitModel->getParicularBusinessUnit($data['businessunit_id']); $particulardeptidArr = $departmentsmodel->getParicularDepartmentId($data['department_id']); $monthslistdata = $monthslistmodel->getMonthlistData(); $weekdaysdata = $weekdaysmodel->getWeeklistData(); if (!empty($businessunitData) && !empty($particulardeptidArr)) { if (!empty($businessunitData)) { $leavemanagementform->businessunit->addMultiOption($businessunitData[0]['id'], $businessunitData[0]['unitname']); } if (!empty($particulardeptidArr)) { $leavemanagementform->department_id->addMultiOption($particulardeptidArr[0]['id'], utf8_encode($particulardeptidArr[0]['deptname'])); } if (sizeof($monthslistdata) > 0) { foreach ($monthslistdata as $monthslistres) { $leavemanagementform->cal_startmonth->addMultiOption($monthslistres['month_id'], utf8_encode($monthslistres['month_name'])); } } if (sizeof($weekdaysdata) > 0) { foreach ($weekdaysdata as $weekdaysres) { $leavemanagementform->weekend_startday->addMultiOption($weekdaysres['day_id'], utf8_encode($weekdaysres['day_name'])); $leavemanagementform->weekend_endday->addMultiOption($weekdaysres['day_id'], utf8_encode($weekdaysres['day_name'])); } } $leavemanagementform->populate($data); $leavemanagementform->setDefault('cal_startmonth', $data['cal_startmonth']); $leavemanagementform->setDefault('weekend_startday', $data['weekend_startday']); $leavemanagementform->setDefault('weekend_endday', $data['weekend_endday']); $leavemanagementform->setDefault('businessunit', $data['businessunit_id']); $leavemanagementform->setDefault('department_id', $data['department_id']); $leavemanagementform->setAttrib('action', BASE_URL . 'leavemanagement/edit/id/' . $id); $this->view->form = $leavemanagementform; $this->view->rowexist = ""; } else { $this->view->rowexist = "rows"; } } else { $this->view->rowexist = "norows"; } } else { $this->view->rowexist = "norows"; } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($leavemanagementform); $this->view->msgarray = $result; } }
public function addAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; $loginuserbusinessunit_id = $auth->getStorage()->read()->businessunit_id; } $msgarray = array(); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $addEmpLeavesForm = new Default_Form_addemployeeleaves(); $bu_model = new Default_Model_Businessunits(); $bu_arr = $bu_model->getBU_report(); if (!empty($bu_arr)) { foreach ($bu_arr as $bu) { $addEmpLeavesForm->businessunit_id->addMultiOption($bu['id'], utf8_encode($bu['bu_name'])); } } else { $msgarray['businessunit_id'] = 'Business Units are not added yet.'; } $addEmpLeavesForm->alloted_year->setValue(date('Y')); $addEmpLeavesForm->setAttrib('action', BASE_URL . 'addemployeeleaves/add'); $this->view->form = $addEmpLeavesForm; $this->view->msgarray = $msgarray; $this->view->ermsg = ''; if ($this->getRequest()->getPost()) { $result = $this->saveEmployeeLeaves($addEmpLeavesForm, $loginUserId); $this->view->msgarray = $result; } }
public function editAction() { $auth = Zend_Auth::getInstance(); $role_datap = array(); $empGroup = ""; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; $loginuserUnitID = $auth->getStorage()->read()->businessunit_id; $loginuserDeptID = $auth->getStorage()->read()->department_id; } $id = (int) $this->getRequest()->getParam('id'); $id = abs($id); if ($id == '') { $id = $loginUserId; } $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $employeeform = new Default_Form_Myteamemployee(); try { if ($id != '' && is_numeric($id) && $id > 0 && $id != $loginUserId) { $employeeModal = new Default_Model_Employee(); $usersModel = new Default_Model_Users(); $employmentstatusModel = new Default_Model_Employmentstatus(); $busineesUnitModel = new Default_Model_Businessunits(); $deptModel = new Default_Model_Departments(); $role_model = new Default_Model_Roles(); $user_model = new Default_Model_Usermanagement(); $candidate_model = new Default_Model_Candidatedetails(); $jobtitlesModel = new Default_Model_Jobtitles(); $positionsmodel = new Default_Model_Positions(); $prefixModel = new Default_Model_Prefix(); $data = array(); $empDeptId = ""; $empRoleId = ""; $data = $employeeModal->getsingleEmployeeData($id); if ($data == 'norows') { $this->view->rowexist = "norows"; } else { if (!empty($data)) { $this->view->rowexist = "rows"; $employeeform->submit->setLabel('Update'); $data = $data[0]; /* Earlier code to fetch employee details */ $employeeData = $employeeModal->getsingleEmployeeData($id); $roles_arr = $role_model->getRolesListByGroupID(EMPLOYEE_GROUP); if (sizeof($roles_arr) > 0) { $employeeform->emprole->addMultiOptions(array('' => 'Select Role') + $roles_arr); } $employmentStatusData = $employmentstatusModel->getempstatuslist(); if (sizeof($employmentStatusData) > 0) { $employeeform->emp_status_id->addMultiOption('', 'Select Employment Status'); foreach ($employmentStatusData as $employmentStatusres) { $employeeform->emp_status_id->addMultiOption($employmentStatusres['workcodename'], $employmentStatusres['statusname']); } } $businessunitData = $busineesUnitModel->getDeparmentList(); if (sizeof($businessunitData) > 0) { foreach ($businessunitData as $businessunitres) { if ($businessunitres['id'] == $loginuserUnitID) { $employeeform->businessunit_id->addMultiOption($businessunitres['id'], $businessunitres['unitname']); } } } $departmentsData = $deptModel->getDepartmentList($data['businessunit_id']); if (sizeof($departmentsData) > 0) { foreach ($departmentsData as $departmentsres) { if ($departmentsres['id'] == $loginuserDeptID) { $employeeform->department_id->addMultiOption($departmentsres['id'], $departmentsres['deptname']); } } } $jobtitleData = $jobtitlesModel->getJobTitleList(); if (sizeof($jobtitleData) > 0) { $employeeform->jobtitle_id->addMultiOption('', 'Select Job Title'); foreach ($jobtitleData as $jobtitleres) { $employeeform->jobtitle_id->addMultiOption($jobtitleres['id'], $jobtitleres['jobtitlename']); } } $positionlistArr = $positionsmodel->getPositionList($data['jobtitle_id']); if (sizeof($positionlistArr) > 0) { $employeeform->position_id->addMultiOption('', 'Select Position'); foreach ($positionlistArr as $positionlistres) { $employeeform->position_id->addMultiOption($positionlistres['id'], $positionlistres['positionname']); } } $prefixData = $prefixModel->getPrefixList(); if (!empty($prefixData)) { foreach ($prefixData as $prefixres) { $employeeform->prefix_id->addMultiOption($prefixres['id'], $prefixres['prefix']); } } $userData = $usersModel->getUserDetails($loginUserId); if (count($userData) > 0) { $employeeform->reporting_manager->addMultiOption($userData[0]['id'], $userData[0]['userfullname']); } $employeeform->populate($data); $employeeform->setDefault('user_id', $data['user_id']); $employeeform->setDefault('emp_status_id', $data['emp_status_id']); $employeeform->setDefault('businessunit_id', $data['businessunit_id']); $employeeform->setDefault('jobtitle_id', $data['jobtitle_id']); $employeeform->setDefault('department_id', $data['department_id']); $employeeform->setDefault('position_id', $data['position_id']); $employeeform->setDefault('prefix_id', $data['prefix_id']); $date_of_joining = sapp_Global::change_date($data['date_of_joining'], 'view'); $employeeform->date_of_joining->setValue($date_of_joining); if ($data['date_of_leaving'] != '' && $data['date_of_leaving'] != '0000-00-00') { $date_of_leaving = sapp_Global::change_date($data['date_of_leaving'], 'view'); $employeeform->date_of_leaving->setValue($date_of_leaving); } $role_data = $role_model->getRoleDataById($data['emprole']); $employeeform->emprole->setValue($data['emprole'] . "_" . $role_data['group_id']); $employeeform->setAttrib('action', DOMAIN . 'myemployees/edit/id/' . $id); $this->view->id = $id; $this->view->form = $employeeform; $this->view->employeedata = !empty($employeeData) ? $employeeData[0] : ""; $this->view->messages = $this->_helper->flashMessenger->getMessages(); $this->view->data = $data; } } } else { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($employeeform); $this->view->msgarray = $result; $employeeform->modeofentry->setValue($data['modeofentry']); } } catch (Exception $e) { $this->view->rowexist = "norows"; } }
/** * This function is used to check login id user is a request receiver or not. * @param integer $emp_id = id of login user * @param integer $businessunit_id = id of business unit * @param integer $service_desk_flag = service desk flag value * @return string Yes/No */ public function check_receiver($emp_id, $businessunit_id) { $status = "no"; if ($emp_id != '') { if ($businessunit_id == 0) { $service_desk_flag = '0'; } else { $bu_model = new Default_Model_Businessunits(); $bu_data = $bu_model->getSingleUnitData($businessunit_id); $service_desk_flag = $bu_data['service_desk_flag']; } if ($service_desk_flag != '' && $businessunit_id != '') { $db = Zend_Db_Table::getDefaultAdapter(); $query = "select count(*) cnt from main_sd_configurations " . "where isactive = 1 and businessunit_id = " . $businessunit_id . " and service_desk_flag = " . $service_desk_flag . " " . "and find_in_set(" . $emp_id . ",request_recievers) "; $result = $db->query($query); $row = $result->fetch(); if ($row['cnt'] != '' && $row['cnt'] > 0) { $status = "yes"; } } } return $status; }
public function getbunitimplementationAction() { $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('getbunitimplementation', 'json')->initContext(); $businessunitsmodel = new Default_Model_Businessunits(); $servicedeskconfmodel = new Default_Model_Servicedeskconf(); $bunitid = $this->_request->getParam('bunitid'); $result = array(); if ($bunitid != '') { $pendingRequestdata = $servicedeskconfmodel->getPendingServiceReqData($bunitid); if (!empty($pendingRequestdata)) { $result['count'] = $pendingRequestdata[0]['count']; } $implementationdata = $businessunitsmodel->getSingleUnitData($bunitid); if (!empty($implementationdata)) { $result['result'] = $implementationdata['service_desk_flag']; } } $this->_helper->_json($result); }
public function indexAction() { $errorMsg = ""; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $businessunit_id = $auth->getStorage()->read()->businessunit_id; $department_id = $auth->getStorage()->read()->department_id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $view = $this->view; $model = new Default_Model_Appraisalmanager(); $app_rating_model = new Default_Model_Appraisalratings(); $ratingflag = 'false'; $linemangerids = ''; $managerprofileimgArr = array(); $businessUnits = array(); $business_unit_model = new Default_Model_Businessunits(); $businessUnits = $business_unit_model->getBusinessUnitsList(); $emp_data = $model->getEmpdata_managerapp($loginUserId); if (!empty($emp_data)) { $checkRatingsExists = $app_rating_model->getAppraisalRatingsbyInitId($emp_data[0]['init_id']); if (!empty($checkRatingsExists)) { $ratingflag = 'true'; } } if (!empty($emp_data)) { foreach ($emp_data as $key => $empval) { for ($i = 1; $i <= 5; $i++) { if (isset($empval['line_rating_' . $i])) { $linemangerids .= $empval['line_manager_' . $i] . ','; } } if ($linemangerids) { $linemangerids = rtrim($linemangerids, ','); $managerprofileimgArr = $app_rating_model->getManagerProfileImg($linemangerids); } $emp_data[$key] = $emp_data[$key] + $managerprofileimgArr; $linemangerids = ''; $managerprofileimgArr = array(); } } $view->emp_data = $emp_data; $view->manager_id = $loginUserId; $view->error_msg = $errorMsg; $view->ratingflag = $ratingflag; $view->business_units = $businessUnits; $view->loginuserRole = $loginuserRole; $view->loginuserGroup = $loginuserGroup; }
public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->getRequest()->getParam('id'); $id = abs($id); $emailgroup_model = new Default_Model_Emailgroups(); $business_unit_model = new Default_Model_Businessunits(); $bunits_options = $business_unit_model->getBusinessUnitsList(); $emailContactsform = new Default_Form_emailcontacts(); $emailContactsModel = new Default_Model_Emailcontacts(); $group_options = $emailgroup_model->getEgroupsOptions(); $emailContactsform->group_id->addMultiOptions(array('' => 'Select Group') + $group_options); $emailContactsform->business_unit_id->addMultiOptions(array('' => 'Select Business Unit') + $bunits_options); try { if ($id && $id > 0 && is_numeric($id)) { $data = $emailContactsModel->getgroupEmailRecord($id); if (!empty($data)) { if (sapp_Global::_isactivemodule(RESOURCEREQUISITION) && ($data[0]['group_code'] == 'REQ_HR' || $data[0]['group_code'] == 'REQ_MGMT') || sapp_Global::_isactivemodule(BGCHECKS) && ($data[0]['group_code'] == 'BG_CHECKS_HR' || $data[0]['group_code'] == 'BG_CHECKS_MNGMNT')) { $group_name = $group_options[$data[0]["group_id"]]; $bunit_name = $bunits_options[$data[0]["business_unit_id"]]; $emailContactsform->setDefault("id", $id); $emailContactsform->setDefault("group_id", $data[0]["group_id"]); $emailContactsform->setDefault("groupEmail", $data[0]["groupEmail"]); $emailContactsform->setDefault("business_unit_id", $data[0]["business_unit_id"]); $this->view->id = $id; $this->view->nodata = ''; $this->view->group_name = $group_name; $this->view->bunit_name = $bunit_name; $emailContactsform->submit->setLabel('Update'); } else { $this->view->nodata = 'norecord'; } } else { $this->view->nodata = 'norecord'; } $emailContactsform->setAttrib('action', DOMAIN . 'emailcontacts/edit/id/' . $id); } else { $this->view->nodata = 'norecord'; } } catch (Exception $e) { $this->view->nodata = 'nodata'; } $this->view->form = $emailContactsform; if ($this->getRequest()->getPost()) { $result = $this->save($emailContactsform); $this->view->msgarray = $result; } }
public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'departments/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'departments'); $id = new Zend_Form_Element_Hidden('id'); $deptname = new Zend_Form_Element_Text('deptname'); $deptname->setAttrib('maxLength', 50); $deptname->addFilter(new Zend_Filter_StringTrim()); $deptname->setRequired(true); $deptname->addValidator('NotEmpty', false, array('messages' => 'Please enter department name.')); $deptname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid department name.'))); $deptcode = new Zend_Form_Element_Text('deptcode'); $deptcode->addFilter(new Zend_Filter_StringTrim()); $deptcode->setRequired(true); $deptcode->setAttrib("maxlength", 4); $deptcode->addValidator('NotEmpty', false, array('messages' => 'Please enter department code.')); $deptcode->addValidators(array(array('StringLength', false, array('min' => 2, 'max' => 4, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Code must contain at least %min% characters.'))))); $deptcode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\&\'\\.\\s]+$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid department code.'))))); $deptcode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_departments', 'field' => 'deptcode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1'))); $deptcode->getValidator('Db_NoRecordExists')->setMessage('Department code already exists.'); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date'); $start_date->setAttrib('readonly', 'true'); $start_date->setAttrib('onfocus', 'this.blur()'); $start_date->setOptions(array('class' => 'brdr_none')); $unitid = new Zend_Form_Element_Select('unitid'); $unitid->setLabel('unitid'); $unitid->setAttrib('onchange', 'validateorgandunitstartdate(this,"deptunit")'); $bunitModel = new Default_Model_Businessunits(); $bunitdata = $bunitModel->fetchAll('isactive=1', 'unitname'); $unitid->addMultiOption('0', 'No Business Unit'); foreach ($bunitdata->toArray() as $data) { $unitid->addMultiOption($data['id'], $data['unitname']); } $bUnitid = Zend_Controller_Front::getInstance()->getRequest()->getParam('unitId'); if ($bUnitid == '') { } $country = new Zend_Form_Element_Select('country'); $country->setLabel('country'); $country->setRequired(true); $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $country->setAttrib('onchange', 'displayParticularState_normal(this,"state","state","city")'); $countryModal = new Default_Model_Countries(); $countriesData = $countryModal->fetchAll('isactive=1', 'country'); $country->addMultiOption('', 'Select country'); foreach ($countriesData->toArray() as $data) { $country->addMultiOption($data['country_id_org'], $data['country']); } $country->setRegisterInArrayValidator(false); $state = new Zend_Form_Element_Select('state'); $state->setAttrib('class', 'selectoption'); $state->setAttrib('onchange', 'displayParticularCity_normal(this,"city","city","")'); $state->setRegisterInArrayValidator(false); $state->addMultiOption('', 'Select State'); $state->setRequired(true); $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $city = new Zend_Form_Element_Select('city'); $city->setAttrib('class', 'selectoption'); $city->setAttrib('onchange', 'displayCityCode(this)'); $city->setRegisterInArrayValidator(false); $city->addMultiOption('', 'Select City'); $city->setRequired(true); $city->addValidator('NotEmpty', false, array('messages' => 'Please select city.')); $address1 = new Zend_Form_Element_Textarea('address1'); $address1->setAttrib('rows', 10); $address1->setAttrib('cols', 50); $address1->setRequired(true); $address1->addValidator('NotEmpty', false, array('messages' => ' Please enter street address.')); $address2 = new Zend_Form_Element_Textarea('address2'); $address2->setAttrib('rows', 10); $address2->setAttrib('cols', 50); $address3 = new Zend_Form_Element_Textarea('address3'); $address3->setAttrib('rows', 10); $address3->setAttrib('cols', 50); $timezone = new Zend_Form_Element_Select('timezone'); $timezone->setAttrib('class', 'selectoption'); $timezone->setLabel('timezone'); $timezone->setRequired(true); $timezone->addValidator('NotEmpty', false, array('messages' => 'Please select time zone.')); $timezoneModel = new Default_Model_Timezone(); $timezonedata = $timezoneModel->fetchAll('isactive=1', 'timezone'); $timezone->addMultiOption('', 'Select Time zone'); foreach ($timezonedata->toArray() as $data) { $timezone->addMultiOption($data['id'], $data['timezone'] . ' [' . $data['timezone_abbr'] . ']'); } $timezone->setRegisterInArrayValidator(false); $depthead = new Zend_Form_Element_Select('depthead'); $depthead->setAttrib('class', 'selectoption'); $depthead->setLabel('Department Head'); $depthead->setRequired(true); $depthead->addValidator('NotEmpty', false, array('messages' => 'Please select department head.')); $depthead->addMultiOption('', 'Select Department Head'); $depthead->setRegisterInArrayValidator(false); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $deptname, $deptcode, $description, $start_date, $unitid, $country, $state, $city, $address1, $address2, $address3, $timezone, $depthead, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('start_date')); }
/** * */ public function addAction() { $sd_req_model = new Default_Model_Servicerequests(); $request_form = new Default_Form_Servicerequest(); $isUpdate = "0"; $msgarray = array(); $auth = Zend_Auth::getInstance(); $grid_type = $this->_getParam('t', null); $status_value = $this->_getParam('v', null); $this->view->x_grid_type = $grid_type; $this->view->x_status_value = $status_value; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; $login_bu = $auth->getStorage()->read()->businessunit_id; $login_dept = $auth->getStorage()->read()->department_id; $reporting_manager = $auth->getStorage()->read()->reporting_manager; $org_head_flag = $auth->getStorage()->read()->is_orghead; } if ($org_head_flag == 1) { $this->view->ermsg = 'norecord'; $this->render('form'); } if ($grid_type != '') { if ($login_bu == 0) { $service_desk_flag = 0; } else { $bu_model = new Default_Model_Businessunits(); $bu_data = $bu_model->getSingleUnitData($login_bu); $service_desk_flag = $bu_data['service_desk_flag']; } $service_types_data = $sd_req_model->getServiceTypes($login_bu, $login_dept, $service_desk_flag); $grid_type = sapp_Global::_decrypt($grid_type); $grid_type_arr = $sd_req_model->getGridtypearr(); if ($login_bu == 0 && $login_dept == 0) { $msgarray['service_desk_conf_id'] = "To use service request management, please assign to any department."; } $this->view->msgarray = $msgarray; $this->view->form = $request_form; $this->view->service_types_data = $service_types_data; $this->view->action_name = $this->getRequest()->getActionName(); $this->view->grid_type = $grid_type_arr[$grid_type]; $this->view->grid_type_arr = $sd_req_model->getGridtypearr_rev(); $this->view->status_value = $status_value; $id = $this->getRequest()->getParam('id', null); $where = ""; $actionflag = 1; if ($id > 0 && is_numeric($id)) { //update code $actionflag = 2; $id = abs($id); $serviceticketdata = $sd_req_model->getServiceTicketByID($id); if ($serviceticketdata != false) { $request_form->setDefault('service_desk_conf_id', $serviceticketdata['service_desk_conf_id']); $request_form->setDefault('priority', $serviceticketdata['priority']); $request_form->setDefault('description', $serviceticketdata['description']); $sd_dept_model = new Default_Model_Servicedeskdepartment(); $servicedeskrequesttypes = $sd_dept_model->getRequestIDNameById($serviceticketdata['service_desk_conf_id']); $request_form->service_request_id->addMultiOptions(array('' => 'Select Request') + $servicedeskrequesttypes); $request_form->setDefault('service_request_id', $serviceticketdata['service_request_id']); $request_form->submit->setLabel('Update'); } else { $this->view->ermsg = 'norecord'; } } if ($this->getRequest()->getPost()) { if ($request_form->isValid($this->_request->getPost())) { $service_desk_id = $this->_getParam('service_desk_id', null); $service_desk_conf_id = $this->_getParam('service_desk_conf_id', null); if ($service_desk_id == "") { $service_desk_id = $service_desk_conf_id; } $service_request_id = $this->_getParam('service_request_id', null); $priority = $this->_getParam('priority', null); $description = $this->_getParam('description', null); $attachment = $this->_getParam('attachment', null); $check_raiser = $sd_req_model->check_raiser($service_desk_conf_id, $loginUserId); if ($check_raiser == 'yes') { $file_original_names = $this->_getParam('file_original_names', null); $file_new_names = $this->_getParam('file_new_names', null); $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[$org_names[$i]] = $new_names[$i]; } } $data = array('service_desk_id' => $service_desk_id, 'service_desk_conf_id' => $service_desk_conf_id, 'service_request_id' => $service_request_id, 'priority' => $priority, 'description' => $description, 'attachment' => count($attachment_array) > 0 ? json_encode($attachment_array) : null, 'status' => 'Open', 'reporting_manager_id' => $reporting_manager, 'raised_by' => $loginUserId, 'isactive' => 1, 'createdby' => $loginUserId, 'modifiedby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s")); $trDb = Zend_Db_Table::getDefaultAdapter(); // starting transaction $trDb->beginTransaction(); try { if ($id != '') { $isUpdate = "1"; unset($data['createdby']); unset($data['createdon']); $where = "id = " . $id; $actionflag = 2; $result = $sd_req_model->SaveorUpdateRequestData($data, $where); $rslt = "Request updated successfully."; //start of saving history $reqh_model = new Default_Model_Requesthistory(); $reqh_data = array('request_id' => $id, 'description' => ucfirst($rslt), 'emp_id' => $loginUserId, 'emp_name' => ucfirst($auth->getStorage()->read()->userfullname), 'emp_profileimg' => $auth->getStorage()->read()->profileimg, 'createdby' => $loginUserId, 'modifiedby' => $loginUserId, 'comments' => trim($description), 'isactive' => 1, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s")); $reqh_model->SaveorUpdateRhistory($reqh_data, ''); } else { $id = $sd_req_model->SaveorUpdateRequestData($data, ''); $data = array('modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'ticket_number' => "SD" . str_pad($id, 4, '0', STR_PAD_LEFT)); $sd_req_model->SaveorUpdateRequestData($data, 'id = ' . $id); $rslt = "Request raised successfully."; } if (count($new_names) > 0) { foreach ($new_names as $n) { if ($n != '') { if (file_exists(SD_TEMP_UPLOAD_PATH . $n)) { copy(SD_TEMP_UPLOAD_PATH . $n, SD_UPLOAD_PATH . $n); unlink(SD_TEMP_UPLOAD_PATH . $n); } } } } $result = sapp_Global::logManager(SERVICEDESK, 1, $loginUserId, $id); $this->send_req_mails($id, $isUpdate); $trDb->commit(); $this->_helper->getHelper("FlashMessenger")->addMessage(array(array("success" => $rslt))); $this->_redirect('servicerequests/index/t/' . sapp_Global::_encrypt('1')); } catch (Exception $ex) { $trDb->rollBack(); $msgarray['service_desk_conf_id'] = "Something went wrong, please try again."; $this->view->msgarray = $msgarray; } } else { $msgarray['service_desk_conf_id'] = "You cannot raise the request as you are the request receiver."; $this->view->msgarray = $msgarray; } } else { $file_original_names = $this->_getParam('file_original_names', null); $file_new_names = $this->_getParam('file_new_names', null); $show_attachment = $this->_getParam('show_attachment', null); $messages = $request_form->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; $this->view->file_original_names = $file_original_names; $this->view->file_new_names = $file_new_names; $this->view->show_attachment = $show_attachment; } if (count($msgarray) > 0) { $sd_dept_model = new Default_Model_Servicedeskdepartment(); $data = $sd_dept_model->getRequestsById($this->_getParam('service_desk_id')); $ser_req_options = array('' => 'Select request'); if (count($data) > 0) { foreach ($data as $opt) { $ser_req_options[$opt['id']] = $opt['service_request_name']; } } $request_form->service_request_id->addMultiOptions($ser_req_options); } } } else { $this->view->ermsg = 'norecord'; } $this->render('form'); }
public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; $loginuserbusinessunit_id = $auth->getStorage()->read()->businessunit_id; } $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $announcementsForm = new Default_Form_Announcements(); $announcementsModel = new Default_Model_Announcements(); try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $announcementsModel->getAnnouncementsDatabyID($id); if (isset($data[0]['status']) && $data[0]['status'] == 1 || $loginuserRole == SUPERADMINROLE || $loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP) { $bu_model = new Default_Model_Businessunits(); $bu_arr = $bu_model->getBU_report(); if (!empty($bu_arr)) { foreach ($bu_arr as $bu) { if ($loginuserGroup == HR_GROUP && $bu['id'] == $loginuserbusinessunit_id) { $announcementsForm->businessunit_id->addMultiOption($bu['id'], utf8_encode($bu['bu_name'])); } if ($loginuserGroup != HR_GROUP) { $announcementsForm->businessunit_id->addMultiOption($bu['id'], utf8_encode($bu['bu_name'])); } } } $dept_model = new Default_Model_Departments(); $dept_data = $dept_model->getDepartmentWithCodeList_bu($data[0]['businessunit_id']); if (!empty($dept_data)) { foreach ($dept_data as $dept) { $announcementsForm->department_id->addMultiOption($dept['id'], $dept['unitcode'] . " " . $dept['deptname']); } } if (!empty($data)) { $data = $data[0]; $announcementsForm->populate($data); $announcementsForm->post_description->setValue($data['description']); $announcementsForm->businessunit_id->setValue(explode(',', $data['businessunit_id'])); if ($data['department_id']) { $announcementsForm->department_id->setValue(explode(',', $data['department_id'])); } $announcementsForm->setAttrib('action', BASE_URL . 'announcements/edit/id/' . $id); if ($data['attachments']) { $new = array(); $ori = array(); $attachments = json_decode($data['attachments'], true); foreach ($attachments as $k => $v) { $new[] = $v["new_name"]; $ori[] = $v["original_name"]; } $msg['file_original_names'] = implode(',', $ori); $msg['file_new_names'] = implode(',', $new); $this->view->msgarray = $msg; } $this->view->data = $data; } else { $this->view->ermsg = 'norecord'; } } else { $this->_redirect('announcements'); } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = ''; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $announcementsForm; if ($this->getRequest()->getPost()) { $result = $this->save($announcementsForm); $this->view->msgarray = $result; } $this->render('form'); }
public function init() { $this->setMethod('post'); //$this->setAttrib('action',DOMAIN.'language/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'appraisalconfig'); $id = new Zend_Form_Element_Hidden('id'); $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); $businessunit_id = new Zend_Form_Element_Select('businessunit_id'); $businessunit_id->setLabel("Business Unit"); $businessunit_id->setAttrib('class', 'selectoption'); if ($postid == '') { $businessunit_id->setAttrib('onchange', 'displayDept(this)'); $bunitModel = new Default_Model_Businessunits(); $bunitdata = $bunitModel->fetchAll('isactive=1', 'unitname'); $businessunit_id->addMultiOptions(array('' => 'Select Business unit', '0' => 'No Business Unit')); foreach ($bunitdata->toArray() as $data) { $businessunit_id->addMultiOption($data['id'], $data['unitname']); } } else { $businessunit_id->addMultiOptions(array('' => 'Select Business unit')); } $businessunit_id->setRegisterInArrayValidator(false); $businessunit_id->setRequired(true); $businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.')); $department_id = new Zend_Form_Element_Select('department_id'); $department_id->setLabel("Department"); $department_id->setAttrib('class', 'selectoption'); $department_id->addMultiOption('', 'Select Department'); if ($postid == '') { $department_id->setAttrib('onchange', 'displayDept(this)'); } $department_id->setRegisterInArrayValidator(false); $performance_app_flag = new Zend_Form_Element_Radio('performance_app_flag'); $performance_app_flag->setLabel("Applicability"); $performance_app_flag->setAttrib('onclick', 'checkimplementfun(this)'); $performance_app_flag->addMultiOptions(array('1' => 'Business unit wise', '0' => 'Department wise')); $performance_app_flag->setSeparator(''); $performance_app_flag->setValue(1); $performance_app_flag->setRegisterInArrayValidator(false); $performance_app_flag->setRequired(true); $performance_app_flag->addValidator('NotEmpty', false, array('messages' => 'Please select applicability.')); $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode'); $appraisal_mode->setLabel("Appraisal Mode"); $appraisal_mode->setAttrib('class', 'selectoption'); $appraisal_mode->addMultiOptions(array('' => 'Select appraisal mode', 'Quarterly' => 'Quarterly', 'Half yearly' => 'Half yearly', 'Yearly' => 'Yearly')); $appraisal_mode->setRegisterInArrayValidator(false); $appraisal_mode->setRequired(true); $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal mode.')); $approval_selection = new Zend_Form_Element_Select('approval_selection'); $approval_selection->setLabel("Appraisal Level"); $approval_selection->setAttrib('class', 'selectoption'); $approval_selection->addMultiOptions(array('' => 'Select appraisal level', '1' => 'HR', '2' => 'Manager')); $approval_selection->setRegisterInArrayValidator(false); $approval_selection->setRequired(true); $approval_selection->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal level.')); $appraisal_ratings = new Zend_Form_Element_Select('appraisal_ratings'); $appraisal_ratings->setLabel("Appraisal Ratings"); $appraisal_ratings->setAttrib('class', 'selectoption'); $appraisal_ratings->addMultiOptions(array('' => 'Select ratings', '1' => '1-5', '2' => '1-10')); $appraisal_ratings->setRegisterInArrayValidator(false); $appraisal_ratings->setRequired(true); $appraisal_ratings->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal ratings.')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $businessunit_id, $performance_app_flag, $department_id, $appraisal_mode, $approval_selection, $appraisal_ratings, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function indexAction() { $editPrivilege = ""; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $loginUserId; $data = array(); $tabName = "employee"; $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $employeeform = new Default_Form_employee(); try { if ($id != '' && $id > 0) { $employeeModal = new Default_Model_Employee(); $usersModel = new Default_Model_Users(); $employmentstatusModel = new Default_Model_Employmentstatus(); $busineesUnitModel = new Default_Model_Businessunits(); $deptModel = new Default_Model_Departments(); $role_model = new Default_Model_Roles(); $user_model = new Default_Model_Usermanagement(); $candidate_model = new Default_Model_Candidatedetails(); $jobtitlesModel = new Default_Model_Jobtitles(); $positionsmodel = new Default_Model_Positions(); $prefix_model = new Default_Model_Prefix(); $data = $employeeModal->getsingleEmployeeData($id); if ($data == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { if (!empty($data)) { $this->view->rowexist = "rows"; $this->view->empdata = $data; $elements = $employeeform->getElements(); if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") { $element->setAttrib("disabled", "disabled"); } } } $employeeform->removeElement("submit"); $data = $data[0]; if ($loginUserId == SUPERADMIN) { //If login user is superAdmin..... role is 'Super Admin'. $employeeform->emprole->addMultiOption('superAdmin', 'Super Admin'); } else { $roles_arr = $role_model->getRolesDataByID($data['emprole']); if (sizeof($roles_arr) > 0) { $employeeform->emprole->addMultiOption($roles_arr[0]['id'] . '_' . $roles_arr[0]['group_id'], utf8_encode($roles_arr[0]['rolename'])); } } $prefix_data = $prefix_model->getsinglePrefixData($data['prefix_id']); if ($prefix_data != 'norows') { $prefix_data = $prefix_data[0]; $employeeform->prefix_id->addMultiOption($prefix_data['id'], $prefix_data['prefix']); } $referedby_options = $user_model->getRefferedByForUsers(); /* Code for reporting manager dropdown */ $reportingManagerData = $usersModel->getUserDetailsByID($data['reporting_manager']); if (!empty($reportingManagerData)) { $employeeform->reporting_manager->addMultiOption($reportingManagerData[0]['id'], $reportingManagerData[0]['userfullname']); } $employmentStatusData = $employmentstatusModel->getempstatuslist(); if (sizeof($employmentStatusData) > 0) { $employeeform->emp_status_id->addMultiOption('', 'Select a Employment Status'); foreach ($employmentStatusData as $employmentStatusres) { $employeeform->emp_status_id->addMultiOption($employmentStatusres['workcodename'], $employmentStatusres['statusname']); } } $businessunitData = $busineesUnitModel->getDeparmentList(); if (sizeof($businessunitData) > 0) { $employeeform->businessunit_id->addMultiOption('0', 'No Business Unit'); foreach ($businessunitData as $businessunitres) { $employeeform->businessunit_id->addMultiOption($businessunitres['id'], $businessunitres['unitname']); } } $departmentsData = $deptModel->getDepartmentList($data['businessunit_id']); if (sizeof($departmentsData) > 0) { $employeeform->department_id->addMultiOption('', 'Select a Department'); foreach ($departmentsData as $departmentsres) { $employeeform->department_id->addMultiOption($departmentsres['id'], $departmentsres['deptname']); } } $jobtitleData = $jobtitlesModel->getJobTitleList(); if (sizeof($jobtitleData) > 0) { $employeeform->jobtitle_id->addMultiOption('', 'Select a Job Title'); foreach ($jobtitleData as $jobtitleres) { $employeeform->jobtitle_id->addMultiOption($jobtitleres['id'], $jobtitleres['jobtitlename']); } } $positionlistArr = $positionsmodel->getPositionList($data['jobtitle_id']); if (sizeof($positionlistArr) > 0) { $employeeform->position_id->addMultiOption('', 'Select a Position'); foreach ($positionlistArr as $positionlistres) { $employeeform->position_id->addMultiOption($positionlistres['id'], $positionlistres['positionname']); } } $employeeform->populate($data); $employeeform->setDefault('user_id', $data['user_id']); $employeeform->setDefault('emp_status_id', $data['emp_status_id']); $employeeform->setDefault('businessunit_id', $data['businessunit_id']); $employeeform->setDefault('jobtitle_id', $data['jobtitle_id']); $employeeform->setDefault('department_id', $data['department_id']); $employeeform->setDefault('position_id', $data['position_id']); if ($data['date_of_joining'] != '' && $data['date_of_joining'] != '0000-00-00') { $date_of_joining = sapp_Global::change_date($data['date_of_joining'], 'view'); $employeeform->date_of_joining->setValue($date_of_joining); } if ($data['date_of_leaving'] != '' && $data['date_of_leaving'] != '0000-00-00') { $date_of_leaving = sapp_Global::change_date($data['date_of_leaving'], 'view'); $employeeform->date_of_leaving->setValue($date_of_leaving); } if ($data['modeofentry'] != 'Direct') { $employeeform->rccandidatename->setValue($data['userfullname']); } if (sizeof($referedby_options) > 0 && $data['candidatereferredby'] != '' && $data['candidatereferredby'] != 0) { $employeeform->candidatereferredby->setValue($referedby_options[$data['candidatereferredby']]); } $employeeform->setAttrib('action', DOMAIN . 'mydetails/edit/'); $this->view->id = $id; $this->view->form = $employeeform; $this->view->employeedata = !empty($data) ? $data : ""; $this->view->messages = $this->_helper->flashMessenger->getMessages(); $this->view->empdata = $data; $this->view->editPrivilege = $this->mydetailsobjPrivileges; } } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($employeeform, $tabName); $this->view->msgarray = $result; } }
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) { $businessunitsmodel = new Default_Model_Businessunits(); $checkdeptexistance = $businessunitsmodel->checkdeptstobusinessunits($id); if ($checkdeptexistance == 0) { $menumodel = new Default_Model_Menu(); $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $id); $Id = $businessunitsmodel->SaveorUpdateBusinessUnits($data, $where); if ($Id == 'update') { $menuidArr = $menumodel->getMenuObjID('/businessunits'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $messages['message'] = 'Business unit deleted successfully.'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'Business unit cannot be deleted.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Since departments are associated with this business unit, you cannot delete the business unit.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Business unit cannot be deleted.'; } $this->_helper->json($messages); }
public function init() { $this->setMethod('post'); //$this->setAttrib('action',DOMAIN.'language/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'servicedeskrequests'); $id = new Zend_Form_Element_Hidden('id'); $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); $businessunit_id = new Zend_Form_Element_Select('businessunit_id'); $businessunit_id->setLabel("Business Unit"); $businessunit_id->setAttrib('class', 'selectoption'); if ($postid == '') { $businessunit_id->setAttrib('onchange', 'displayemployees(this)'); $bunitModel = new Default_Model_Businessunits(); $bunitdata = $bunitModel->fetchAll('isactive=1', 'unitname'); $businessunit_id->addMultiOptions(array('' => 'Select Business unit', '0' => 'No Business Unit')); foreach ($bunitdata->toArray() as $data) { $businessunit_id->addMultiOption($data['id'], $data['unitname']); } } else { $businessunit_id->addMultiOptions(array('' => 'Select Business unit')); } $businessunit_id->setRegisterInArrayValidator(false); $businessunit_id->setRequired(true); $businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.')); $department_id = new Zend_Form_Element_Select('department_id'); $department_id->setLabel("Department"); $department_id->setAttrib('class', 'selectoption'); $department_id->addMultiOption('', 'Select Department'); if ($postid == '') { $department_id->setAttrib('onchange', 'displayemployees(this)'); } $department_id->setRegisterInArrayValidator(false); $service_desk_flag = new Zend_Form_Element_Radio('service_desk_flag'); $service_desk_flag->setLabel("Applicability"); $service_desk_flag->setAttrib('onclick', 'changeimplementation(this)'); $service_desk_flag->addMultiOptions(array('1' => 'Business unit wise', '0' => 'Department wise')); $service_desk_flag->setSeparator(''); $service_desk_flag->setValue(1); $service_desk_flag->setRegisterInArrayValidator(false); $service_desk_flag->setRequired(true); $service_desk_flag->addValidator('NotEmpty', false, array('messages' => 'Please select applicability.')); $service_desk_id = new Zend_Form_Element_Select('service_desk_id'); $service_desk_id->setLabel("Category"); $service_desk_id->setAttrib('class', 'selectoption'); $service_desk_id->addMultiOption('', 'Select category'); $service_desk_id->setRegisterInArrayValidator(false); $service_desk_id->setRequired(true); $service_desk_id->addValidator('NotEmpty', false, array('messages' => 'Please select category.')); $request_recievers = new Zend_Form_Element_Multiselect('request_recievers'); $request_recievers->setLabel("Executors"); $request_recievers->setAttrib('class', 'selectoption'); $request_recievers->setRegisterInArrayValidator(false); $request_recievers->setRequired(true); $request_recievers->addValidator('NotEmpty', false, array('messages' => 'Please select executor.')); $approvingauthority = new Zend_Form_Element_Select('approvingauthority'); $approvingauthority->setLabel("No. of Approvers"); $approvingauthority->setAttrib('class', 'selectoption'); $approvingauthority->setAttrib('onchange', 'displayapprovingauthority(this)'); $approvingauthority->addMultiOptions(array('' => 'Select no. of approvers', '1' => '1', '2' => '2', '3' => '3')); $approvingauthority->setRegisterInArrayValidator(false); $approvingauthority->setRequired(true); $approvingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select no. of approvers.')); $approver_1 = new Zend_Form_Element_Select('approver_1'); $approver_1->setLabel("Approver 1"); $approver_1->setAttrib('class', 'selectoption'); $approver_1->addMultiOption('', 'Select Approver 1'); $approver_1->setAttrib('onchange', 'displayapprovingauthority(this)'); $approver_1->setRegisterInArrayValidator(false); $approver_2 = new Zend_Form_Element_Select('approver_2'); $approver_2->setLabel("Approver 2"); $approver_2->setAttrib('class', 'selectoption'); $approver_2->addMultiOption('', 'Select Approver 2'); $approver_2->setAttrib('onchange', 'displayapprovingauthority(this)'); $approver_2->setRegisterInArrayValidator(false); $approver_3 = new Zend_Form_Element_Select('approver_3'); $approver_3->setLabel("Approver 3"); $approver_3->setAttrib('class', 'selectoption'); $approver_3->addMultiOption('', 'Select Approver 3'); $approver_3->setRegisterInArrayValidator(false); $cc_mail_recievers = new Zend_Form_Element_Multiselect('cc_mail_recievers'); $cc_mail_recievers->setLabel("Request Viewers"); $cc_mail_recievers->setAttrib('class', 'selectoption'); $cc_mail_recievers->setRegisterInArrayValidator(false); $attachment = new Zend_Form_Element_Radio('attachment'); $attachment->setLabel("Attachment"); $attachment->addMultiOptions(array('1' => 'Yes', '0' => 'No')); $attachment->setSeparator(''); $attachment->setValue(0); $attachment->setRegisterInArrayValidator(false); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel("Description"); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $businessunit_id, $department_id, $description, $service_desk_flag, $service_desk_id, $request_recievers, $approvingauthority, $approver_1, $approver_2, $approver_3, $cc_mail_recievers, $attachment, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function buildoptions($businessUnitId, $departmentId, $performanceappflag) { $businessunitmodel = new Default_Model_Businessunits(); $deptmodel = new Default_Model_Departments(); $deptOptions = ''; $buDataArr = $businessunitmodel->getSingleUnitData($businessUnitId); if (!empty($buDataArr)) { $buOptions = "<option value=" . $buDataArr['id'] . ">" . utf8_encode($buDataArr['unitname']) . "</option>"; } if ($performanceappflag == 0) { if ($departmentId != '') { $deptArr = $deptmodel->getSingleDepartmentData($departmentId); } } if (!empty($deptArr)) { $deptOptions = "<option value=" . $deptArr['id'] . ">" . utf8_encode($deptArr['deptname']) . "</option>"; } return array('buoptions' => $buOptions, 'deptoptions' => $deptOptions); }
public static function getbudeptname($appraisalid) { $appInitModel = new Default_Model_Appraisalinit(); $businessunitmodel = new Default_Model_Businessunits(); $deptmodel = new Default_Model_Departments(); $buname = ''; $deptname = ''; $perf_impl_flag = ''; $appraisaldataArr = array(); if ($appraisalid) { $appraisaldataArr = $appInitModel->getAppDataById($appraisalid); if (!empty($appraisaldataArr)) { if ($appraisaldataArr['businessunit_id'] != '') { $buDataArr = $businessunitmodel->getSingleUnitData($appraisaldataArr['businessunit_id']); // $perfimplementation = $appInitModel->check_performance_implmentation($appraisaldataArr['businessunit_id']); if (!empty($buDataArr)) { $buname = $buDataArr['unitname']; } /*if(!empty($perfimplementation)) { $perf_impl_flag = $perfimplementation['performance_app_flag']; }*/ $perf_impl_flag = isset($appraisaldataArr['performance_app_flag']) ? $appraisaldataArr['performance_app_flag'] : 1; } if ($perf_impl_flag == 0) { if ($appraisaldataArr['department_id'] != '') { $deptArr = $deptmodel->getSingleDepartmentData($appraisaldataArr['department_id']); } if (!empty($deptArr)) { $deptname = $deptArr['deptname']; } } } } return array('buname' => $buname, 'deptname' => $deptname, 'perf_app_flag' => $perf_impl_flag, 'appdata' => $appraisaldataArr); }
public function createDepartmentsReportFinalArray($dataArray, $columnArray) { $businessunitArray = array(); $cityArray = array(); $stateArray = array(); $countryArray = array(); if (!empty($dataArray)) { foreach ($dataArray as $key => $curr) { if (isset($curr['unitid'])) { if (!in_array($curr['unitid'], $businessunitArray)) { array_push($businessunitArray, $curr['unitid']); } } if (isset($curr['city'])) { if (!in_array($curr['city'], $cityArray)) { array_push($cityArray, $curr['city']); } } if (isset($curr['state'])) { if (!in_array($curr['state'], $stateArray)) { array_push($stateArray, $curr['state']); } } if (isset($curr['country'])) { if (!in_array($curr['country'], $countryArray)) { array_push($countryArray, $curr['country']); } } } } if (!empty($businessunitArray)) { $businessunitModel = new Default_Model_Businessunits(); $businessNameArray = $businessunitModel->getBusinessunitNamesByIds($businessunitArray); } if (!empty($cityArray)) { $cityModel = new Default_Model_Cities(); $cityNameArray = $cityModel->getCityNamesByIds($cityArray); } if (!empty($stateArray)) { $stateModel = new Default_Model_States(); $stateNameArray = $stateModel->getStateNamesByIds($stateArray); } if (!empty($countryArray)) { $countryModel = new Default_Model_Countries(); $countryNameArray = $countryModel->getCountryNamesByIds($countryArray); } $finalArray = array(); if (!empty($dataArray)) { foreach ($dataArray as $key => $curr) { $finalArray[$key]['id'] = $curr['id']; if (in_array("deptname", $columnArray)) { $finalArray[$key]['deptname'] = $curr['deptname']; } if (in_array("unitname", $columnArray)) { $finalArray[$key]['unitname'] = isset($businessNameArray[$curr['unitid']]) ? $businessNameArray[$curr['unitid']] : ''; } if (in_array("deptcode", $columnArray)) { $finalArray[$key]['deptcode'] = $curr['deptcode']; } if (in_array("empcount", $columnArray)) { $finalArray[$key]['empcount'] = $curr['empcount']; } if (in_array("startdate", $columnArray)) { $finalArray[$key]['startdate'] = $curr['startdate']; } if (in_array("address", $columnArray)) { $finalArray[$key]['address1'] = $curr['address1']; $finalArray[$key]['address'] = $curr['address1']; } if (in_array("ccity", $columnArray)) { $finalArray[$key]['ccity'] = isset($cityNameArray[$curr['city']]) ? $cityNameArray[$curr['city']] : ''; } if (in_array("sstate", $columnArray)) { $finalArray[$key]['sstate'] = isset($stateNameArray[$curr['state']]) ? $stateNameArray[$curr['state']] : ''; } if (in_array("ccountry", $columnArray)) { $finalArray[$key]['ccountry'] = isset($countryNameArray[$curr['country']]) ? $countryNameArray[$curr['country']] : ''; } if (in_array("status", $columnArray)) { $finalArray[$key]['status'] = $curr['status']; } } } return $finalArray; }
public function editpopupAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $orgInfoModel = new Default_Model_Organisationinfo(); $getorgData = $orgInfoModel->getorgrecords(); $deptModel = new Default_Model_Departments(); if (!empty($getorgData)) { $orgdata = ''; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $msgarray = array(); $flag = 'true'; $bunitid = $this->getRequest()->getParam('unitId'); $id = intVal($this->getRequest()->getParam('id')); $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $timezonemodel = new Default_Model_Timezone(); $businessunitsmodel = new Default_Model_Businessunits(); $allTimezoneData = $timezonemodel->fetchAll('isactive=1', 'timezone')->toArray(); $allCountriesData = $countriesModel->fetchAll('isactive=1', 'country')->toArray(); $allStatesData = $statesmodel->fetchAll('isactive=1', 'state')->toArray(); $allCitiesData = $citiesmodel->fetchAll('isactive=1', 'city')->toArray(); $allBusinessunitsData = $businessunitsmodel->fetchAll('isactive=1', 'unitname')->toArray(); $deptModel = new Default_Model_Departments(); $deptform = new Default_Form_departments(); $deptform->setAction(BASE_URL . 'departments/editpopup/id/' . $id . '/unitId/' . $bunitid); $country = $getorgData[0]['country']; if (isset($_POST['country'])) { $country = $_POST['country']; } $state = $getorgData[0]['state']; if (isset($_POST['state'])) { $state = $_POST['state']; } $city = $getorgData[0]['city']; if (isset($_POST['city'])) { $city = $_POST['city']; } $address = $getorgData[0]['address1']; //department head data $managementUsersData = $deptModel->getDepartmenttHead(''); foreach ($managementUsersData as $mgmtdata) { $deptform->depthead->addMultiOption($mgmtdata['user_id'], $mgmtdata['userfullname']); } if (isset($country) && $country != 0 && $country != '') { $deptform->setDefault('country', $country); $statesData = $statesmodel->getBasicStatesList($country); foreach ($statesData as $res) { $deptform->state->addMultiOption($res['state_id_org'], utf8_encode($res['state'])); } if (isset($state) && $state != 0 && $state != '') { $deptform->setDefault('state', $state); } } if (isset($state) && $state != 0 && $state != '') { $citiesData = $citiesmodel->getBasicCitiesList($state); foreach ($citiesData as $res) { $deptform->city->addMultiOption($res['city_org_id'], utf8_encode($res['city'])); } if (isset($city) && $city != 0 && $city != '') { $deptform->setDefault('city', $city); } } if (isset($address) && $address != '') { $deptform->address1->setValue($address); } $close = ''; $controllername = 'departments'; $deptData = array(); if ($id) { $data = $deptModel->getSingleDepartmentData($id); if (!empty($data)) { $deptform->populate($data); $deptform->submit->setLabel('Update'); $st_date = sapp_Global::change_date($data['startdate'], 'view'); $deptform->setDefault('start_date', $st_date); $deptform->setDefault('start_date', $st_date); $deptform->state->clearMultiOptions(); $deptform->city->clearMultiOptions(); $countryId = $data['country']; if (isset($_POST['country'])) { $countryId = $_POST['country']; } $stateId = $data['state']; if (isset($_POST['state'])) { $stateId = $_POST['state']; } $cityId = $data['city']; if (isset($_POST['city'])) { $cityId = $_POST['city']; } if ($countryId != '') { $statesmodel = new Default_Model_States(); $statesData = $statesmodel->getBasicStatesList($countryId); foreach ($statesData as $res) { $deptform->state->addMultiOption($res['state_id_org'], utf8_encode($res['state'])); } } if ($stateId != '') { $citiesmodel = new Default_Model_Cities(); $citiesData = $citiesmodel->getBasicCitiesList($stateId); foreach ($citiesData as $res) { $deptform->city->addMultiOption($res['city_org_id'], utf8_encode($res['city'])); } } $deptform->setDefault('country', $countryId); $deptform->setDefault('state', $stateId); $deptform->setDefault('city', $cityId); $this->view->ermsg = ''; $this->view->datarr = $data; } else { $this->view->ermsg = 'nodata'; } } $bname = $deptModel->getbusinessunitname($bunitid); $this->view->bunitname = $bname; $this->view->deptData = sizeof($deptData); $this->view->form = $deptform; $this->view->unitid = $bunitid; $this->view->controllername = $controllername; if (!empty($allBusinessunitsData) && !empty($allCountriesData) && !empty($allStatesData) && !empty($allCitiesData) && !empty($allTimezoneData)) { $this->view->configuremsg = ''; } else { $this->view->configuremsg = 'notconfigurable'; } if (empty($allCountriesData)) { $msgarray['country'] = 'Countries are not configured yet.'; $flag = 'false'; } if (empty($allStatesData)) { $msgarray['state'] = 'States are not configured yet.'; $flag = 'false'; } if (empty($allCitiesData)) { $msgarray['city'] = 'Cities are not configured yet.'; $flag = 'false'; } if (empty($allTimezoneData)) { $msgarray['timezone'] = 'Time zones are not configured yet.'; $flag = 'false'; } $this->view->msgarray = $msgarray; if ($this->getRequest()->getPost()) { if ($deptform->isValid($this->_request->getPost()) && $flag == 'true') { $deptname = $this->_request->getParam('deptname'); $deptcode = $this->_request->getParam('deptcode'); $description = $this->_request->getParam('description'); $start_date = $this->_request->getParam('start_date', null); $start_date = sapp_Global::change_date($start_date, 'database'); $country = $this->_request->getParam('country'); $state = intval($this->_request->getParam('state')); $city = intval($this->_request->getParam('city')); $address1 = $this->_request->getParam('address1'); $address2 = $this->_request->getParam('address2'); $address3 = $this->_request->getParam('address3'); $unitid = $this->_request->getParam('unitid'); $timezone = $this->_request->getParam('timezone'); $depthead = $this->_request->getParam('depthead'); if (!isset($unitid) || $unitid == '') { $unitid = $bunitid; } $deptcodeExistance = $deptModel->checkCodeDuplicates($deptcode, $id); if (!$deptcodeExistance) { $date = new Zend_Date(); $actionflag = ''; $tableid = ''; $data = array('deptname' => trim($deptname), 'deptcode' => trim($deptcode), 'description' => trim($description), 'startdate' => $start_date != '' ? $start_date : NULL, 'country' => trim($country), 'state' => trim($state), 'city' => trim($city), 'address1' => trim($address1), 'address2' => trim($address2), 'address3' => trim($address3), 'timezone' => trim($timezone), 'unitid' => $unitid, 'depthead' => trim($depthead), 'modifiedby' => $loginUserId, 'modifieddate' => $date->get('yyyy-MM-dd HH:mm:ss')); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = $date->get('yyyy-MM-dd HH:mm:ss'); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $deptModel->SaveorUpdateDepartmentsUnits($data, $where); if ($Id == 'update') { $this->view->eventact = 'updated'; $tableid = $id; } else { $this->view->eventact = 'added'; $tableid = $Id; } $menuID = DEPARTMENTS; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $close = 'close'; $this->view->popup = $close; $this->view->controllername = $controllername; } else { $msgarray['message'] = 'A Department, with the given code, already exists.'; $msgarray['msgtype'] = 'error'; $this->view->messages = $msgarray; } } else { $messages = $deptform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } if (empty($allCountriesData)) { $msgarray['country'] = 'Countries are not configured yet.'; } if (empty($allStatesData)) { $msgarray['state'] = 'States are not configured yet.'; } if (empty($allCitiesData)) { $msgarray['city'] = 'Cities are not configured yet.'; } if (empty($allTimezoneData)) { $msgarray['timezone'] = 'Time zones are not configured yet.'; } } $this->view->msgarray = $msgarray; } } } else { $orgdata = 'noorgdata'; $this->view->orgdata = $orgdata; } }
public function getdepartmentsAction() { $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('getdepartments', 'html')->initContext(); $businessunitsmodel = new Default_Model_Businessunits(); $bunitid = $this->_request->getParam('bunitid'); $deptid = $this->_request->getParam('deptid'); $implementationData = array(); if ($bunitid != '') { $implementationData = $businessunitsmodel->getSingleUnitData($bunitid); } $this->_helper->_json($implementationData); }
/** * * Show analytics of employees reporting to manager */ public function employeereportAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == MANAGEMENT_GROUP || $loginuserRole == SUPERADMINROLE) { $norec_arr = array(); $form = new Default_Form_Employeereport(); $requi_model = new Default_Model_Requisition(); $employmentstatusModel = new Default_Model_Employmentstatus(); $role_model = new Default_Model_Roles(); $departmentsmodel = new Default_Model_Departments(); $bu_model = new Default_Model_Businessunits(); $roles_arr = $role_model->getRolesList_EMP(); $job_data = $requi_model->getJobTitleList(); $employmentStatusData = $employmentstatusModel->getempstatuslist(); if (count($job_data) == 0) { $norec_arr['jobtitle_id'] = "Job titles are not configured yet."; $norec_arr['position_id'] = "Positions are not configured yet."; } if (count($employmentStatusData) == 0) { $norec_arr['emp_status_id'] = "Employment status is not configured yet."; } $form->jobtitle_id->addMultiOptions(array('' => 'Select Job Title') + $job_data); if (count($employmentStatusData) > 0) { $form->emp_status_id->addMultiOption('', 'Select Employment Status'); foreach ($employmentStatusData as $employmentStatusres) { $form->emp_status_id->addMultiOption($employmentStatusres['workcodename'], $employmentStatusres['statusname']); } } if (sizeof($roles_arr) > 0) { $form->emprole->addMultiOptions(array('' => 'Select Role') + $roles_arr); } else { $norec_arr['emprole'] = 'Roles are not added yet.'; } $bu_arr = $bu_model->getBU_report(); if (!empty($bu_arr)) { foreach ($bu_arr as $bu) { $form->businessunit_id->addMultiOption($bu['id'], utf8_encode($bu['bu_name'])); } } else { $norec_arr['businessunit_id'] = 'Business Units are not added yet.'; } // Show count of employees reporting to manager // Get employees data reporting to manager $myEmployees_model = new Default_Model_Myemployees(); $employee_model = new Default_Model_Employee(); //$this->_helper->layout->setLayout("analyticslayout"); $this->view->count_emp_reporting = $employee_model->getCountEmpReporting($myEmployees_model->getLoginUserId()); $this->view->form = $form; $this->view->messages = $norec_arr; $this->view->ermsg = ''; } else { $this->render('error/error.phtml'); } }
/** * This function acts as a service to get business units list. * @param array $params_arr = array of parameters * @return array Array of business units. */ public function bunitslist($params_arr) { $result = array(); $status = 0; $message = "No data found."; $page_cnt = 1; if (isset($params_arr['role_id']) && $params_arr['role_id'] != '' && isset($params_arr['group_id']) && $params_arr['group_id'] != '') { $role_id = $params_arr['role_id']; $group_id = $params_arr['group_id']; $page_no = 1; $per_page = PERPAGE; if (isset($params_arr['page_no']) && $params_arr['page_no'] != '') { $page_no = $params_arr['page_no']; } if (isset($params_arr['per_page']) && $params_arr['per_page'] != '') { $per_page = $params_arr['per_page']; } $privilege_flag = sapp_Global::_check_menu_access(BUSINESSUNITS, $group_id, $role_id); if ($privilege_flag == 'Yes') { $bunit_model = new Default_Model_Businessunits(); $total_data = $bunit_model->getunitlist_service($page_no, $per_page); $bunit_data = $total_data['rows']; if (!empty($bunit_data) && count($bunit_data) > 0) { $message = "success"; $status = 1; $page_cnt = $total_data['page_cnt']; foreach ($bunit_data as $bdata) { $add_arr = array(); if ($bdata['address1'] != '') { $add_arr[] = $bdata['address1']; } if ($bdata['city'] != '') { $add_arr[] = $bdata['city']; } if ($bdata['state'] != '') { $add_arr[] = $bdata['state']; } if ($bdata['country'] != '') { $add_arr[] = $bdata['country']; } $address = ''; if (count($add_arr) > 0) { $address = implode(",", $add_arr); } $result[] = array('id' => $bdata['id'], 'unitname' => $bdata['unitname'], 'unitcode' => $bdata['unitcode'], 'address' => $address); } //echo "<pre>";print_r($result);echo "</pre>"; } } } return array('status' => $status, 'message' => $message, 'page_cnt' => $page_cnt, 'result' => $result); }