Exemplo n.º 1
0
 public function getVAllEmployees()
 {
     $db = Zend_Db_Table::getDefaultAdapter();
     $empmodel = new Default_Model_Employee();
     $acceptedrolesArr = $empmodel->getUserRole();
     $roles = $acceptedrolesArr[0]['roles'];
     $where = "u.isactive = 1 AND u.userstatus = 'old' ";
     if ($roles != '') {
         $where .= " AND emprole IN(" . $roles . ")";
     }
     $empData = $db->query("SELECT u.id,u.profileimg,\n\t\t\t\t\t\t\t   concat(u.userfullname,if(j.jobtitlename is null,'',concat(' , ',j.jobtitlename))) as name\n\t\t\t\t\t\t\t   FROM main_users u\n\t\t\t\t\t\t\t   left JOIN main_jobtitles j on j.id = u.jobtitle_id\n\t\t\t\t\t\t\t   WHERE " . $where . " ORDER BY name ASC");
     $result = $empData->fetchAll();
     return $result;
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emp_performanceappraisal', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $userid = $this->getRequest()->getParam('userid');
             $employeeModal = new Default_Model_Employee();
             $isrowexist = $employeeModal->getsingleEmployeeData($userid);
             if ($isrowexist == 'norows') {
                 $this->view->rowexist = "norows";
             } else {
                 $this->view->rowexist = "rows";
             }
             $empdata = $employeeModal->getActiveEmployeeData($userid);
             if (!empty($empdata)) {
                 $empperformanceApprModel = new Default_Model_Empperformanceappraisal();
                 if ($userid) {
                     //To display Employee Profile information......
                     $usersModel = new Default_Model_Users();
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($userid);
                 }
                 $this->view->id = $userid;
                 $this->view->employeedata = $employeeData[0];
                 if ($this->getRequest()->getPost()) {
                 }
             }
             $this->view->empdata = $empdata;
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emp_additional', $empOrganizationTabs)) {
             $userID = "";
             $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('userid');
             $conText = '';
             $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');
             }
             if ($id == '') {
                 $id = $userID;
             }
             $Uid = $id ? $id : $userID;
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($Uid && is_numeric($Uid) && $Uid > 0) {
                     $usersModel = new Default_Model_Users();
                     $empdata = $employeeModal->getActiveEmployeeData($Uid);
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($Uid);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             $empadditionaldetailsModal = new Default_Model_Empadditionaldetails();
                             $view = Zend_Layout::getMvcInstance()->getView();
                             $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 = '';
                             } 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 = $empadditionaldetailsModal->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $Uid, $conText);
                             array_push($data, $dataTmp);
                             $this->view->dataArray = $data;
                             $this->view->call = $call;
                             $this->view->employeedata = $employeeData[0];
                             $this->view->id = $id;
                             $this->view->messages = $this->_helper->flashMessenger->getMessages();
                         }
                         $this->view->empdata = $empdata;
                     }
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
    public function sendmailstoemployees($oldRM, $newRM)
    {
        $baseUrl = BASE_URL;
        $employeeModal = new Default_Model_Employee();
        $employessunderEmpId = $employeeModal->getEmployeesUnderRM($oldRM);
        /* Send Mails to the employees whose reporting manager is changed */
        $oldRMData = $employeeModal->getsingleEmployeeData($oldRM);
        $newRMData = $employeeModal->getsingleEmployeeData($newRM);
        if (!empty($newRMData)) {
            foreach ($employessunderEmpId as $employee) {
                $options['subject'] = APPLICATION_NAME . ' : Change of reporting manager';
                $options['header'] = 'Change of reporting manager';
                $options['toEmail'] = $employee['emailaddress'];
                $options['toName'] = $employee['userfullname'];
                $options['message'] = '<div>Hello ' . ucfirst($employee['userfullname']) . ',
											<div>' . ucfirst($newRMData[0]['userfullname']) . ' is your new reporting manager.</div>
											<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login </div>
										</div>';
                $result = sapp_Global::_sendEmail($options);
            }
        }
    }
