コード例 #1
0
 public function checkperformanceduedate()
 {
     $app_init_model = new Default_Model_Appraisalinit();
     $app_ratings_model = new Default_Model_Appraisalemployeeratings();
     $active_appraisal_Arr = $app_init_model->getActiveAppraisals();
     $appraisalPrivMainModel = new Default_Model_Appraisalqsmain();
     $app_manager_model = new Default_Model_Appraisalmanager();
     $usersmodel = new Default_Model_Users();
     $current_day = new DateTime('now');
     $current_day->sub(new DateInterval('P1D'));
     if (!empty($active_appraisal_Arr)) {
         foreach ($active_appraisal_Arr as $appval) {
             if ($appval['managers_due_date']) {
                 $manager_due_date = new DateTime($appval['managers_due_date']);
             } else {
                 $manager_due_date = '';
             }
             if ($appval['employees_due_date']) {
                 $emp_due_date = new DateTime($appval['employees_due_date']);
             } else {
                 $emp_due_date = '';
             }
             $due_date = $appval['enable_step'] == 2 ? $emp_due_date : $manager_due_date;
             $interval = $current_day->diff($due_date);
             $interval->format('%d');
             $interval = $interval->days;
             $appIdArr = array();
             $appIdList = '';
             if ($interval <= 2) {
                 if ($appval['enable_step'] == 2) {
                     $employeeidArr = $app_ratings_model->getEmployeeIds($appval['id'], 'cron');
                     if (!empty($employeeidArr)) {
                         $empIdArr = array();
                         $empIdList = '';
                         foreach ($employeeidArr as $empval) {
                             array_push($empIdArr, $empval['employee_id']);
                         }
                         if (!empty($empIdArr)) {
                             $empIdList = implode(',', $empIdArr);
                             $employeeDetailsArr = $app_manager_model->getUserDetailsByEmpID($empIdList);
                             //Fetching employee details
                             if (!empty($employeeDetailsArr)) {
                                 $empArr = array();
                                 foreach ($employeeDetailsArr as $emp) {
                                     array_push($empArr, $emp['emailaddress']);
                                     //preparing Bcc array
                                 }
                                 $optionArr = array('subject' => 'Self Appraisal Submission Pending', 'header' => 'Performance Appraisal', 'toemail' => SUPERADMIN_EMAIL, 'toname' => 'Super Admin', 'bcc' => $empArr, 'message' => "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span style='color:#3b3b3b;'>Hi, </span><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>Self appraisal submission is pending.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 10px 0;'>Please <a href=" . BASE_URL . " target='_blank' style='color:#b3512f;'>click here</a> to login  to your <b>" . APPLICATION_NAME . "</b> account to check the details.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div> ", 'cron' => 'yes');
                                 sapp_PerformanceHelper::saveCronMail($optionArr);
                             }
                         }
                     }
                 } else {
                     $getLine1ManagerId = $appraisalPrivMainModel->getLine1ManagerIdMain($appval['id']);
                     if (!empty($getLine1ManagerId)) {
                         $empArr = array();
                         foreach ($getLine1ManagerId as $val) {
                             array_push($empArr, $val['emailaddress']);
                             //preparing Bcc array
                         }
                         $optionArr = array('subject' => 'Manager Appraisal Submission Pending', 'header' => 'Performance Appraisal', 'toemail' => SUPERADMIN_EMAIL, 'toname' => 'Super Admin', 'bcc' => $empArr, 'message' => "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span style='color:#3b3b3b;'>Hi, </span><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>Manager appraisal submission is pending.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 10px 0;'>Please <a href=" . BASE_URL . " target='_blank' style='color:#b3512f;'>click here</a> to login  to your <b>" . APPLICATION_NAME . "</b> account to check the details.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div> ", 'cron' => 'yes');
                         sapp_PerformanceHelper::saveCronMail($optionArr);
                     }
                 }
             }
         }
     }
 }
