public function indexAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $addpermission = 'No'; $editpermission = 'No'; $structureModel = new Default_Model_Structure(); $orgData = $structureModel->getOrgData(); $heirarchyModel = new Default_Model_Heirarchy(); $levelsdata = $heirarchyModel->getlevelsusernames(); $baseUrl = $this->getBaseurl(); $emps = $heirarchyModel->getAllEmployees(); $vEmps = $heirarchyModel->getVAllEmployees(); $output = ''; $empData = array(); if (count($emps) > 0) { foreach ($emps as $empRecord) { $empData[] = array('id' => $empRecord['id'], 'name' => ucwords($empRecord['name']), 'profileimg' => $empRecord['profileimg']); } } $editpermission = sapp_Global::_checkprivileges(HEIRARCHY, $loginuserGroup, $loginuserRole, 'edit'); $addpermission = sapp_Global::_checkprivileges(HEIRARCHY, $loginuserGroup, $loginuserRole, 'add'); $dataArr = array(); $tmplevelsdata = $levelsdata; $parentArr = array(); for ($i = 0; $i < sizeof($levelsdata); $i++) { $parentArr[] = $levelsdata[$i]['parent']; } $parentArr = array_unique($parentArr); $parr = array(); foreach ($parentArr as $parent) { foreach ($tmplevelsdata as $data) { if ($data['parent'] == $parent) { $parr[$parent][] = array('userid' => $data['userid'], 'userfullname' => $data['userfullname'], 'profileimg' => $data['profileimg'], 'level_number' => $data['level_number'], 'parent' => $data['parent'], 'jobtitlename' => $data['jobtitlename']); } } } if (!empty($parr)) { $output = "<ul id='org' style='display:none;'>"; $output .= "<li>\r\n\t\t\t\t\t\t<i></i>\t\r\n\t\t\t\t\t\t<p class='tags-ctrl'>\t\t\t\t\t\t \r\n\t\t\t\t\t\t <img class='main-img' border='0' src='" . $baseUrl . "/public/uploads/profile/" . $parr[key($parr)][0]['profileimg'] . "' onerror='this.src=\"" . $baseUrl . "/public/media/images/hierarchy-deafult-pic.jpg\"' />\r\n\t\t\t\t\t\t <span class='main-name' title='" . ucwords($parr[key($parr)][0]['userfullname']) . "' id='" . $parr[key($parr)][0]['userid'] . "'>" . $parr[key($parr)][0]['userfullname'] . "</span>\r\n\t\t\t\t\t\t <span class='main-name' title='" . ucwords($parr[key($parr)][0]['jobtitlename']) . "'>" . $parr[key($parr)][0]['jobtitlename'] . "</span>\r\n\t\t\t\t\t\t </p>"; $output .= $this->hasChildNoEdit($parr[key($parr)][0]['userid'], $parr); $output .= " </li></ul>"; } $this->view->output = $output; $this->view->allEmpdata = $vEmps; $this->view->empData = $empData; $this->view->orgData = $orgData; $this->view->editpermission = $editpermission; $this->view->addpermission = $addpermission; }
public function welcomeAction() { $auth = Zend_Auth::getInstance(); $businessunit_id = ''; $department_id = ''; $announcementPrivilege = ''; $isOrganizationHead = ''; $loginuserGroup = ''; $loginuserRole = ''; if ($auth->hasIdentity()) { $businessunit_id = $auth->getStorage()->read()->businessunit_id; $department_id = $auth->getStorage()->read()->department_id; $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; $isOrganizationHead = $auth->getStorage()->read()->is_orghead; } $this->view->loginuserGroup = $loginuserGroup; $this->view->loginuserRole = $loginuserRole; $widgetsModel = new Default_Model_Widgets(); // Birthdays & Announcements $birthdaysRes = $widgetsModel->getTodaysBirthdays($businessunit_id, $department_id, $isOrganizationHead); $upcomingBirthdyas = $widgetsModel->getUpcomingBirthdays($businessunit_id, $department_id, $isOrganizationHead); $this->view->todyasBirthdays = $birthdaysRes; $this->view->upcomingBirthdyas = $upcomingBirthdyas; // Announcements - START if (sapp_Global::_checkprivileges(ANNOUNCEMENTS, $loginuserGroup, $loginuserRole, 'view') == 'Yes') { $announcementPrivilege = 'true'; $announcementsModel = new Default_Model_Announcements(); $announcementsData = $announcementsModel->getAllByBusiAndDeptId(); } $this->view->announcementsData = !empty($announcementsData) ? $announcementsData : array(); $this->view->announcementPrivilege = $announcementPrivilege; // Announcements - END //Widgets formats //Interview Schedules = 'format1'; //My Service Request = 'format2'; //Request Pending Approval = 'format3'; //Leaves Available = 'format4'; //My Leaves This Month = 'format5'; //Leave Management Options = 'format6'; //My details = 'format7'; $menuIdsArr = array(57 => 'format1', 10 => 'format5', 11 => 'format5', 20 => 'format5', 21 => 'format5', 14 => 'format4', 23 => 'format2', 32 => 'format7', 34 => 'format4', 35 => 'format5', 41 => 'format5', 42 => 'format5', 45 => 'format3', 54 => 'format4', 55 => 'format5', 56 => 'format4', 61 => 'format3', 65 => 'format3', 44 => 'format6', 43 => 'format5', 80 => 'format5', 86 => 'format5', 87 => 'format5', 88 => 'format5', 89 => 'format5', 90 => 'format5', 91 => 'format5', 92 => 'format5', 93 => 'format5', 100 => 'format5', 101 => 'format5', 102 => 'format5', 103 => 'format5', 107 => 'format5', 108 => 'format5', 110 => 'format5', 111 => 'format5', 114 => 'format5', 115 => 'format5', 116 => 'format5', 117 => 'format5', 118 => 'format5', 120 => 'format5', 121 => 'format5', 123 => 'format5', 124 => 'format5', 125 => 'format5', 126 => 'format5', 127 => 'format5', 128 => 'format5', 132 => 'format5', 136 => 'format5', 140 => 'format5', 143 => 'format3', 144 => 'format5', 145 => 'format5', 146 => 'format5', 148 => 'format3', 150 => 'format5', 151 => 'format5', 152 => 'format5', 154 => 'format4', 155 => 'format5', 165 => 'format5', 166 => 'format5', 62 => 'format3', 63 => 'format3', 64 => 'format3', 68 => 'format3', 69 => 'format3', 85 => 'format3', 131 => 'format5', 134 => 'format3', 135 => 'format3', 138 => 'format3', 139 => 'format3', 140 => 'format5', 142 => 'format5', 151 => 'format5', 154 => 'format6', 158 => 'format5', 159 => 'format5', 160 => '', 161 => 'format3', 165 => 'format5', 166 => 'format5', 167 => 'format6', 168 => '', 174 => 'format5', 169 => 'format3', 170 => 'format3', 172 => 'format5', 174 => 'format5', 182 => 'format5'); $getMenuIds = $widgetsModel->getWidgets($loginUserId, $loginuserRole); $htmlcontent = ''; $tmpHtml1 = ""; $tmpHtml5 = ""; $tmpHtml2 = ""; $tmpHtml3 = ""; $tmpHtml4 = ""; $format = ''; if (!empty($getMenuIds)) { //$i,j for css color changing for widgets $i = 1; $j = 1; foreach ($getMenuIds as $getMenuIdArr) { $i = $i >= 5 ? $i - 4 : $i; // I for format 2,3,4 $j = $i >= 5 ? $j - 4 : $j; // J for format 5 //echo "<pre>";print_r($menuIdsArr); $menuId = $getMenuIdArr['id']; $url = $getMenuIdArr['url']; $format = isset($menuIdsArr[$menuId]) ? $menuIdsArr[$menuId] : ''; if ($menuId == 57) { $tmpHtml1 = sapp_Global::format1($url); } else { if ($format == 'format2') { $tmpHtml2 .= sapp_Global::format2($menuId, $i, $url); $i++; } else { if ($format == 'format3') { $tmpHtml2 .= sapp_Global::format3($menuId, $i, $url); $i++; } else { if ($format == 'format4') { $tmpHtml2 .= sapp_Global::format4($menuId, $i, $url); $i++; } else { if ($format == 'format5') { $tmpHtml5 .= sapp_Global::format5($menuId, $j, $url); $j++; } else { if ($format == 'format6') { $tmpHtml5 .= sapp_Global::format6($menuId, $url); $j++; } else { if ($format != '') { $htmlcontent .= sapp_Global::format7($menuId, $url); } else { if ($format == '') { $htmlcontent = ''; } } } } } } } } } //$htmlcontent = '<div class="left_dashboard">'.$tmpHtml1.$tmpHtml2.$tmpHtml4.$tmpHtml3.$tmpHtml5.$htmlcontent.'</div>'; $htmlcontent = '<div class="left_dashboard">' . $tmpHtml1 . $tmpHtml2 . '<div class="clear"></div>' . $tmpHtml5 . $htmlcontent . '</div>'; } $this->view->htmlcontent = $htmlcontent; }
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'); } }
public function viewAction() { $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(); } $objName = 'leavemanagement'; $leavemanagementform = new Default_Form_leavemanagement(); $leavemanagementform->removeElement("submit"); $elements = $leavemanagementform->getElements(); if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") { $element->setAttrib("disabled", "disabled"); } } } $permission = sapp_Global::_checkprivileges(LEAVEMANAGEMENT, $loginuserGroup, $loginuserRole, 'edit'); $this->view->editpermission = $permission; 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(); $departmentsmodel = new Default_Model_Departments(); $busineesUnitModel = new Default_Model_Businessunits(); $businessunitData = $busineesUnitModel->getParicularBusinessUnit($data['businessunit_id']); $particulardeptidArr = $departmentsmodel->getParicularDepartmentId($data['department_id']); $monthslistdata = $monthslistmodel->getMonthlistData(); $weekdaysdata = $weekdaysmodel->getWeeklistData(); if (!empty($businessunitData) && !empty($particulardeptidArr) && !empty($monthslistdata) && !empty($weekdaysdata)) { if (!empty($businessunitData)) { $leavemanagementform->businessunit->addMultiOption($businessunitData[0]['id'], utf8_encode($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']); $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"; } $this->view->controllername = $objName; $this->view->id = $id; $this->view->form = $leavemanagementform; }
public function editAction() { if (defined('EMPTABCONFIGS')) { $popConfigPermission = array(); $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('empcommunicationdetails', $empOrganizationTabs)) { $empDeptdata = array(); $employeeData = array(); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } if (sapp_Global::_checkprivileges(COUNTRIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'country'); } if (sapp_Global::_checkprivileges(STATES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'state'); } if (sapp_Global::_checkprivileges(CITIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'city'); } $id = $this->getRequest()->getParam('userid'); if ($id == '') { $id = $loginUserId; } $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } try { if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) { $employeeModal = new Default_Model_Employee(); $empdata = $employeeModal->getsingleEmployeeData($id); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $empDept = $empdata[0]['department_id']; $empcommdetailsform = new Default_Form_empcommunicationdetails(); $empcommdetailsModal = new Default_Model_Empcommunicationdetails(); $usersModel = new Default_Model_Users(); $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $orgInfoModel = new Default_Model_Organisationinfo(); $msgarray = array(); $orgid = 1; $countryId = ''; $stateId = ''; $cityId = ''; $deptModel = new Default_Model_Departments(); if ($empDept != '' && $empDept != 'NULL') { $empDeptdata = $deptModel->getEmpdepartmentdetails($empDept); if (!empty($empDeptdata)) { $countryId = $empDeptdata[0]['country']; $stateId = $empDeptdata[0]['state']; $cityId = $empDeptdata[0]['city']; } } else { $empDeptdata = $orgInfoModel->getOrganisationDetails($orgid); if (!empty($empDeptdata)) { $countryId = $empDeptdata[0]['country']; $stateId = $empDeptdata[0]['state']; $cityId = $empDeptdata[0]['city']; } } if ($countryId != '') { $countryData = $countriesModel->getActiveCountryName($countryId); } if (!empty($countryData)) { $empDeptdata[0]['country'] = $countryData[0]['country']; } else { $empDeptdata[0]['country'] = ''; } if ($stateId != '') { $stateData = $statesmodel->getStateNameData($stateId); } if (!empty($stateData)) { $empDeptdata[0]['state'] = $stateData[0]['state']; } else { $empDeptdata[0]['state'] = ''; } if ($cityId != '') { $citiesData = $citiesmodel->getCitiesNameData($cityId); } if (!empty($citiesData)) { $empDeptdata[0]['city'] = $citiesData[0]['city']; } else { $empDeptdata[0]['city'] = ''; } $countrieslistArr = $countriesModel->getTotalCountriesList(); if (sizeof($countrieslistArr) > 0) { $empcommdetailsform->perm_country->addMultiOption('', 'Select Country'); $empcommdetailsform->current_country->addMultiOption('', 'Select Country'); foreach ($countrieslistArr as $countrieslistres) { $empcommdetailsform->perm_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); $empcommdetailsform->current_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); } } else { $msgarray['perm_country'] = 'Countries are not configured yet.'; $msgarray['current_country'] = 'Countries are not configured yet.'; } $data = $empcommdetailsModal->getsingleEmpCommDetailsData($id); if (!empty($data)) { $perm_country = $data[0]['perm_country']; if (isset($_POST['perm_country'])) { $perm_country = $_POST['perm_country']; } $perm_state = $data[0]['perm_state']; if (isset($_POST['perm_state'])) { $perm_state = $_POST['perm_state']; } $perm_city = $data[0]['perm_city']; if (isset($_POST['perm_city'])) { $perm_city = $_POST['perm_city']; } if ($perm_country != '') { $statePermlistArr = $statesmodel->getStatesList($perm_country); if (sizeof($statePermlistArr) > 0) { $empcommdetailsform->perm_state->addMultiOption('', 'Select State'); foreach ($statePermlistArr as $statelistres) { $empcommdetailsform->perm_state->addMultiOption($statelistres['id'], $statelistres['state_name']); } } } if ($perm_state != '') { $cityPermlistArr = $citiesmodel->getCitiesList($perm_state); if (sizeof($cityPermlistArr) > 0) { $empcommdetailsform->perm_city->addMultiOption('', 'Select City'); foreach ($cityPermlistArr as $cityPermlistres) { $empcommdetailsform->perm_city->addMultiOption($cityPermlistres['id'], $cityPermlistres['city_name']); } } } $current_country = $data[0]['current_country']; if (isset($_POST['current_country'])) { $current_country = $_POST['current_country']; } $current_state = $data[0]['current_state']; if (isset($_POST['current_state'])) { $current_state = $_POST['current_state']; } $current_city = $data[0]['current_city']; if (isset($_POST['current_city'])) { $current_city = $_POST['current_city']; } if ($current_country != '') { $statecurrlistArr = $statesmodel->getStatesList($current_country); if (sizeof($statecurrlistArr) > 0) { $empcommdetailsform->current_state->addMultiOption('', 'Select State'); foreach ($statecurrlistArr as $statecurrlistres) { $empcommdetailsform->current_state->addMultiOption($statecurrlistres['id'], $statecurrlistres['state_name']); } } } if ($current_state != '') { $cityCurrlistArr = $citiesmodel->getCitiesList($current_state); if (sizeof($cityCurrlistArr) > 0) { $empcommdetailsform->current_city->addMultiOption('', 'Select City'); foreach ($cityCurrlistArr as $cityCurrlistres) { $empcommdetailsform->current_city->addMultiOption($cityCurrlistres['id'], $cityCurrlistres['city_name']); } } } $empcommdetailsform->populate($data[0]); $empcommdetailsform->setDefault('perm_country', $perm_country); $empcommdetailsform->setDefault('perm_state', $perm_state); $empcommdetailsform->setDefault('perm_city', $perm_city); if ($data[0]['current_country'] != '') { $empcommdetailsform->setDefault('current_country', $current_country); } if ($data[0]['current_state'] != '') { $empcommdetailsform->setDefault('current_state', $current_state); } if ($data[0]['current_city'] != '') { $empcommdetailsform->setDefault('current_city', $current_city); } } $empcommdetailsform->setAttrib('action', DOMAIN . 'empcommunicationdetails/edit/userid/' . $id); $empcommdetailsform->user_id->setValue($id); if (!empty($empdata)) { $this->view->employeedata = $empdata[0]; } else { $this->view->employeedata = $empdata; } if (!empty($empDeptdata)) { $this->view->dataArray = $empDeptdata[0]; } else { $this->view->dataArray = $empDeptdata; } $this->view->form = $empcommdetailsform; $this->view->data = $data; $this->view->id = $id; $this->view->msgarray = $msgarray; $this->view->popConfigPermission = $popConfigPermission; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } $this->view->empdata = $empdata; } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($empcommdetailsform, $id); $this->view->msgarray = $result; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
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(); } $feedforwardquestionsform = new Default_Form_Feedforwardquestions(); $feedforwardquestionsmodel = new Default_Model_Feedforwardquestions(); $msgarray = array(); $popConfigPermission = array(); if (sapp_Global::_checkprivileges(FEEDFORWARDQUESTIONS, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'feedforwardquestions'); } $feedforwardquestionsform->submit->setLabel('Update'); try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $feedforwardquestionsmodel->getFeedforwardQuestionbyID($id); if (!empty($data)) { $data = $data[0]; if ($data['isused'] != 1) { $feedforwardquestionsform->populate($data); $feedforwardquestionsform->setAttrib('action', BASE_URL . 'feedforwardquestions/edit/id/' . $id); $this->view->data = $data; } else { $this->view->ermsg = 'noedit'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = ''; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $feedforwardquestionsform; if ($this->getRequest()->getPost()) { $result = $this->save($feedforwardquestionsform); $this->view->msgarray = $result; } $this->render('form'); }
public function editAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('workeligibilitydetails', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginUserRole = $auth->getStorage()->read()->emprole; $loginUserGroup = $auth->getStorage()->read()->group_id; } $this->view->WorkeligibilitydoctypesPermission = sapp_Global::_checkprivileges(WORKELIGIBILITYDOCTYPES, $loginUserGroup, $loginUserRole, 'add'); $popConfigPermission = array(); if (sapp_Global::_checkprivileges(COUNTRIES, $loginUserGroup, $loginUserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'country'); } if (sapp_Global::_checkprivileges(STATES, $loginUserGroup, $loginUserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'state'); } if (sapp_Global::_checkprivileges(CITIES, $loginUserGroup, $loginUserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'city'); } $this->view->popConfigPermission = $popConfigPermission; $userid = $this->getRequest()->getParam('userid'); $employeeModal = new Default_Model_Employee(); $workeligibilityform = new Default_Form_Workeligibilitydetails(); $workeligibilityModel = new Default_Model_Workeligibilitydetails(); $msgarray = array(); $emptyFlag = 0; $issuingauthority = ''; //To check previliges for edit $myEmployees_model = new Default_Model_Myemployees(); $getMyTeamIds = $myEmployees_model->getTeamIds($loginUserId); $teamIdArr = array(); if (!empty($getMyTeamIds)) { foreach ($getMyTeamIds as $teamId) { array_push($teamIdArr, $teamId['user_id']); } } if ($loginUserRole == SUPERADMINROLE || $loginUserGroup == MANAGEMENT_GROUP || $loginUserGroup == HR_GROUP || $loginUserGroup == MANAGER_GROUP && in_array($userid, $teamIdArr)) { try { if ($userid && is_numeric($userid) && $userid > 0 && $userid != $loginUserId) { $usersModel = new Default_Model_Users(); $empdata = $employeeModal->getActiveEmployeeData($userid); $employeeData = $usersModel->getUserDetailsByIDandFlag($userid); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $workeligibilityDoctypesModal = new Default_Model_Workeligibilitydoctypes(); $workeligibilityDoctypesData = $workeligibilityDoctypesModal->fetchAll('isactive=1', 'documenttype'); $workeligibilityDoctypesDataArr = $workeligibilityDoctypesData->toArray(); if (!empty($workeligibilityDoctypesDataArr)) { foreach ($workeligibilityDoctypesDataArr as $data) { $workeligibilityform->documenttype_id->addMultiOption($data['id'], $data['documenttype']); } } else { $msgarray['documenttype_id'] = 'Work eligibility document types are not configured yet.'; $emptyFlag++; } $countrieslistArr = $countriesModel->getTotalCountriesList(); if (!empty($countrieslistArr)) { $workeligibilityform->issuingauth_country->addMultiOption('', 'Select Country'); foreach ($countrieslistArr as $countrieslistres) { $workeligibilityform->issuingauth_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); } } else { $msgarray['issuingauth_country'] = 'Countries are not configured yet.'; } $data = $workeligibilityModel->getWorkEligibilityRecord($userid); //echo "<pre>Work eligibility Data ";print_r($data);echo "</pre>"; die; if (!empty($data) && isset($data)) { $countryId = $data[0]['issuingauth_country']; $stateId = $data[0]['issuingauth_state']; $cityId = $data[0]['issuingauth_city']; $documenttype_id = $data[0]['documenttype_id']; if ($countryId != '') { $statelistArr = $statesmodel->getStatesList($countryId); if (!empty($statelistArr)) { $workeligibilityform->issuingauth_state->addMultiOption('', 'Select State'); foreach ($statelistArr as $statelistres) { $workeligibilityform->issuingauth_state->addMultiOption($statelistres['id'] . '!@#' . $statelistres['state_name'], $statelistres['state_name']); } } } if ($stateId != '') { $citylistArr = $citiesmodel->getCitiesList($stateId); if (!empty($citylistArr)) { $workeligibilityform->issuingauth_city->addMultiOption('', 'Select City'); foreach ($citylistArr as $cityPermlistres) { $workeligibilityform->issuingauth_city->addMultiOption($cityPermlistres['id'] . '!@#' . $cityPermlistres['city_name'], $cityPermlistres['city_name']); } } $stateNameArr = $statesmodel->getStateName($stateId); } if ($cityId != '') { $cityNameArr = $citiesmodel->getCityName($cityId); } if ($documenttype_id != '') { $issuingauthorityArr = $workeligibilityDoctypesModal->getIssuingAuthority($documenttype_id); } if (!empty($issuingauthorityArr)) { $issuingauthority = $issuingauthorityArr[0]['issuingauthority']; $workeligibilityform->issuingauthflag->setValue($issuingauthority); } $workeligibilityform->setDefault("id", $data[0]["id"]); $workeligibilityform->setDefault("user_id", $data[0]["user_id"]); $workeligibilityform->setDefault('issuingauth_country', $data[0]['issuingauth_country']); if (!empty($stateNameArr)) { $workeligibilityform->setDefault('issuingauth_state', $stateNameArr[0]['id'] . '!@#' . $stateNameArr[0]['statename']); } if (!empty($cityNameArr)) { $workeligibilityform->setDefault('issuingauth_city', $cityNameArr[0]['id'] . '!@#' . $cityNameArr[0]['cityname']); } $workeligibilityform->setDefault("documenttype_id", $data[0]["documenttype_id"]); $workeligibilityform->setDefault("issuingauth_name", $data[0]["issuingauth_name"]); $workeligibilityform->setDefault("issuingauth_postalcode", $data[0]["issuingauth_postalcode"]); $issue_date = date(DATEFORMAT_PHP, strtotime($data[0]["doc_issue_date"])); $workeligibilityform->setDefault('doc_issue_date', $issue_date); $expiry_date = date(DATEFORMAT_PHP, strtotime($data[0]["doc_expiry_date"])); $workeligibilityform->setDefault('doc_expiry_date', $expiry_date); } $workeligibilityform->setAttrib('action', BASE_URL . 'workeligibilitydetails/edit/userid/' . $userid); $workeligibilityform->setDefault("user_id", $userid); $this->view->id = $userid; } $this->view->employeedata = $employeeData[0]; $this->view->form = $workeligibilityform; $this->view->empdata = $empdata; $this->view->msgarray = $msgarray; $this->view->emptyFlag = $emptyFlag; $this->view->issuingauthority = $issuingauthority; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($workeligibilityform); $result['issuingauthorityflag'] = $_POST['issuingauthflag']; $this->view->msgarray = $result; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
public function editAction() { $emptyFlag = 0; $msgarray = array(); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = sapp_Global::_checkprivileges(JOBTITLES, $loginuserGroup, $loginuserRole, 'add'); $this->view->popConfigPermission = $popConfigPermission; $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $positionsform = new Default_Form_positions(); $positionsform->submit->setLabel('Update'); $positionsmodel = new Default_Model_Positions(); $objName = 'positions'; try { if ($id) { $deptModel = new Default_Model_Departments(); $data = $positionsmodel->getsinglePositionData($id); $jobtitleidmodel = new Default_Model_Jobtitles(); $jobtitleidmodeldata = $jobtitleidmodel->getJobTitleList(); if (!empty($jobtitleidmodeldata)) { foreach ($jobtitleidmodeldata as $jobtitleidres) { $positionsform->jobtitleid->addMultiOption($jobtitleidres['id'], utf8_encode($jobtitleidres['jobtitlename'])); } } else { $msgarray['jobtitleid'] = 'Job titles are not configured yet.'; $emptyFlag++; } if (!empty($data) && $data != 'norows') { $positionsform->populate($data[0]); $this->view->form = $positionsform; $this->view->controllername = $objName; $this->view->id = $id; $this->view->ermsg = ''; $positionsform->setAttrib('action', BASE_URL . 'positions/edit'); } else { $this->view->ermsg = 'norecord'; } $this->view->emptyFlag = $emptyFlag; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } if ($this->getRequest()->getPost()) { $result = $this->save($positionsform); $this->view->msgarray = $result; } }
/** * This action is used to create new group by manager.It will serve as ajax call. */ public function createnewgroupAction() { $appraisal_id = $this->_getParam('appraisal_id', null); $manager_id = $this->_getParam('manager_id', null); $flag = $this->_getParam('flag', null); $group_id = $this->_getParam('group_id', null); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } try { if ($appraisal_id != '' && $manager_id != '') { $appraisal_id = sapp_Global::_decrypt($appraisal_id); $manager_id = sapp_Global::_decrypt($manager_id); if ($flag == 'edit') { $group_id = sapp_Global::_decrypt($group_id); } $app_manager_model = new Default_Model_Appraisalmanager(); $appraisal_init_model = new Default_Model_Appraisalinit(); $appraisal_qs_model = new Default_Model_Appraisalquestions(); $check_array = array(); $tablename = 'main_pa_questions_privileges'; $manager_emp = $app_manager_model->getmanager_emp($appraisal_id, $manager_id, ''); if (empty($manager_emp) && $flag == 'add') { $this->view->ermsg = 'No employees to add.'; } $appraisaldata = $appraisal_init_model->getConfigData($appraisal_id); $appraisaldata = $appraisaldata[0]; $questionPrivileges = $appraisal_qs_model->gethrquestionprivileges($appraisal_id, $tablename, ''); $questionsArr = $appraisal_qs_model->getQuestionsByCategory($appraisaldata['category_id'], ''); if (!empty($questionPrivileges)) { if (isset($questionPrivileges['manager_qs']) && isset($questionPrivileges['manager_qs_privileges'])) { if ($questionPrivileges['manager_qs'] != '' && $questionPrivileges['manager_qs_privileges'] != '') { $hr_qs_Arr = explode(',', $questionPrivileges['manager_qs']); $hr_qs_privileges = json_decode($questionPrivileges['manager_qs_privileges'], true); foreach ($hr_qs_privileges as $key => $val) { //$val = explode(',',substr($val, 1, -1)); $check_array[$key] = $val; } } } } if (sapp_Global::_checkprivileges(APPRAISALQUESTIONS, $loginuserGroup, $loginuserRole, 'edit') == 'Yes') { $appraisaldata['poppermission'] = 'yes'; } $appraisaldata['poppermission'] = 'yes'; $manager_emp_selected = array(); $group_name = ""; if ($flag == 'edit') { $app_group_model = new Default_Model_Appraisalgroups(); $group_details = $app_group_model->getAppraisalGroupsDatabyID($group_id); if (!empty($group_details)) { $group_details = $group_details[0]; $group_name = $group_details['group_name']; $manager_emp_selected = $app_manager_model->getmanager_emp($appraisal_id, $manager_id, $group_id); $manager_qs_privileges = json_decode($manager_emp_selected[0]['manager_qs_privileges'], true); foreach ($manager_qs_privileges as $key => $val) { $check_array[$key] = $val; } } else { $this->view->ermsg = 'No data found.'; } } $view = $this->view; $view->appraisal_id = $appraisal_id; $view->manager_id = $manager_id; $view->manager_emp = $manager_emp; $view->questionsArr = $questionsArr; $view->checkArr = $check_array; $view->appraisaldata = $appraisaldata; $view->checkArr = $check_array; $view->flag = $flag; $view->group_name = $group_name; $view->group_id = $group_id; $view->selected_emp = $manager_emp_selected; } else { $this->view->ermsg = 'No data found.'; } } catch (Exception $ex) { $this->view->ermsg = 'No data found.'; } }
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; } $popConfigPermission = sapp_Global::_checkprivileges(PAYFREQUENCY, $loginuserGroup, $loginuserRole, 'add'); $this->view->popConfigPermission = $popConfigPermission; $objName = 'jobtitles'; $emptyFlag = 0; $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $jobtitlesform = new Default_Form_jobtitles(); $jobtitlesmodel = new Default_Model_Jobtitles(); $payfrequencyModal = new Default_Model_Payfrequency(); $payfreqData = $payfrequencyModal->getActivePayFreqData(); $msgarray = array(); if (sizeof($payfreqData) > 0) { foreach ($payfreqData as $payfreqres) { $jobtitlesform->jobpayfrequency->addMultiOption($payfreqres['id'], $payfreqres['freqtype']); } } else { $msgarray['jobpayfrequency'] = 'Pay frequency is not configured yet.'; $emptyFlag++; } $this->view->msgarray = $msgarray; $this->view->emptyFlag = $emptyFlag; try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $jobtitlesmodel->getsingleJobTitleData($id); if (!empty($data) && $data != "norows") { $jobtitlesform->populate($data[0]); $jobtitlesform->submit->setLabel('Update'); $this->view->form = $jobtitlesform; $this->view->ermsg = ''; $this->view->controllername = $objName; $this->view->id = $id; } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->form = $jobtitlesform; $this->view->ermsg = ''; } } catch (Exception $ex) { $this->view->ermsg = 'nodata'; } if ($this->getRequest()->getPost()) { if ($jobtitlesform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $jobtitlecode = $this->_request->getParam('jobtitlecode'); $jobtitlename = $this->_request->getParam('jobtitlename'); $jobdescription = $this->_request->getParam('jobdescription'); $minexperiencerequired = $this->_request->getParam('minexperiencerequired'); $jobpaygradecode = $this->_request->getParam('jobpaygradecode'); $jobpayfrequency = $this->_request->getParam('jobpayfrequency'); $comments = $this->_request->getParam('comments'); $date = new Zend_Date(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('jobtitlecode' => trim($jobtitlecode), 'jobtitlename' => trim($jobtitlename), 'jobdescription' => trim($jobdescription), 'minexperiencerequired' => trim($minexperiencerequired), 'jobpaygradecode' => trim($jobpaygradecode), 'jobpayfrequency' => trim($jobpayfrequency), 'comments' => trim($comments), '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 = $jobtitlesmodel->SaveorUpdateJobTitleData($data, $where); if ($Id == 'update') { $tableid = $id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Job title updated successfully.")); } else { $tableid = $Id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Job title added successfully.")); } $menuidArr = $menumodel->getMenuObjID('/jobtitles'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $this->_redirect('jobtitles'); } else { $messages = $jobtitlesform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } if (sizeof($payfreqData) < 1) { $msgarray['jobpayfrequency'] = 'Pay frequency not configured yet.'; } $this->view->msgarray = $msgarray; } } }
public function editAction() { $genderaddpermission = ''; $msaddpermission = ''; $ethnicaddpermission = ''; $racecodepermission = ''; $languagepermission = ''; $nationalityaddpermission = ''; $identityDocumentArr = array(); $documentsArr = array(); if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emppersonaldetails', $empOrganizationTabs)) { $loginUserId = ''; $loginUserGroup = ''; $loginUserRole = ''; $auth = Zend_Auth::getInstance(); $emptyFlag = 0; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginUserGroup = $auth->getStorage()->read()->group_id; $loginUserRole = $auth->getStorage()->read()->emprole; } $genderaddpermission = sapp_Global::_checkprivileges(GENDER, $loginUserGroup, $loginUserRole, 'add'); $msaddpermission = sapp_Global::_checkprivileges(MARITALSTATUS, $loginUserGroup, $loginUserRole, 'add'); $ethnicaddpermission = sapp_Global::_checkprivileges(ETHNICCODE, $loginUserGroup, $loginUserRole, 'add'); $racecodepermission = sapp_Global::_checkprivileges(RACECODE, $loginUserGroup, $loginUserRole, 'add'); $languagepermission = sapp_Global::_checkprivileges(LANGUAGE, $loginUserGroup, $loginUserRole, 'add'); $nationalityaddpermission = sapp_Global::_checkprivileges(NATIONALITY, $loginUserGroup, $loginUserRole, 'add'); $id = $this->getRequest()->getParam('userid'); if ($id == '') { $id = $loginUserId; } $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } try { if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) { $employeeModal = new Default_Model_Employee(); $empdata = $employeeModal->getsingleEmployeeData($id); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $empperdetailsModal = new Default_Model_Emppersonaldetails(); $usersModel = new Default_Model_Users(); $empprobationreviewform = new Default_Form_empprobationreview(); $emppersonaldetailsform = new Default_Form_emppersonaldetails(); if ($loginUserGroup == MANAGEMENT_GROUP || $loginUserGroup == HR_GROUP || $loginUserRole == SUPERADMINROLE) { $identitydocumentsModel = new Default_Model_Identitydocuments(); $identityDocumentArr = $identitydocumentsModel->getIdentitydocumnetsrecord(); } $genderModel = new Default_Model_Gender(); $maritalstatusmodel = new Default_Model_Maritalstatus(); $nationalitymodel = new Default_Model_Nationality(); $ethniccodemodel = new Default_Model_Ethniccode(); $racecodemodel = new Default_Model_Racecode(); $languagemodel = new Default_Model_Language(); $msgarray = array(); $genderlistArr = $genderModel->getGenderList(); if (!empty($genderlistArr)) { foreach ($genderlistArr as $genderlistres) { $emppersonaldetailsform->genderid->addMultiOption($genderlistres['id'], $genderlistres['gendername']); } } else { $msgarray['genderid'] = 'Gender is not configured yet.'; $emptyFlag++; } $maritalstatuslistArr = $maritalstatusmodel->getMaritalStatusList(); if (!empty($maritalstatuslistArr)) { foreach ($maritalstatuslistArr as $maritalstatuslistres) { $emppersonaldetailsform->maritalstatusid->addMultiOption($maritalstatuslistres['id'], $maritalstatuslistres['maritalstatusname']); } } else { $msgarray['maritalstatusid'] = 'Marital status is not configured yet.'; $emptyFlag++; } $nationalitylistArr = $nationalitymodel->getNationalityList(); if (!empty($nationalitylistArr)) { foreach ($nationalitylistArr as $nationalitylistres) { $emppersonaldetailsform->nationalityid->addMultiOption($nationalitylistres['id'], $nationalitylistres['nationalitycode']); } } else { $msgarray['nationalityid'] = 'Nationality is not configured yet.'; $emptyFlag++; } $ethniccodeArr = $ethniccodemodel->gettotalEthnicCodeData(); if (!empty($ethniccodeArr)) { foreach ($ethniccodeArr as $ethniccoderes) { $emppersonaldetailsform->ethniccodeid->addMultiOption($ethniccoderes['id'], $ethniccoderes['ethnicname']); } } else { $msgarray['ethniccodeid'] = 'Ethnic codes are not configured yet.'; $emptyFlag++; } $racecodeArr = $racecodemodel->gettotalRaceCodeData(); if (!empty($racecodeArr)) { foreach ($racecodeArr as $racecoderes) { $emppersonaldetailsform->racecodeid->addMultiOption($racecoderes['id'], $racecoderes['racename']); } } else { $msgarray['racecodeid'] = 'Race codes are not configured yet.'; $emptyFlag++; } $languageArr = $languagemodel->gettotalLanguageData(); if (!empty($languageArr)) { foreach ($languageArr as $languageres) { $emppersonaldetailsform->languageid->addMultiOption($languageres['id'], $languageres['languagename']); } } else { $msgarray['languageid'] = 'Languages are not configured yet.'; $emptyFlag++; } if (!empty($identityDocumentArr)) { $this->view->identitydocument = $identityDocumentArr; } $data = $empperdetailsModal->getsingleEmpPerDetailsData($id); if (!empty($data)) { $emppersonaldetailsform->populate($data[0]); $dob = sapp_Global::change_date($data[0]["dob"], 'view'); $emppersonaldetailsform->dob->setValue($dob); if ($data[0]['celebrated_dob'] != '') { $celebrated_dob = sapp_Global::change_date($data[0]["celebrated_dob"], 'view'); $emppersonaldetailsform->celebrated_dob->setValue($celebrated_dob); } if ($data[0]['identity_documents'] != '') { $documentsArr = get_object_vars(json_decode($data[0]['identity_documents'])); } $emppersonaldetailsform->setDefault('genderid', $data[0]['genderid']); $emppersonaldetailsform->setDefault('maritalstatusid', $data[0]['maritalstatusid']); $emppersonaldetailsform->setDefault('nationalityid', $data[0]['nationalityid']); $emppersonaldetailsform->setDefault('ethniccodeid', $data[0]['ethniccodeid']); $emppersonaldetailsform->setDefault('racecodeid', $data[0]['racecodeid']); $emppersonaldetailsform->setDefault('languageid', $data[0]['languageid']); } $emppersonaldetailsform->user_id->setValue($id); $emppersonaldetailsform->setAttrib('action', DOMAIN . 'emppersonaldetails/edit/userid/' . $id); $this->view->form = $empprobationreviewform; $this->view->data = $data; $this->view->documentsArr = $documentsArr; $this->view->id = $id; $this->view->msgarray = $msgarray; $this->view->employeedata = $empdata[0]; $this->view->emptyFlag = $emptyFlag; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } $this->view->empdata = $empdata; } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($empprobationreviewform, $id, $identityDocumentArr); $this->view->msgarray = $result; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } $empprobationreviewModal = new Default_Model_Empprobationreview(); $this->view->probationreviewhistory = $this->ConvertArrayToGrid("Probation Review History", $empprobationreviewModal->getProbationReviewHistory($id)); $this->view->genderaddpermission = $genderaddpermission; $this->view->msaddpermission = $msaddpermission; $this->view->ethnicaddpermission = $ethnicaddpermission; $this->view->racecodepermission = $racecodepermission; $this->view->languagepermission = $languagepermission; $this->view->nationalityaddpermission = $nationalityaddpermission; }
public function addpopupAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $addcomp = sapp_Global::_checkprivileges(COMPETENCYLEVEL, $loginuserGroup, $loginuserRole, 'add'); $id = $this->getRequest()->getParam('unitId'); if ($id == '') { $id = $loginUserId; } // For open the form in popup... $emptyFlag = 0; $empskillsform = new Default_Form_empskills(); $competencylevelModel = new Default_Model_Competencylevel(); $competencylevelArr = $competencylevelModel->getCompetencylevelList(); $msgarray = array(); $empskillsform->competencylevelid->addMultiOption('', 'Select Competency level'); if (!empty($competencylevelArr)) { foreach ($competencylevelArr as $competencylevelres) { $empskillsform->competencylevelid->addMultiOption($competencylevelres['id'], $competencylevelres['competencylevel']); } } else { $msgarray['competencylevelid'] = 'Competency levels are not configured yet.'; $emptyFlag++; } $empskillsform->setAttrib('action', BASE_URL . 'empskills/addpopup/unitId/' . $id); $this->view->form = $empskillsform; $this->view->msgarray = $msgarray; $this->view->emptyFlag = $emptyFlag; $this->view->controllername = 'empskills'; $this->view->addcomp = $addcomp; if ($this->getRequest()->getPost()) { $result = $this->save($empskillsform, $id); $this->view->msgarray = $result; } }
public function viewAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $login_group_id = $auth->getStorage()->read()->group_id; $login_role_id = $auth->getStorage()->read()->emprole; } $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $objName = 'appraisalskills'; try { if ($id) { if (is_numeric($id) && $id > 0) { $appraisalSkillsModel = new Default_Model_Appraisalskills(); $data = $appraisalSkillsModel->getAppraisalSkillsDatabyID($id); $previ_data = sapp_Global::_checkprivileges(APPRAISALSKILLS, $login_group_id, $login_role_id, 'edit'); if (!empty($data)) { $data = $data[0]; $this->view->ermsg = ''; $this->view->data = $data; $this->view->previ_data = $previ_data; $this->view->id = $id; $this->view->controllername = $objName; } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } }
public function editAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emp_holidays', $empOrganizationTabs)) { $emptyFlag = 0; $conText = ""; $userID = ""; $msgarray = array(); $empGroupId = ''; $holidayGroupConfigPermission = ''; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $holidayGroupConfigPermission = sapp_Global::_checkprivileges(HOLIDAYGROUPS, $loginuserGroup, $loginuserRole, 'add'); $this->view->holidayGroupConfigPermission = $holidayGroupConfigPermission; $id = $this->getRequest()->getParam('userid'); $call = $this->_getParam('call'); if ($call == 'ajaxcall') { $this->_helper->layout->disableLayout(); $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid'); $conText = $this->_getParam('context') != '' ? $this->_getParam('context') : $this->getRequest()->getParam('context'); } else { if (isset($_SESSION['holidaygroupid'])) { unset($_SESSION['holidaygroupid']); } } if ($id == '') { $id = $userID; } $Uid = $id ? $id : $userID; if ($Uid != "") { //TO dispaly EMployee Profile information..... $usersModel = new Default_Model_Users(); $employeeData = $usersModel->getUserDetailsByIDandFlag($Uid); } $employeesModel = new Default_Model_Employees(); $holidaydatesmodel = new Default_Model_Holidaydates(); $employeeModal = new Default_Model_Employee(); try { if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) { $isrowexist = $employeeModal->getsingleEmployeeData($id); if ($isrowexist == 'norows') { $this->view->rowexist = "norows"; } else { $this->view->rowexist = "rows"; } $empdata = $employeeModal->getActiveEmployeeData($id); if (!empty($empdata)) { if ($id) { $empholidaysform = new Default_Form_empholidays(); $holidaygroupModel = new Default_Model_Holidaygroups(); $holidaygroupArr = $holidaygroupModel->getAllGroupData(); if (!empty($holidaygroupArr)) { foreach ($holidaygroupArr as $holidaygroupres) { $empholidaysform->holiday_group->addMultiOption($holidaygroupres['id'], $holidaygroupres['groupname']); } } else { $msgarray['holiday_group'] = 'Holiday groups are not configured yet.'; $emptyFlag++; } $empholidaysform->holiday_group_name->setValue("Holiday group is not assigned yet."); $data = $employeesModel->getHolidayGroupForEmployee($id); if ($data[0]['holiday_group'] != '') { $singleholidaygroupArr = $holidaygroupModel->getsingleGroupData($data[0]['holiday_group']); $empholidaysform->populate($data[0]); $empholidaysform->setDefault('holiday_group', $data[0]['holiday_group']); $empGroupId = $data[0]['holiday_group']; if (!empty($singleholidaygroupArr)) { $empholidaysform->holiday_group_name->setValue($singleholidaygroupArr['groupname']); } $this->view->data = $data; $empholidaysform->setAttrib('action', BASE_URL . 'empholidays/edit/userid/' . $id); $objname = $this->_getParam('objname'); $refresh = $this->_getParam('refresh'); $dashboardcall = $this->_getParam('dashboardcall', null); $data = array(); $searchQuery = ''; $searchArray = array(); $tablecontent = ''; if ($refresh == 'refresh') { if ($dashboardcall == 'Yes') { $perPage = DASHBOARD_PERPAGE; } else { $perPage = PERPAGE; } $sort = 'DESC'; $by = 'h.modifieddate'; $pageNo = 1; $searchData = ''; $searchQuery = ''; $searchArray = array(); } else { $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC'; $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'h.modifieddate'; if ($dashboardcall == 'Yes') { $perPage = $this->_getParam('per_page', DASHBOARD_PERPAGE); } else { $perPage = $this->_getParam('per_page', PERPAGE); } $pageNo = $this->_getParam('page', 1); $searchData = $this->_getParam('searchData'); $searchData = rtrim($searchData, ','); } $objName = 'empholidays'; $dataTmp = $holidaydatesmodel->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $objName, $empGroupId, $Uid, $conText); array_push($data, $dataTmp); $this->view->dataArray = $data; $this->view->call = $call; } $this->view->id = $id; $this->view->emptyFlag = $emptyFlag; $this->view->messages = $this->_helper->flashMessenger->getMessages(); if (!empty($employeeData)) { $this->view->employeedata = $employeeData[0]; } $this->view->form = $empholidaysform; $this->view->empdata = $empdata; $this->view->msgarray = $msgarray; if ($this->getRequest()->getPost()) { $result = $this->save($empholidaysform, $id); $this->view->msgarray = $result; } } } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
/** * * View function is used to populate the data for the particular ID. */ public function viewAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $login_group_id = $auth->getStorage()->read()->group_id; $login_role_id = $auth->getStorage()->read()->emprole; $businessUnit = $auth->getStorage()->read()->businessunit_id; $department = $auth->getStorage()->read()->department_id; } $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $objName = 'appraisalratings'; $appraisalratingsmodel = new Default_Model_Appraisalratings(); $appInitModel = new Default_Model_Appraisalinit(); $businessunitmodel = new Default_Model_Businessunits(); $deptmodel = new Default_Model_Departments(); $buname = ''; $deptname = ''; $performanceappflag = ''; try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $appraisalratingsmodel->getAppraisalRatingsbyInitId($id); $previ_data = sapp_Global::_checkprivileges(APPRAISALRATINGS, $login_group_id, $login_role_id, 'edit'); if (!empty($data)) { //$data = $data[0]; $appInitdata = $appInitModel->getConfigData($data[0]['pa_initialization_id']); if ($login_role_id == SUPERADMINROLE || $login_group_id == MANAGEMENT_GROUP) { if (!empty($appInitdata)) { $businessUnit = $appInitdata[0]['businessunit_id']; $department = $appInitdata[0]['department_id']; } } $appImpleData = sapp_PerformanceHelper::check_per_implmentation($businessUnit, $department); if (!empty($appImpleData)) { $performanceappflag = $appImpleData['performance_app_flag']; } $buDataArr = $businessunitmodel->getSingleUnitData($businessUnit); if (!empty($buDataArr)) { $buname = $buDataArr['unitname']; } if ($performanceappflag == 0) { if ($department != '') { $deptArr = $deptmodel->getSingleDepartmentData($department); if (!empty($deptArr)) { $deptname = $deptArr['deptname']; } } } $this->view->checkActiveApp = $appInitdata[0]; $this->view->data = $data; $this->view->ermsg = ''; $this->view->previ_data = $previ_data; $this->view->id = $id; $this->view->controllername = $objName; $this->view->buname = $buname; $this->view->deptname = $deptname; } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } }
public function leavesAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emp_leaves', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginUserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $id = $loginUserId; $call = $this->_getParam('call'); if ($call == 'ajaxcall') { $this->_helper->layout->disableLayout(); $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid'); } $Uid = $id ? $id : $userID; $employeeleavesModel = new Default_Model_Employeeleaves(); $leavemanagementModel = new Default_Model_Leavemanagement(); $employeeModal = new Default_Model_Employee(); try { $empdata = $employeeModal->getsingleEmployeeData($Uid); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { if ($Uid) { $empleavesform = new Default_Form_empleaves(); $employeeleavesModal = new Default_Model_Employeeleaves(); $currentdata = ''; $leavetransferArr = $leavemanagementModel->getWeekendDetails($empdata[0]['department_id']); $prevyeardata = $employeeleavesModal->getPreviousYearEmployeeleaveData($Uid); $currentyeardata = $employeeleavesModal->getsingleEmployeeleaveData($Uid); if (empty($currentyeardata)) { $currentdata = "empty"; $currentyearleavecount = ''; } else { $currentdata = "notempty"; $currentyearleavecount = $currentyeardata[0]['emp_leave_limit']; } $this->view->currentdata = $currentdata; $leavetransfercount = ''; $previousyear = ''; $isleavetrasnferset = ''; $data = $employeeleavesModal->getsingleEmployeeleaveData($id); $used_leaves = 0; $date = date('Y'); if (!empty($data)) { $empleavesform->populate($data[0]); $used_leaves = $data[0]['used_leaves']; } $empleavesform->alloted_year->setValue($date); if (!empty($leavetransferArr) && $leavetransferArr[0]['is_leavetransfer'] == 1 && !empty($prevyeardata) && is_numeric($prevyeardata[0]['remainingleaves']) && (int) $prevyeardata[0]['remainingleaves'] > 0 && $prevyeardata[0]['alloted_year'] != '' && empty($currentyeardata)) { $leavetransfercount = $prevyeardata[0]['remainingleaves']; $previousyear = $prevyeardata[0]['alloted_year']; $isleavetrasnferset = 1; $empleavesform->submitbutton->setAttrib('onClick', 'return showleavealert(' . $leavetransfercount . ',' . $previousyear . ')'); $empleavesform->setAttrib('action', DOMAIN . 'mydetails/leaves/'); } else { $empleavesform->setAttrib('action', DOMAIN . 'mydetails/leaves/'); } $this->view->form = $empleavesform; $this->view->data = $data; $this->view->id = $Uid; $this->view->leavetransfercount = $leavetransfercount; } //Post values.... if ($this->getRequest()->getPost()) { $result = $this->empaddorremoveleaves($empleavesform, $Uid, $used_leaves, $leavetransfercount, $isleavetrasnferset, $currentyearleavecount); $this->view->msgarray = $result; } $objname = $this->_getParam('objname'); $refresh = $this->_getParam('refresh'); $data = array(); $searchQuery = ''; $searchArray = array(); $tablecontent = ''; if ($refresh == 'refresh') { $sort = 'DESC'; $by = 'e.modifieddate'; $perPage = 10; $pageNo = 1; $searchData = ''; } else { $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC'; $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'e.modifieddate'; $perPage = $this->_getParam('per_page', 10); $pageNo = $this->_getParam('page', 1); $searchData = $this->_getParam('searchData'); $searchData = rtrim($searchData, ','); /** search from grid - START **/ $searchData = $this->_getParam('searchData'); if ($searchData != '' && $searchData != 'undefined') { $searchValues = json_decode($searchData); foreach ($searchValues as $key => $val) { $searchQuery .= " " . $key . " like '%" . $val . "%' AND "; $searchArray[$key] = $val; } $searchQuery = rtrim($searchQuery, " AND"); } /** search from grid - END **/ } $objName = 'empleaves'; $tableFields = array('action' => 'Action', 'emp_leave_limit' => 'Alloted leave limit', 'used_leaves' => 'Used leaves', 'remainingleaves' => 'Leave balance', 'alloted_year' => 'Alloted year'); $tablecontent = $employeeleavesModel->getEmpLeavesData($sort, $by, $pageNo, $perPage, $searchQuery, $Uid); $dataTmp = array('userid' => $Uid, 'sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getEmployeeAjaxgridData', 'jsFillFnName' => '', 'searchArray' => $searchArray, 'add' => 'add', 'menuName' => 'Employee Leaves', 'formgrid' => 'true', 'unitId' => $Uid, 'call' => $call, 'context' => 'mydetails'); array_push($data, $dataTmp); $permission = sapp_Global::_checkprivileges(EMPLOYEE, $loginuserGroup, $loginUserRole, 'edit'); $this->view->dataArray = $data; $this->view->call = $call; $this->view->id = $Uid; $this->view->messages = $this->_helper->flashMessenger->getMessages(); $this->view->employeedata = $empdata[0]; $this->view->usergroup = $loginuserGroup; $this->view->permission = $permission; } $this->view->empdata = $empdata; } } catch (Exception $e) { $this->view->rowexist = "norows"; } $this->view->usergroup = $loginuserGroup; } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $appraisalquestionsform = new Default_Form_Appraisalquestions(); $appraisalCategoryModel = new Default_Model_Appraisalcategory(); $appraisalquestionsmodel = new Default_Model_Appraisalquestions(); $msgarray = array(); $popConfigPermission = array(); if (sapp_Global::_checkprivileges(APPRAISALQUESTIONS, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'appraisalquestions'); } $appraisalquestionsform->submit->setLabel('Update'); try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $appraisalquestionsmodel->getAppraisalQuestionbyID($id); if (!empty($data)) { $data = $data[0]; // When question is already question details can't be edited if ($data['isused'] == 1) { $this->view->ermsg = 'norecord'; } else { $appraisalCategoriesData = $appraisalCategoryModel->getAppraisalCategorysData(); if (sizeof($appraisalCategoriesData) > 0) { foreach ($appraisalCategoriesData as $ac) { $appraisalquestionsform->pa_category_id->addMultiOption($ac['id'], utf8_encode($ac['category_name'])); } } $appraisalquestionsform->populate($data); $appraisalquestionsform->setDefault('pa_category_id', $data['pa_category_id']); $appraisalquestionsform->setAttrib('action', BASE_URL . 'appraisalquestions/edit/id/' . $id); $this->view->data = $data; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = ''; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $appraisalquestionsform; if ($this->getRequest()->getPost()) { $result = $this->save($appraisalquestionsform); $this->view->msgarray = $result; } $this->render('form'); }
public function editAction() { $popConfigPermission = array(); $auth = Zend_Auth::getInstance(); $report_opt = array(); $role_datap = array(); $empGroup = ""; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } if (sapp_Global::_checkprivileges(PREFIX, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'prefix'); } if (sapp_Global::_checkprivileges(PREFIX, $loginuserGroup, $loginuserRole, 'edit') == 'Yes') { array_push($popConfigPermission, 'identitycodes'); } if (sapp_Global::_checkprivileges(EMPLOYMENTSTATUS, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'empstatus'); } if (sapp_Global::_checkprivileges(JOBTITLES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'jobtitles'); } if (sapp_Global::_checkprivileges(POSITIONS, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'position'); } $this->view->popConfigPermission = $popConfigPermission; $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_employee(); $appEmpRatingsModel = new Default_Model_Appraisalemployeeratings(); $performanceflag = 'true'; try { if ($id != '' && is_numeric($id) && $id > 0 && $id != $loginUserId) { $appEmpRatingsData = $appEmpRatingsModel->getSelfAppraisalDataByEmpID($id); if (sizeof($appEmpRatingsData) > 0 && $appEmpRatingsData[0]['status'] == 1) { $performanceflag = 'false'; } if ($performanceflag == 'true') { $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); if ($data['is_orghead'] == 1) { $roles_arr = $role_model->getRolesList_EMP('orghead'); if (sizeof($roles_arr) > 0) { $employeeform->emprole->addMultiOptions(array('' => 'Select Role') + $roles_arr); } } else { $roles_arr = $role_model->getRolesList_EMP(); if (sizeof($roles_arr) > 0) { $employeeform->emprole->addMultiOptions(array('' => 'Select Role') + $roles_arr); } } $referedby_options = $user_model->getRefferedByForUsers(); $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 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']); } } $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']); //$employeeform->setDefault('emprole',$data['emprole']."_".MANAGEMENT_GROUP); $employeeform->setDefault('emprole', $data['emprole']); $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']; } $role_data = $role_model->getRoleDataById($data['emprole']); $employeeform->emprole->setValue($data['emprole'] . "_" . $role_data['group_id']); $employeeform->setAttrib('action', BASE_URL . 'employee/edit/id/' . $id); $reportingManagerData = $usersModel->getReportingManagerList_employees($data['department_id'], $data['id'], $role_data['group_id']); $empDeptId = isset($_POST['department_id']) ? $_POST['department_id'] : $data['department_id']; if (isset($_POST['emprole']) && $_POST['emprole'] != '') { $role_split = preg_split('/_/', $_POST['emprole']); $empRoleId = $role_split[0]; } else { $empRoleId = $data['emprole']; } if (isset($empDeptId) && $empDeptId != '' && isset($empRoleId) && $empRoleId != '') { try { $role_datap = $role_model->getRoleDataById($empRoleId); $reportingManagerData = $usersModel->getReportingManagerList_employees($empDeptId, $data['id'], $role_datap['group_id']); } catch (Exception $e) { $reportingManagerData = array(); } } if (!empty($reportingManagerData)) { $report_opt = $reportingManagerData; } $employeeform->setDefault('reporting_manager', $data['reporting_manager']); $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; if ($data['is_orghead'] == 1) { $employeeform->removeElement('businessunit_id'); $employeeform->removeElement('reporting_manager'); $employeeform->removeElement('department_id'); $employeeform->removeElement('emp_status_id'); $employeeform->removeElement('date_of_leaving'); //$employeeform->removeElement('emprole'); } } } $this->view->report_opt = $report_opt; } else { $this->editappraisal($id); } } else { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($employeeform); $this->view->msgarray = $result; $employeeform->modeofentry->setValue($data['modeofentry']); $employeeform->other_modeofentry->setValue($data['other_modeofentry']); 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']]); } } } catch (Exception $e) { $this->view->rowexist = "norows"; } }
public function viewAction() { $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(); } $objName = 'holidaydates'; $holidaydatesform = new Default_Form_holidaydates(); $holidaydatesmodel = new Default_Model_Holidaydates(); $holidaygroupsmodel = new Default_Model_Holidaygroups(); $holidaydatesform->removeElement("submit"); $holidaydatesform->removeElement('groupid'); $groupval = ''; $groupname = ''; try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $holidaydatesmodel->getParticularHolidayDateData($id); if (!empty($data)) { $data = $data[0]; $groupdataArr = $holidaygroupsmodel->getParticularGroupData($data['groupid']); if (sizeof($groupdataArr) > 0) { $groupname = $groupdataArr[0]['groupname']; } $holidaydatesform->populate($data); $holidaydate = sapp_Global::change_date($data['holidaydate'], 'view'); $holidaydatesform->holidaydate->setValue($holidaydate); $this->view->rowexist = ""; $groupval = $data['groupid']; } else { $this->view->rowexist = "norows"; } } else { $this->view->rowexist = "norows"; } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } $elements = $holidaydatesform->getElements(); if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") { $element->setAttrib("disabled", "disabled"); } } } $permission = sapp_Global::_checkprivileges(HOLIDAYDATES, $loginuserGroup, $loginuserRole, 'edit'); $this->view->groupname = $groupname; $this->view->groupval = $groupval; $this->view->editpermission = $permission; $this->view->controllername = $objName; $this->view->id = $id; $this->view->form = $holidaydatesform; }
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; } $popConfigPermission = array(); if (sapp_Global::_checkprivileges(CURRENCY, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'currency'); } $this->view->popConfigPermission = $popConfigPermission; $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $geographygroupform = new Default_Form_geographygroup(); $geographygroupmodel = new Default_Model_Geographygroup(); try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $geographygroupmodel->getGeographyGroupDataByID($id); if (!empty($data)) { $geographygroupform->populate($data[0]); $geographygroupform->submit->setLabel('Update'); $this->view->data = $data; $this->view->id = $id; $this->view->ermsg = ''; } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = ''; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $geographygroupform; if ($this->getRequest()->getPost()) { if ($geographygroupform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $geographycode = $this->_request->getParam('geographycode'); $defaultGeographyGroup = $this->_request->getParam('defaultGeographyGroup'); $geographygroupname = $this->_request->getParam('geographygroupname'); $geographyregion = $this->_request->getParam('geographyregion'); $currency = $this->_request->getParam('currency'); $geographycityname = $this->_request->getParam('geographycityname'); $date = new Zend_Date(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('currency' => trim($currency), 'geographygroupname' => trim($geographygroupname != '' ? $geographygroupname : NULL), 'geographycode' => trim($geographycode), 'geographyregion' => trim($geographyregion != '' ? $geographyregion : NULL), 'geographycityname' => trim($geographycityname != '' ? $geographycityname : NULL), 'defaultGeographyGroup' => trim($defaultGeographyGroup != '' ? $defaultGeographyGroup : NULL), '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 = $geographygroupmodel->SaveorUpdateGeographyGroupData($data, $where); if ($Id == 'update') { $tableid = $id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Geography group updated successfully.")); } else { $tableid = $Id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Geography group added successfully.")); } $menuidArr = $menumodel->getMenuObjID('/geographygroup'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $this->_redirect('geographygroup'); } else { $messages = $geographygroupform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } }
public function editAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emp_salary', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); $emptyFlag = 0; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = array(); if (sapp_Global::_checkprivileges(CURRENCY, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'currency'); } if (sapp_Global::_checkprivileges(ACCOUNTCLASSTYPE, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'accountclasstype'); } if (sapp_Global::_checkprivileges(BANKACCOUNTTYPE, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'bankaccounttype'); } $this->view->popConfigPermission = $popConfigPermission; $id = $this->getRequest()->getParam('userid'); if ($id == '') { $id = $loginUserId; } $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $empsalarydetailsform = new Default_Form_empsalarydetails(); try { if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) { $employeeModal = new Default_Model_Employee(); $empdata = $employeeModal->getsingleEmployeeData($id); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $empsalarydetailsModal = new Default_Model_Empsalarydetails(); $usersModel = new Default_Model_Users(); $currencymodel = new Default_Model_Currency(); $accountclasstypemodel = new Default_Model_Accountclasstype(); $bankaccounttypemodel = new Default_Model_Bankaccounttype(); $msgarray = array(); $basecurrencymodeldata = $currencymodel->getCurrencyList(); $empsalarydetailsform->currencyid->addMultiOption('', 'Select Salary Currency'); if (sizeof($basecurrencymodeldata) > 0) { foreach ($basecurrencymodeldata as $basecurrencyres) { $empsalarydetailsform->currencyid->addMultiOption($basecurrencyres['id'], utf8_encode($basecurrencyres['currency'])); } } else { $msgarray['currencyid'] = 'Currencies are not configured yet.'; $emptyFlag++; } $bankaccounttypeArr = $bankaccounttypemodel->getBankAccountList(); $empsalarydetailsform->bankaccountid->addMultiOption('', 'Select Bank Account Type'); if (!empty($bankaccounttypeArr)) { foreach ($bankaccounttypeArr as $bankaccounttyperes) { $empsalarydetailsform->bankaccountid->addMultiOption($bankaccounttyperes['id'], $bankaccounttyperes['bankaccounttype']); } } else { $msgarray['bankaccountid'] = 'Bank account types are not configured yet.'; $emptyFlag++; } $accountclasstypeArr = $accountclasstypemodel->getAccountClassTypeList(); $empsalarydetailsform->accountclasstypeid->addMultiOption('', 'Select Account Type'); if (!empty($accountclasstypeArr)) { foreach ($accountclasstypeArr as $accountclasstyperes) { $empsalarydetailsform->accountclasstypeid->addMultiOption($accountclasstyperes['id'], $accountclasstyperes['accountclasstype']); } } else { $msgarray['accountclasstypeid'] = 'Account class types are not configured yet.'; $emptyFlag++; } $data = $empsalarydetailsModal->getsingleEmpSalaryDetailsData($id); if (!empty($data)) { $empsalarydetailsform->populate($data[0]); if ($data[0]['accountholding'] != '') { $accountholding = sapp_Global::change_date($data[0]["accountholding"], 'view'); $empsalarydetailsform->accountholding->setValue($accountholding); } if ($data[0]['accountclasstypeid'] != '') { $empsalarydetailsform->setDefault('accountclasstypeid', $data[0]['accountclasstypeid']); } $empsalarydetailsform->setDefault('currencyid', $data[0]['currencyid']); $empsalarydetailsform->setDefault('bankaccountid', $data[0]['bankaccountid']); } $empsalarydetailsform->user_id->setValue($id); $empsalarydetailsform->setAttrib('action', DOMAIN . 'empsalarydetails/edit/userid/' . $id); $this->view->form = $empsalarydetailsform; $this->view->data = isset($data[0]) ? $data[0] : array(); $this->view->id = $id; $this->view->msgarray = $msgarray; $this->view->employeedata = $empdata[0]; $this->view->emptyFlag = $emptyFlag; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } $this->view->empdata = $empdata; } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($empsalarydetailsform, $id); $this->view->msgarray = $result; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
public function viewAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $permission = 'No'; $id = intVal($this->getRequest()->getParam('id')); if (is_int($id) && $id != 0) { $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $permission = sapp_Global::_checkprivileges(BGSCREENINGTYPE, $loginuserGroup, $loginuserRole, 'edit'); $objName = 'bgscreeningtype'; $bgscreeningtypeform = new Default_Form_bgscreeningtype(); $bgscreeningtypemodel = new Default_Model_Bgscreeningtype(); $data = $bgscreeningtypemodel->getSingleScreeningtypeData($id); if (!empty($data)) { $bgscreeningtypeform->populate($data); $elements = $bgscreeningtypeform->getElements(); if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") { $element->setAttrib("disabled", "disabled"); } } } $this->view->controllername = $objName; $this->view->id = $id; $this->view->form = $bgscreeningtypeform; $this->view->permission = $permission; $this->view->ermsg = ''; } else { $this->view->ermsg = 'nodata'; } } else { $this->view->ermsg = 'nodata'; } }
public function editAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emp_leaves', $empOrganizationTabs)) { $userID = ""; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserGroup = $auth->getStorage()->read()->group_id; $loginUserRole = $auth->getStorage()->read()->emprole; } $conText = ""; $id = $this->getRequest()->getParam('userid'); $call = $this->_getParam('call'); $usersModel = new Default_Model_Users(); if ($call == 'ajaxcall') { $this->_helper->layout->disableLayout(); $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid'); $conText = $this->_getParam('context') != '' ? $this->_getParam('context') : $this->getRequest()->getParam('context'); } if ($id == '') { $id = $userID; } $Uid = $id ? $id : $userID; if ($Uid != "") { $employeeData = $usersModel->getUserDetailsByIDandFlag($Uid); } $employeeleavesModel = new Default_Model_Employeeleaves(); $leavemanagementModel = new Default_Model_Leavemanagement(); $employeeModal = new Default_Model_Employee(); try { if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) { $isrowexist = $employeeModal->getsingleEmployeeData($id); if ($isrowexist == 'norows') { $this->view->rowexist = "norows"; } else { $this->view->rowexist = "rows"; } $empdata = $employeeModal->getActiveEmployeeData($id); //print_r($empdata); exit; //echo $empdata[0]['date_of_joining'];exit; //echo $currentdate=date("Y/m/d");exit; if (!empty($empdata)) { $call = $this->_getParam('call'); if ($id == '') { $id = $loginUserId; } if ($call == 'ajaxcall') { $this->_helper->layout->disableLayout(); $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid'); } if ($id) { $empleavesform = new Default_Form_empleaves(); $joiningdate = $empdata[0]['date_of_joining']; $empjoiningdate = strtotime($joiningdate); $empjoiningyear = date("y", $empjoiningdate); $currentyear = date("y"); if ($empjoiningyear <= $currentyear) { $employeeleavesModal = new Default_Model_Employeeleaves(); $currentdata = ''; $leavetransferArr = $leavemanagementModel->getWeekendDetails($empdata[0]['department_id']); $prevyeardata = $employeeleavesModal->getPreviousYearEmployeeleaveData($id); $currentyeardata = $employeeleavesModal->getsingleEmployeeleaveData($id); if (empty($currentyeardata)) { $currentdata = "empty"; $currentyearleavecount = ''; } else { $currentdata = "notempty"; $currentyearleavecount = $currentyeardata[0]['emp_leave_limit']; } $this->view->currentdata = $currentdata; $leavetransfercount = ''; $previousyear = ''; $isleavetrasnferset = ''; $data = $employeeleavesModal->getsingleEmployeeleaveData($id); $used_leaves = 0; $date = date('Y'); if (!empty($data)) { $used_leaves = $data[0]['used_leaves']; } $empleavesform->alloted_year->setValue($date); if (!empty($leavetransferArr) && $leavetransferArr[0]['is_leavetransfer'] == 1 && !empty($prevyeardata) && is_numeric($prevyeardata[0]['remainingleaves']) && (int) $prevyeardata[0]['remainingleaves'] > 0 && $prevyeardata[0]['alloted_year'] != '' && empty($currentyeardata)) { $leavetransfercount = $prevyeardata[0]['remainingleaves']; $previousyear = $prevyeardata[0]['alloted_year']; $isleavetrasnferset = 1; $empleavesform->submitbutton->setAttrib('onClick', 'return showleavealert(' . $leavetransfercount . ',' . $previousyear . ')'); $empleavesform->setAttrib('action', BASE_URL . 'empleaves/edit/userid/' . $id); } else { $empleavesform->setAttrib('action', BASE_URL . 'empleaves/edit/userid/' . $id); } $this->view->form = $empleavesform; $this->view->data = $data; $this->view->id = $id; $this->view->leavetransfercount = $leavetransfercount; $this->view->formflag = 'show'; } else { $this->view->form = $empleavesform; $this->view->formflag = 'hide'; } } if ($this->getRequest()->getPost()) { $result = $this->save($empleavesform, $id, $used_leaves, $leavetransfercount, $isleavetrasnferset, $currentyearleavecount); $this->view->msgarray = $result; } $objname = $this->_getParam('objname'); $refresh = $this->_getParam('refresh'); $dashboardcall = $this->_getParam('dashboardcall', null); $data = array(); $searchQuery = ''; $searchArray = array(); $tablecontent = ''; if ($refresh == 'refresh') { if ($dashboardcall == 'Yes') { $perPage = DASHBOARD_PERPAGE; } else { $perPage = PERPAGE; } $sort = 'DESC'; $by = 'e.modifieddate'; $pageNo = 1; $searchData = ''; $searchQuery = ''; $searchArray = array(); } else { $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC'; $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'e.modifieddate'; if ($dashboardcall == 'Yes') { $perPage = $this->_getParam('per_page', DASHBOARD_PERPAGE); } else { $perPage = $this->_getParam('per_page', PERPAGE); } $pageNo = $this->_getParam('page', 1); $searchData = $this->_getParam('searchData'); $searchData = rtrim($searchData, ','); } $dataTmp = $employeeleavesModel->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $Uid, $conText); array_push($data, $dataTmp); $permission = sapp_Global::_checkprivileges(EMPLOYEE, $loginuserGroup, $loginUserRole, 'edit'); $this->view->dataArray = $data; $this->view->call = $call; $this->view->id = $id; $this->view->messages = $this->_helper->flashMessenger->getMessages(); if (!empty($employeeData)) { $this->view->employeedata = $employeeData[0]; } $this->view->usergroup = $loginuserGroup; $this->view->permission = $permission; } $this->view->empdata = $empdata; } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
/** * * View function is used to populate the data for the particular ID. */ public function viewAction() { $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(); } $objName = 'appraisalconfig'; $appraisalconfigform = new Default_Form_Appraisalconfig(); $appraisalconfigmodel = new Default_Model_Appraisalconfig(); $departmentsmodel = new Default_Model_Departments(); $appraisalconfigform->removeElement("submit"); $elements = $appraisalconfigform->getElements(); try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $appraisalconfigmodel->getAppraisalConfigbyID($id); if (!empty($data)) { $data = $data[0]; $previ_data = sapp_Global::_checkprivileges(APPRAISAL_SETTINGS, $loginuserGroup, $loginuserRole, 'edit'); $this->view->previ_data = $previ_data; 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'])); } } $bunitModel = new Default_Model_Businessunits(); $bunitdata = $bunitModel->fetchAll('isactive=1', 'unitname'); $appraisalconfigform->businessunit_id->addMultiOptions(array('' => 'Select Business unit', '0' => 'No Business Unit')); foreach ($bunitdata->toArray() as $bdata) { $appraisalconfigform->businessunit_id->addMultiOption($bdata['id'], $bdata['unitname']); } $appraisalconfigform->setDefault('businessunit_id', $data['businessunit_id']); $this->view->performance_app_flag = $data['performance_app_flag']; $appraisalconfigform->populate($data); if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete") { $element->setAttrib("disabled", "disabled"); } } } /** to show/hide edit button **/ $chkFlagForEdit = $appraisalconfigmodel->checkInitializationData($id); $this->view->chkFlagForEdit = $chkFlagForEdit; } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->controllername = $objName; $this->view->id = $id; $this->view->form = $appraisalconfigform; $this->render('form'); }
public function editAction() { $orgInfoModel = new Default_Model_Organisationinfo(); $getorgData = $orgInfoModel->getorgrecords(); $sitepreferencemodel = new Default_Model_Sitepreference(); $activerecordArr = $sitepreferencemodel->getActiveRecord(); $timezoneid = !empty($activerecordArr[0]['timezoneid']) ? $activerecordArr[0]['timezoneid'] : ''; $popConfigPermission = array(); $organisationHead = array(); if (!empty($getorgData)) { $orgdata = ''; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginUserRole = $auth->getStorage()->read()->emprole; $loginUserGroup = $auth->getStorage()->read()->group_id; } if (sapp_Global::_checkprivileges(TIMEZONE, $loginUserGroup, $loginUserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'timezone'); } if (sapp_Global::_checkprivileges(COUNTRIES, $loginUserGroup, $loginUserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'country'); } if (sapp_Global::_checkprivileges(STATES, $loginUserGroup, $loginUserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'state'); } if (sapp_Global::_checkprivileges(CITIES, $loginUserGroup, $loginUserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'city'); } if (sapp_Global::_checkprivileges(EMPLOYEE, $loginUserGroup, $loginUserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'employee'); } $msgarray = array(); $flag = 'true'; $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); $deptModel = new Default_Model_Departments(); $deptform = new Default_Form_departments(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $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(); $orgInfoModel = new Default_Model_Organisationinfo(); $employeeModal = new Default_Model_Employee(); $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(); $deptData = array(); $deptform->setAttrib('action', BASE_URL . 'departments/edit'); $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']; } $deptform->setDefault('timezone', $timezoneid); $address = $getorgData[0]['address1']; $organisationHead = $employeeModal->getCurrentOrgHead(); 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); } if (is_numeric($id) && $id > 0) { $data = $deptModel->getSingleDepartmentData($id); if (!empty($data)) { $deptform->setAttrib('action', BASE_URL . 'departments/edit/id/' . $id); $managementUsersData = $deptModel->getDepartmenttHead($data['depthead']); foreach ($managementUsersData as $mgmtdata) { $deptform->depthead->addMultiOption($mgmtdata['user_id'], $mgmtdata['userfullname']); } $deptform->populate($data); $deptform->setDefault('depthead', $data['depthead']); $deptform->submit->setLabel('Update'); $deptform->state->clearMultiOptions(); $deptform->city->clearMultiOptions(); $deptform->state->addMultiOption('', utf8_encode("Select State")); $deptform->city->addMultiOption('', utf8_encode("Select City")); $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 != '') { $statesData = $statesmodel->getBasicStatesList($countryId); foreach ($statesData as $res) { $deptform->state->addMultiOption($res['state_id_org'], utf8_encode($res['state'])); } $deptform->setDefault('country', $countryId); $deptform->setDefault('state', $stateId); } if ($stateId != '') { $citiesData = $citiesmodel->getBasicCitiesList($stateId); foreach ($citiesData as $res) { $deptform->city->addMultiOption($res['city_org_id'], utf8_encode($res['city'])); } $deptform->setDefault('city', $cityId); } if ($data["startdate"] != '') { $st_date = sapp_Global::change_date($data["startdate"], 'view'); $deptform->setDefault('start_date', $st_date); } $this->view->ermsg = ''; $this->view->datarr = $data; } else { $this->view->ermsg = 'nodata'; } } else { if ($id != '') { $this->view->ermsg = 'nodata'; } else { $managementUsersData = $deptModel->getDepartmenttHead(''); foreach ($managementUsersData as $mgmtdata) { $deptform->depthead->addMultiOption($mgmtdata['user_id'], $mgmtdata['userfullname']); } } } $this->view->deptData = sizeof($deptData); $this->view->form = $deptform; 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($allBusinessunitsData)) { $msgarray['unitid'] = 'Business units are not added yet.'; $flag = 'false'; } if (empty($allTimezoneData)) { $msgarray['timezone'] = 'Time zones are not configured yet.'; $flag = 'false'; } $this->view->msgarray = $msgarray; if ($this->getRequest()->getPost()) { $deptname = trim($this->_request->getParam('deptname')); $unitid = $this->_request->getParam('unitid'); if ($deptname != '' && $unitid != '') { if (!preg_match('/^[a-zA-Z.\\- ?]+$/', $deptname)) { $msgarray['deptname'] = "Please enter valid department name."; $flag = 'false'; } else { $checkExists = $deptModel->checkExistance($deptname, $unitid, $id); if ($checkExists != 0) { $msgarray['deptname'] = "Department name already exists."; $flag = 'false'; } } } else { $flag = 'false'; } $start_date = $this->_request->getParam('start_date', null); $start_date = sapp_Global::change_date($start_date, 'database'); if ($deptform->isValid($this->_request->getPost()) && $flag == 'true') { $deptname = $this->_request->getParam('deptname'); $deptcode = $this->_request->getParam('deptcode'); $description = $this->_request->getParam('description'); $country = $this->_request->getParam('country'); $state = intval($this->_request->getParam('state')); $city = $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'); $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); /* Updating business unit and department for org head*/ $emp_data = array('businessunit_id' => $unitid, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $emp_where = array('user_id=?' => $depthead); if ($Id == 'update') { $tableid = $id; $emp_data['department_id'] = $id; $this->_helper->getHelper("FlashMessenger")->addMessage("Department updated successfully."); } else { $tableid = $Id; $emp_data['department_id'] = $Id; $this->_helper->getHelper("FlashMessenger")->addMessage("Department added successfully."); } $employeeModal->SaveorUpdateEmployeeData($emp_data, $emp_where); $menuID = DEPARTMENTS; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $this->_redirect('departments'); } 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($allBusinessunitsData)) { $msgarray['unitid'] = 'Business units are not added yet.'; } if (empty($allTimezoneData)) { $msgarray['timezone'] = 'Time zones are not configured yet.'; } } $this->view->msgarray = $msgarray; } } } else { $orgdata = 'noorgdata'; $this->view->orgdata = $orgdata; } $this->view->popConfigPermission = $popConfigPermission; $this->view->organisationHead = $organisationHead; }
/** * @name indexAction * * This function is used to edit the details of a particular agency. * @author Asma * @version 1.0 */ public function editAction() { $popConfigPermission = array(); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } if (sapp_Global::_checkprivileges(COUNTRIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'country'); } if (sapp_Global::_checkprivileges(STATES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'state'); } if (sapp_Global::_checkprivileges(CITIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'city'); } if (sapp_Global::_checkprivileges(BGSCREENINGTYPE, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'screening'); } $checktypeModal = new Default_Model_Bgscreeningtype(); $msgarray = array(); $id = intval($this->getRequest()->getParam('id')); if (is_int($id) && $id != 0) { $agencylistform = new Default_Form_agencylist(); $agencylistmodel = new Default_Model_Agencylist(); $secondpocid = ''; $thirdpocid = ''; $checktypeArr = array(); $recordData = ''; $userdata = $agencylistmodel->getAgencyEmail($id); $endData = $this->getrecordData($id, $agencylistform, $agencylistmodel); $recordData = $endData['recordData']; $agencylistform->setDefault('emprole', $userdata['emprole']); $agencylistform->submit->setLabel('Update'); $this->view->record = $recordData; $this->view->form = $agencylistform; $this->view->ermsg = ''; } else { $this->view->ermsg = 'nodata'; } $rolesData = $agencylistmodel->getagencyrole(); $typesData = $checktypeModal->fetchAll('isactive=1', 'type')->toArray(); if (!empty($typesData)) { $this->view->configure = ''; } else { $msgarray['bg_checktype'] = 'Screening types are not configured yet.'; $this->view->configure = 'notconfigured'; } if (!empty($rolesData)) { $this->view->rolesconfigure = ''; } else { $msgarray['emprole'] = 'Roles are not configured yet.'; $this->view->rolesconfigure = 'notconfigured'; } $this->view->msgarray = $msgarray; if ($this->getRequest()->getPost()) { $result = $this->save($agencylistform); $this->view->msgarray = $result; $this->view->messages = $result; } $this->view->popConfigPermission = $popConfigPermission; }
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; } $popConfigPermission = array(); $msgarray = array(); $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $systempreferenceform = new Default_Form_systempreference(); $dateformatidmodel = new Default_Model_Dateformat(); $timeformatidmodel = new Default_Model_Timeformat(); $currencyidmodel = new Default_Model_Currency(); $systempreferencemodel = new Default_Model_Sitepreference(); $date_formats_arr = array(); $time_formats_arr = array(); $passworddataArr = array(); $timezonemodel = new Default_Model_Timezone(); $allTimezoneData = $timezonemodel->fetchAll('isactive=1', 'timezone')->toArray(); if (sapp_Global::_checkprivileges(CURRENCY, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'currency'); } if (sapp_Global::_checkprivileges(TIMEZONE, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'timezone'); } if ($id && $id > 0 && is_numeric($id)) { try { $data = $systempreferencemodel->getsingleSystemPreferanceData($id); $date_formats_arr = $dateformatidmodel->getAllDateFormats(); $time_formats_arr = $timeformatidmodel->fetchAll()->toArray(); $currencyidmodeldata = $currencyidmodel->getCurrencyList(); $systempreferenceform->currencyid->addMultiOption('', 'Select Currency'); if (sizeof($currencyidmodeldata) > 0) { foreach ($currencyidmodeldata as $currencyidres) { $systempreferenceform->currencyid->addMultiOption($currencyidres['id'], utf8_encode($currencyidres['currencytext'])); } } $systempreferenceform->passwordid->addMultiOption('', 'Select Password Preference'); $passworddataArr = $systempreferencemodel->getPasswordData(); foreach ($passworddataArr as $passwordres) { $systempreferenceform->passwordid->addMultiOption($passwordres['id'], utf8_encode($passwordres['passwordtype'])); } if (sizeof($allTimezoneData) > 0) { foreach ($allTimezoneData as $timezoneidres) { $systempreferenceform->timezoneid->addMultiOption($timezoneidres['id'], utf8_encode($timezoneidres['timezone'] . ' [' . $timezoneidres['timezone_abbr'] . ']')); } } else { $msgarray['timezoneid'] = 'Time Zone is not configured yet.'; } $systempreferenceform->populate($data); $systempreferenceform->setDefault('dateformatid', $data['dateformatid']); $systempreferenceform->setDefault('timeformatid', $data['timeformatid']); $systempreferenceform->setDefault('currencyid', $data['currencyid']); $systempreferenceform->setDefault('passwordid', $data['passwordid']); $systempreferenceform->setAttrib('action', DOMAIN . 'sitepreference/edit/id/' . $id); $this->view->msgarray = $msgarray; } catch (Exception $e) { $this->view->nodata = "nodata"; } } else { $this->view->nodata = "nodata"; } $this->view->form = $systempreferenceform; $this->view->date_formats_arr = $date_formats_arr; $this->view->time_formats_arr = $time_formats_arr; $this->view->passworddata = $passworddataArr; if ($this->getRequest()->getPost()) { $result = $this->save($systempreferenceform); $this->view->msgarray = $result; } $this->view->popConfigPermission = $popConfigPermission; }
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(); } $popConfigPermission = array(); if (sapp_Global::_checkprivileges(COUNTRIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'country'); } $statesform = new Default_Form_states(); $statesmodel = new Default_Model_States(); $countriesModel = new Default_Model_Countries(); $msgarray = array(); $countrieslistArr = $countriesModel->getActiveCountriesList(); if (sizeof($countrieslistArr) > 0) { $statesform->countryid->addMultiOption('', 'Select Country'); foreach ($countrieslistArr as $countrieslistres) { $statesform->countryid->addMultiOption($countrieslistres['country_id_org'], $countrieslistres['country']); } } else { $msgarray['countryid'] = 'Countries are not configured yet'; } try { if ($id) { $data = $statesmodel->getStatesDataByID($id); if (!empty($data)) { $statesmodeldata = $statesmodel->getStatesList($data[0]['countryid']); foreach ($statesmodeldata as $state) { $statesform->state->addMultiOption($state['id'] . '!@#' . $state['state_name'], utf8_encode($state['state_name'])); } $statesform->populate($data[0]); $statesform->submit->setLabel('Update'); $this->view->stateValue = $data[0]['state_id_org'] . '!@#' . $data[0]['state']; $this->view->data = $data; $this->view->id = $id; $this->view->ermsg = ''; } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = ''; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $statesform; $this->view->msgarray = $msgarray; if ($this->getRequest()->getPost()) { $id = $this->_request->getParam('id'); $errorflag = "true"; $msgarray = array(); $newstateArr = array(); $dbstate = ''; $dbcountryid = ''; $statestring = ''; $countryid = $this->_request->getParam('countryid'); $stateArr = $this->_request->getParam('state'); if (!empty($stateArr)) { $otherstatename = trim($this->_request->getParam('otherstatename')); if (in_array('other', $stateArr)) { if ($otherstatename == '') { $msgarray['otherstatename'] = "Please enter state name."; $msgarray['dupstatename'] = ''; $msgarray['countid'] = $countryid; $errorflag = "false"; } else { $isDuplicateStateNameArr = $statesmodel->getDuplicateStateName($otherstatename, $countryid); if ($isDuplicateStateNameArr[0]['count'] > 0) { $errorflag = "false"; $msgarray['otherstatename'] = "State already exists"; $msgarray['dupstatename'] = $otherstatename; $msgarray['countid'] = $countryid; } else { $statestring = implode(",", $stateArr); if (sizeof($stateArr) > 1) { $newstateArr = $stateArr; array_pop($newstateArr); $statestring = implode(",", $newstateArr); $statestringcomma = trim(str_replace("!@#", ",", $statestring), ','); $statestringArr = explode(",", $statestringcomma); foreach ($statestringArr as $key => $val) { if (is_numeric($val)) { $stateid[] = $val; } else { $statename[] = $val; } } } $dbstate = $otherstatename; $errorflag = "true"; } } } else { $statestring = implode(",", $stateArr); $statestringcomma = trim(str_replace("!@#", ",", $statestring), ','); $statestringArr = explode(",", $statestringcomma); foreach ($statestringArr as $key => $val) { if (is_numeric($val)) { $stateid[] = $val; } else { $statename[] = $val; } } $errorflag = "true"; } } else { $msgarray['countid'] = $countryid; $errorflag = "false"; } if ($statesform->isValid($this->_request->getPost()) && $errorflag == "true" && $statestring != '') { $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; if (in_array('other', $stateArr)) { if ($otherstatename != '') { $NewStateId = $statesmodel->SaveMainStateData($countryid, $otherstatename); $NewStateInsertedId = $statesmodel->SaveorUpdateStatesData($countryid, $otherstatename, $NewStateId, $loginUserId); if (sizeof($stateArr) > 1) { if (!empty($stateid)) { for ($j = 0; $j < sizeof($stateid); $j++) { $Id = $statesmodel->SaveorUpdateStatesData($countryid, $statename[$j], $stateid[$j], $loginUserId); } } } $actionflag = 1; $tableid = $NewStateInsertedId; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "State added successfully.")); } } else { for ($j = 0; $j < sizeof($stateid); $j++) { $Id = $statesmodel->SaveorUpdateStatesData($countryid, $statename[$j], $stateid[$j], $loginUserId); } if ($id) { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "State updated successfully.")); $actionflag = 2; $tableid = $id; } else { if (sizeof($stateid) > 1) { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "States added successfully.")); } else { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "State added successfully.")); } $actionflag = 1; $tableid = $Id; } } $menuidArr = $menumodel->getMenuObjID('/states'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $this->_redirect('states'); } else { $messages = $statesform->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->getStatesList($countryid); foreach ($statesmodeldata as $res) { $statesform->state->addMultiOption($res['id'] . '!@#' . utf8_encode($res['state_name']), utf8_encode($res['state_name'])); } $statesform->state->addMultiOption('other', 'Other'); } $this->view->msgarray = $msgarray; } } $this->view->popConfigPermission = $popConfigPermission; }
public function configureorganisationAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = array(); $new_stateId = ''; if (sapp_Global::_checkprivileges(COUNTRIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'country'); } if (sapp_Global::_checkprivileges(STATES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'state'); } if (sapp_Global::_checkprivileges(CITIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'city'); } $msgarray = array(); $new_stateId = ''; $new_cityId = ''; $id = $this->getRequest()->getParam('id'); $form = new Default_Form_Organisationinfo(); $orgInfoModel = new Default_Model_Organisationinfo(); $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $wizard_model = new Default_Model_Wizard(); $wizardData = $wizard_model->getWizardData(); $orginfodata = $orgInfoModel->getOrganisationInfo(); $allCountriesData = $countriesModel->fetchAll('isactive=1', 'country')->toArray(); $allStatesData = $statesmodel->fetchAll('isactive=1', 'state')->toArray(); $allCitiesData = $citiesmodel->fetchAll('isactive=1', 'city')->toArray(); $form->setAttrib('action', DOMAIN . 'wizard/configureorganisation'); $flag = 'true'; 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($orginfodata)) { try { $data = $orginfodata[0]; $data['org_startdate'] = sapp_Global::change_date($data['org_startdate'], 'view'); $form->populate($data); $countryId = $data['country']; $stateId = $data['state']; $cityId = $data['city']; $actionpage = 'edit'; if (count($_POST) > 0) { $countryId = isset($_POST['country']) ? $_POST['country'] : ""; $stateId = isset($_POST['state']) ? $_POST['state'] : ""; $cityId = isset($_POST['city']) ? $_POST['city'] : ""; } if ($countryId != '') { $statesData = $statesmodel->getBasicStatesList((int) $countryId); foreach ($statesData as $res) { if ($stateId == $res['state_id_org']) { $new_stateId = $res['state_id_org'] . '!@#' . utf8_encode($res['state']); } $form->state->addMultiOption($res['state_id_org'] . '!@#' . utf8_encode($res['state']), utf8_encode($res['state'])); } if (count($_POST) == 0) { $stateId = $new_stateId; } } if ($stateId != '') { $citiesData = $citiesmodel->getBasicCitiesList((int) $stateId); foreach ($citiesData as $res) { if ($cityId == $res['city_org_id']) { $new_cityId = $res['city_org_id'] . '!@#' . utf8_encode($res['city']); } $form->city->addMultiOption($res['city_org_id'] . '!@#' . utf8_encode($res['city']), utf8_encode($res['city'])); } if (count($_POST) == 0) { $cityId = $new_cityId; } } $form->setDefault('country', $countryId); $form->setDefault('state', $stateId); $form->setDefault('city', $cityId); $this->view->domainValue = $data['domain']; $this->view->org_image = $data['org_image']; $this->view->ermsg = ''; $this->view->datarr = $data; } catch (Exception $e) { $this->view->ermsg = 'nodata'; } } else { sapp_Global::buildlocations($form, $wizardData); } $this->view->form = $form; if (!empty($allCountriesData) && !empty($allStatesData) && !empty($allCitiesData)) { $this->view->configuremsg = ''; } else { $this->view->configuremsg = 'notconfigurable'; } $this->view->wizarddata = $wizardData; $this->view->msgarray = $msgarray; $this->view->popConfigPermission = $popConfigPermission; $this->view->messages = $this->_helper->flashMessenger->getMessages(); if ($this->getRequest()->getPost()) { $result = $this->saveorginfo($form, $loginUserId, $wizardData); $this->view->msgarray = $result; if (isset($this->msgarray['domain'])) { $this->view->msMsg = 'multiselecterror'; } } }
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; } $popConfigPermission = array(); $basecurrexists = ''; $targetcurrexists = ''; if (sapp_Global::_checkprivileges(CURRENCY, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'currency'); } $this->view->popConfigPermission = $popConfigPermission; $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $currencyconverterform = new Default_Form_currencyconverter(); $currencyconvertermodel = new Default_Model_Currencyconverter(); $currencymodel = new Default_Model_Currency(); $currencyconverterform->submit->setLabel('Update'); try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $currencyconvertermodel->getCurrencyConverterDatabyID($id); $currencyconverterform->basecurrency->addMultiOption('', 'Select Base Currency'); if (!empty($data)) { $data = $data[0]; if ($data['basecurrency'] && $data['targetcurrency']) { $basecurrencydata = $currencymodel->getCurrencyList(); $targetcurrencydata = $currencymodel->getCurrencyList(); foreach ($basecurrencydata as $res) { $currencyconverterform->basecurrency->addMultiOption($res['id'], utf8_encode($res['currency'])); if ($res['id'] == $data['basecurrency']) { $basecurrexists = 'true'; } } foreach ($targetcurrencydata as $res) { if ($data['basecurrency'] != $res['id']) { $currencyconverterform->targetcurrency->addMultiOption($res['id'], utf8_encode($res['currency'])); if ($res['id'] == $data['targetcurrency']) { $targetcurrexists = 'true'; } } } } $currencyconverterform->populate($data); $startdate = sapp_Global::change_date($data["start_date"], 'view'); $enddate = sapp_Global::change_date($data["end_date"], 'view'); $currencyconverterform->start_date->setValue($startdate); $currencyconverterform->end_date->setValue($enddate); $currencyconverterform->setDefault('basecurrency', $data['basecurrency']); $currencyconverterform->setDefault('targetcurrency', $data['targetcurrency']); $currencyconverterform->setAttrib('action', BASE_URL . 'currencyconverter/edit/id/' . $id); $this->view->data = $data; $this->view->basecurrexists = $basecurrexists; $this->view->targetcurrexists = $targetcurrexists; } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = ''; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $currencyconverterform; if ($this->getRequest()->getPost()) { $result = $this->save($currencyconverterform); $this->view->msgarray = $result; } }