Exemplo n.º 5
0
 public function updateempdetails($employeeform)
 {
     $emproleStr = '';
     $roleArr = array();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $usersModel = new Default_Model_Usermanagement();
     $employeeModal = new Default_Model_Employee();
     $businessunit_id = $this->_request->getParam('businessunit_id', null);
     $department_id = $this->_request->getParam('department_id', null);
     $reporting_manager = $this->_request->getParam('reporting_manager', null);
     $jobtitle_id = $this->_request->getParam('jobtitle_id', null);
     $position_id = $this->_request->getParam('position_id', null);
     $user_id = $this->_getParam('user_id', null);
     $prefix_id = $this->_getParam('prefix_id', null);
     $extension_number = $this->_getParam('extension_number', null);
     if ($employeeform->isValid($this->_request->getPost())) {
         $id = $this->_request->getParam('id');
         $emp_status_id = $this->_request->getParam('emp_status_id', null);
         $date_of_joining = $this->_request->getParam('date_of_joining', null);
         $date_of_joining = sapp_Global::change_date($date_of_joining, 'database');
         $date_of_leaving = $this->_request->getParam('date_of_leaving', null);
         $date_of_leaving = sapp_Global::change_date($date_of_leaving, 'database');
         $years_exp = $this->_request->getParam('years_exp');
         //FOR USER table
         $employeeId = $this->_getParam('employeeId', null);
         $modeofentry = $this->_getParam('modeofentry', null);
         $hid_modeofentry = $this->_getParam('hid_modeofentry', null);
         $other_modeofentry = $this->_getParam('other_modeofentry', null);
         $userfullname = $this->_getParam('userfullname', null);
         $candidatereferredby = $this->_getParam('candidatereferredby', null);
         $rccandidatename = $this->_getParam('rccandidatename', null);
         $emprole = $this->_getParam('emprole', null);
         //roleid_group_id
         if ($emprole != "") {
             $roleArr = explode('_', $emprole);
             if (!empty($roleArr)) {
                 $emproleStr = $roleArr[0];
             }
         }
         $emailaddress = $this->_getParam('emailaddress', null);
         $tmp_name = $this->_request->getParam('tmp_emp_name', null);
         $act_inact = $this->_request->getParam("act_inact", null);
         //end of user table
         $date = new Zend_Date();
         $menumodel = new Default_Model_Menu();
         $empstatusarray = array(8, 9, 10);
         $actionflag = '';
         $tableid = '';
         if ($modeofentry == 'Direct' || $hid_modeofentry == 'Direct') {
             $candidate_key = 'userfullname';
             $candidate_value = $userfullname;
             $emp_name = $userfullname;
             $candidate_flag = 'no';
         } else {
             $candidate_key = 'rccandidatename';
             $candidate_value = $rccandidatename;
             $emp_name = $tmp_name;
             $candidate_flag = 'yes';
         }
         $trDb = Zend_Db_Table::getDefaultAdapter();
         // starting transaction
         $trDb->beginTransaction();
         try {
             $emppassword = sapp_Global::generatePassword();
             $user_data = array('emprole' => $emproleStr, $candidate_key => $candidate_value, 'emailaddress' => $emailaddress, 'modifiedby' => $loginUserId, 'modifieddate' => Zend_Registry::get('currentdate'), 'emppassword' => md5($emppassword), 'employeeId' => $employeeId, 'modeofentry' => $id == '' ? $modeofentry : "", 'selecteddate' => $date_of_joining, 'candidatereferredby' => $candidatereferredby, 'userstatus' => 'old', 'other_modeofentry' => $other_modeofentry);
             if ($id != '') {
                 $where = array('user_id=?' => $user_id);
                 $actionflag = 2;
                 $user_where = "id = " . $user_id;
                 unset($user_data['candidatereferredby']);
                 unset($user_data['userstatus']);
                 unset($user_data['emppassword']);
                 unset($user_data['employeeId']);
                 unset($user_data['modeofentry']);
                 unset($user_data['other_modeofentry']);
             } else {
                 $data['createdby'] = $loginUserId;
                 $data['createddate'] = gmdate("Y-m-d H:i:s");
                 $data['isactive'] = 1;
                 $user_data['createdby'] = $loginUserId;
                 $user_data['createddate'] = gmdate("Y-m-d H:i:s");
                 $user_data['isactive'] = 1;
                 if ($modeofentry != 'Direct') {
                     $user_data['userfullname'] = $emp_name;
                 }
                 $where = '';
                 $actionflag = 1;
                 $user_where = '';
             }
             $user_status = $usersModel->SaveorUpdateUserData($user_data, $user_where);
             if ($id == '') {
                 $user_id = $user_status;
             }
             $data = array('user_id' => $user_id, 'reporting_manager' => $reporting_manager, 'emp_status_id' => $emp_status_id, 'businessunit_id' => $businessunit_id, 'department_id' => $department_id, 'jobtitle_id' => $jobtitle_id, 'position_id' => $position_id, 'prefix_id' => $prefix_id, 'extension_number' => $extension_number, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'years_exp' => $years_exp == '' ? null : $years_exp, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $Id = $employeeModal->SaveorUpdateEmployeeData($data, $where);
             $statuswhere = array('id=?' => $user_id);
             if (in_array($emp_status_id, $empstatusarray)) {
                 $isactivestatus = '';
                 if ($emp_status_id == 8) {
                     $isactivestatus = 2;
                 } else {
                     if ($emp_status_id == 9) {
                         $isactivestatus = 3;
                     } else {
                         if ($emp_status_id == 10) {
                             $isactivestatus = 4;
                         }
                     }
                 }
                 $statusdata = array('isactive' => $isactivestatus);
                 $empstatusId = $usersModel->SaveorUpdateUserData($statusdata, $statuswhere);
             } else {
                 $statusdata = array('isactive' => 1);
                 $empstatusId = $usersModel->SaveorUpdateUserData($statusdata, $statuswhere);
             }
             if ($Id == 'update') {
                 $tableid = $id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee details updated successfully."));
             } else {
                 //start of mailing
                 $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                 $view = $this->getHelper('ViewRenderer')->view;
                 $this->view->emp_name = $emp_name;
                 $this->view->password = $emppassword;
                 $this->view->emp_id = $employeeId;
                 $this->view->base_url = $base_url;
                 $text = $view->render('mailtemplates/newpassword.phtml');
                 $options['subject'] = APPLICATION_NAME . ' login credentials';
                 $options['header'] = 'Greetings from Sentrifugo';
                 $options['toEmail'] = $emailaddress;
                 $options['toName'] = $this->view->emp_name;
                 $options['message'] = $text;
                 $result = sapp_Global::_sendEmail($options);
                 //end of mailing
                 $tableid = $Id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee details added successfully."));
             }
             $menuidArr = $menumodel->getMenuObjID('/employee');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             $menuidArr = $menumodel->getMenuObjID('/usermanagement');
             $menuID_user = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id);
             if ($act_inact == 1) {
                 if ($user_data['isactive'] == 1) {
                     $act_str = array("Activated" => Zend_Registry::get('currentdate'));
                 } else {
                     $act_str = array("Inactivated" => Zend_Registry::get('currentdate'));
                 }
                 $result = sapp_Global::logManager($menuID_user, 4, $loginUserId, $user_id, '', $act_str);
             }
             $trDb->commit();
             $this->_redirect('employee/edit/id/' . $user_id);
         } catch (Exception $e) {
             $trDb->rollBack();
             $msgarray['employeeId'] = "Something went wrong,please try again later.";
             return $msgarray;
         }
     } else {
         $messages = $employeeform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         $usersModel = new Default_Model_Users();
         if (isset($businessunit_id) && $businessunit_id != 0 && $businessunit_id != '') {
             $departmentsmodel = new Default_Model_Departments();
             $departmentlistArr = $departmentsmodel->getDepartmentList($businessunit_id);
             $employeeform->department_id->clearMultiOptions();
             $employeeform->reporting_manager->clearMultiOptions();
             $employeeform->department_id->addMultiOption('', 'Select Department');
             foreach ($departmentlistArr as $departmentlistresult) {
                 $employeeform->department_id->addMultiOption($departmentlistresult['id'], utf8_encode($departmentlistresult['deptname']));
             }
             if (isset($department_id) && $department_id != 0 && $department_id != '') {
                 $employeeform->setDefault('department_id', $department_id);
             }
         }
         if (isset($department_id) && $department_id != 0 && $department_id != '') {
             $reportingManagerArr = $usersModel->getReportingManagerList($department_id, $user_id);
             $employeeform->reporting_manager->addMultiOption('', 'Select Reporting Manager');
             foreach ($reportingManagerArr as $reportingManagerresult) {
                 $employeeform->reporting_manager->addMultiOption($reportingManagerresult['id'], utf8_encode($reportingManagerresult['userfullname']));
             }
             if (isset($reporting_manager) && $reporting_manager != 0 && $reporting_manager != '') {
                 $employeeform->setDefault('reporting_manager', $reporting_manager);
             }
         }
         if (isset($jobtitle_id) && $jobtitle_id != 0 && $jobtitle_id != '') {
             $positionsmodel = new Default_Model_Positions();
             $positionlistArr = $positionsmodel->getPositionList($jobtitle_id);
             $employeeform->position_id->clearMultiOptions();
             $employeeform->position_id->addMultiOption('', 'Select Position');
             foreach ($positionlistArr as $positionlistRes) {
                 $employeeform->position_id->addMultiOption($positionlistRes['id'], utf8_encode($positionlistRes['positionname']));
             }
             if (isset($position_id) && $position_id != 0 && $position_id != '') {
                 $employeeform->setDefault('position_id', $position_id);
             }
         }
         return $msgarray;
     }
 }
 public function 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 viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('visadetails', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             $objName = 'visaandimmigrationdetails';
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             $employeeModal = new Default_Model_Employee();
             $visaandimmigrationDetailsform = new Default_Form_Visaandimmigrationdetails();
             $visaandimmigrationdetailsModel = new Default_Model_Visaandimmigrationdetails();
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $empdata = $employeeModal->getsingleEmployeeData($id);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             $visaandimmigrationDetailsform->removeElement("submit");
                             $elements = $visaandimmigrationDetailsform->getElements();
                             if (count($elements) > 0) {
                                 foreach ($elements as $key => $element) {
                                     if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                                         $element->setAttrib("disabled", "disabled");
                                     }
                                 }
                             }
                             $data = $visaandimmigrationdetailsModel->getvisadetailsRecord($id);
                             if (!empty($data)) {
                                 $visaandimmigrationDetailsform->setDefault("id", $data[0]["id"]);
                                 $visaandimmigrationDetailsform->setDefault("user_id", $data[0]["user_id"]);
                                 $visaandimmigrationDetailsform->setDefault("passport_number", $data[0]["passport_number"]);
                                 $pp_issue_date = sapp_Global::change_date($data[0]["passport_issue_date"], 'view');
                                 $visaandimmigrationDetailsform->setDefault('passport_issue_date', $pp_issue_date);
                                 $pp_expiry_date = sapp_Global::change_date($data[0]["passport_expiry_date"], 'view');
                                 $visaandimmigrationDetailsform->setDefault("passport_expiry_date", $pp_expiry_date);
                                 $visaandimmigrationDetailsform->setDefault("visa_number", $data[0]["visa_number"]);
                                 $visaandimmigrationDetailsform->setDefault("visa_type", $data[0]["visa_type"]);
                                 $v_issue_date = sapp_Global::change_date($data[0]["visa_issue_date"], 'view');
                                 $visaandimmigrationDetailsform->setDefault('visa_issue_date', $v_issue_date);
                                 $v_expiry_date = sapp_Global::change_date($data[0]["visa_expiry_date"], 'view');
                                 $visaandimmigrationDetailsform->setDefault("visa_expiry_date", $v_expiry_date);
                                 $visaandimmigrationDetailsform->setDefault("inine_status", $data[0]["inine_status"]);
                                 $inine_review = sapp_Global::change_date($data[0]["inine_review_date"], 'view');
                                 $visaandimmigrationDetailsform->setDefault("inine_review_date", $inine_review);
                                 $visaandimmigrationDetailsform->setDefault("issuing_authority", $data[0]["issuing_authority"]);
                                 $visaandimmigrationDetailsform->setDefault("ininetyfour_status", $data[0]["ininetyfour_status"]);
                                 $ininetyfour_expiry = sapp_Global::change_date($data[0]["ininetyfour_expiry_date"], 'view');
                                 $visaandimmigrationDetailsform->setDefault("ininetyfour_expiry_date", $ininetyfour_expiry);
                             }
                             $this->view->controllername = $objName;
                             $this->view->id = $id;
                             $this->view->data = $data;
                             $this->view->employeedata = $empdata[0];
                             $this->view->form = $visaandimmigrationDetailsform;
                         }
                         $this->view->empdata = $empdata;
                     }
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('creditcarddetails', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             $objName = 'creditcarddetails';
             $creditcardDetailsform = new Default_Form_Creditcarddetails();
             $creditcardDetailsModel = new Default_Model_Creditcarddetails();
             $creditcardDetailsform->removeElement("submit");
             $elements = $creditcardDetailsform->getElements();
             if (count($elements) > 0) {
                 foreach ($elements as $key => $element) {
                     if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                         $element->setAttrib("disabled", "disabled");
                     }
                 }
             }
             $data = $creditcardDetailsModel->getcreditcarddetailsRecord($id);
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $empdata = $employeeModal->getsingleEmployeeData($id);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             if (!empty($data)) {
                                 $creditcardDetailsform->setDefault("id", $data[0]['id']);
                                 $creditcardDetailsform->setDefault('user_id', $data[0]['user_id']);
                                 $creditcardDetailsform->setDefault("card_type", $data[0]["card_type"]);
                                 $creditcardDetailsform->setDefault("card_number", $data[0]["card_number"]);
                                 $creditcardDetailsform->setDefault("nameoncard", $data[0]["nameoncard"]);
                                 $expiry_date = sapp_Global::change_date($data[0]["card_expiration"], 'view');
                                 $creditcardDetailsform->setDefault('card_expiration', $expiry_date);
                                 $creditcardDetailsform->setDefault("card_issuedby", $data[0]["card_issued_comp"]);
                                 $creditcardDetailsform->setDefault("card_code", $data[0]["card_code"]);
                             }
                             $this->view->controllername = $objName;
                             $this->view->id = $id;
                             if (!empty($empdata)) {
                                 $this->view->employeedata = $empdata[0];
                             } else {
                                 $this->view->employeedata = $empdata;
                             }
                             $this->view->form = $creditcardDetailsform;
                             $this->view->data = $data;
                         }
                         $this->view->empdata = $empdata;
                     }
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
Exemplo n.º 9
0
    public function employeedetails($emparr, $conText, $userId)
    {
        $session = new Zend_Auth_Storage_Session();
        $data = $session->read();
        $loggedinuser = $data['id'];
        $group_id = $data['group_id'];
        $empdata = '';
        $employeetabsStr = '';
        $empdata = '<div class="ml-alert-1-success" id="empdetailsmsgdiv" style="display:none;">';
        $empdata .= '<div class="style-1-icon success" style="display:block;"></div>';
        $empdata .= '<div id="successtext"></div>';
        $empdata .= '</div>';
        $empdata .= '<div class="all-bg-ctrl">';
        $employeeModal = new Default_Model_Employee();
        $employessunderEmpId = $employeeModal->getEmployeesUnderRM($userId);
        if (!empty($employessunderEmpId)) {
            $empdata .= '<input type="hidden" value="true" id="hasteam" name="hasteam" />';
        } else {
            $empdata .= '<input type="hidden" value="false" id="hasteam" name="hasteam" />';
        }
        if ($conText == 'edit' || $conText == 'view') {
            //If the user has BG status as "Yet to start" then we should enable the link....
            $usersModel = new Default_Model_Users();
            $bgstatusArr = $usersModel->getBGstatus($userId);
            if (!empty($bgstatusArr) && isset($bgstatusArr) && $bgstatusArr[0]['group_id'] != MANAGEMENT_GROUP) {
                if ($bgstatusArr[0]['isactive'] == 1) {
                    $empdata .= '<div id="hrbgchecklink" style="display:none;" class="action-to-page"><a href="' . BASE_URL . '/empscreening/checkscreeningstatus/empid/' . $userId . '">Send for background checks</a></div>';
                }
            }
        }
        if ($conText != 'mydetails') {
            $empdata .= '<div class="back-to-page"><input type="button" value="Back" name="Back" onclick="gobacktocontroller(\'' . $conText . '\');"></div>';
        }
        $empdata .= '<div class="emp-screen-view">';
        $empdata .= '<div class="display-img-div" id="displayimg" >';
        $empdata .= '<div class="employee-pic-emp">';
        if ($emparr['profileimg'] != '') {
            $empdata .= '<img id="userImage" src="' . BASE_URL . "/public/uploads/profile/" . $emparr['profileimg'] . '" onerror="this.src=\'' . BASE_URL . '/public/media/images/default-profile-pic.jpg\'"/>';
        } else {
            $empdata .= '<img id="userImage" src="' . BASE_URL . '/public/media/images/employee-deafult-pic.jpg" />';
        }
        if ($conText != 'mydetails') {
            if ($group_id == HR_GROUP || $loggedinuser == SUPERADMIN || $group_id == MANAGEMENT_GROUP) {
                $sel_act = $sel_dact = "";
                if ($emparr['isactive'] < 2 && $emparr['emptemplock'] == 0) {
                    if ($emparr['isactive'] == 1) {
                        $sel_act = "selected";
                    } else {
                        if ($emparr['isactive'] == 0) {
                            $sel_dact = "selected";
                        }
                    }
                    $empdata .= '<p class="field switch"><label class="cb-enable  ' . $sel_act . '"><span>Active</span></label><label class="cb-disable ' . $sel_dact . '"><span>Inactive</span></label> </p>';
                    if ($sel_act == "selected") {
                        $empdata .= "\n\t\t\t\t\t\t\t\t\t<script type='text/javascript' language='javascript'>\n\t\t\t\t\t\t\t\t\t\t\$('.cb-disable').click(function(){              \n\t\t\t\t\t\t\t\t\t\t\tmakeActiveInactive('inactive','" . $emparr['id'] . "');\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t</script> ";
                    } else {
                        if ($sel_dact == "selected") {
                            $empdata .= "\n\t\t\t\t\t\t\t\t\t<script type='text/javascript' language='javascript'>\n\t\t\t\t\t\t\t\t\t\t\$('.cb-enable').click(function(){                \n\t\t\t\t\t\t\t\t\t\t\tmakeActiveInactive('active','" . $emparr['id'] . "');\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t</script> ";
                        }
                    }
                } else {
                    if ($emparr['isactive'] < 2 && $emparr['emptemplock'] == 1) {
                        $sel_dact = "selected";
                        $sel_act = "";
                        $empdata .= '<p class="field switch"><label class="cb-enable  ' . $sel_act . '"><span>Active</span></label><label class="cb-disable ' . $sel_dact . '"><span>Inactive</span></label> </p>';
                        $empdata .= "\n\t\t\t\t\t\t\t\t<script type='text/javascript' language='javascript'>\n\t\t\t\t\t\t\t\t\t\$('.cb-enable').click(function(){                \n\t\t\t\t\t\t\t\t\t\tmakeActiveInactive('active','" . $emparr['id'] . "');\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t</script>   \n\t\t\t\t\t\t\t\t";
                    } else {
                        $sel_dact = "selected";
                        $sel_act = "";
                        $empdata .= '<p class="field switch"><label class="cb-enable  ' . $sel_act . '"><span>Active</span></label><label class="cb-disable ' . $sel_dact . '"><span>Inactive</span></label> </p>';
                        $empdata .= "\n\t\t\t\t\t\t\t\t<script type='text/javascript' language='javascript'>\n\t\t\t\t\t\t\t\t\t\$('.cb-enable,.cb-disable').click(function(){                \n\t\t\t\t\t\t\t\t\t\tmakeActiveInactive('other','" . $emparr['isactive'] . "');\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t</script>   \n\t\t\t\t\t\t\t\t";
                    }
                }
            }
        }
        $empdata .= '</div>';
        $empdata .= '<div id="loaderimg" style="display:none; clear:both; margin:0 auto; text-align: center; width:100%;"><img src="' . BASE_URL . "/public/media/images/loaderwhite_21X21.gif" . '" style="width:21px; height: 21px; float: none; "/>';
        $empdata .= '</div>';
        $empdata .= '</div>';
        $empdata .= '<div id="personalDetailsDiv">';
        if ($emparr['is_orghead'] == '1') {
            $headicon = '<img src="' . BASE_URL . "/public/media/images/org-head.png" . '" class="org-head-icon" />';
        } else {
            $headicon = '';
        }
        if (isset($emparr['active_prefix']) && isset($emparr['prefix']) && $emparr['active_prefix'] == 1 && $emparr['prefix'] != '') {
            $empdata .= '<p><b>Employee Name <i>:</i></b><span class="emp-name-span bold-text">' . $emparr['prefix'] . '.&nbsp;' . $emparr['userfullname'] . '</span>' . $headicon . '</p>';
        } else {
            $empdata .= '<p><b>Employee Name <i>:</i></b><span class="emp-name-span bold-text">' . $emparr['userfullname'] . '</span>' . $headicon . '</p>';
        }
        $empdata .= '<p><b>Employee Id <i>:</i></b><span class="emp-name-span" id ="spanempid">' . $emparr['employeeId'] . '</span></p>';
        $empdata .= '<p><b>Email Id <i>:</i></b><span><a href="javascript:void(0)">' . $emparr['emailaddress'] . '</a></span></p>';
        if ($emparr['contactnumber'] != '') {
            $empdata .= '<p><b>Contact Number <i>:</i></b>';
            $empdata .= '<span id="contactnospan" >' . $emparr['contactnumber'] . '</span>';
            if ($group_id == HR_GROUP || $loggedinuser == SUPERADMIN || $loggedinuser == $userId || $group_id == MANAGER_GROUP) {
                $empdata .= '<span class="number-edit"><input type="button" value="Update" id="editcontactnumber" name="Edit Number" onclick="opencontactnumberpopup(\'' . $emparr['id'] . '\',\'edit\',\'' . $emparr['contactnumber'] . '\');">';
                $empdata .= '</span>';
            }
            $empdata .= '</p>';
        } else {
            $empdata .= '<p><b>Contact Number <i>:</i></b>';
            $empdata .= '<span id="contactnospan" ></span>';
            if ($group_id == HR_GROUP || $loggedinuser == SUPERADMIN || $loggedinuser == $userId || $group_id == MANAGER_GROUP) {
                $empdata .= '<span class="number-add"><input type="button" value="Add" id="addcontactnumber" name="Add Number" onclick="opencontactnumberpopup(\'' . $emparr['id'] . '\',\'add\',\'\');">';
                $empdata .= '</span>';
            }
            $empdata .= '</p>';
        }
        $empdata .= '</div>';
        $empdata .= '</div>';
        $empdata .= '<div id="employeeContainer"  style="display: none; overflow: auto;">
						<div class="heading">
							<a href="javascript:void(0)">
								<img src="' . BASE_URL . '/public/media/images/close.png" name="" align="right" border="0" hspace="3" vspace="5" class="closeAttachPopup" style="margin: -24px 8px 0 0;"> 
							</a>
						</div>
						<iframe id="employeeCont" name="employeeCont" class="business_units_iframe" frameborder="0"></iframe>
					</div>';
        $empdata .= '</div>';
        echo $empdata;
        $employeetabsStr = $this->employeetabs($conText, $userId);
        echo $employeetabsStr;
    }
 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;
 }
