public function getfeedforwardstatusAction()
 {
     $id = $this->_request->getParam('id');
     $ffstatus = $this->_request->getParam('ffstatus');
     $ffEmpRatModel = new Default_Model_Feedforwardemployeeratings();
     $ffEmpsStatusData = $ffEmpRatModel->getfeedforwardstatus($id, $ffstatus);
     $this->view->ffEmpsStatusData = $ffEmpsStatusData;
 }
Esempio n. 2
0
 public function checkffduedate()
 {
     $ffinitModel = new Default_Model_Feedforwardinit();
     $ffEmpRatModel = new Default_Model_Feedforwardemployeeratings();
     $ffDataArr = $ffinitModel->getFFbyBUDept('', 'yes');
     $ffIdArr = array();
     $ffIdList = '';
     $current_day = new DateTime('now');
     $current_day->sub(new DateInterval('P1D'));
     if (!empty($ffDataArr)) {
         foreach ($ffDataArr as $ffval) {
             if ($ffval['status'] == 1) {
                 if ($ffval['ff_due_date']) {
                     $due_date = new DateTime($ffval['ff_due_date']);
                 } else {
                     $due_date = '';
                 }
                 $interval = $current_day->diff($due_date);
                 $interval->format('%d');
                 $interval = $interval->days;
                 if ($interval <= 2) {
                     array_push($ffIdArr, $ffval['id']);
                 }
             }
         }
     }
     if (!empty($ffIdArr)) {
         $ffIdList = implode(',', $ffIdArr);
     }
     if ($ffIdList != '') {
         $ffEmpsStatusData = $ffEmpRatModel->getEmpsFFStatus($ffIdList, 'cron');
         if (!empty($ffEmpsStatusData)) {
             $empIdArr = array();
             foreach ($ffEmpsStatusData as $empval) {
                 array_push($empIdArr, $empval['emailaddress']);
             }
             $optionArr = array('subject' => 'Manager Feedforward submission pending', 'header' => 'Feedforward', 'toemail' => SUPERADMIN_EMAIL, 'toname' => 'Super Admin', 'bcc' => $empIdArr, '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;'>Mangaer feedforward 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);
         }
     }
 }
 public function getdetailedratingsbyquesAction()
 {
     $ff_id = $this->_request->getParam('ff_id');
     $mgr_id = $this->_request->getParam('mgr_id');
     $pa_conf_id = $this->_request->getParam('pa_conf_id');
     $ques_id = $this->_request->getParam('ques_id');
     $ffinitModel = new Default_Model_Feedforwardinit();
     $ffEmpRatModel = new Default_Model_Feedforwardemployeeratings();
     $empsData = $ffinitModel->getDetailEmpsDataByMgrId($ff_id, $mgr_id);
     $quesData = $ffEmpRatModel->getFFQuesDataByIDs($empsData[0]['question_ids']);
     // Employee response
     $emp_response = array();
     if ($empsData[0]['employee_response']) {
         $emp_response = json_decode($empsData[0]['employee_response'], true);
     }
     // get rating details using configuration id
     $ratingsData = $ffEmpRatModel->getAppRatingsDataByConfgId($pa_conf_id);
     $ratingType = $ratingsData[0]['rating_type'];
     $ratingText = array();
     $ratingTextDisplay = array();
     $ratingValues = array();
     foreach ($ratingsData as $rd) {
         $ratingText[] = $rd['rating_text'];
         $ratingTextDisplay[$rd['id']] = $rd['rating_text'];
         $ratingValues[$rd['id']] = $rd['rating_value'];
     }
     $this->view->empsData = $empsData;
     $this->view->quesData = $quesData;
     $this->view->ratingType = $ratingType;
     $this->view->ratingTextDisplay = $ratingTextDisplay;
     $this->view->ratingText = json_encode($ratingText);
     $this->view->ratingValues = $ratingValues;
     $this->view->emp_response = $emp_response;
     $this->view->ques_id = $ques_id;
     $this->view->emp_view_flag = $this->_request->getParam('emp_view_flag');
     //Condition is for checking of additional questions click event
     $this->view->additional_Qflag = '';
     if ($ques_id == '') {
         $this->view->additional_Qflag = 'additional_flag';
     }
 }
 public function saveAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
         $loginuserFullName = $auth->getStorage()->read()->userfullname;
         $loginuserProfileImg = $auth->getStorage()->read()->profileimg;
     }
     try {
         $ffEmpRatingsModel = new Default_Model_Feedforwardemployeeratings();
         $id = $this->_request->getParam('id');
         $employee_id = $this->_request->getParam('employee_id');
         $initialization_id = $this->_request->getParam('initialization_id');
         $config_id = $this->_request->getParam('config_id');
         $flag = $this->_request->getParam('flag');
         $ratingsData = $ffEmpRatingsModel->getAppRatingsDataByConfgId($config_id);
         $ratingValues = array();
         foreach ($ratingsData as $rd) {
             $ratingValues[$rd['id']] = $rd['rating_value'];
         }
         $appData = array('additional_comments' => trim($this->_request->getParam('additional_comments')), 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s"));
         $emp_rating_arr = $this->_request->getParam('emp_rating');
         $emp_comment_arr = $this->_request->getParam('emp_comment');
         $emp_response = array();
         $rating_sum = 0;
         $ratings_given = 0;
         if (sizeof($emp_rating_arr) > 0 || sizeof($emp_comment_arr) > 0) {
             foreach ($emp_rating_arr as $qid => $val) {
                 if (isset($emp_rating_arr[$qid])) {
                     $rating_id = array_search($emp_rating_arr[$qid], $ratingValues);
                     $rating_sum += $emp_rating_arr[$qid];
                     $ratings_given++;
                 } else {
                     $rating_id = '';
                 }
                 $emp_response[$qid] = array('comment' => $emp_comment_arr[$qid], 'rating_id' => $rating_id);
             }
         }
         $appData['employee_response'] = json_encode($emp_response, true);
         if ($flag == 'submit') {
             $appData['ff_status'] = 2;
             $appData['consolidated_rating'] = $rating_sum / $ratings_given;
         }
         $appWhere = array('id=?' => $id);
         $result1 = $ffEmpRatingsModel->SaveorUpdateFFEmpRatingsData($appData, $appWhere);
         if ($result1) {
             $msg = 'saved';
             if ($flag != 'submit') {
                 $this->_redirect('feedforwardemployee/edit/msg/saved/flags/draft');
             } else {
                 //Logs storing
                 $tableid = '';
                 $actionflag = 1;
                 $menuID = APPRAISE_YOUR_MANAGER;
                 $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
                 $this->_redirect('feedforwardemployee');
             }
         } else {
             $msg = 'err';
         }
     } catch (Exception $e) {
         $msg = "Something went wrong, please try again.";
     }
     //$this->_helper->json(array('msg'=>$msg));
 }
 public function ffinitialize($appInitId, $tableid, $enable_to, $check)
 {
     if ($tableid) {
         $auth = Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             $loginUserId = $auth->getStorage()->read()->id;
             $loginuserRole = $auth->getStorage()->read()->emprole;
             $loginuserGroup = $auth->getStorage()->read()->group_id;
             $loginUserEmpId = $auth->getStorage()->read()->employeeId;
             $loginUserfullname = $auth->getStorage()->read()->userfullname;
         }
         $ffEmpRatingsModel = new Default_Model_Feedforwardemployeeratings();
         $feedforwardInitModel = new Default_Model_Feedforwardinit();
         $appraisalEmpsData = $feedforwardInitModel->getEmpsFromAppEmpRat($appInitId);
         $appEmpIDs = array();
         if (sizeof($appraisalEmpsData) > 0) {
             foreach ($appraisalEmpsData as $appE) {
                 $appEmpIDs[] = $appE['employee_id'];
                 $where = '';
                 $data = array('ff_initialization_id' => $tableid, 'question_ids' => $check != '' ? implode(',', $check) : NULL, 'manager_id' => $appE['line_manager_1'], 'employee_id' => $appE['employee_id'], 'ff_status' => 1, 'createdby' => $loginUserId, 'createdby_role' => $loginuserRole, 'createdby_group' => $loginuserGroup, 'createddate' => gmdate("Y-m-d H:i:s"));
                 $ffEmpRatingsModel->SaveorUpdateFFEmpRatingsData($data, $where);
             }
         }
         if (sizeof($appEmpIDs) > 0 && $enable_to == 1) {
             $appEmpIDsCsv = implode(',', $appEmpIDs);
             $allEmpsData = $feedforwardInitModel->getEmpsFromSummary($appEmpIDsCsv);
             if (sizeof($allEmpsData) > 0) {
                 foreach ($allEmpsData as $allE) {
                     $where1 = '';
                     $data1 = array('ff_initialization_id' => $tableid, 'question_ids' => $check != '' ? implode(',', $check) : NULL, 'manager_id' => $allE['reporting_manager'], 'employee_id' => $allE['user_id'], 'ff_status' => 1, 'createdby' => $loginUserId, 'createdby_role' => $loginuserRole, 'createdby_group' => $loginuserGroup, 'createddate' => gmdate("Y-m-d H:i:s"));
                     $ffEmpRatingsModel->SaveorUpdateFFEmpRatingsData($data1, $where1);
                 }
             }
         }
         $actionflag = 1;
         $tableid = '';
         $menuID = INITIALIZE_FEEDFORWARD;
         $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
         /** Start
          * Sending Mails to Super Admin,Management,HR
          */
         $appraisalratingsmodel = new Default_Model_Appraisalratings();
         $appraisalconfigmodel = new Default_Model_Appraisalconfig();
         //to get initialization details using appraisal Id for Business Unit,Department,To Year
         $appraisal_details = $appraisalratingsmodel->getappdata($appInitId);
         if (!empty($appraisal_details)) {
             $businessUnit = $appraisal_details['businessunit_id'];
             $department = $appraisal_details['deptid'];
             $bunit = $appraisal_details['unitname'];
             $dept = $appraisal_details['deptname'];
             $to_year = $appraisal_details['to_year'];
             $employeeDetailsArr = $appraisalconfigmodel->getUserDetailsByID($businessUnit, $department);
             if ($enable_to == 1) {
                 $empforFF = $feedforwardInitModel->getEmpIdforFF($businessUnit, $department);
             } else {
                 $empforFF = $feedforwardInitModel->getAppemployeeIDs($appInitId);
             }
             $ffEmpArr = array();
             $ffEmpList = '';
             if (!empty($empforFF)) {
                 foreach ($empforFF as $emp) {
                     array_push($ffEmpArr, $emp['employeeId']);
                 }
                 $ffEmpList = implode(',', $ffEmpArr);
             }
             $ffEmpEmailArr = array();
             $ffemployeeDetailsArr = $feedforwardInitModel->getUserDetailsByIds($ffEmpList);
             if (!empty($ffemployeeDetailsArr)) {
                 foreach ($ffemployeeDetailsArr as $empFF) {
                     array_push($ffEmpEmailArr, $empFF['emailaddress']);
                 }
             }
             $dept_str = $dept == '' ? " " : "and department <b>{$dept}</b> ";
             $emp_id_str = $loginuserRole == SUPERADMINROLE ? " " : "({$loginUserEmpId})";
             //Preparing Employee array for Bcc
             $empArr = array();
             $total_emp_arr = array();
             if (!empty($employeeDetailsArr)) {
                 $empArrList = '';
                 foreach ($employeeDetailsArr as $emp) {
                     array_push($empArr, $emp['emailaddress']);
                 }
             }
             $total_emp_arr = array_merge($empArr, $ffEmpEmailArr);
             //Sending mail to Super admin,HR,Management
             $options['subject'] = APPLICATION_NAME . ': Feedforward Initialization';
             $options['header'] = 'Feedforward Initialization : ' . $to_year;
             $options['toEmail'] = SUPERADMIN_EMAIL;
             $options['toName'] = 'Super Admin';
             $options['bcc'] = $total_emp_arr;
             $options['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<span style='color:#3b3b3b;'>Hi,</span><br />\n\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>Feedforward process have been initialized for the year <b>{$to_year}</b> for business unit <b>{$bunit}</b>  {$dept_str} by " . $loginUserfullname . $emp_id_str . ". </div>\n\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 and check the details.</div>\n\t\t\t\t\t\t\t\t\t\t</div> ";
             //'Dear Super Admin, performance appraisal Initialized '.$mail_str;
             $mail_id = sapp_Global::_sendEmail($options);
         }
     }
 }