コード例 #2
0
 public function checkperformanceduedate()
 {
     $app_init_model = new Default_Model_Appraisalinit();
     $app_ratings_model = new Default_Model_Appraisalemployeeratings();
     $active_appraisal_Arr = $app_init_model->getActiveAppraisals();
     $appraisalPrivMainModel = new Default_Model_Appraisalqsmain();
     $usersmodel = new Default_Model_Users();
     //echo'<pre>';print_r($active_appraisal_Arr);exit;
     $current_day = new DateTime('now');
     $current_day->sub(new DateInterval('P1D'));
     if (!empty($active_appraisal_Arr)) {
         foreach ($active_appraisal_Arr as $appval) {
             if ($appval['enable_step'] == 2) {
                 if ($appval['managers_due_date']) {
                     $manager_due_date = new DateTime($appval['managers_due_date']);
                 } else {
                     $manager_due_date = '';
                 }
                 if ($appval['employees_due_date']) {
                     $emp_due_date = new DateTime($appval['employees_due_date']);
                 } else {
                     $emp_due_date = '';
                 }
                 $employeeidArr = $app_ratings_model->getEmployeeIds($appval['id'], 'cron');
                 if (!empty($employeeidArr)) {
                     foreach ($employeeidArr as $empval) {
                         if ($empval['appraisal_status'] != 7) {
                             $interval = $current_day->diff($emp_due_date);
                             $interval->format('%d');
                             $interval = $interval->days;
                             if ($interval <= 1) {
                                 $employeeDetailsArr = $usersmodel->getUserDetailsByID($empval['employee_id'], '');
                                 $optionArr = array('subject' => 'Performance Appraisal Pending', 'header' => 'Performance Appraisal', 'toemail' => $employeeDetailsArr[0]['userfullname'], 'toname' => $employeeDetailsArr[0]['emailaddress'], 'message' => 'Dear ' . $employeeDetailsArr[0]['userfullname'] . ', performance appraisal is pending.', 'cron' => 'yes');
                                 sapp_PerformanceHelper::saveCronMail($optionArr);
                             }
                         }
                     }
                 }
             } else {
                 if ($appval['managers_due_date']) {
                     $manager_due_date = new DateTime($appval['managers_due_date']);
                 } else {
                     $manager_due_date = '';
                 }
                 if ($appval['manager_ids']) {
                     $manager_comp_array = explode(',', $appval['manager_ids']);
                 } else {
                     $manager_comp_array = array();
                 }
                 $getLine1ManagerId = $appraisalPrivMainModel->getLine1ManagerIdMain($appval['id']);
                 if (!empty($getLine1ManagerId)) {
                     foreach ($getLine1ManagerId as $val) {
                         if (!in_array($val['line_manager_1'], $manager_comp_array)) {
                             $interval = $current_day->diff($manager_due_date);
                             $interval->format('%d');
                             $interval = $interval->days;
                             if ($interval <= 1) {
                                 $optionArr = array('subject' => 'Performance Appraisal Pending', 'header' => 'Performance Appraisal', 'toemail' => $val['emailaddress'], 'toname' => $val['userfullname'], 'message' => 'Dear ' . $val['userfullname'] . ', performance appraisal is pending.', 'cron' => 'yes');
                                 sapp_PerformanceHelper::saveCronMail($optionArr);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #3
0
 public function employeestatusAction()
 {
     $ajaxContext = $this->_helper->getHelper('AjaxContext');
     $ajaxContext->addActionContext('employeestatus', 'html')->initContext();
     $flag = $this->_request->getParam('flag');
     $appraisalid = $this->_request->getParam('appraisalid');
     $department_id = $this->_request->getParam('deptid');
     $businessunit_id = $this->_request->getParam('bunitid');
     $performanceappflag = $this->_request->getParam('perf_app_flag');
     $app_status = $this->_request->getParam('app_status');
     $appqsprivilegesModel = new Default_Model_Appraisalqsmain();
     $appempModel = new Default_Model_Appraisalgroupemployees();
     $appInitModel = new Default_Model_Appraisalinit();
     $empratingsModel = new Default_Model_Appraisalemployeeratings();
     $employeeIds = '';
     $msgarray = array();
     $employeeArr = array();
     $getEmployeeRatingsArr = array();
     $errorMsg = '';
     $budeptArr = array();
     if ($flag == 1) {
         if ($appraisalid) {
             $getEmployeeRatingsArr = $empratingsModel->getEmployeeIds($appraisalid, '', $app_status);
             if (!empty($getEmployeeRatingsArr)) {
                 foreach ($getEmployeeRatingsArr as $ids) {
                     $employeeIds .= $ids['employee_id'] . ',';
                 }
                 $employeeIds = rtrim($employeeIds, ',');
             }
             if ($employeeIds != '') {
                 $employeedetailsArr = $appempModel->getEmployeeList(array(), $employeeIds, 2);
             }
             if (!empty($employeedetailsArr)) {
                 foreach ($employeedetailsArr as $key => $val) {
                     $employeeArr[$val['user_id']] = $val;
                 }
             }
             //$budeptArr = $this->getbudeptname($appraisalid);
             $budeptArr = sapp_Global::getbudeptname($appraisalid);
         }
     } else {
         $checkActiveApp = $appInitModel->checkAppraisalExists($businessunit_id, $department_id, $performanceappflag);
         if (count($checkActiveApp) > 0) {
             $checkActiveApp = $checkActiveApp[0];
             if ($checkActiveApp['enable_step'] == 2 && $checkActiveApp['status'] == 1) {
                 $appraisalid = $checkActiveApp['id'];
                 $getEmployeeRatingsArr = $empratingsModel->getEmployeeIds($checkActiveApp['id'], '', $app_status);
                 if (!empty($getEmployeeRatingsArr)) {
                     foreach ($getEmployeeRatingsArr as $ids) {
                         $employeeIds .= $ids['employee_id'] . ',';
                     }
                     $employeeIds = rtrim($employeeIds, ',');
                 }
                 if ($employeeIds != '') {
                     $employeedetailsArr = $appempModel->getEmployeeList(array(), $employeeIds, 2);
                 }
                 if (!empty($employeedetailsArr)) {
                     foreach ($employeedetailsArr as $key => $val) {
                         $employeeArr[$val['user_id']] = $val;
                     }
                 }
             } else {
                 if ($checkActiveApp['enable_step'] == 1) {
                     $errorMsg = 'Appraisal process is enabled to managers.';
                 }
                 if ($checkActiveApp['status'] == 2) {
                     $errorMsg = 'Appraisal process is closed.';
                 }
             }
             //$budeptArr = $this->getbudeptname($checkActiveApp['id']);
             $budeptArr = sapp_Global::getbudeptname($checkActiveApp['id']);
         } else {
             $errorMsg = 'Appraisal process is not yet configured.';
         }
     }
     $this->view->flag = $flag;
     $this->view->msgarray = $msgarray;
     $this->view->ermsg = $errorMsg;
     $this->view->employeeArr = $employeeArr;
     $this->view->employeeratingsArr = $getEmployeeRatingsArr;
     $this->view->appraisalid = $appraisalid;
     $this->view->budeptArr = $budeptArr;
 }
コード例 #4
0
 public function closeappraisal($appraisalid, $status, $enablestepflag, $buid, $perfflag, $deptid)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
         $loginuserArr = array('loginuserid' => $loginUserId, 'loginuserrole' => $loginuserRole, 'loginusergroup' => $loginuserGroup);
     }
     $appraisalinitmodel = new Default_Model_Appraisalinit();
     $appraisalqsmodel = new Default_Model_Appraisalqsmain();
     $appraisalempratingsmodel = new Default_Model_Appraisalemployeeratings();
     $usersmodel = new Default_Model_Users();
     $departmentsmodel = new Default_Model_Departments();
     $announcementsModel = new Default_Model_Announcements();
     $deptids = '';
     $title = 'Performance Appraisal';
     $description = 'Performance appraisal initialized';
     $result = array();
     $employeeidArr = array();
     if ($status == 2) {
         $statustext = 'Closed';
     } else {
         $statustext = 'Forcefully Closed';
     }
     if ($appraisalid) {
         $trDb = Zend_Db_Table::getDefaultAdapter();
         $trDb->beginTransaction();
         try {
             /** Start
              * Updating initialization table
              */
             $init_Arr = array('status' => $status, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $where = array('id=?' => $appraisalid);
             $Id = $appraisalinitmodel->SaveorUpdateAppraisalInitData($init_Arr, $where);
             /**
             						End
             */
             /** Start
              * Sending Mails to employees
              */
             if ($enablestepflag == 1) {
                 $employeeidArr = $appraisalqsmodel->getemployeeIDs($appraisalid);
             } else {
                 $employeeidArr = $appraisalempratingsmodel->getEmployeeIds($appraisalid);
             }
             if (!empty($employeeidArr)) {
                 foreach ($employeeidArr as $emp) {
                     $employeeDetailsArr = $usersmodel->getUserDetailsByID($emp['employee_id'], '');
                     if (!empty($employeeDetailsArr)) {
                         $options['subject'] = APPLICATION_NAME . ': Performance Appraisal ' . $statustext;
                         $options['header'] = 'Performance Appraisal ' . $statustext;
                         $options['toEmail'] = $employeeDetailsArr[0]['emailaddress'];
                         $options['toName'] = $employeeDetailsArr[0]['userfullname'];
                         $options['message'] = 'Dear ' . $employeeDetailsArr[0]['userfullname'] . ', performance appraisal ' . $statustext;
                         $options['cron'] = 'yes';
                         // sapp_Global::_sendEmail($options);
                     }
                 }
             }
             /**
              * End
              */
             /** 
              * Mail to performance Appraisal Group
              */
             if (defined('PER_APPRAISAL_' . $buid) && $buid != '') {
                 $options['subject'] = APPLICATION_NAME . ': Performance Appraisal ' . $statustext;
                 $options['header'] = 'Performance Appraisal';
                 $options['toEmail'] = constant('PER_APPRAISAL_' . $buid);
                 $options['toName'] = 'Performance Appraisal';
                 $options['message'] = 'Performance appraisal initiated ' . $statustext;
                 $options['cron'] = 'yes';
                 //  sapp_Global::_sendEmail($options);
             }
             /**
              * End
              */
             $trDb->commit();
             $result['msg'] = 'Performance Appraisal ' . $statustext;
             $result['result'] = 'success';
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Performance Appraisal " . $statustext));
         } catch (Exception $e) {
             $trDb->rollBack();
             $result['msg'] = $e->getMessage();
             $result['result'] = 'error';
         }
     }
     return $result;
 }