Exemplo n.º 11
0
 public function addemppopupAction()
 {
     $flag = 'true';
     $controllername = 'employee';
     $msgarray = array();
     $emptyFlag = 0;
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $deptidforhead = $this->_getParam('deptidforhead', null);
     $report_opt = array();
     $emp_form = new Default_Form_employee();
     $user_model = new Default_Model_Usermanagement();
     $role_model = new Default_Model_Roles();
     $prefixModel = new Default_Model_Prefix();
     $identity_code_model = new Default_Model_Identitycodes();
     $jobtitlesModel = new Default_Model_Jobtitles();
     $deptModel = new Default_Model_Departments();
     $positionsmodel = new Default_Model_Positions();
     $employeeModal = new Default_Model_Employee();
     $usersModel2 = new Default_Model_Users();
     $employmentstatusModel = new Default_Model_Employmentstatus();
     $emp_form->setAction(DOMAIN . 'employee/addemppopup/deptidforhead/' . $deptidforhead);
     $emp_form->removeElement('department_id');
     $emp_form->removeElement('modeofentry');
     $identity_codes = $identity_code_model->getIdentitycodesRecord();
     $emp_identity_code = isset($identity_codes[0]) ? $identity_codes[0]['employee_code'] : "";
     if ($emp_identity_code != '') {
         $emp_id = $emp_identity_code . str_pad($user_model->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT);
     } else {
         $emp_id = '';
         $msgarray['employeeId'] = 'Identity codes are not configured yet.';
         $flag = 'false';
     }
     $emp_form->employeeId->setValue($emp_id);
     $role_data = $role_model->getRolesList_Dept();
     $emp_form->emprole->addMultiOptions(array('' => 'Select Role') + $role_data);
     if (empty($role_data)) {
         $msgarray['emprole'] = 'Roles are not configured yet.';
         $flag = 'false';
     }
     $prefixData = $prefixModel->getPrefixList();
     $emp_form->prefix_id->addMultiOption('', 'Select Prefix');
     if (!empty($prefixData)) {
         foreach ($prefixData as $prefixres) {
             $emp_form->prefix_id->addMultiOption($prefixres['id'], $prefixres['prefix']);
         }
     } else {
         $msgarray['prefix_id'] = 'Prefixes are not configured yet.';
         $flag = 'false';
     }
     $jobtitleData = $jobtitlesModel->getJobTitleList();
     if (!empty($jobtitleData)) {
         foreach ($jobtitleData as $jobtitleres) {
             $emp_form->jobtitle_id->addMultiOption($jobtitleres['id'], $jobtitleres['jobtitlename']);
         }
     } else {
         $msgarray['jobtitle_id'] = 'Job titles are not configured yet.';
         $msgarray['position_id'] = 'Positions are not configured yet.';
         $flag = 'false';
     }
     if (isset($_POST['jobtitle_id']) && $_POST['jobtitle_id'] != '') {
         $positionlistArr = $positionsmodel->getPositionList($_POST['jobtitle_id']);
         if (sizeof($positionlistArr) > 0) {
             $emp_form->position_id->addMultiOption('', 'Select Position');
             foreach ($positionlistArr as $positionlistres) {
                 $emp_form->position_id->addMultiOption($positionlistres['id'], $positionlistres['positionname']);
             }
         }
     }
     $employmentStatusData = $employmentstatusModel->getempstatusActivelist();
     $emp_form->emp_status_id->addMultiOption('', 'Select Employment Status');
     if (!empty($employmentStatusData)) {
         foreach ($employmentStatusData as $employmentStatusres) {
             $emp_form->emp_status_id->addMultiOption($employmentStatusres['workcodename'], $employmentStatusres['statusname']);
         }
     } else {
         $msgarray['emp_status_id'] = 'Employment status is not configured yet.';
         $emptyFlag++;
     }
     $reportingManagerData = $usersModel2->getReportingManagerList_employees('', '', MANAGEMENT_GROUP);
     if (!empty($reportingManagerData)) {
         $report_opt = $reportingManagerData;
         if (isset($_POST['reporting_manager']) && $_POST['reporting_manager'] != '') {
             $emp_form->setDefault('reporting_manager', $_POST['reporting_manager']);
         }
     } else {
         $msgarray['reporting_manager'] = 'Reporting managers are not added yet.';
         $flag = 'false';
     }
     if ($this->getRequest()->getPost()) {
         if ($emp_form->isValid($this->_request->getPost()) && $flag == 'true') {
             $jobtitle_id = $this->_request->getParam('jobtitle_id', null);
             $position_id = $this->_request->getParam('position_id', null);
             $date_of_joining = sapp_Global::change_date($this->_request->getParam('date_of_joining', null), 'database');
             $date_of_leaving = $this->_request->getParam('date_of_leaving', null);
             $date_of_leaving = sapp_Global::change_date($date_of_leaving, 'database');
             $employeeId = $this->_getParam('employeeId', null);
             $emprole = $this->_getParam('emprole', null);
             $reporting_manager = $this->_getParam('reporting_manager', null);
             $emailaddress = $this->_getParam('emailaddress', null);
             $emppassword = sapp_Global::generatePassword();
             $userfullname = trim($this->_request->getParam('userfullname', null));
             $prefix_id = $this->_getParam('prefix_id', null);
             $user_id = $this->_getParam('user_id', null);
             $emp_status_id = $this->_getParam('emp_status_id', null);
             $user_data = array('emprole' => $emprole, 'userfullname' => $userfullname, 'emailaddress' => $emailaddress, 'jobtitle_id' => $jobtitle_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'emppassword' => md5($emppassword), 'employeeId' => $employeeId, 'modeofentry' => 'Direct', 'selecteddate' => $date_of_joining, 'userstatus' => 'old');
             $emp_data = array('user_id' => $user_id, 'jobtitle_id' => $jobtitle_id, 'position_id' => $position_id, 'prefix_id' => $prefix_id, 'department_id' => $deptidforhead, 'reporting_manager' => $reporting_manager, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'emp_status_id' => $emp_status_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $user_data['createdby'] = $loginUserId;
             $user_data['createddate'] = gmdate("Y-m-d H:i:s");
             $user_data['isactive'] = 1;
             if ($emp_identity_code != '') {
                 $emp_id = $emp_identity_code . str_pad($user_model->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT);
             } else {
                 $emp_id = '';
             }
             $user_data['employeeId'] = $emp_id;
             $user_id = $user_model->SaveorUpdateUserData($user_data, '');
             $emp_data['user_id'] = $user_id;
             $emp_data['createdby'] = $loginUserId;
             $emp_data['createddate'] = gmdate("Y-m-d H:i:s");
             $emp_data['isactive'] = 1;
             $employeeModal->SaveorUpdateEmployeeData($emp_data, '');
             //end of saving into employee table.
             $tableid = $user_id;
             $actionflag = 1;
             $menuID = ORGANISATIONINFO;
             try {
                 $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             } catch (Exception $e) {
                 echo $e->getMessage();
             }
             $managementUsersData = $deptModel->getDeptHeads();
             $opt = '';
             foreach ($managementUsersData as $record) {
                 $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['userfullname']);
             }
             $this->view->managementUsersData = $opt;
             /* Send Mail to the user */
             $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
             $view = $this->getHelper('ViewRenderer')->view;
             $this->view->emp_name = $userfullname;
             $this->view->password = $emppassword;
             $this->view->emp_id = $employeeId;
             $this->view->base_url = $base_url;
             $text = $view->render('mailtemplates/newpassword.phtml');
             $options['subject'] = APPLICATION_NAME . ' login Credentials';
             $options['header'] = 'Greetings from Sentrifugo';
             $options['toEmail'] = $emailaddress;
             $options['toName'] = $this->view->emp_name;
             $options['message'] = $text;
             $result = sapp_Global::_sendEmail($options);
             /* END */
             $this->view->eventact = 'added';
             $close = 'close';
             $this->view->popup = $close;
         } else {
             $messages = $emp_form->getMessages();
             foreach ($messages as $key => $val) {
                 foreach ($val as $key2 => $val2) {
                     $msgarray[$key] = $val2;
                     break;
                 }
             }
             $this->view->msgarray = $msgarray;
         }
     }
     $this->view->msgarray = $msgarray;
     $this->view->report_opt = $report_opt;
     $this->view->controllername = $controllername;
     $this->view->emp_form = $emp_form;
 }
