Ejemplo n.º 1
0
 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 viewAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $idData = $this->getRequest()->getParam('id');
     $empscreeningform = new Default_Form_empscreening();
     $empscreeningModel = new Default_Model_Empscreening();
     $processData = array();
     $idArr = array();
     $idArr = explode('-', $idData);
     if (sizeof($idArr) > 1) {
         $id = intVal($idArr[0]);
         $userflag = intVal($idArr[1]);
         $idData = $id . '-' . $userflag;
     } else {
         $id = '';
         $userflag = '';
         $idData = '';
     }
     if ($userflag == 2) {
         $flag = 'cand';
     } else {
         $flag = 'emp';
     }
     if ($userflag == 1 || $userflag == 2 && sapp_Global::_isactivemodule(RESOURCEREQUISITION)) {
         if ($id && $id != $loginUserId) {
             $data = $empscreeningModel->getsingleEmpscreeningData($id, $userflag);
             if (!empty($data) && $data != 'norows') {
                 $empscreeningform->setAttrib('action', BASE_URL . 'empscreening/edit/id/' . $idData);
                 $empscreeningform->removeElement("employee");
                 $empscreeningform->removeElement("checktype");
                 $empscreeningform->removeElement("checkagency");
                 $empscreeningform->populate($data);
                 $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");
                         }
                     }
                 }
                 $specimenId = $data['specimen_id'];
                 $empData = array();
                 if (isset($specimenId) && isset($flag)) {
                     $personalData = $empscreeningModel->getEmpPersonalData($specimenId, $flag);
                     $addressData = $empscreeningModel->getEmpAddressData($specimenId, $flag);
                     $companyData = $empscreeningModel->getEmpCompanyData($specimenId, $flag);
                 }
                 $this->view->personalData = $personalData;
                 $this->view->addressData = $addressData;
                 $this->view->companyData = $companyData;
                 $this->view->ermsg = '';
                 if ($idData != '') {
                     $processData = $this->processesGrid($idData, $personalData[0]['ustatus']);
                 }
                 $this->view->dataArray = $processData;
                 $this->view->form = $empscreeningform;
             } else {
                 $this->view->ermsg = 'nodata';
             }
         } else {
             $this->view->ermsg = 'nodata';
         }
     } else {
         $this->view->ermsg = 'nodata';
     }
 }