Example #1
0
 public function getgroupEmails($sort, $by, $pageNo, $perPage, $searchQuery)
 {
     $where = "e.isactive = 1";
     if ($searchQuery) {
         $where .= " AND " . $searchQuery;
     }
     if (!sapp_Global::_isactivemodule(RESOURCEREQUISITION)) {
         $where .= " AND eg.group_code <> 'REQ_HR' AND eg.group_code <> 'REQ_MGMT' ";
     }
     if (!sapp_Global::_isactivemodule(BGCHECKS)) {
         $where .= " AND eg.group_code <> 'BG_CHECKS_HR' AND eg.group_code <> 'BG_CHECKS_MNGMNT' ";
     }
     $emailContactsdata = $this->select()->setIntegrityCheck(false)->from(array('e' => 'main_emailcontacts'))->joinInner(array('eg' => 'main_emailgroups'), "eg.id = e.group_id and eg.isactive = 1", array('group_name' => 'eg.group_name'))->joinInner(array('bu' => 'main_businessunits'), "bu.id = e.business_unit_id and bu.isactive = 1", array('unitname' => "if(bu.id = 0,'',bu.unitname)"))->where($where)->order("{$by} {$sort}")->limitPage($pageNo, $perPage);
     return $emailContactsdata;
 }
 public function save($IdentityCodesform, $redirect_flag = '')
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $date = new Zend_Date();
     if ($IdentityCodesform->isValid($this->_request->getPost())) {
         $IdentityCodesModel = new Default_Model_Identitycodes();
         $id = $this->_request->getParam('id');
         $employeeCode = $this->_request->getParam('employee_code');
         $bgAgencyCode = $this->_request->getParam('bg_code');
         $vendorCode = $this->_request->getParam('vendor_code');
         $staffingCode = $this->_request->getParam('staffing_code');
         $users_code = $this->_request->getParam('users_code');
         $requisition_code = $this->_request->getParam('requisition_code');
         $data = array('employee_code' => $employeeCode, 'backgroundagency_code' => $bgAgencyCode, 'vendor_code' => $vendorCode, 'staffing_code' => $staffingCode, 'users_code' => $users_code, 'requisition_code' => $requisition_code, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
         /* Removing the codes which we are not being using for the first phase*/
         unset($data['vendor_code']);
         unset($data['staffing_code']);
         if (!sapp_Global::_isactivemodule(RESOURCEREQUISITION)) {
             unset($data['requisition_code']);
         }
         if (!sapp_Global::_isactivemodule(BGCHECKS)) {
             unset($data['backgroundagency_code']);
         }
         if ($id != '') {
             $where = array('id=?' => $id);
             $actionflag = 2;
         } else {
             $data['createdby'] = $loginUserId;
             $data['createddate'] = gmdate("Y-m-d H:i:s");
             $where = '';
             $actionflag = 1;
         }
         $Id = $IdentityCodesModel->SaveorUpdateIdentitycodesData($data, $where);
         if ($Id == 'update') {
             $tableid = $id;
             if ($redirect_flag == '') {
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Identity codes updated successfully."));
             }
             $smessage = "Identity codes updated successfully.";
         } else {
             $tableid = $Id;
             if ($redirect_flag == '') {
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Identity codes added successfully."));
             }
             $smessage = "Identity codes added successfully.";
         }
         $menuID = IDENTITYCODES;
         $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
         if ($redirect_flag == '') {
             $this->_redirect('identitycodes');
         } else {
             return array('msg' => $smessage);
         }
     } else {
         $messages = $IdentityCodesform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
 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';
     }
 }
 public function viewAction()
 {
     $id = abs(intval($this->getRequest()->getParam('id')));
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $emailContactsform = new Default_Form_emailcontacts();
     $emailContactsModel = new Default_Model_Emailcontacts();
     if ($id && $id > 0) {
         try {
             $data = $emailContactsModel->getdataforview($id);
             if (count($data) > 0) {
                 if (sapp_Global::_isactivemodule(RESOURCEREQUISITION) && ($data['group_code'] == 'REQ_HR' || $data['group_code'] == 'REQ_MGMT') || sapp_Global::_isactivemodule(BGCHECKS) && ($data['group_code'] == 'BG_CHECKS_HR' || $data['group_code'] == 'BG_CHECKS_MNGMNT')) {
                     $emailContactsform->setDefault("id", $id);
                     $emailContactsform->setDefault("groupEmail", $data["groupEmail"]);
                     $emailContactsform->group_id->addMultiOptions(array('' => $data['group_name']));
                     $emailContactsform->business_unit_id->addMultiOptions(array('' => $data['unitname']));
                     $emailContactsform->group_id->setAttrib('disabled', 'disabled');
                     $emailContactsform->groupEmail->setAttrib('disabled', 'disabled');
                     $emailContactsform->business_unit_id->setAttrib('disabled', 'disabled');
                     $this->view->emailContactsData = $data;
                 } else {
                     $this->view->nodata = "nodata";
                 }
             } else {
                 $this->view->nodata = "nodata";
             }
         } catch (Exception $e) {
             $this->view->nodata = "nodata";
         }
     } else {
         $this->view->nodata = "nodata";
     }
     $this->view->form = $emailContactsform;
     $this->view->id = $id;
     $this->view->controllername = "emailcontacts";
 }