Exemplo n.º 12
0
 public function empautoAction()
 {
     $term = $this->_getParam('term', null);
     $output = array(array('id' => '', 'value' => 'No records', 'label' => 'No records'));
     $emp_model = new Default_Model_Employee();
     if ($term != '') {
         $emp_arr = $emp_model->getAutoReportEmp($term);
         if (count($emp_arr) > 0) {
             $output = array();
             foreach ($emp_arr as $emp) {
                 $output[] = array('id' => $emp['user_id'], 'value' => $emp['emp_name'], 'label' => $emp['emp_name'], 'profile_img' => $emp['profileimg']);
             }
         }
     }
     $this->_helper->json($output);
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('disabilitydetails', $empOrganizationTabs)) {
             $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;
             }
             $id = $this->getRequest()->getParam('userid');
             $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)) {
                         $callval = $this->getRequest()->getParam('call');
                         if ($callval == 'ajaxcall') {
                             $this->_helper->layout->disableLayout();
                         }
                         $objName = 'disabilitydetails';
                         $employeeData = array();
                         $empDisabilitydetailsform = new Default_Form_Disabilitydetails();
                         $empDisabilitydetailsModel = new Default_Model_Disabilitydetails();
                         $empDisabilitydetailsform->removeElement("submit");
                         $elements = $empDisabilitydetailsform->getElements();
                         if (count($elements) > 0) {
                             foreach ($elements as $key => $element) {
                                 if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                                     $element->setAttrib("disabled", "disabled");
                                 }
                             }
                         }
                         $data = $empDisabilitydetailsModel->getempDisabilitydetails($id);
                         $usersModel = new Default_Model_Users();
                         $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                         if (!empty($data)) {
                             $empDisabilitydetailsform->setDefault('user_id', $data[0]['user_id']);
                             $empDisabilitydetailsform->setDefault('disability_name', $data[0]['disability_name']);
                             $empDisabilitydetailsform->setDefault('disability_type', $data[0]['disability_type']);
                             $empDisabilitydetailsform->setDefault('other_disability_type', $data[0]['other_disability_type']);
                             $empDisabilitydetailsform->setDefault('disability_description', $data[0]['disability_description']);
                         }
                         $this->view->controllername = $objName;
                         $this->view->id = $id;
                         $this->view->data = $data;
                         $this->view->employeedata = $employeeData[0];
                         $this->view->form = $empDisabilitydetailsform;
                     }
                     $this->view->empdata = $empdata;
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     }
 }