Esempio n. 6
0
 public function checkffduedate()
 {
     $ffinitModel = new Default_Model_Feedforwardinit();
     $ffEmpRatModel = new Default_Model_Feedforwardemployeeratings();
     $ffDataArr = $ffinitModel->getFFbyBUDept('', 'yes');
     $current_day = new DateTime('now');
     $current_day->sub(new DateInterval('P1D'));
     if (!empty($ffDataArr)) {
         foreach ($ffDataArr as $ffval) {
             if ($ffval['status'] == 1) {
                 if ($ffval['ff_due_date']) {
                     $due_date = new DateTime($ffval['ff_due_date']);
                 } else {
                     $due_date = '';
                 }
                 $ffEmpsStatusData = $ffEmpRatModel->getEmpsFFStatus($ffval['id'], 'cron');
                 if (!empty($ffEmpsStatusData)) {
                     foreach ($ffEmpsStatusData as $empval) {
                         if ($empval['ff_status'] != APP_COMPLETED) {
                             $interval = $current_day->diff($due_date);
                             $interval->format('%d');
                             $interval = $interval->days;
                             if ($interval <= 1) {
                                 $optionArr = array('subject' => 'Feed Forward Pending', 'header' => 'Feed Forward', 'toemail' => $empval['userfullname'], 'toname' => $empval['emailaddress'], 'message' => 'Dear ' . $empval['userfullname'] . ', feed forward is pending.', 'cron' => 'yes');
                                 sapp_PerformanceHelper::saveCronMail($optionArr);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 public function ffinitialize($appInitId, $tableid, $enable_to, $check)
 {
     if ($tableid) {
         $auth = Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             $loginUserId = $auth->getStorage()->read()->id;
             $loginuserRole = $auth->getStorage()->read()->emprole;
             $loginuserGroup = $auth->getStorage()->read()->group_id;
         }
         $ffEmpRatingsModel = new Default_Model_Feedforwardemployeeratings();
         $feedforwardInitModel = new Default_Model_Feedforwardinit();
         $appraisalEmpsData = $feedforwardInitModel->getEmpsFromAppEmpRat($appInitId);
         $appEmpIDs = array();
         if (sizeof($appraisalEmpsData) > 0) {
             foreach ($appraisalEmpsData as $appE) {
                 $appEmpIDs[] = $appE['employee_id'];
                 $where = '';
                 $data = array('ff_initialization_id' => $tableid, 'question_ids' => $check != '' ? implode(',', $check) : NULL, 'manager_id' => $appE['line_manager_1'], 'employee_id' => $appE['employee_id'], 'ff_status' => 1, 'createdby' => $loginUserId, 'createdby_role' => $loginuserRole, 'createdby_group' => $loginuserGroup, 'createddate' => gmdate("Y-m-d H:i:s"));
                 $ffEmpRatingsModel->SaveorUpdateFFEmpRatingsData($data, $where);
             }
         }
         if (sizeof($appEmpIDs) > 0 && $enable_to == 1) {
             $appEmpIDsCsv = implode(',', $appEmpIDs);
             $allEmpsData = $feedforwardInitModel->getEmpsFromSummary($appEmpIDsCsv);
             if (sizeof($allEmpsData) > 0) {
                 foreach ($allEmpsData as $allE) {
                     $where1 = '';
                     $data1 = array('ff_initialization_id' => $tableid, 'question_ids' => $check != '' ? implode(',', $check) : NULL, 'manager_id' => $allE['reporting_manager'], 'employee_id' => $allE['user_id'], 'ff_status' => 1, 'createdby' => $loginUserId, 'createdby_role' => $loginuserRole, 'createdby_group' => $loginuserGroup, 'createddate' => gmdate("Y-m-d H:i:s"));
                     $ffEmpRatingsModel->SaveorUpdateFFEmpRatingsData($data1, $where1);
                 }
             }
         }
     }
 }