public function addpopupAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $hrem = 'true'; $mngmntem = 'true'; $idData = $this->getRequest()->getParam('unitId'); $idArr = array(); $idArr = explode('-', $idData); $specimen_id = $idArr[0]; $userflag = $idArr[1]; $bgstatus = ''; $agencyids = ''; $empmodel = new Default_Model_Empscreening(); $emparraydata = $empmodel->checkbgstatus($specimen_id, $userflag, 'status'); if (!empty($emparraydata)) { $bgstatus = $emparraydata[0]['bgcheck_status']; } $empscreeningform = new Default_Form_empscreening(); $empscreeningform->setAttrib('id', 'processform'); $submitButon = $empscreeningform->getElement("submit"); $submitButon->setAttrib('style', 'display:none;'); $empscreeningform->setAttrib('action', DOMAIN . 'processes/addpopup/unitId/' . $idData); $empscreeningform->removeElement("employee"); $processdata = array(); $empscreeningform->removeElement("bgcheck_status"); if ($loginuserGroup != HR_GROUP && $loginuserGroup != '' && $loginuserGroup != MANAGEMENT_GROUP) { $elements = $empscreeningform->getElements(); if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") { $element->setAttrib("disabled", "disabled"); } } } } /* */ /* Checking for configurations - screening type and agencies */ $msgarray = array(); $errorflag = 'true'; $checktypeModal = new Default_Model_Bgscreeningtype(); $agencymodel = new Default_Model_Agencylist(); $typesData = $checktypeModal->fetchAll('isactive=1', 'type')->toArray(); $agencyData = $agencymodel->fetchAll('isactive=1', 'agencyname')->toArray(); $personalData = $empmodel->getEmpPersonalData($specimen_id, $userflag); if (empty($typesData)) { $msgarray['checktype'] = 'Screening types are not configured yet.'; $errorflag = 'false'; } if (empty($agencyData)) { $msgarray['agencyids'] = 'Agencies are not added yet.'; $errorflag = 'false'; } if (!empty($typesData) && !empty($agencyData)) { $this->view->configure = ''; } else { $this->view->configure = 'notconfigured'; } $bid = ''; if (isset($personalData[0]['businessid'])) { $bid = $personalData[0]['businessid']; } if (defined('BG_CHECKS_HR_' . $bid) && $bid != '') { $hremailId = explode(",", constant('BG_CHECKS_HR_' . $bid)); } else { $hrem = 'false'; $hremailId = array(); } if (defined('BG_CHECKS_MNGMNT_' . $bid) && $bid != '') { $mngmntemailId = explode(",", constant('BG_CHECKS_MNGMNT_' . $bid)); } else { $mngmntem = 'false'; $mngmntemailId = array(); } if ($specimen_id == $loginUserId) { $displaymsg = 'nodata'; } else { $displaymsg = ''; } $this->view->msgarray = $msgarray; $this->view->hrEmail = $hrem; $this->view->mngmntEmail = $mngmntem; $this->view->displaymsg = $displaymsg; /* */ $this->view->form = $empscreeningform; $this->view->bgstatus = $bgstatus; if ($this->getRequest()->getPost()) { $agencyids = $this->_request->getParam('agencyids'); $result = $this->save($empscreeningform, $processdata); $this->view->msgarray = $result; $this->view->messages = $result; $this->view->agencyids = $agencyids; $this->view->contactRadio = $this->_request->getParam('contactRadio'); } }
public function forcedfullupdateAction() { $baseUrl = BASE_URL; $baseUrl = rtrim($baseUrl, '/'); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $specimenId = $this->_request->getParam('specimenId'); $empFlag = $this->_request->getParam('empFlag'); $count = intval($this->_request->getParam('count')); $username = ''; $empscreeningModel = new Default_Model_Empscreening(); $getAllRecords = $empscreeningModel->checkbgstatus($specimenId, $empFlag, 'completedata'); $username = $getAllRecords[0]['username']; if (isset($getAllRecords[0]['rmanager_email'])) { $reportmanagerEmail = $getAllRecords[0]['rmanager_email']; } else { $reportmanagerEmail = ''; } if (isset($getAllRecords[0]['reporting_manager'])) { $reportmanagername = $getAllRecords[0]['reporting_manager']; } else { $reportmanagername = ''; } if ($count == '') { $this->view->dataArray = $getAllRecords; } $close = ''; if ($count != '') { for ($i = 0; $i < $count; $i++) { $id = intval($this->_request->getParam('id' . $i)); $explanation = $this->_request->getParam('text' . $i); $date = new Zend_Date(); $data = array('process_status' => 'Complete', 'explanation' => $explanation, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('specimen_id=?' => $specimenId, 'flag=?' => $empFlag, 'process_status=?' => 'In process', 'id=?' => $id); $detailId = $empscreeningModel->SaveorUpdateDetails($data, $where); $where = array('specimen_id=?' => $specimenId, 'flag=?' => $empFlag, 'process_status' => 'On hold', 'id=?' => $id); $detailId = $empscreeningModel->SaveorUpdateDetails($data, $where); if ($detailId == 'update') { $tableid = $id; } else { $tableid = $detailId; } $actionflag = 2; $menuID = EMPSCREENING; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $specimenId . '-' . $empFlag); } $bgdata = array('bgcheck_status' => 'Complete', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('specimen_id=?' => $specimenId, 'flag=?' => $empFlag, 'isactive = 1'); $actionflag = 2; $detailId = $empscreeningModel->SaveorUpdateDetails($bgdata, $where); /* Updating back ground check status to Completed in employees/candidates status */ if ($empFlag == 1) { $usermodel = new Default_Model_Users(); $empData = array('backgroundchk_status' => 'Completed', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $empWhere = array('id=?' => $specimenId); $usermodel->addOrUpdateUserModel($empData, $empWhere, $specimenId); } else { $candModel = new Default_Model_Candidatedetails(); $candData = array('backgroundchk_status' => 'Completed', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $candWhere = array('id=?' => $specimenId); $candModel->SaveorUpdateUserData($candData, $candWhere); } /* END */ /* Mail to HRD, L1 and L2 managers*/ $personalData = $empscreeningModel->getEmpPersonalData($specimenId, $empFlag); $bid = ''; if (isset($personalData[0]['businessid'])) { $bid = $personalData[0]['businessid']; } if (isset($reportmanagerEmail) && $reportmanagerEmail != '') { $manager1 = array($reportmanagerEmail); } else { $manager1 = array(); } if (defined('BG_CHECKS_MNGMNT_' . $bid) && $bid != '') { $mngmntemailId = explode(",", constant('BG_CHECKS_MNGMNT_' . $bid)); } else { $mngmntemailId = array(); } if (defined('BG_CHECKS_HR_' . $bid) && $bid != '') { $hremailId = explode(",", constant('BG_CHECKS_HR_' . $bid)); } else { $hremailId = array(); } $emailArr = array_merge($manager1, $mngmntemailId, $hremailId); for ($i = 0; $i < sizeof($emailArr); $i++) { $salutation = 'Dear Sir/Madam,'; if ($i == 0) { $salutation = 'Dear ' . ucfirst($reportmanagername) . ','; $options['toName'] = ucfirst($reportmanagername); } else { if ($i == 1) { $salutation = 'Dear Management,'; $options['toName'] = 'Management'; } else { if ($i == 2) { $salutation = 'Dear HR,'; $options['toName'] = 'HR'; } } } $options['subject'] = APPLICATION_NAME . ' :: Background check'; $options['header'] = 'Background check completed'; $options['toEmail'] = $emailArr[$i]; $options['message'] = '<div>' . $salutation . '<div>The background check for ' . ucfirst($username) . ' has been completed.'; if (!empty($personalData[0]['employee_id'])) { $options['message'] .= ' Please find the details below.</div> <div> <table border="1" style="border-collapse:collapse;"> <tr><td>Employee ID</td><td>' . $getAllRecords[0]['employee_id'] . '</td></tr> <tr><td>Employee Email</td><td>' . $getAllRecords[0]['email_id'] . '</td></tr> <tr><td>Employee Designation</td><td>' . $getAllRecords[0]['designation'] . '</td></tr> </table> </div>'; } $options['message'] .= '<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login and check the details.</div> </div>'; $options['cron'] = 'yes'; $result = sapp_Global::_sendEmail($options); } /* END */ $updateresult['result'] = 'saved'; $updateresult['popup'] = 'close'; $this->_helper->json($updateresult); } }