Exemplo n.º 14
0
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emp_holidays', $empOrganizationTabs)) {
             $conText = "";
             $userID = '';
             $msgarray = array();
             $empGroupId = '';
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $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');
             }
             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 (sizeof($holidaygroupArr) > 0) {
                                 $empGroupId = $holidaygroupArr[0]['id'];
                                 foreach ($holidaygroupArr as $holidaygroupres) {
                                     $empholidaysform->holiday_group->addMultiOption($holidaygroupres['id'], $holidaygroupres['groupname']);
                                 }
                             } else {
                                 $msgarray['empholidaysform'] = 'Holiday groups not configured 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'];
                                 $this->view->data = $data;
                             }
                             $empholidaysform->setAttrib('action', BASE_URL . 'empholidays/edit/userid/' . $id);
                             $this->view->form = $empholidaysform;
                         }
                         if ($this->getRequest()->getPost()) {
                             $result = $this->save($empholidaysform, $id);
                             $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 = '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->messages = $this->_helper->flashMessenger->getMessages();
                         if (!empty($employeeData)) {
                             $this->view->employeedata = $employeeData[0];
                         }
                     }
                     $this->view->empdata = $empdata;
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function displaymanagersAction()
 {
     $ajaxContext = $this->_helper->getHelper('AjaxContext');
     $ajaxContext->addActionContext('displaymanagers', 'html')->initContext();
     $line1_data = array();
     $line_managers = array();
     $type = $this->_getParam('type', null);
     $levels = $this->_getParam('levels', null);
     $init_id = $this->_getParam('init_id', null);
     $line1_id = $this->_getParam('line1_id', null);
     $context = $this->_getParam('context', 'add');
     $employeeid = $this->_getParam('employeeid');
     $app_levels = 1;
     $app_init_model = new Default_Model_Appraisalinit();
     $appEmpRatingsModel = new Default_Model_Appraisalemployeeratings();
     $init_data = $app_init_model->getConfigData($init_id);
     if (count($init_data) > 0) {
         $init_data = $init_data[0];
     }
     $managers = $app_init_model->getRepManagers_new($type, $init_id, $init_data);
     if ($context == 'edit') {
         $emp_model = new Default_Model_Employee();
         $line1_data = $emp_model->getEmp_from_summary($line1_id);
         $line_managers = $app_init_model->getLineManagers_new($init_id, $employeeid);
         $line_managers = array_filter($line_managers);
     }
     $appEmpRatingsData = $appEmpRatingsModel->getSelectedAppraisalData_notused($init_id, $employeeid);
     if (!empty($appEmpRatingsData)) {
         if ($appEmpRatingsData['appstatus'] != 1) {
             $app_levels = $appEmpRatingsData['appstatus'] - 1;
         }
     }
     $this->view->levels = $levels;
     $this->view->managers = $managers;
     $this->view->init_id = $init_id;
     $this->view->context = $context;
     $this->view->line1_data = $line1_data;
     $this->view->line_managers = $line_managers;
     $this->view->line1_id = $line1_id;
     $this->view->app_levels = $app_levels;
     $this->render('displaymanagers');
 }
 public function getapproverAction()
 {
     $ajaxContext = $this->_helper->getHelper('AjaxContext');
     $ajaxContext->addActionContext('getapprover', 'html')->initContext();
     $employeemodel = new Default_Model_Employee();
     $elementid = $this->_request->getParam('elementid');
     $bunitid = $this->_request->getParam('bunitid');
     $deptid = $this->_request->getParam('deptid');
     $approver_1 = $this->_request->getParam('approver_1');
     $approver_2 = $this->_request->getParam('approver_2');
     $employeeData = array();
     $approvercount = '';
     $empstring = '';
     if ($elementid == 'approvingauthority') {
         $approvercount = 1;
     } else {
         if ($elementid == 'approver_1') {
             $approvercount = 2;
         } else {
             $approvercount = 3;
         }
     }
     if ($approver_1 != '') {
         $empstring = $approver_1;
     }
     if ($approver_2 != '') {
         $empstring .= ',' . $approver_2;
     }
     $employeeData = $employeemodel->getApproverForServiceDesk($bunitid, $deptid, $empstring);
     $this->view->employeedata = $employeeData;
     $this->view->approvercount = $approvercount;
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('workeligibilitydetails', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $employeeData = array();
             $id = $this->getRequest()->getParam('userid');
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             $objName = 'workeligibilitydetails';
             $issuingauthority = '';
             $employeeModal = new Default_Model_Employee();
             $workeligibilityform = new Default_Form_Workeligibilitydetails();
             $workeligibilityform->removeElement("submit");
             $elements = $workeligibilityform->getElements();
             if (count($elements) > 0) {
                 foreach ($elements as $key => $element) {
                     if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                         $element->setAttrib("disabled", "disabled");
                     }
                 }
             }
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $usersModel = new Default_Model_Users();
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             $workeligibilityModel = new Default_Model_Workeligibilitydetails();
                             if ($id) {
                                 $usersModel = new Default_Model_Users();
                                 $workeligibilityDoctypesModal = new Default_Model_Workeligibilitydoctypes();
                                 $countriesModel = new Default_Model_Countries();
                                 $statesmodel = new Default_Model_States();
                                 $citiesmodel = new Default_Model_Cities();
                                 $countrieslistArr = $countriesModel->getTotalCountriesList();
                                 if (sizeof($countrieslistArr) > 0) {
                                     $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($id);
                                 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 (sizeof($statelistArr) > 0) {
                                             $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 (sizeof($citylistArr) > 0) {
                                             $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->documenttype_id->addMultiOption($issuingauthorityArr[0]['id'], $issuingauthorityArr[0]['documenttype']);
                                     }
                                     $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);
                                 }
                                 $this->view->controllername = $objName;
                                 $this->view->id = $id;
                                 $this->view->data = $data;
                                 $this->view->employeedata = $employeeData[0];
                                 $this->view->form = $workeligibilityform;
                                 $this->view->issuingauthority = $issuingauthority;
                             }
                         }
                         $this->view->empdata = $empdata;
                     }
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('dependency_details', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
                 $loginUserRole = $auth->getStorage()->read()->emprole;
                 $loginUserGroup = $auth->getStorage()->read()->group_id;
             }
             $userid = $this->getRequest()->getParam('userid');
             $employeeData = array();
             $empdata = array();
             $userID = '';
             $conText = "";
             $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');
             }
             if ($userid == '') {
                 $userid = $userID;
             }
             $dependencydetailsModel = new Default_Model_Dependencydetails();
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($userid && is_numeric($userid) && $userid > 0 && $userid != $loginUserId) {
                     $isrowexist = $employeeModal->getsingleEmployeeData($userid);
                     if ($isrowexist == 'norows') {
                         $this->view->rowexist = "norows";
                     } else {
                         $this->view->rowexist = "rows";
                     }
                     $empdata = $employeeModal->getActiveEmployeeData($userid);
                     if (!empty($empdata)) {
                         $view = Zend_Layout::getMvcInstance()->getView();
                         $objname = $this->_getParam('objname');
                         $refresh = $this->_getParam('refresh');
                         $data = array();
                         $searchQuery = '';
                         $searchArray = array();
                         $tablecontent = '';
                         if ($refresh == 'refresh') {
                             $sort = 'DESC';
                             $by = 'modifieddate';
                             $perPage = 10;
                             $pageNo = 1;
                             $searchData = '';
                         } else {
                             $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC';
                             $by = $this->_getParam('by') != '' ? $this->_getParam('by') : '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 = 'dependencydetails';
                         $Uid = $userid ? $userid : $userID;
                         $tableFields = array('action' => 'Action', 'dependent_name' => 'Dependent Name', 'dependent_relation' => 'Dependent Relation', 'dependent_dob' => 'Dependent DOB');
                         $tablecontent = $dependencydetailsModel->getdependencydetailsData($sort, $by, $pageNo, $perPage, $searchQuery, $Uid);
                         if ($Uid != "") {
                             $usersModel = new Default_Model_Users();
                             $employeeData = $usersModel->getUserDetailsByIDandFlag($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' => 'Dependency', 'formgrid' => 'true', 'unitId' => $Uid, 'call' => $call, 'context' => $conText);
                         array_push($data, $dataTmp);
                         $this->view->id = $userid;
                         $this->view->controllername = $objName;
                         $this->view->dataArray = $data;
                         $this->view->call = $call;
                         $this->view->employeedata = $employeeData[0];
                         $this->view->messages = $this->_helper->flashMessenger->getMessages();
                     }
                     $this->view->empdata = $empdata;
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emp_salary', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             if ($id == '') {
                 $id = $loginUserId;
             }
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             $objName = 'empsalarydetails';
             $empsalarydetailsform = new Default_Form_empsalarydetails();
             $empsalarydetailsform->removeElement("submit");
             $elements = $empsalarydetailsform->getElements();
             if (count($elements) > 0) {
                 foreach ($elements as $key => $element) {
                     if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                         $element->setAttrib("disabled", "disabled");
                     }
                 }
             }
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $employeeModal = new Default_Model_Employee();
                     $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();
                             $data = $empsalarydetailsModal->getsingleEmpSalaryDetailsData($id);
                             if (!empty($data)) {
                                 if (isset($data[0]['currencyid']) && $data[0]['currencyid'] != '') {
                                     $currencyArr = $currencymodel->getCurrencyDataByID($data[0]['currencyid']);
                                     if (sizeof($currencyArr) > 0) {
                                         $empsalarydetailsform->currencyid->addMultiOption($currencyArr[0]['id'], $currencyArr[0]['currencyname'] . ' ' . $currencyArr[0]['currencycode']);
                                     }
                                 }
                                 if (isset($data[0]['accountclasstypeid']) && $data[0]['accountclasstypeid'] != '') {
                                     $accountclasstypeArr = $accountclasstypemodel->getsingleAccountClassTypeData($data[0]['accountclasstypeid']);
                                     if (sizeof($accountclasstypeArr) > 0) {
                                         $empsalarydetailsform->accountclasstypeid->addMultiOption($accountclasstypeArr[0]['id'], $accountclasstypeArr[0]['accountclasstype']);
                                     }
                                 }
                                 if (isset($data[0]['bankaccountid']) && $data[0]['bankaccountid'] != '') {
                                     $bankaccounttypeArr = $bankaccounttypemodel->getsingleBankAccountData($data[0]['bankaccountid']);
                                     if ($bankaccounttypeArr != 'norows') {
                                         $empsalarydetailsform->bankaccountid->addMultiOption($bankaccounttypeArr[0]['id'], $bankaccounttypeArr[0]['bankaccounttype']);
                                     }
                                 }
                                 $empsalarydetailsform->populate($data[0]);
                                 if ($data[0]['accountholding'] != '') {
                                     $accountholding = sapp_Global::change_date($data[0]["accountholding"], 'view');
                                     $empsalarydetailsform->accountholding->setValue($accountholding);
                                 }
                             }
                             $this->view->controllername = $objName;
                             $this->view->data = $data;
                             $this->view->id = $id;
                             $this->view->form = $empsalarydetailsform;
                             $this->view->employeedata = $empdata[0];
                         }
                         $this->view->empdata = $empdata;
                     }
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
Exemplo n.º 20
0
 public function getindividualempdetailsAction()
 {
     $employeeModel = new Default_Model_Employee();
     $userid = $this->_request->getParam('userid', null);
     $userdetails = $employeeModel->getEmp_from_summary($userid);
     $this->view->userdetails = $userdetails;
 }
Exemplo n.º 21
0
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emp_leaves', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             $conText = "";
             $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');
             }
             $usersModel = new Default_Model_Users();
             if ($id == '') {
                 $id = $userID;
             }
             $Uid = $id ? $id : $userID;
             if ($Uid != "") {
                 $employeeData = $usersModel->getUserDetailsByIDandFlag($Uid);
             }
             $employeeleavesModel = new Default_Model_Employeeleaves();
             $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)) {
                         $usersModel = new Default_Model_Users();
                         if ($id) {
                             $empleavesform = new Default_Form_empleaves();
                             $employeeleavesModal = new Default_Model_Employeeleaves();
                             $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);
                             $empleavesform->setAttrib('action', BASE_URL . 'empleaves/edit/userid/' . $id);
                             $this->view->form = $empleavesform;
                             $this->view->data = $data;
                             $this->view->id = $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 = '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);
                         $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->empdata = $empdata;
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
Exemplo n.º 22
0
 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;
 }
Exemplo n.º 23
0
 public function getdisplayacontentreportacc($init_id, $manager_id)
 {
     $data = array();
     if ($init_id !== '' && $manager_id !== '') {
         /***
          *** edited on 12-03-2015 , soujanya
          *** for filtering employees based on business unit id in Initialize appraisal > step -2
          ***/
         //echo $init_id.">>".$manager_id;die;
         $appInitializationData = $this->getConfigData($init_id);
         if (!empty($appInitializationData)) {
             $businessUnitId = $appInitializationData[0]['businessunit_id'];
             $departmentId = $appInitializationData[0]['department_id'];
             $eligibility = $appInitializationData[0]['eligibility'];
             $emp_model = new Default_Model_Employee();
             $data = $emp_model->getEmployeesUnderRM($manager_id, $businessUnitId, $departmentId, $eligibility);
         }
     }
     return $data;
 }
Exemplo n.º 24
0
 /**
  * Export analytics of employees reporting to manager to excel.
  */
 public function exportemployeereportAction()
 {
     $this->_helper->layout->disableLayout();
     $param_arr = $this->_getAllParams();
     $cols_param_arr = $this->_getParam('cols_arr', array());
     if (isset($param_arr['cols_arr'])) {
         unset($param_arr['cols_arr']);
     }
     $page_no = isset($param_arr['page_no']) ? $param_arr['page_no'] : 1;
     $per_page = isset($param_arr['per_page']) ? $param_arr['per_page'] : PERPAGE;
     $sort_name = $param_arr['sort_name'];
     $sort_type = $param_arr['sort_type'];
     if (isset($param_arr['page_no'])) {
         unset($param_arr['page_no']);
     }
     if (isset($param_arr['sort_name'])) {
         unset($param_arr['sort_name']);
     }
     if (isset($param_arr['sort_type'])) {
         unset($param_arr['sort_type']);
     }
     if (isset($param_arr['per_page'])) {
         unset($param_arr['per_page']);
     }
     unset($param_arr['module']);
     unset($param_arr['controller']);
     unset($param_arr['action']);
     // Get employees data reporting to manager
     $myEmployees_model = new Default_Model_Myemployees();
     $param_arr['reporting_manager'] = $myEmployees_model->getLoginUserId();
     if (count($cols_param_arr) == 0) {
         $cols_param_arr = $this->empreport_heplper1('mandatory');
     }
     $employee_model = new Default_Model_Employee();
     $emp_data_org = $employee_model->getdata_emp_report($param_arr, $per_page, $page_no, $sort_name, $sort_type);
     $emp_arr = $emp_data_org['rows'];
     require_once 'Classes/PHPExcel.php';
     require_once 'Classes/PHPExcel/IOFactory.php';
     $objPHPExcel = new PHPExcel();
     $letters = range('A', 'Z');
     $count = 0;
     $filename = "EmployeeReport.xlsx";
     $cell_name = "";
     // Show count of employees reporting to manager
     // Get employees data reporting to manager
     $myEmployees_model = new Default_Model_Myemployees();
     $employee_model = new Default_Model_Employee();
     $count_emp_reporting = $employee_model->getCountEmpReporting($myEmployees_model->getLoginUserId());
     $objPHPExcel->getActiveSheet()->SetCellValue($letters[$count] . "1", "My Team Count : " . $count_emp_reporting);
     // Make first row Headings bold and highlighted in Excel.
     foreach ($cols_param_arr as $names) {
         $i = 2;
         $cell_name = $letters[$count] . $i;
         $names = html_entity_decode($names, ENT_QUOTES, 'UTF-8');
         $objPHPExcel->getActiveSheet()->SetCellValue($cell_name, $names);
         // Make bold cells
         $objPHPExcel->getActiveSheet()->getStyle($cell_name)->getFont()->setBold(true);
         $objPHPExcel->getActiveSheet()->getStyle($cell_name)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => '82CAFF'))));
         $objPHPExcel->getActiveSheet()->getColumnDimension($letters[$count])->setAutoSize(true);
         $i++;
         $count++;
     }
     // Display field/column values in Excel.
     $i = 3;
     foreach ($emp_arr as $emp_data) {
         $count1 = 0;
         foreach ($cols_param_arr as $column_key => $column_name) {
             // display field/column values
             $cell_name = $letters[$count1] . $i;
             if ($column_key == 'userfullname') {
                 $value = isset($emp_data['prefix_name']) ? $emp_data['prefix_name'] . ". " . $emp_data['userfullname'] : $emp_data['userfullname'];
             } elseif ($column_key == 'date_of_joining') {
                 $value = isset($emp_data['date_of_joining']) ? sapp_Global::change_date($emp_data['date_of_joining'], "view") : "";
             } else {
                 $value = isset($emp_data[$column_key]) ? $emp_data[$column_key] : "";
             }
             $value = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
             $objPHPExcel->getActiveSheet()->SetCellValue($cell_name, $value);
             $count1++;
         }
         $i++;
     }
     sapp_Global::clean_output_buffer();
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header("Content-Disposition: attachment; filename=\"{$filename}\"");
     header('Cache-Control: max-age=0');
     sapp_Global::clean_output_buffer();
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save('php://output');
     exit;
 }
Exemplo n.º 25
0
 public function changeOrgHead($oldhead, $newhead, $oldheadRM = '')
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $db = Zend_Db_Table::getDefaultAdapter();
     $empmodel = new Default_Model_Employee();
     $oldRMData = $empmodel->getsingleEmployeeData($oldhead);
     try {
         $empQuery1 = "UPDATE main_employees SET reporting_manager = " . $newhead . ", modifieddate = '" . gmdate("Y-m-d H:i:s") . "', modifiedby = " . $loginUserId . " WHERE reporting_manager=" . $oldhead . " and isactive = 1 AND user_id <> " . $newhead . ";";
         if ($oldheadRM != '') {
             $orgQuery1 = "UPDATE main_employees SET is_orghead = 0, reporting_manager= " . $oldheadRM . ", modifieddate = '" . gmdate("Y-m-d H:i:s") . "', modifiedby = " . $loginUserId . " WHERE user_id=" . $oldhead . " ;";
             $db->query($orgQuery1);
         }
         $orgQuery2 = "UPDATE main_employees SET is_orghead = 1,reporting_manager= 0, modifieddate = '" . gmdate("Y-m-d H:i:s") . "', modifiedby = " . $loginUserId . " WHERE user_id=" . $newhead . " ;";
         $db->query($orgQuery2);
         $db->query($empQuery1);
         return 'success';
     } catch (Exception $e) {
         return 'failed';
     }
 }
 public function editpopupAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->getRequest()->getParam('id');
     $userid = $this->getRequest()->getParam('unitId');
     if ($id == '') {
         $id = $loginUserId;
     }
     // For open the form in popup...
     $empjobhistoryform = new Default_Form_empjobhistory();
     $empjobhistoryModel = new Default_Model_Empjobhistory();
     $employeeModel = new Default_Model_Employee();
     $positionModel = new Default_Model_Positions();
     $departmentModel = new Default_Model_Departments();
     $jobtitleModel = new Default_Model_Jobtitles();
     $clientsModel = new Timemanagement_Model_Clients();
     if ($id) {
         $employeeArr = $employeeModel->getActiveEmployeeData($userid);
         if (!empty($employeeArr)) {
             if (isset($employeeArr[0]['businessunit_id']) && $employeeArr[0]['businessunit_id'] != '') {
                 $departmentArr = $departmentModel->getDepartmentList($employeeArr[0]['businessunit_id']);
                 if (!empty($departmentArr)) {
                     $empjobhistoryform->department->addMultiOption('', 'Select Department');
                     foreach ($departmentArr as $departmentres) {
                         $empjobhistoryform->department->addMultiOption($departmentres['id'], $departmentres['deptname']);
                     }
                 }
             } else {
                 $departmentArr = $departmentModel->getTotalDepartmentList();
                 if (!empty($departmentArr)) {
                     $empjobhistoryform->department->addMultiOption('', 'Select Department');
                     foreach ($departmentArr as $departmentres) {
                         $empjobhistoryform->department->addMultiOption($departmentres['id'], $departmentres['deptname']);
                     }
                 }
             }
         }
         $positionArr = $positionModel->getTotalPositionList();
         if (!empty($positionArr)) {
             $empjobhistoryform->positionheld->addMultiOption('', 'Select Position');
             foreach ($positionArr as $positionres) {
                 $empjobhistoryform->positionheld->addMultiOption($positionres['id'], $positionres['positionname']);
             }
         }
         $jobtitleArr = $jobtitleModel->getJobTitleList();
         if (!empty($jobtitleArr)) {
             $empjobhistoryform->jobtitleid->addMultiOption('', 'Select Job Title');
             foreach ($jobtitleArr as $jobtitleres) {
                 $empjobhistoryform->jobtitleid->addMultiOption($jobtitleres['id'], $jobtitleres['jobtitlename']);
             }
         }
         $clientsArr = $clientsModel->getActiveClientsData();
         if (!empty($clientsArr)) {
             $empjobhistoryform->client->addMultiOption('', 'Select a Client');
             foreach ($clientsArr as $clientsres) {
                 $empjobhistoryform->client->addMultiOption($clientsres['id'], $clientsres['client_name']);
             }
         }
         $data = $empjobhistoryModel->getsingleEmpJobHistoryData($id);
         if (!empty($data)) {
             $empjobhistoryform->populate($data[0]);
             $empjobhistoryform->setDefault('department', $data[0]['department']);
             $empjobhistoryform->setDefault('positionheld', $data[0]['positionheld']);
             $empjobhistoryform->setDefault('jobtitleid', $data[0]['jobtitleid']);
             $empjobhistoryform->setDefault('client', $data[0]['client_id']);
             if (isset($data[0]['start_date']) && $data[0]['start_date'] != '') {
                 $start_date = sapp_Global::change_date($data[0]['start_date'], 'view');
                 $empjobhistoryform->start_date->setValue($start_date);
             }
             if (isset($data[0]['end_date']) && $data[0]['end_date'] != '') {
                 $end_date = sapp_Global::change_date($data[0]['end_date'], 'view');
                 $empjobhistoryform->end_date->setValue($end_date);
             }
         }
     }
     $empjobhistoryform->setAttrib('action', BASE_URL . 'empjobhistory/editpopup/unitId/' . $userid);
     $this->view->form = $empjobhistoryform;
     $this->view->controllername = 'empjobhistory';
     if ($this->getRequest()->getPost()) {
         $result = $this->save($empjobhistoryform, $userid);
         $this->view->msgarray = $result;
     }
 }
Exemplo n.º 27
0
 public function getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $exParam1 = '', $exParam2 = '', $exParam3 = '', $exParam4 = '')
 {
     $searchQuery = '';
     $tablecontent = '';
     $searchArray = array();
     $data = array();
     $id = '';
     $dataTmp = array();
     if ($searchData != '' && $searchData != 'undefined') {
         $searchValues = json_decode($searchData);
         foreach ($searchValues as $key => $val) {
             if ($key == "userfullname") {
                 $searchQuery .= " e." . $key . " like '%" . $val . "%' AND ";
             } else {
                 if ($key == "rm") {
                     $searchQuery .= " e.userfullname like '%" . $val . "%' AND ";
                 } else {
                     if ($key == "jobtitle_name") {
                         $searchQuery .= " e.jobtitle_name like '%" . $val . "%' AND ";
                     } else {
                         if ($key == 'extn') {
                             $searchQuery .= " concat(e.office_number,' (ext ',e.extension_number,')') like '%" . $val . "%' AND ";
                         } else {
                             if ($key == 'astatus') {
                                 $searchQuery .= " e.isactive like '%" . $val . "%' AND ";
                             } else {
                                 $searchQuery .= " e." . $key . " like '%" . $val . "%' AND ";
                             }
                         }
                     }
                 }
             }
             $searchArray[$key] = $val;
         }
         $searchQuery = rtrim($searchQuery, " AND");
     }
     $objName = 'myemployees';
     $emptyroles = 0;
     $tableFields = array('action' => 'Action', 'firstname' => 'First Name', 'lastname' => 'Last Name', 'emailaddress' => 'E-mail', 'employeeId' => 'Employee ID', 'astatus' => 'User Status', 'extn' => ' Work Phone', 'jobtitle_name' => 'Job Title', 'contactnumber' => 'Contact Number');
     $employeeModel = new Default_Model_Employee();
     $tablecontent = $employeeModel->getEmployeesData($sort, $by, $pageNo, $perPage, $searchQuery, $exParam1, $exParam1);
     if ($tablecontent == "emptyroles") {
         $emptyroles = 1;
     } else {
         $emptyroles = 0;
     }
     $dataTmp = array('dashboardcall' => $dashboardcall, 'emptyroles' => $emptyroles, 'sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getAjaxgridData', 'jsFillFnName' => '', 'searchArray' => $searchArray, 'menuName' => 'My Team', 'add' => 'add', 'call' => $call, 'sortStr' => $by, 'context' => 'myteam', 'search_filters' => array('astatus' => array('type' => 'select', 'filter_data' => array('' => 'All', 1 => 'Active', 0 => 'Inactive', 2 => 'Resigned', 3 => 'Left', 4 => 'Suspended'))));
     return $dataTmp;
 }
Exemplo n.º 28
0
 public static function process_emp_excel($file_name)
 {
     require_once 'Classes/PHPExcel.php';
     require_once 'Classes/PHPExcel/IOFactory.php';
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $emp_model = new Default_Model_Employee();
     $usersModel = new Default_Model_Usermanagement();
     $identity_code_model = new Default_Model_Identitycodes();
     $objReader = PHPExcel_IOFactory::createReaderForFile($file_name);
     $objPHPExcel = $objReader->load($file_name);
     //Read first sheet
     $sheet = $objPHPExcel->getSheet(0);
     // Get worksheet dimensions
     $sizeOfWorksheet = $sheet->getHighestDataRow();
     $highestColumn = $sheet->getHighestDataColumn();
     if ($sizeOfWorksheet > 1) {
         $arrReqHeaders = array('Prefix', 'First name', 'Last name', 'Role Type', 'Email', 'Business Unit', 'Department', 'Reporting manager', 'Job Title', 'Position', 'Employment Status', 'Date of joining', 'Date of leaving', 'Experience', 'Extension', 'Work telephone number', 'Fax');
         //Get first/header from excel
         $firstRow = $sheet->rangeToArray('A' . 1 . ':' . $highestColumn . 1, NULL, TRUE, TRUE);
         $arrGivenHeaders = $firstRow[0];
         $diffArray = array_diff_assoc($arrReqHeaders, $arrGivenHeaders);
         $prefix_arr = $emp_model->getPrefix_emp_excel();
         $roles_arr = $emp_model->getRoles_emp_excel();
         $bu_arr = $emp_model->getBU_emp_excel();
         $dep_arr = $emp_model->getDep_emp_excel();
         $job_arr = $emp_model->getJobs_emp_excel();
         $positions_arr = $emp_model->getPositions_emp_excel();
         $users_arr = $emp_model->getUsers_emp_excel();
         $emp_stat_arr = $emp_model->getEstat_emp_excel();
         $dol_emp_stat_arr = $emp_model->getDOLEstat_emp_excel();
         $mng_roles_arr = $emp_model->getMngRoles_emp_excel();
         $emps_arr = $emp_model->getEmps_emp_excel();
         $emails_arr = $emps_arr['email'];
         $emp_ids_arr = $emps_arr['ids'];
         $emp_depts_arr = $emp_model->getEmpsDeptWise();
         $dept_bu_arr = $emp_model->getDeptBUWise();
         $pos_jt_arr = $emp_model->getPosJTWise();
         $identity_codes = $identity_code_model->getIdentitycodesRecord();
         $emp_identity_code = isset($identity_codes[0]) ? $identity_codes[0]['employee_code'] : "";
         $trDb = Zend_Db_Table::getDefaultAdapter();
         // starting transaction
         $trDb->beginTransaction();
         try {
             //start of validations
             $ex_prefix_arr = array();
             //$ex_fullname_arr = array();
             $ex_firstname_arr = array();
             $ex_lastname_arr = array();
             $ex_role_arr = array();
             $ex_email_arr = array();
             $ex_bu_arr = array();
             $ex_dep_arr = array();
             $ex_rm_arr = array();
             $ex_jt_arr = array();
             $ex_pos_arr = array();
             $ex_es_arr = array();
             $ex_doj_arr = array();
             $ex_dol_arr = array();
             $ex_exp_arr = array();
             $ex_ext_arr = array();
             $ex_wn_arr = array();
             $ex_fax_arr = array();
             $tot_rec_cnt = 0;
             $err_msg = "";
             for ($i = 2; $i <= $sizeOfWorksheet; $i++) {
                 $rowData_org = $sheet->rangeToArray('A' . $i . ':' . $highestColumn . $i, NULL, TRUE, TRUE);
                 $rowData = $rowData_org[0];
                 $rowData_cpy = $rowData;
                 foreach ($rowData_cpy as $rkey => $rvalue) {
                     $rowData[$rkey] = trim($rvalue);
                 }
                 //start of mandatory checking
                 if (empty($rowData[0])) {
                     $err_msg = "Prefix cannot be empty at row " . $i . ".";
                     break;
                 }
                 /* if(empty($rowData[1]))
                    {
                        $err_msg = "Full Name cannot be empty at row ".$i.".";
                        break;
                    }*/
                 if (empty($rowData[1])) {
                     $err_msg = "First name cannot be empty at row " . $i . ".";
                     break;
                 }
                 if (empty($rowData[2])) {
                     $err_msg = "Last name cannot be empty at row " . $i . ".";
                     break;
                 }
                 if (empty($rowData[3])) {
                     $err_msg = "Role type cannot be empty at row " . $i . ".";
                     break;
                 }
                 if (empty($rowData[4])) {
                     $err_msg = "Email cannot be empty at row " . $i . ".";
                     break;
                 }
                 if (empty($rowData[7])) {
                     $err_msg = "Reporting manager cannot be empty at row " . $i . ".";
                     break;
                 }
                 if (empty($rowData[8])) {
                     $err_msg = "Job title cannot be empty at row " . $i . ".";
                     break;
                 }
                 if (empty($rowData[9])) {
                     $err_msg = "Position cannot be empty at row " . $i . ".";
                     break;
                 }
                 if (empty($rowData[10])) {
                     $err_msg = "Employment status cannot be empty at row " . $i . ".";
                     break;
                 }
                 if (empty($rowData[11])) {
                     $err_msg = "Date of joining cannot be empty at row " . $i . ".";
                     break;
                 }
                 if (!in_array($rowData[3], $mng_roles_arr) && empty($rowData[6])) {
                     $err_msg = "Department cannot be empty at row " . $i . ".";
                     break;
                 }
                 if (in_array($rowData[10], $dol_emp_stat_arr) && empty($rowData[12])) {
                     $err_msg = "Date of leaving cannot be empty at row " . $i . ".";
                     break;
                 }
                 if (!in_array($rowData[10], $dol_emp_stat_arr) && !empty($rowData[12]) && in_array($rowData[10], $emp_stat_arr)) {
                     $err_msg = "Date of leaving must be empty for '" . $rowData[10] . "' at row " . $i . ".";
                     break;
                 }
                 // end of mandatory checking
                 // start of pattern checking
                 if (!preg_match("/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)\$/", trim($rowData[0])) && !empty($rowData[0])) {
                     $err_msg = "Prefix is not a valid format at row " . $i . ".";
                     break;
                 }
                 /* if (!preg_match("/^([a-zA-Z.]+ ?)+$/", $rowData[1])  && !empty($rowData[1]))
                    {
                        $err_msg = "Full Name is not a valid format at row ".$i.".";
                        break;
                    }*/
                 if (!preg_match("/^([a-zA-Z.]+ ?)+\$/", $rowData[1]) && !empty($rowData[1])) {
                     $err_msg = "First name is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^([a-zA-Z.]+ ?)+\$/", $rowData[2]) && !empty($rowData[2])) {
                     $err_msg = "Last name is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^[a-zA-Z]+?\$/", $rowData[3]) && !empty($rowData[3])) {
                     $err_msg = "Role type is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+\$/", $rowData[4]) && !empty($rowData[4])) {
                     $err_msg = "Email is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^[a-zA-Z0-9\\&\\'\\.\\s]+\$/", $rowData[5]) && !empty($rowData[5])) {
                     $err_msg = "Business unit is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^[a-zA-Z0-9\\&\\'\\.\\s]+\$/", $rowData[6]) && !empty($rowData[6])) {
                     $err_msg = "Department is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^[a-zA-Z0-9\\&\\'\\.\\s]+\$/", $rowData[7]) && !empty($rowData[7])) {
                     $err_msg = "Reporting manager is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^[a-zA-Z][a-zA-Z0-9\\s]*\$/", $rowData[8]) && !empty($rowData[8])) {
                     $err_msg = "Job title is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^[a-zA-Z][a-zA-Z0-9\\-\\s]*\$/i", $rowData[9]) && !empty($rowData[9])) {
                     $err_msg = "Position is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)\$/", $rowData[10]) && !empty($rowData[10])) {
                     $err_msg = "Employment status is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!empty($rowData[11])) {
                     try {
                         $test_doj = new DateTime($rowData[11]);
                     } catch (Exception $ex) {
                         return array('status' => 'error', 'msg' => "Date of joining is not a valid format at row " . $i . ".");
                     }
                 }
                 if (!empty($rowData[12])) {
                     try {
                         $test_dol = new DateTime($rowData[12]);
                     } catch (Exception $ex) {
                         return array('status' => 'error', 'msg' => "Date of leaving is not a valid format at row " . $i . ".");
                     }
                 }
                 if (!empty($rowData[12]) && $rowData[12] < $rowData[11]) {
                     $err_msg = "Date of leaving must be greater than date of joining at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^[0-9]\\d{0,1}(\\.\\d*)?\$/", $rowData[13]) && !empty($rowData[13])) {
                     $err_msg = "Experience is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^[0-9]+\$/", $rowData[14]) && !empty($rowData[14])) {
                     $err_msg = "Extension is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^(?!0{10})[0-9\\+\\-\\)\\(]+\$/", $rowData[15]) && !empty($rowData[15])) {
                     $err_msg = "Work telephone number is not a valid format at row " . $i . ".";
                     break;
                 }
                 if (!preg_match("/^[0-9\\+\\-\\)\\(]+\$/", $rowData[16]) && !empty($rowData[16])) {
                     $err_msg = "Fax is not a valid format at row " . $i . ".";
                     break;
                 }
                 // end of pattern checking
                 // start of checking existence in the system.
                 if (!array_key_exists(strtolower($rowData[0]), $prefix_arr) && !empty($rowData[0])) {
                     $err_msg = "Unknown prefix at row " . $i . ".";
                     break;
                 }
                 if (!array_key_exists(strtolower($rowData[3]), $roles_arr) && !empty($rowData[3])) {
                     $err_msg = "Unknown role type at row " . $i . ".";
                     break;
                 }
                 if (!array_key_exists(strtolower($rowData[5]), $bu_arr) && !empty($rowData[5])) {
                     $err_msg = "Unknown business unit at row " . $i . ".";
                     break;
                 }
                 if (!array_key_exists(strtolower($rowData[6]), $dep_arr) && !empty($rowData[6])) {
                     $err_msg = "Unknown department at row " . $i . ".";
                     break;
                 }
                 if (in_array(strtolower($rowData[4]), $emails_arr) && !empty($rowData[4])) {
                     $err_msg = "Email already exists at row " . $i . ".";
                     break;
                 }
                 if (!in_array(strtolower($rowData[7]), $emp_ids_arr) && !empty($rowData[7])) {
                     $err_msg = "Unknown reporting manager at row " . $i . ".";
                     break;
                 }
                 if (!array_key_exists(strtolower($rowData[8]), $job_arr) && !empty($rowData[8])) {
                     $err_msg = "Unknown job title at row " . $i . ".";
                     break;
                 }
                 if (!array_key_exists(strtolower($rowData[9]), $positions_arr) && !empty($rowData[9])) {
                     $err_msg = "Unknown position at row " . $i . ".";
                     break;
                 }
                 if (!array_key_exists(strtolower($rowData[10]), $emp_stat_arr) && !empty($rowData[10])) {
                     $err_msg = "Unknown employment status at row " . $i . ".";
                     break;
                 }
                 // end of checking existence in the system.
                 if (!empty($rowData[6])) {
                     if (isset($emp_depts_arr[$dep_arr[strtolower($rowData[6])]]) && !in_array(strtolower($rowData[7]), $emp_depts_arr[$dep_arr[strtolower($rowData[6])]])) {
                         if (isset($emp_depts_arr[0]) && is_array($emp_depts_arr[0])) {
                             if (!in_array(strtolower($rowData[7]), $emp_depts_arr[0])) {
                                 $err_msg = "Reporting manager is not belongs to '" . $rowData[6] . "' department at row " . $i . ".";
                                 break;
                             }
                         }
                     }
                 } else {
                     if (isset($emp_depts_arr[0]) && is_array($emp_depts_arr[0])) {
                         if (!in_array(strtolower($rowData[7]), $emp_depts_arr[0])) {
                             $err_msg = "Reporting manager is not belongs to management group at row " . $i . ".";
                             break;
                         }
                     }
                 }
                 if (!empty($rowData[6])) {
                     if (isset($dept_bu_arr[0]) && is_array($dept_bu_arr[0])) {
                         if (in_array(strtolower($rowData[6]), $dept_bu_arr[0]) && !empty($rowData[5])) {
                             $err_msg = "Business unit not needed for this department '" . $rowData[6] . "' at row " . $i . ".";
                             break;
                         }
                         if (!in_array(strtolower($rowData[6]), $dept_bu_arr[0]) && empty($rowData[5])) {
                             $err_msg = "Business unit cannot be empty at row " . $i . ".";
                             break;
                         }
                     }
                     if (!empty($rowData[5])) {
                         if (isset($dept_bu_arr[$bu_arr[strtolower($rowData[5])]]) && !in_array(strtolower($rowData[6]), $dept_bu_arr[$bu_arr[strtolower($rowData[5])]]) && !empty($rowData[5])) {
                             $err_msg = "Department is not belongs to '" . $rowData[5] . "' business unit at row " . $i . ".";
                             break;
                         }
                     }
                 }
                 if (!empty($rowData[8]) && !empty($rowData[9])) {
                     if (isset($pos_jt_arr[$job_arr[strtolower($rowData[8])]]) && !in_array(strtolower($rowData[9]), $pos_jt_arr[$job_arr[strtolower($rowData[8])]]) && !empty($rowData[8])) {
                         $err_msg = "Position is not belongs to '" . $rowData[8] . "' job title at row " . $i . ".";
                         break;
                     }
                 }
             }
             //end of for loop
             if (!empty($err_msg)) {
                 return array('status' => 'error', 'msg' => $err_msg);
             }
             $err_msg = "";
             for ($i = 2; $i <= $sizeOfWorksheet; $i++) {
                 $rowData_org = $sheet->rangeToArray('A' . $i . ':' . $highestColumn . $i, NULL, TRUE, TRUE);
                 $rowData = $rowData_org[0];
                 $rowData_cpy = $rowData;
                 foreach ($rowData_cpy as $rkey => $rvalue) {
                     $rowData[$rkey] = trim($rvalue);
                 }
                 $ex_prefix_arr[] = $rowData[0];
                 //$ex_fullname_arr[] = $rowData[1];
                 $ex_firstname_arr[] = $rowData[1];
                 $ex_lastname_arr[] = $rowData[2];
                 $ex_role_arr[] = $rowData[3];
                 $ex_email_arr[$i] = $rowData[4];
                 $ex_bu_arr[] = $rowData[5];
                 $ex_dep_arr[] = $rowData[6];
                 $ex_rm_arr[] = $rowData[7];
                 $ex_jt_arr[] = $rowData[8];
                 $ex_pos_arr[] = $rowData[9];
                 $ex_es_arr[] = $rowData[10];
                 $ex_doj_arr[] = $rowData[11];
                 $ex_dol_arr[] = $rowData[12];
                 $ex_exp_arr[] = $rowData[13];
                 $ex_ext_arr[] = $rowData[14];
                 $ex_wn_arr[] = $rowData[15];
                 $ex_fax_arr[] = $rowData[16];
                 $tot_rec_cnt++;
             }
             foreach ($ex_email_arr as $key1 => $value1) {
                 $d = 0;
                 foreach ($ex_email_arr as $key2 => $value2) {
                     if ($key1 != $key2 && $value1 == $value2) {
                         $err_msg = "Duplicate email entry at row " . $key2 . ".";
                         $d++;
                         break;
                     }
                 }
                 if ($d > 0) {
                     break;
                 }
             }
             if (!empty($err_msg)) {
                 return array('status' => 'error', 'msg' => $err_msg);
             }
             //end of validations
             //start of saving
             if ($tot_rec_cnt > 0) {
                 for ($i = 2; $i <= $sizeOfWorksheet; $i++) {
                     $emp_id = $emp_identity_code . str_pad($usersModel->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT);
                     $rowData_org = $sheet->rangeToArray('A' . $i . ':' . $highestColumn . $i, NULL, TRUE, TRUE);
                     $rowData = $rowData_org[0];
                     $rowData_cpy = $rowData;
                     foreach ($rowData_cpy as $rkey => $rvalue) {
                         $rowData[$rkey] = trim($rvalue);
                     }
                     $emppassword = sapp_Global::generatePassword();
                     $date = new DateTime($rowData[11]);
                     $date_of_joining = $date->format('Y-m-d');
                     $date_of_leaving = "";
                     if ($rowData[12] != '') {
                         $ldate = new DateTime($rowData[12]);
                         $date_of_leaving = $ldate->format('Y-m-d');
                     }
                     $userfullname = $rowData[1] . ' ' . $rowData[2];
                     $user_data = array('emprole' => $roles_arr[strtolower($rowData[3])], 'userfullname' => $userfullname, 'firstname' => $rowData[1], 'lastname' => $rowData[2], 'emailaddress' => $rowData[4], 'jobtitle_id' => $job_arr[strtolower($rowData[8])], 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'emppassword' => md5($emppassword), 'employeeId' => $emp_id, 'modeofentry' => "Direct", 'selecteddate' => $date_of_joining, 'userstatus' => 'old');
                     $user_data['createdby'] = $loginUserId;
                     $user_data['createddate'] = gmdate("Y-m-d H:i:s");
                     $user_data['isactive'] = 1;
                     $user_id = $usersModel->SaveorUpdateUserData($user_data, '');
                     $data = array('user_id' => $user_id, 'reporting_manager' => $users_arr[strtolower($rowData[7])], 'emp_status_id' => $emp_stat_arr[strtolower($rowData[10])], 'businessunit_id' => !empty($rowData[4]) ? $bu_arr[strtolower($rowData[5])] : 0, 'department_id' => !empty($rowData[5]) ? $dep_arr[strtolower($rowData[6])] : null, 'jobtitle_id' => $job_arr[strtolower($rowData[8])], 'position_id' => $positions_arr[strtolower($rowData[9])], 'prefix_id' => $prefix_arr[strtolower($rowData[0])], 'extension_number' => $rowData[13] != '' ? $rowData[14] : NULL, 'office_number' => $rowData[14] != '' ? $rowData[15] : NULL, 'office_faxnumber' => $rowData[15] != '' ? $rowData[16] : NULL, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'years_exp' => $rowData[13] == '' ? null : $rowData[13], 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                     $data['createdby'] = $loginUserId;
                     $data['createddate'] = gmdate("Y-m-d H:i:s");
                     $data['isactive'] = 1;
                     $emp_model->SaveorUpdateEmployeeData($data, '');
                     $text = "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n\t<span style='color:#3b3b3b;'>Hello " . ucfirst($userfullname) . ",</span><br />\n\t\n\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>You have been added to " . APPLICATION_NAME . ". The login credentials for your Sentrifugo account are:</div>\n\t\n\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>Username: <strong>" . $emp_id . "</strong></div>\n\t<div style='padding:5px 0 0 0;color:#3b3b3b;'>Password: <strong>" . $emppassword . "</strong></div>\n\t\n\t<div style='padding:20px 0 10px 0;'>Please <a href='" . DOMAIN . "index/popup' target='_blank' style='color:#b3512f;'>click here</a> to login  to your Sentrifugo account.</div>\n\n</div>";
                     $options['subject'] = APPLICATION_NAME . ': Login Credentials';
                     $options['header'] = 'Greetings from Sentrifugo';
                     $options['toEmail'] = $rowData[4];
                     $options['toName'] = $userfullname;
                     $options['message'] = $text;
                     $options['cron'] = 'yes';
                     $result = sapp_Global::_sendEmail($options);
                 }
                 //end of for loop
                 $trDb->commit();
                 return array('status' => "success", 'msg' => 'Employees saved successfully.');
             } else {
                 return array('status' => 'error', 'msg' => "No records to save.");
             }
             //end of saving
         } catch (Exception $e) {
             $trDb->rollBack();
             return array('status' => 'error', 'msg' => "Something went wrong,please try again.");
         }
     } else {
         return array('status' => 'error', 'msg' => "No records to save.");
     }
 }
Exemplo n.º 29
0
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('employeedocs', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $employeeModal = new Default_Model_Employee();
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     if (!empty($empdata)) {
                         $empDocuModel = new Default_Model_Employeedocs();
                         $empDocuments = $empDocuModel->getEmpDocumentsByFieldOrAll('user_id', $id);
                         $this->view->empDocuments = $empDocuments;
                     }
                     $usersModel = new Default_Model_Users();
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                     if (!empty($employeeData)) {
                         $this->view->employeedata = $employeeData[0];
                     }
                     $this->view->id = $id;
                     $this->view->empdata = $empdata;
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
Exemplo n.º 30
0
 public function editAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->getRequest()->getParam('id');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $appraisalinitform = new Default_Form_Appraisalinit();
     $appraisalinitform->submit->setLabel('Update');
     try {
         if ($id) {
             if (is_numeric($id) && $id > 0) {
                 $appraisalinitmodel = new Default_Model_Appraisalinit();
                 $data = $appraisalinitmodel->getConfigData($id);
                 if (!empty($data)) {
                     $empSummaryModel = new Default_Model_Employee();
                     $empData = $empSummaryModel->getEmp_from_summary($loginUserId);
                     $appraisalinitform->businessunit_name->setValue($empData['businessunit_name']);
                     $appraisalinitform->department_name->setValue($empData['department_name']);
                     $employmentstatusModel = new Default_Model_Employmentstatus();
                     $employmentStatusData = $employmentstatusModel->getempstatusActivelist();
                     if (!empty($employmentStatusData)) {
                         foreach ($employmentStatusData as $employmentStatusres) {
                             $appraisalinitform->eligibility->addMultiOption($employmentStatusres['workcodename'], $employmentStatusres['statusname']);
                         }
                     }
                     $data = $data[0];
                     $appraisalinitform->populate($data);
                     $appraisalinitform->setAttrib('action', DOMAIN . 'appraisalinit/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->eligibility_value = $data['eligibility'];
     $this->view->form = $appraisalinitform;
     if ($this->getRequest()->getPost()) {
         $result = $this->save($appraisalinitform);
         $this->view->msgarray = $result;
     }
     $this->render('form');
 }