public static function buildlocations($form, $wizardData) { $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $countryId = ''; $stateId = ''; $cityId = ''; $new_stateId = ''; $new_cityId = ''; if (isset($wizardData['country']) && $wizardData['country'] != 'null') { $countryId = $wizardData['country']; } if (isset($wizardData['state']) && $wizardData['state'] != 'null') { $stateId = $wizardData['state']; } if (isset($wizardData['city']) && $wizardData['city'] != 'null') { $cityId = $wizardData['city']; } if (count($_POST) > 0) { $countryId = isset($_POST['country']) ? $_POST['country'] : ""; $stateId = isset($_POST['state']) ? $_POST['state'] : ""; $cityId = isset($_POST['city']) ? $_POST['city'] : ""; } if ($countryId != '') { $statesData = $statesmodel->getBasicStatesList((int) $countryId); foreach ($statesData as $res) { if ($stateId == $res['state_id_org']) { $new_stateId = $res['state_id_org'] . '!@#' . utf8_encode($res['state']); } $form->state->addMultiOption($res['state_id_org'] . '!@#' . utf8_encode($res['state']), utf8_encode($res['state'])); } if (count($_POST) == 0) { $stateId = $new_stateId; } } if ($stateId != '') { $citiesData = $citiesmodel->getBasicCitiesList((int) $stateId); foreach ($citiesData as $res) { if ($cityId == $res['city_org_id']) { $new_cityId = $res['city_org_id'] . '!@#' . utf8_encode($res['city']); } $form->city->addMultiOption($res['city_org_id'] . '!@#' . utf8_encode($res['city']), utf8_encode($res['city'])); } if (count($_POST) == 0) { $cityId = $new_cityId; } } $form->setDefault('country', $countryId); $form->setDefault('state', $stateId); $form->setDefault('city', $cityId); }
public function editpopupAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $orgInfoModel = new Default_Model_Organisationinfo(); $getorgData = $orgInfoModel->getorgrecords(); $deptModel = new Default_Model_Departments(); if (!empty($getorgData)) { $orgdata = ''; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $msgarray = array(); $flag = 'true'; $bunitid = $this->getRequest()->getParam('unitId'); $id = intVal($this->getRequest()->getParam('id')); $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $timezonemodel = new Default_Model_Timezone(); $businessunitsmodel = new Default_Model_Businessunits(); $allTimezoneData = $timezonemodel->fetchAll('isactive=1', 'timezone')->toArray(); $allCountriesData = $countriesModel->fetchAll('isactive=1', 'country')->toArray(); $allStatesData = $statesmodel->fetchAll('isactive=1', 'state')->toArray(); $allCitiesData = $citiesmodel->fetchAll('isactive=1', 'city')->toArray(); $allBusinessunitsData = $businessunitsmodel->fetchAll('isactive=1', 'unitname')->toArray(); $deptModel = new Default_Model_Departments(); $deptform = new Default_Form_departments(); $deptform->setAction(BASE_URL . 'departments/editpopup/id/' . $id . '/unitId/' . $bunitid); $country = $getorgData[0]['country']; if (isset($_POST['country'])) { $country = $_POST['country']; } $state = $getorgData[0]['state']; if (isset($_POST['state'])) { $state = $_POST['state']; } $city = $getorgData[0]['city']; if (isset($_POST['city'])) { $city = $_POST['city']; } $address = $getorgData[0]['address1']; //department head data $managementUsersData = $deptModel->getDepartmenttHead(''); foreach ($managementUsersData as $mgmtdata) { $deptform->depthead->addMultiOption($mgmtdata['user_id'], $mgmtdata['userfullname']); } if (isset($country) && $country != 0 && $country != '') { $deptform->setDefault('country', $country); $statesData = $statesmodel->getBasicStatesList($country); foreach ($statesData as $res) { $deptform->state->addMultiOption($res['state_id_org'], utf8_encode($res['state'])); } if (isset($state) && $state != 0 && $state != '') { $deptform->setDefault('state', $state); } } if (isset($state) && $state != 0 && $state != '') { $citiesData = $citiesmodel->getBasicCitiesList($state); foreach ($citiesData as $res) { $deptform->city->addMultiOption($res['city_org_id'], utf8_encode($res['city'])); } if (isset($city) && $city != 0 && $city != '') { $deptform->setDefault('city', $city); } } if (isset($address) && $address != '') { $deptform->address1->setValue($address); } $close = ''; $controllername = 'departments'; $deptData = array(); if ($id) { $data = $deptModel->getSingleDepartmentData($id); if (!empty($data)) { $deptform->populate($data); $deptform->submit->setLabel('Update'); $st_date = sapp_Global::change_date($data['startdate'], 'view'); $deptform->setDefault('start_date', $st_date); $deptform->setDefault('start_date', $st_date); $deptform->state->clearMultiOptions(); $deptform->city->clearMultiOptions(); $countryId = $data['country']; if (isset($_POST['country'])) { $countryId = $_POST['country']; } $stateId = $data['state']; if (isset($_POST['state'])) { $stateId = $_POST['state']; } $cityId = $data['city']; if (isset($_POST['city'])) { $cityId = $_POST['city']; } if ($countryId != '') { $statesmodel = new Default_Model_States(); $statesData = $statesmodel->getBasicStatesList($countryId); foreach ($statesData as $res) { $deptform->state->addMultiOption($res['state_id_org'], utf8_encode($res['state'])); } } if ($stateId != '') { $citiesmodel = new Default_Model_Cities(); $citiesData = $citiesmodel->getBasicCitiesList($stateId); foreach ($citiesData as $res) { $deptform->city->addMultiOption($res['city_org_id'], utf8_encode($res['city'])); } } $deptform->setDefault('country', $countryId); $deptform->setDefault('state', $stateId); $deptform->setDefault('city', $cityId); $this->view->ermsg = ''; $this->view->datarr = $data; } else { $this->view->ermsg = 'nodata'; } } $bname = $deptModel->getbusinessunitname($bunitid); $this->view->bunitname = $bname; $this->view->deptData = sizeof($deptData); $this->view->form = $deptform; $this->view->unitid = $bunitid; $this->view->controllername = $controllername; if (!empty($allBusinessunitsData) && !empty($allCountriesData) && !empty($allStatesData) && !empty($allCitiesData) && !empty($allTimezoneData)) { $this->view->configuremsg = ''; } else { $this->view->configuremsg = 'notconfigurable'; } if (empty($allCountriesData)) { $msgarray['country'] = 'Countries are not configured yet.'; $flag = 'false'; } if (empty($allStatesData)) { $msgarray['state'] = 'States are not configured yet.'; $flag = 'false'; } if (empty($allCitiesData)) { $msgarray['city'] = 'Cities are not configured yet.'; $flag = 'false'; } if (empty($allTimezoneData)) { $msgarray['timezone'] = 'Time zones are not configured yet.'; $flag = 'false'; } $this->view->msgarray = $msgarray; if ($this->getRequest()->getPost()) { if ($deptform->isValid($this->_request->getPost()) && $flag == 'true') { $deptname = $this->_request->getParam('deptname'); $deptcode = $this->_request->getParam('deptcode'); $description = $this->_request->getParam('description'); $start_date = $this->_request->getParam('start_date', null); $start_date = sapp_Global::change_date($start_date, 'database'); $country = $this->_request->getParam('country'); $state = intval($this->_request->getParam('state')); $city = intval($this->_request->getParam('city')); $address1 = $this->_request->getParam('address1'); $address2 = $this->_request->getParam('address2'); $address3 = $this->_request->getParam('address3'); $unitid = $this->_request->getParam('unitid'); $timezone = $this->_request->getParam('timezone'); $depthead = $this->_request->getParam('depthead'); if (!isset($unitid) || $unitid == '') { $unitid = $bunitid; } $deptcodeExistance = $deptModel->checkCodeDuplicates($deptcode, $id); if (!$deptcodeExistance) { $date = new Zend_Date(); $actionflag = ''; $tableid = ''; $data = array('deptname' => trim($deptname), 'deptcode' => trim($deptcode), 'description' => trim($description), 'startdate' => $start_date != '' ? $start_date : NULL, 'country' => trim($country), 'state' => trim($state), 'city' => trim($city), 'address1' => trim($address1), 'address2' => trim($address2), 'address3' => trim($address3), 'timezone' => trim($timezone), 'unitid' => $unitid, 'depthead' => trim($depthead), 'modifiedby' => $loginUserId, 'modifieddate' => $date->get('yyyy-MM-dd HH:mm:ss')); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = $date->get('yyyy-MM-dd HH:mm:ss'); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $deptModel->SaveorUpdateDepartmentsUnits($data, $where); if ($Id == 'update') { $this->view->eventact = 'updated'; $tableid = $id; } else { $this->view->eventact = 'added'; $tableid = $Id; } $menuID = DEPARTMENTS; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $close = 'close'; $this->view->popup = $close; $this->view->controllername = $controllername; } else { $msgarray['message'] = 'A Department, with the given code, already exists.'; $msgarray['msgtype'] = 'error'; $this->view->messages = $msgarray; } } else { $messages = $deptform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } if (empty($allCountriesData)) { $msgarray['country'] = 'Countries are not configured yet.'; } if (empty($allStatesData)) { $msgarray['state'] = 'States are not configured yet.'; } if (empty($allCitiesData)) { $msgarray['city'] = 'Cities are not configured yet.'; } if (empty($allTimezoneData)) { $msgarray['timezone'] = 'Time zones are not configured yet.'; } } $this->view->msgarray = $msgarray; } } } else { $orgdata = 'noorgdata'; $this->view->orgdata = $orgdata; } }
public function workeligibilityAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('workeligibilitydetails', $empOrganizationTabs)) { $tabName = "workeligibility"; $employeeData = array(); $msgarray = array(); $emptyFlag = 0; $issuingauthority = ''; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $userid = $loginUserId; $employeeModal = new Default_Model_Employee(); $empdata = $employeeModal->getsingleEmployeeData($userid); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $workeligibilityform = new Default_Form_Workeligibilitydetails(); $workeligibilityModel = new Default_Model_Workeligibilitydetails(); $workeligibilityDoctypesModal = new Default_Model_Workeligibilitydoctypes(); //fetchAll($where = null, $order = null, $count = null, $offset = null) function syntax... $workeligibilityDoctypesData = $workeligibilityDoctypesModal->fetchAll('isactive=1', 'documenttype'); $workeligibilityDoctypesDataArr = $workeligibilityDoctypesData->toArray(); if (!empty($workeligibilityDoctypesDataArr)) { foreach ($workeligibilityDoctypesDataArr as $data) { $workeligibilityform->documenttype_id->addMultiOption($data['id'], $data['documenttype']); } } else { $msgarray['documenttype_id'] = 'Work eligibility document types are not configured yet.'; $emptyFlag++; } if ($userid) { $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $countrieslistArr = $countriesModel->getTotalCountriesList(); if (sizeof($countrieslistArr) > 0) { $workeligibilityform->issuingauth_country->addMultiOption('', 'Select Country'); foreach ($countrieslistArr as $countrieslistres) { $workeligibilityform->issuingauth_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); } } else { $msgarray['issuingauth_country'] = 'Countries are not configured yet.'; $emptyFlag++; } $data = $workeligibilityModel->getWorkEligibilityRecord($userid); if (!empty($data) && isset($data)) { $countryId = $data[0]['issuingauth_country']; $stateId = $data[0]['issuingauth_state']; $cityId = $data[0]['issuingauth_city']; $documenttype_id = $data[0]['documenttype_id']; //Populating states & cities Drop down......... from tbl_states & tbl_cities if ($countryId != '') { $statelistArr = $statesmodel->getStatesList($countryId); if (sizeof($statelistArr) > 0) { $workeligibilityform->issuingauth_state->addMultiOption('', 'Select State'); foreach ($statelistArr as $statelistres) { $workeligibilityform->issuingauth_state->addMultiOption($statelistres['id'] . '!@#' . $statelistres['state_name'], $statelistres['state_name']); } } } if ($stateId != '') { $citylistArr = $citiesmodel->getCitiesList($stateId); if (sizeof($citylistArr) > 0) { $workeligibilityform->issuingauth_city->addMultiOption('', 'Select City'); foreach ($citylistArr as $cityPermlistres) { $workeligibilityform->issuingauth_city->addMultiOption($cityPermlistres['id'] . '!@#' . $cityPermlistres['city_name'], $cityPermlistres['city_name']); } } $stateNameArr = $statesmodel->getStateName($stateId); } if ($cityId != '') { $cityNameArr = $citiesmodel->getCityName($cityId); } if ($documenttype_id != '') { $issuingauthorityArr = $workeligibilityDoctypesModal->getIssuingAuthority($documenttype_id); } if (!empty($issuingauthorityArr)) { $issuingauthority = $issuingauthorityArr[0]['issuingauthority']; $workeligibilityform->issuingauthflag->setValue($issuingauthority); } $workeligibilityform->setDefault("id", $data[0]["id"]); $workeligibilityform->setDefault("user_id", $data[0]["user_id"]); $workeligibilityform->setDefault('issuingauth_country', $data[0]['issuingauth_country']); if (!empty($stateNameArr)) { $workeligibilityform->setDefault('issuingauth_state', $stateNameArr[0]['id'] . '!@#' . $stateNameArr[0]['statename']); } if (!empty($cityNameArr)) { $workeligibilityform->setDefault('issuingauth_city', $cityNameArr[0]['id'] . '!@#' . $cityNameArr[0]['cityname']); } $workeligibilityform->setDefault("documenttype_id", $data[0]["documenttype_id"]); $workeligibilityform->setDefault("issuingauth_name", $data[0]["issuingauth_name"]); $workeligibilityform->setDefault("issuingauth_postalcode", $data[0]["issuingauth_postalcode"]); $issue_date = sapp_Global::change_date($data[0]["doc_issue_date"], 'view'); $workeligibilityform->setDefault('doc_issue_date', $issue_date); $expiry_date = sapp_Global::change_date($data[0]["doc_expiry_date"], 'view'); $workeligibilityform->setDefault('doc_expiry_date', $expiry_date); } $workeligibilityform->setAttrib('action', DOMAIN . 'mydetails/workeligibility'); $this->view->id = $userid; $this->view->data = $data; $this->view->form = $workeligibilityform; $this->view->issuingauthority = $issuingauthority; $this->view->msgarray = $msgarray; } if ($this->getRequest()->getPost()) { $documenttype_id = $this->_request->getParam('documenttype_id'); if ($documenttype_id != '') { $issuingauthorityArr = $workeligibilityDoctypesModal->getIssuingAuthority($documenttype_id); } if (!empty($issuingauthorityArr)) { $issuingauthority = $issuingauthorityArr[0]['issuingauthority']; if ($issuingauthority == 2) { $workeligibilityform->issuingauth_state->setRequired(true)->addErrorMessage('Please select a state.'); $workeligibilityform->issuingauth_state->addValidator('NotEmpty', false, array('messages' => 'Please select a state.')); } else { if ($issuingauthority == 3) { $workeligibilityform->issuingauth_state->setRequired(true)->addErrorMessage('Please select a state.'); $workeligibilityform->issuingauth_state->addValidator('NotEmpty', false, array('messages' => 'Please select a state.')); $workeligibilityform->issuingauth_city->setRequired(true)->addErrorMessage('Please select a city.'); $workeligibilityform->issuingauth_city->addValidator('NotEmpty', false, array('messages' => 'Please select a city.')); } } } $result = $this->save($workeligibilityform, $tabName); $result['issuingauthorityflag'] = $_POST['issuingauthflag']; $this->view->msgarray = $result; } } $this->view->empdata = $empdata; $this->view->emptyFlag = $emptyFlag; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
public function viewAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('workeligibilitydetails', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $employeeData = array(); $id = $this->getRequest()->getParam('userid'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $objName = 'workeligibilitydetails'; $issuingauthority = ''; $employeeModal = new Default_Model_Employee(); $workeligibilityform = new Default_Form_Workeligibilitydetails(); $workeligibilityform->removeElement("submit"); $elements = $workeligibilityform->getElements(); if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") { $element->setAttrib("disabled", "disabled"); } } } try { if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) { $usersModel = new Default_Model_Users(); $empdata = $employeeModal->getActiveEmployeeData($id); $employeeData = $usersModel->getUserDetailsByIDandFlag($id); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $workeligibilityModel = new Default_Model_Workeligibilitydetails(); if ($id) { $usersModel = new Default_Model_Users(); $workeligibilityDoctypesModal = new Default_Model_Workeligibilitydoctypes(); $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $countrieslistArr = $countriesModel->getTotalCountriesList(); if (sizeof($countrieslistArr) > 0) { $workeligibilityform->issuingauth_country->addMultiOption('', 'Select Country'); foreach ($countrieslistArr as $countrieslistres) { $workeligibilityform->issuingauth_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); } } else { $msgarray['issuingauth_country'] = 'Countries are not configured yet.'; } $data = $workeligibilityModel->getWorkEligibilityRecord($id); if (!empty($data) && isset($data)) { $countryId = $data[0]['issuingauth_country']; $stateId = $data[0]['issuingauth_state']; $cityId = $data[0]['issuingauth_city']; $documenttype_id = $data[0]['documenttype_id']; if ($countryId != '') { $statelistArr = $statesmodel->getStatesList($countryId); if (sizeof($statelistArr) > 0) { $workeligibilityform->issuingauth_state->addMultiOption('', 'Select State'); foreach ($statelistArr as $statelistres) { $workeligibilityform->issuingauth_state->addMultiOption($statelistres['id'] . '!@#' . $statelistres['state_name'], $statelistres['state_name']); } } } if ($stateId != '') { $citylistArr = $citiesmodel->getCitiesList($stateId); if (sizeof($citylistArr) > 0) { $workeligibilityform->issuingauth_city->addMultiOption('', 'Select City'); foreach ($citylistArr as $cityPermlistres) { $workeligibilityform->issuingauth_city->addMultiOption($cityPermlistres['id'] . '!@#' . $cityPermlistres['city_name'], $cityPermlistres['city_name']); } } $stateNameArr = $statesmodel->getStateName($stateId); } if ($cityId != '') { $cityNameArr = $citiesmodel->getCityName($cityId); } if ($documenttype_id != '') { $issuingauthorityArr = $workeligibilityDoctypesModal->getIssuingAuthority($documenttype_id); } if (!empty($issuingauthorityArr)) { $issuingauthority = $issuingauthorityArr[0]['issuingauthority']; $workeligibilityform->issuingauthflag->setValue($issuingauthority); $workeligibilityform->documenttype_id->addMultiOption($issuingauthorityArr[0]['id'], $issuingauthorityArr[0]['documenttype']); } $workeligibilityform->setDefault("id", $data[0]["id"]); $workeligibilityform->setDefault("user_id", $data[0]["user_id"]); $workeligibilityform->setDefault('issuingauth_country', $data[0]['issuingauth_country']); if (!empty($stateNameArr)) { $workeligibilityform->setDefault('issuingauth_state', $stateNameArr[0]['id'] . '!@#' . $stateNameArr[0]['statename']); } if (!empty($cityNameArr)) { $workeligibilityform->setDefault('issuingauth_city', $cityNameArr[0]['id'] . '!@#' . $cityNameArr[0]['cityname']); } $workeligibilityform->setDefault("documenttype_id", $data[0]["documenttype_id"]); $workeligibilityform->setDefault("issuingauth_name", $data[0]["issuingauth_name"]); $workeligibilityform->setDefault("issuingauth_postalcode", $data[0]["issuingauth_postalcode"]); $issue_date = date(DATEFORMAT_PHP, strtotime($data[0]["doc_issue_date"])); $workeligibilityform->setDefault('doc_issue_date', $issue_date); $expiry_date = date(DATEFORMAT_PHP, strtotime($data[0]["doc_expiry_date"])); $workeligibilityform->setDefault('doc_expiry_date', $expiry_date); } $this->view->controllername = $objName; $this->view->id = $id; $this->view->data = $data; $this->view->employeedata = $employeeData[0]; $this->view->form = $workeligibilityform; $this->view->issuingauthority = $issuingauthority; } } $this->view->empdata = $empdata; } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
/** * * @param type $form * @return type */ public function save($form) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; } $canProcess = true; $cand_model = new Default_Model_Candidatedetails(); $candwork_model = new Default_Model_Candidateworkdetails(); $req_model = new Default_Model_Requisition(); $requisition_id = $this->_getParam('requisition_id', null); $cand_status = $this->_getParam('cand_status', null); $ststidflag1 = $this->_getParam('ststidflag1', null); $flag = 'true'; if ($form->isValid($this->_request->getPost())) { $id = $this->getRequest()->getParam('id'); } if ($ststidflag1 == 'true') { if ($requisition_id == '') { $msgarray['requisition_id'] = 'Please select requisition id.'; $flag = 'false'; } //perform this action only if login user role is not HRRECRUITER role if ($loginuserRole != HRRECRUITER) { if ($cand_status == '') { $msgarray['cand_status'] = 'Please select status.'; $flag = 'false'; } } } $contact_number = $this->_getParam('contact_number', null); if ($contact_number == null) { $contact_number = $this->_getParam('candidate_phonenumber', null); if ($id == '') { if ($contact_number != null) { if (!$cand_model->isPhoneNumberEmailAlreadyExists($contact_number)) { echo "<script> alert('Candidate phone number already exists.'); </script>"; #$msgarray['errors-candidate_phonenumber'] = 'Candidate phone number already exists.'; $canProcess = 'false'; } } } } $emailid = $this->_getParam('emailid', null); if ($emailid == null) { $emailid = $this->_getParam('candidate_emailaddress', null); if ($id == '') { if ($emailid != null) { if (!$cand_model->isPhoneNumberEmailAlreadyExists($emailid)) { echo "<script> alert('Candidate email address already exists.'); </script>"; #$msgarray['errors-candidate_emailaddress'] = 'Candidate email address already exists.'; $canProcess = 'false'; } } } } $this->view->ststidflag1 = $ststidflag1; if ($form->isValid($this->_request->getPost()) && $flag == 'true' && $canProcess == 'true') { $id = $this->getRequest()->getParam('id'); $requisition_id = $this->_getParam('requisition_id', null); $candidate_firstname = $this->_getParam('candidate_firstname', null); $candidate_lastname = $this->_getParam('candidate_lastname', null); $candidate_name = $candidate_firstname . ' ' . $candidate_lastname; $cand_resume = $this->_getParam('cand_resume', null); $req_status = $this->_getParam('req_status', null); $cand_technology = $this->_getParam('candidate_technology', null); $totalexprience = $this->_getParam('totalexprience', null); $releventexprience = $this->_getParam('releventexprience', null); $currentCTC = $this->_getParam('currentCTC', null); $expectedCTC = $this->_getParam('expectedCTC', null); $currentcompany = $this->_getParam('currentcompany', null); $currentlocation = $this->_getParam('currentlocation', null); $noticeperiod = $this->_getParam('noticeperiod', null); $req_records = $cand_model->getcountofrecords($requisition_id); if (empty($req_records) || !empty($req_records)) { $rdata = array('req_status' => 'In process', 'modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s")); $rwhere = ' id = ' . $requisition_id; $req_model->SaveorUpdateRequisitionData($rdata, $rwhere); } $data = array('requisition_id' => $requisition_id, 'candidate_firstname' => trim($candidate_firstname), 'candidate_lastname' => trim($candidate_lastname), 'candidate_name' => trim($candidate_name), 'emailid' => trim($emailid), 'contact_number' => trim($contact_number) == '' ? NULL : trim($contact_number), 'cand_resume' => $cand_resume, 'cand_status' => $cand_status, 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'cand_technology' => trim($cand_technology), 'totalexprience' => trim($totalexprience), 'releventexprience' => trim($releventexprience), 'currentCTC' => trim($currentCTC), 'expectedCTC' => trim($expectedCTC), 'currentcompany' => trim($currentcompany), 'currentlocation' => trim($currentlocation), 'noticeperiod' => trim($noticeperiod)); if (trim($contact_number) == '') { unset($data['contact_number']); } if (trim($emailid) == '') { unset($data['emailid']); } $where = ""; $actionflag = 1; if ($id != '') { unset($data['createdby']); unset($data['createddate']); unset($data['isactive']); $where = "id = " . $id; $tableid = $id; $actionflag = 2; //perform this action only if login user role is not HRRECRUITER role if ($loginuserRole != HRRECRUITER) { $cvshortlistedstatus = ""; try { //CV Shortlisted status and comments $cvshortlistedstatus = $this->_getParam('cvshortlistedstatusid', null); $cvcommentdescription = $this->_getParam('cvcommentdescription', null); $insertCVShortlistDetailsResult = $req_model->insertCVShortlistDetails($id, $requisition_id, $cvshortlistedstatus, $cvcommentdescription, trim($loginUserId), gmdate("Y-m-d H:i:s")); } catch (Exception $xyz) { } } } if ($where == '') { $canProcess = $cand_model->IsCandidateExists($candidate_firstname, $candidate_lastname, $contact_number, $emailid, $cand_technology); } if ($canProcess) { $result = $cand_model->SaveorUpdateCandidateData($data, $where); } else { //$this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Candidate already exists....!")); //$msgarray['requisition_id'] = 'Candidate already exists....!'; //$flag = 'false'; echo "<script> alert('Candidate already exists....!'); </script>"; } //send email start ------------------------------------------------- if ($id == '') { $id = $result; } $candData = $cand_model->getCandidateForView($id); if (isset($cvshortlistedstatus) || strlen(trim($cvshortlistedstatus)) > 0) { //updating existing CV $this->requisition_cvupload_emails($requisition_id, "Update", $candData); } else { //new CV $this->requisition_cvupload_emails($requisition_id, "New", $candData); } //send email end ------------------------------------------------- if ($id == '') { $tableid = $result; } if ($result != '') { //saving of candidate work details if (count($txt_cname) > 0) { $k = 0; foreach ($txt_cname as $cname) { if ($cname != '') { $cdata = array('cand_id' => $tableid, 'company_name' => $cname, 'contact_number' => $txt_cnumber[$k], 'company_address' => $txt_address[$k], 'company_website' => $txt_website[$k], 'cand_designation' => $txt_desig[$k], 'cand_fromdate' => sapp_Global::change_date($txt_from[$k], 'database'), 'cand_todate' => sapp_Global::change_date($txt_to[$k], 'database'), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s")); $cwhere = $hidworkdata[$k] != '' ? "id = " . $hidworkdata[$k] : ""; $candwork_model->SaveorUpdateCandidateWorkData($cdata, $cwhere); } $k++; } } //end of saving of candidate work details $menumodel = new Default_Model_Menu(); $objidArr = $menumodel->getMenuObjID('/candidatedetails'); $objID = $objidArr[0]['id']; $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid); if ($id == '') { //$this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Candidate details added successfully.'); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Candidate details added successfully.")); } else { //$this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Candidate details updated successfully.'); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Candidate details updated successfully.")); } $this->_redirect('/candidatedetails'); } } else { $messages = $form->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } if (isset($country) && $country != 0 && $country != '') { $statesmodel = new Default_Model_States(); $statesmodeldata = $statesmodel->getStatesList(intval($country)); $form->state->clearMultiOptions(); $form->city->clearMultiOptions(); $form->state->addMultiOption('', 'Select State'); foreach ($statesmodeldata as $res) { $form->state->addMultiOption($res['id'], utf8_encode($res['state_name'])); } if (isset($state) && $state != 0 && $state != '') { $form->setDefault('state', $state); } } if (isset($state) && $state != 0 && $state != '') { $citiesmodel = new Default_Model_Cities(); $citiesmodeldata = $citiesmodel->getCitiesList(intval($state)); $form->city->addMultiOption('', 'Select City'); foreach ($citiesmodeldata as $res) { $form->city->addMultiOption($res['id'], utf8_encode($res['city_name'])); } if (isset($city) && $city != 0 && $city != '') { $form->setDefault('city', $city); } } return $msgarray; } }
public function deleteAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->_request->getParam('objid'); $messages['message'] = ''; $messages['msgtype'] = 'error'; $actionflag = 3; $stateOrgId = ''; if ($id) { $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $menumodel = new Default_Model_Menu(); $statedata = $statesmodel->getStatesDataByID($id); if (!empty($statedata)) { $stateOrgId = $statedata[0]['state_id_org']; } $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $id); $Id = $statesmodel->deleteStateData($data, $where); if ($stateOrgId != '') { $citydata = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s")); $citywhere = array('state=?' => $stateOrgId); $CityId = $citiesmodel->deleteCityData($citydata, $citywhere); } if ($Id == 'update') { $menuidArr = $menumodel->getMenuObjID('/states'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $configmail = sapp_Global::send_configuration_mail('State', $statedata[0]['state']); $messages['message'] = 'State deleted successfully'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'State cannot be deleted'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'State cannot be deleted'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); }
public function createDepartmentsReportFinalArray($dataArray, $columnArray) { $businessunitArray = array(); $cityArray = array(); $stateArray = array(); $countryArray = array(); if (!empty($dataArray)) { foreach ($dataArray as $key => $curr) { if (isset($curr['unitid'])) { if (!in_array($curr['unitid'], $businessunitArray)) { array_push($businessunitArray, $curr['unitid']); } } if (isset($curr['city'])) { if (!in_array($curr['city'], $cityArray)) { array_push($cityArray, $curr['city']); } } if (isset($curr['state'])) { if (!in_array($curr['state'], $stateArray)) { array_push($stateArray, $curr['state']); } } if (isset($curr['country'])) { if (!in_array($curr['country'], $countryArray)) { array_push($countryArray, $curr['country']); } } } } if (!empty($businessunitArray)) { $businessunitModel = new Default_Model_Businessunits(); $businessNameArray = $businessunitModel->getBusinessunitNamesByIds($businessunitArray); } if (!empty($cityArray)) { $cityModel = new Default_Model_Cities(); $cityNameArray = $cityModel->getCityNamesByIds($cityArray); } if (!empty($stateArray)) { $stateModel = new Default_Model_States(); $stateNameArray = $stateModel->getStateNamesByIds($stateArray); } if (!empty($countryArray)) { $countryModel = new Default_Model_Countries(); $countryNameArray = $countryModel->getCountryNamesByIds($countryArray); } $finalArray = array(); if (!empty($dataArray)) { foreach ($dataArray as $key => $curr) { $finalArray[$key]['id'] = $curr['id']; if (in_array("deptname", $columnArray)) { $finalArray[$key]['deptname'] = $curr['deptname']; } if (in_array("unitname", $columnArray)) { $finalArray[$key]['unitname'] = isset($businessNameArray[$curr['unitid']]) ? $businessNameArray[$curr['unitid']] : ''; } if (in_array("deptcode", $columnArray)) { $finalArray[$key]['deptcode'] = $curr['deptcode']; } if (in_array("empcount", $columnArray)) { $finalArray[$key]['empcount'] = $curr['empcount']; } if (in_array("startdate", $columnArray)) { $finalArray[$key]['startdate'] = $curr['startdate']; } if (in_array("address", $columnArray)) { $finalArray[$key]['address1'] = $curr['address1']; $finalArray[$key]['address'] = $curr['address1']; } if (in_array("ccity", $columnArray)) { $finalArray[$key]['ccity'] = isset($cityNameArray[$curr['city']]) ? $cityNameArray[$curr['city']] : ''; } if (in_array("sstate", $columnArray)) { $finalArray[$key]['sstate'] = isset($stateNameArray[$curr['state']]) ? $stateNameArray[$curr['state']] : ''; } if (in_array("ccountry", $columnArray)) { $finalArray[$key]['ccountry'] = isset($countryNameArray[$curr['country']]) ? $countryNameArray[$curr['country']] : ''; } if (in_array("status", $columnArray)) { $finalArray[$key]['status'] = $curr['status']; } } } return $finalArray; }
public function comsave($empcommdetailsform, $userid) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $perm_country = $this->_request->getParam('perm_country'); $perm_stateparam = $this->_request->getParam('perm_state'); $perm_stateArr = explode("!@#", $this->_request->getParam('perm_state')); $perm_state = $perm_stateArr[0]; $perm_cityparam = $this->_request->getParam('perm_city'); $perm_cityArr = explode("!@#", $this->_request->getParam('perm_city')); $perm_city = $perm_cityArr[0]; $address_flag = $this->_request->getParam('address_flag'); $current_country = $this->_request->getParam('current_country'); $current_stateparam = $this->_request->getParam('current_state'); $current_stateArr = explode("!@#", $this->_request->getParam('current_state')); $current_state = $current_stateArr[0]; $current_cityparam = $this->_request->getParam('current_city'); $current_cityArr = explode("!@#", $this->_request->getParam('current_city')); $current_city = $current_cityArr[0]; if ($empcommdetailsform->isValid($this->_request->getPost())) { $post_values = $this->_request->getPost(); if (isset($post_values['id'])) { unset($post_values['id']); } if (isset($post_values['user_id'])) { unset($post_values['user_id']); } if (isset($post_values['submit'])) { unset($post_values['submit']); } $new_post_values = array_filter($post_values); if (!empty($new_post_values)) { $empcommdetailsModal = new Default_Model_Empcommunicationdetails(); $id = $this->_request->getParam('id'); $user_id = $userid; $personalemail = $this->_request->getParam('personalemail'); $perm_streetaddress = $this->_request->getParam('perm_streetaddress'); $perm_pincode = $this->_request->getParam('perm_pincode'); $current_streetaddress = $this->_request->getParam('current_streetaddress'); $current_pincode = $this->_request->getParam('current_pincode'); $emergency_number = $this->_request->getParam('emergency_number'); $emergency_name = $this->_request->getParam('emergency_name'); $emergency_email = $this->_request->getParam('emergency_email'); $date = new Zend_Date(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('user_id' => $user_id, 'personalemail' => $personalemail, 'perm_streetaddress' => $perm_streetaddress, 'perm_country' => $perm_country != '' ? $perm_country : NULL, 'perm_state' => $perm_state != '' ? $perm_state : NULL, 'perm_city' => $perm_city != '' ? $perm_city : NULL, 'perm_pincode' => $perm_pincode, 'current_streetaddress' => $current_streetaddress != '' ? $current_streetaddress : NULL, 'current_country' => $current_country != '' ? $current_country : NULL, 'current_state' => $current_state != '' ? $current_state : NULL, 'current_city' => $current_city != '' ? $current_city : NULL, 'current_pincode' => $current_pincode != '' ? $current_pincode : NULL, 'emergency_number' => $emergency_number != '' ? $emergency_number : NULL, 'emergency_name' => $emergency_name != '' ? $emergency_name : NULL, 'emergency_email' => $emergency_email != '' ? $emergency_email : NULL, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('user_id=?' => $user_id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $empcommdetailsModal->SaveorUpdateEmpcommData($data, $where); if ($Id == 'update') { $tableid = $id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee contact details updated successfully.")); } else { $tableid = $Id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee contact details added successfully.")); } $menuidArr = $menumodel->getMenuObjID('/employee'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id); } else { $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => FIELDMSG)); } $this->_redirect('myemployees/comedit/userid/' . $userid); } else { $messages = $empcommdetailsform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } if (isset($perm_country) && $perm_country != 0 && $perm_country != '') { $statesmodel = new Default_Model_States(); $statesmodeldata = $statesmodel->getStatesList($perm_country); $empcommdetailsform->perm_state->clearMultiOptions(); $empcommdetailsform->perm_city->clearMultiOptions(); $empcommdetailsform->perm_state->addMultiOption('', 'Select State'); foreach ($statesmodeldata as $res) { $empcommdetailsform->perm_state->addMultiOption($res['id'] . '!@#' . utf8_encode($res['state_name']), utf8_encode($res['state_name'])); } if (isset($perm_stateparam) && $perm_stateparam != 0 && $perm_stateparam != '') { $empcommdetailsform->setDefault('perm_state', $perm_stateparam); } } if (isset($perm_stateparam) && $perm_stateparam != 0 && $perm_stateparam != '') { $citiesmodel = new Default_Model_Cities(); $citiesmodeldata = $citiesmodel->getCitiesList($perm_state); $empcommdetailsform->perm_city->addMultiOption('', 'Select City'); foreach ($citiesmodeldata as $res) { $empcommdetailsform->perm_city->addMultiOption($res['id'] . '!@#' . utf8_encode($res['city_name']), utf8_encode($res['city_name'])); } if (isset($perm_cityparam) && $perm_cityparam != 0 && $perm_cityparam != '') { $empcommdetailsform->setDefault('perm_city', $perm_cityparam); } } if (isset($current_country) && $current_country != 0 && $current_country != '') { $statesmodel = new Default_Model_States(); $statesmodeldata = $statesmodel->getStatesList($current_country); $empcommdetailsform->current_state->addMultiOption('', 'Select State'); foreach ($statesmodeldata as $res) { $empcommdetailsform->current_state->addMultiOption($res['id'] . '!@#' . utf8_encode($res['state_name']), utf8_encode($res['state_name'])); } if (isset($current_stateparam) && $current_stateparam != 0 && $current_stateparam != '') { $empcommdetailsform->setDefault('current_state', $current_stateparam); } } if (isset($current_stateparam) && $current_stateparam != 0 && $current_stateparam != '') { $citiesmodel = new Default_Model_Cities(); $citiesmodeldata = $citiesmodel->getCitiesList($current_state); $empcommdetailsform->current_city->addMultiOption('', 'Select City'); foreach ($citiesmodeldata as $res) { $empcommdetailsform->current_city->addMultiOption($res['id'] . '!@#' . utf8_encode($res['city_name']), utf8_encode($res['city_name'])); } if (isset($current_cityparam) && $current_cityparam != 0 && $current_cityparam != '') { $empcommdetailsform->setDefault('current_city', $current_cityparam); } } return $msgarray; } }
/** * */ public function candidatepopupAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $req_model = new Default_Model_Requisition(); $jobtitleModel = new Default_Model_Jobtitles(); $cand_model = new Default_Model_Candidatedetails(); $candwork_model = new Default_Model_Candidateworkdetails(); $country_model = new Default_Model_Countries(); $role_model = new Default_Model_Roles(); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $login_group_id = $auth->getStorage()->read()->group_id; $login_role_id = $auth->getStorage()->read()->emprole; } $id = $this->getRequest()->getParam('cand_id'); $form = new Default_Form_Candidatedetails(); $req_data = array(); $jobtitle = ''; $req_data['jobtitlename'] = ''; try { $candidateData = $cand_model->getcandidateData($id); $req_data = $req_model->getRequisitionDataById($candidateData['requisition_id']); $req_data['cand_resume'] = !empty($candidateData['cand_resume']) ? $candidateData['cand_resume'] : ''; $req_data['rec_id'] = $id; $jobttlArr = $jobtitleModel->getsingleJobTitleData($req_data['jobtitle']); if (!empty($jobttlArr) && $jobttlArr != 'norows') { $jobtitle = $jobttlArr[0]['jobtitlename']; $req_data['jobtitlename'] = $jobttlArr[0]['jobtitlename']; } $req_options = array(); $req_options[$req_data['id']] = $req_data['requisition_code']; try { $candidateworkData = $candwork_model->getcandidateworkData($id); $countryId = $candidateData['country']; $stateId = $candidateData['state']; $cityId = $candidateData['city']; if ($countryId && $stateId) { $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $statesData = $statesmodel->getStatesList($countryId); $citiesData = $citiesmodel->getCitiesList($stateId); foreach ($statesData as $res) { $form->state->addMultiOption($res['id'], utf8_encode($res['state_name'])); } foreach ($citiesData as $res) { $form->city->addMultiOption($res['id'], utf8_encode($res['city_name'])); } $form->setDefault('country', $countryId); $form->setDefault('state', $stateId); $form->setDefault('city', $cityId); $form->setDefault('job_title', $jobtitle); } $countrieslistArr = $country_model->getTotalCountriesList(); if (sizeof($countrieslistArr) > 0) { $form->country->addMultiOption('0', 'Select Country'); foreach ($countrieslistArr as $countrieslistres) { $form->country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); } } else { $msgarray['country'] = 'Countries not configured yet'; } $form->requisition_id->addMultiOptions(array('' => 'Select Requisition ID') + $req_options); if ($id) { $form->submit->setLabel('Update'); $form->populate($candidateworkData); $form->populate($candidateData); } $elements = $form->getElements(); if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") { $element->setAttrib("disabled", "disabled"); } } } $previ_data = sapp_Global::_checkprivileges(CANDIDATEDETAILS, $login_group_id, $login_role_id, 'edit'); $this->view->form = $form; $this->view->previ_data = $previ_data; $this->view->workdata = $candidateworkData; $this->view->ermsg = ''; $this->view->req_data = $req_data; $objName = 'candidatedetails'; $this->view->id = $id; $this->view->controllername = $objName; } catch (Exception $e) { $this->view->nodata = 'nodata'; } } catch (Exception $e) { $this->view->nodata = 'nodata'; } }
public function viewAction() { $orgInfoModel = new Default_Model_Organisationinfo(); $getorgData = $orgInfoModel->getorgrecords(); if (!empty($getorgData)) { $orgdata = ''; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $permission = 'No'; $id = $this->getRequest()->getParam('id'); if (is_numeric($id) && $id > 0) { $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $objName = 'businessunits'; $businessunitsform = new Default_Form_businessunits(); $deptModel = new Default_Model_Departments(); $businessunitsform->removeElement("submit"); $elements = $businessunitsform->getElements(); if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") { $element->setAttrib("disabled", "disabled"); } } } $businessunitsmodel = new Default_Model_Businessunits(); $data = $businessunitsmodel->getSingleUnitData($id); if (!empty($data)) { $businessunitsform->populate($data); $countryId = $data['country']; $stateId = $data['state']; $cityId = $data['city']; if ($countryId && $stateId) { $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $statesData = $statesmodel->getBasicStatesList($countryId); $citiesData = $citiesmodel->getBasicCitiesList($stateId); foreach ($statesData as $res) { $businessunitsform->state->addMultiOption($res['state_id_org'], utf8_encode($res['state'])); } foreach ($citiesData as $res) { $businessunitsform->city->addMultiOption($res['city_org_id'], utf8_encode($res['city'])); } $businessunitsform->setDefault('country', $countryId); $businessunitsform->setDefault('state', $stateId); $businessunitsform->setDefault('city', $cityId); } $st_date = sapp_Global::change_date($data["startdate"], 'view'); $businessunitsform->setDefault('start_date', $st_date); $permission = sapp_Global::_checkprivileges(BUSINESSUNITS, $loginuserGroup, $loginuserRole, 'edit'); $deptData = $deptModel->getAllDeptsForUnit($id); $this->view->deptData = sizeof($deptData); $this->view->dataArray = $this->departmentGrid($id); $this->view->ermsg = ''; } else { $this->view->ermsg = 'nodata'; } $this->view->editpermission = $permission; $this->view->controllername = $objName; $this->view->id = $id; $this->view->form = $businessunitsform; $this->view->role = $loginuserRole; } else { $this->view->ermsg = 'nodata'; } } else { $orgdata = 'noorgdata'; $this->view->orgdata = $orgdata; } }
public function edit_oldAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = array(); $empid = ''; $orgheadsData = array(); $oldOrgHead = ''; $new_stateId = ''; $actionpage = ''; if (sapp_Global::_checkprivileges(PREFIX, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'prefix'); } if (sapp_Global::_checkprivileges(IDENTITYCODES, $loginuserGroup, $loginuserRole, 'edit') == 'Yes') { array_push($popConfigPermission, 'identitycodes'); } if (sapp_Global::_checkprivileges(JOBTITLES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'jobtitles'); } if (sapp_Global::_checkprivileges(POSITIONS, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'position'); } if (sapp_Global::_checkprivileges(COUNTRIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'country'); } if (sapp_Global::_checkprivileges(STATES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'state'); } if (sapp_Global::_checkprivileges(CITIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'city'); } if (sapp_Global::_checkprivileges(EMPLOYEE, $loginuserGroup, $loginuserRole, 'edit') == 'Yes') { array_push($popConfigPermission, 'employee'); } $msgarray = array(); $new_stateId = ''; $new_cityId = ''; $id = $this->getRequest()->getParam('id'); $form = new Default_Form_Organisationinfo(); $user_model = new Default_Model_Usermanagement(); $orgInfoModel = new Default_Model_Organisationinfo(); $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $role_model = new Default_Model_Roles(); $prefixModel = new Default_Model_Prefix(); $identity_code_model = new Default_Model_Identitycodes(); $jobtitlesModel = new Default_Model_Jobtitles(); $employeeModal = new Default_Model_Employee(); $positionsmodel = new Default_Model_Positions(); $identity_codes = $identity_code_model->getIdentitycodesRecord(); $role_data = $role_model->getRolesList_orginfo(); $allCountriesData = $countriesModel->fetchAll('isactive=1', 'country')->toArray(); $allStatesData = $statesmodel->fetchAll('isactive=1', 'state')->toArray(); $allCitiesData = $citiesmodel->fetchAll('isactive=1', 'city')->toArray(); $flag = 'true'; $emp_identity_code = isset($identity_codes[0]) ? $identity_codes[0]['employee_code'] : ""; if ($emp_identity_code != '') { $emp_id = $emp_identity_code . str_pad($user_model->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT); } else { $emp_id = ''; $msgarray['employeeId'] = 'Identity codes are not configured yet.'; $flag = 'false'; } $form->employeeId->setValue($emp_id); $form->emprole->addMultiOptions(array('' => 'Select Role') + $role_data); if (empty($allCountriesData)) { $msgarray['country'] = 'Countries are not configured yet.'; $flag = 'false'; } if (empty($role_data)) { $msgarray['emprole'] = 'Roles are not added yet.'; $flag = 'false'; } if (empty($allStatesData)) { $msgarray['state'] = 'States are not configured yet.'; $flag = 'false'; } if (empty($allCitiesData)) { $msgarray['city'] = 'Cities are not configured yet.'; $flag = 'false'; } $prefixData = $prefixModel->getPrefixList(); $form->prefix_id->addMultiOption('', 'Select Prefix'); if (!empty($prefixData)) { foreach ($prefixData as $prefixres) { $form->prefix_id->addMultiOption($prefixres['id'], $prefixres['prefix']); } } else { $msgarray['prefix_id'] = 'Prefixes are not configured yet.'; } $jobtitleData = $jobtitlesModel->getJobTitleList(); if (!empty($jobtitleData)) { foreach ($jobtitleData as $jobtitleres) { $form->jobtitle_id->addMultiOption($jobtitleres['id'], $jobtitleres['jobtitlename']); } } else { $msgarray['jobtitle_id'] = 'Job titles are not configured yet.'; $msgarray['position_id'] = 'Positions are not configured yet.'; } $orgheadsData = $employeeModal->getEmployeesForOrgHead(); $currentOrgHead = $employeeModal->getCurrentOrgHead(); if (!empty($currentOrgHead)) { $oldOrgHead = $currentOrgHead[0]['user_id']; } if ($id) { $form->submit->setLabel('Update'); try { $data = $orgInfoModel->getOrganisationData($id); $form->setAttrib('action', BASE_URL . 'organisationinfo/edit/id/' . $id); $data['org_startdate'] = sapp_Global::change_date($data['org_startdate'], 'view'); $form->populate($data); $countryId = $data['country']; $stateId = $data['state']; $cityId = $data['city']; $actionpage = 'edit'; if (count($_POST) > 0) { $countryId = isset($_POST['country']) ? $_POST['country'] : ""; $stateId = isset($_POST['state']) ? $_POST['state'] : ""; $cityId = isset($_POST['city']) ? $_POST['city'] : ""; } if ($countryId != '') { $statesData = $statesmodel->getBasicStatesList((int) $countryId); foreach ($statesData as $res) { if ($stateId == $res['state_id_org']) { $new_stateId = $res['state_id_org'] . '!@#' . utf8_encode($res['state']); } $form->state->addMultiOption($res['state_id_org'] . '!@#' . utf8_encode($res['state']), utf8_encode($res['state'])); } if (count($_POST) == 0) { $stateId = $new_stateId; } } if ($stateId != '') { $citiesData = $citiesmodel->getBasicCitiesList((int) $stateId); foreach ($citiesData as $res) { if ($cityId == $res['city_org_id']) { $new_cityId = $res['city_org_id'] . '!@#' . utf8_encode($res['city']); } $form->city->addMultiOption($res['city_org_id'] . '!@#' . utf8_encode($res['city']), utf8_encode($res['city'])); } if (count($_POST) == 0) { $cityId = $new_cityId; } } $emp_data = $employeeModal->fetchRow("is_orghead = 1"); if (!empty($emp_data)) { $user_data = $user_model->fetchRow("id = " . $emp_data->user_id); if (!empty($user_data)) { $form->setDefault('firstname_orghead', $user_data->firstname); $form->setDefault('lastname_orghead', $user_data->lastname); $form->setDefault('employeeId', $user_data->employeeId); $form->setDefault('emprole', $user_data->emprole); $form->setDefault('emailaddress', $user_data->emailaddress); $form->setDefault('jobtitle_id', $user_data->jobtitle_id); $form->setDefault('prefix_id', $emp_data->prefix_id); $form->setDefault('date_of_joining', sapp_Global::change_date($emp_data->date_of_joining, 'view')); $jobtitle_id = $emp_data->jobtitle_id; if (isset($_POST['jobtitle_id'])) { $jobtitle_id = $_POST['jobtitle_id']; } $form->position_id->addMultiOption('', 'Select a Position'); if ($jobtitle_id != '') { $positionlistArr = $positionsmodel->getPositionList($jobtitle_id); if (sizeof($positionlistArr) > 0) { foreach ($positionlistArr as $positionlistres) { $form->position_id->addMultiOption($positionlistres['id'], $positionlistres['positionname']); } } } $form->setDefault('position_id', $emp_data->position_id); $form->setDefault('orghead', $user_data->id); } $empid = $emp_data->user_id; } else { $form->setDefault('orghead', ''); } if (empty($orgheadsData)) { $msgarray['orghead'] = 'Management employees are not added yet.'; } $form->setDefault('country', $countryId); $form->setDefault('state', $stateId); $form->setDefault('city', $cityId); $this->view->domainValue = $data['domain']; $this->view->org_image = $data['org_image']; $this->view->ermsg = ''; $this->view->datarr = $data; $this->view->user_id = $empid; $this->view->orgheadsData = $orgheadsData; } catch (Exception $e) { $this->view->ermsg = 'nodata'; } } else { $actionpage = 'add'; $activeOrgs = $orgInfoModel->getorgrecords(); if (empty($activeOrgs)) { $form->setAttrib('action', BASE_URL . 'organisationinfo/edit'); $country = $this->_request->getParam('country'); $state = intVal($this->_request->getParam('state')); $city = intVal($this->_request->getParam('city')); if (isset($country) && $country != 0 && $country != '') { $statesData = $statesmodel->getBasicStatesList($country); foreach ($statesData as $res) { $form->state->addMultiOption($res['state_id_org'] . '!@#' . utf8_encode($res['state']), utf8_encode($res['state'])); } if (isset($state) && $state != 0 && $state != '') { $form->setDefault('state', $state); } } if (isset($state) && $state != 0 && $state != '') { $citiesData = $citiesmodel->getBasicCitiesList($state); foreach ($citiesData as $res) { $form->city->addMultiOption($res['city_org_id'] . '!@#' . utf8_encode($res['city']), utf8_encode($res['city'])); } if (isset($city) && $city != 0 && $city != '') { $form->setDefault('city', $city); } } $this->view->ermsg = ''; } else { $this->view->ermsg = 'cannotadd'; } $form->position_id->addMultiOption('', 'Select a Position'); if (isset($_POST['jobtitle_id']) && $_POST['jobtitle_id'] != '') { $jobtitle_id = $_POST['jobtitle_id']; $positionlistArr = $positionsmodel->getPositionList($jobtitle_id); if (sizeof($positionlistArr) > 0) { foreach ($positionlistArr as $positionlistres) { $form->position_id->addMultiOption($positionlistres['id'], $positionlistres['positionname']); } } } $emp_data = $employeeModal->fetchRow("is_orghead = 1"); if (!empty($emp_data)) { $user_data = $user_model->fetchRow("id = " . $emp_data->user_id); if (!empty($user_data)) { $form->setDefault('employeeId', $user_data->employeeId); $form->setDefault('emprole', $user_data->emprole); $form->setDefault('emailaddress', $user_data->emailaddress); $form->setDefault('jobtitle_id', $user_data->jobtitle_id); $form->setDefault('prefix_id', $emp_data->prefix_id); $form->setDefault('date_of_joining', sapp_Global::change_date($emp_data->date_of_joining, 'view')); $jobtitle_id = $emp_data->jobtitle_id; if (isset($_POST['jobtitle_id'])) { $jobtitle_id = $_POST['jobtitle_id']; } $form->position_id->addMultiOption('', 'Select a Position'); if ($jobtitle_id != '') { $positionlistArr = $positionsmodel->getPositionList($jobtitle_id); if (sizeof($positionlistArr) > 0) { foreach ($positionlistArr as $positionlistres) { $form->position_id->addMultiOption($positionlistres['id'], $positionlistres['positionname']); } } } $form->setDefault('position_id', $emp_data->position_id); $form->setDefault('orghead', $user_data->id); } $empid = $emp_data->user_id; } else { $form->setDefault('orghead', ''); } if (empty($orgheadsData)) { $msgarray['orghead'] = 'Management employees are not added yet.'; } $this->view->user_id = $empid; $this->view->orgheadsData = $orgheadsData; } $this->view->form = $form; $this->view->currentOrgHead = $currentOrgHead; $this->view->actionpage = $actionpage; if (!empty($allCountriesData) && !empty($allStatesData) && !empty($allCitiesData)) { $this->view->configuremsg = ''; } else { $this->view->configuremsg = 'notconfigurable'; } if (isset($_POST['prevorgheadrm'])) { $prevorgheadrm = $this->_request->getParam('prevorgheadrm'); } else { $prevorgheadrm = ''; } $this->view->prevorgheadrmval = $prevorgheadrm; if (isset($_POST['rmflag'])) { $rmflag = $this->_request->getParam('rmflag'); } else { $rmflag = '0'; } $this->view->rmflag = $rmflag; if ($this->getRequest()->getPost()) { $imagerror = $this->_request->getParam('imgerr'); $imagepath = $this->_request->getParam('org_image_value'); $imgerrmsg = $this->_request->getParam('imgerrmsg'); $pphnumber = $this->_request->getParam('phonenumber'); $sphnumber = $this->_request->getParam('secondaryphone'); $org_startdate = sapp_Global::change_date($this->_request->getParam('org_startdate'), 'database'); $flag = 'true'; if (isset($imagepath) && $imagepath != '') { $imageArr = explode('.', $imagepath); if (sizeof($imageArr) > 1) { $imagename = $imageArr[0]; $imageext = $imageArr[1]; $extArr = array('gif', 'jpg', 'jpeg', 'png'); if (!in_array($imageext, $extArr)) { $msgarray['org_image_value'] = 'Please upload an appropriate image file.'; $flag = 'false'; } } else { $msgarray['org_image_value'] = 'Please upload an appropriate image file.'; $flag = 'false'; } } if ($imagerror == 'error') { if ($imgerrmsg != '' && $imgerrmsg != 'undefined') { $msgarray['org_image_value'] = $imgerrmsg; } else { $msgarray['org_image_value'] = 'Please upload an appropriate image file.'; } $flag = 'false'; } if ($pphnumber == $sphnumber && $sphnumber != '' && $pphnumber != '') { $msgarray['secondaryphone'] = 'Please enter different phone number.'; $flag = 'false'; } if ($form->isValid($this->_request->getPost()) && $flag != 'false') { $domain = $this->_request->getParam('domain'); $domain = implode(',', $domain); $prevorgheadrm = $this->_request->getParam('prevorgheadrm'); $actionflag = ''; $date = new Zend_Date(); $newOrgHead = $this->_request->getParam('orghead'); if ($newOrgHead != '') { $neworgHeadData = $employeeModal->getsingleEmployeeData($newOrgHead); } if (!empty($neworgHeadData)) { $headfullname = $neworgHeadData[0]['userfullname']; } else { $headfullname = ''; } $data = array('organisationname' => trim($this->_request->getParam('organisationname')), 'domain' => trim($domain), 'website' => trim($this->_request->getParam('website')), 'org_image' => $imagepath, 'orgdescription' => trim($this->_request->getParam('orgdescription')), 'totalemployees' => trim($this->_request->getParam('totalemployees')), 'org_startdate' => $org_startdate != '' ? $org_startdate : NULL, 'phonenumber' => trim($this->_request->getParam('phonenumber')), 'secondaryphone' => trim($this->_request->getParam('secondaryphone')), 'faxnumber' => trim($this->_request->getParam('faxnumber')), 'country' => trim((int) $this->_request->getParam('country')), 'state' => trim(intval($this->_request->getParam('state'))), 'city' => trim(intval($this->_request->getParam('city'))), 'address1' => trim($this->_request->getParam('address1')), 'address2' => trim($this->_request->getParam('address2')), 'address3' => trim($this->_request->getParam('address3')), 'description' => trim($this->_request->getParam('description')), 'orghead' => trim($this->_request->getParam('orghead')), 'designation' => trim($this->_request->getParam('jobtitle_id', null)), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $db = Zend_Db_Table::getDefaultAdapter(); $db->beginTransaction(); try { if ($oldOrgHead != $newOrgHead && $oldOrgHead != '' && $newOrgHead != '' && $prevorgheadrm) { $orgInfoModel->changeOrgHead($oldOrgHead, $newOrgHead, $prevorgheadrm); } $path = IMAGE_UPLOAD_PATH; $imagepath = $this->_request->getParam('org_image_value'); $filecopy = 'success'; if ($imagepath != '') { $filecopy = 'error'; if (file_exists(USER_PREVIEW_UPLOAD_PATH . '//' . $imagepath)) { try { if (copy(USER_PREVIEW_UPLOAD_PATH . '//' . $imagepath, $path . '//' . $imagepath)) { $filecopy = 'success'; } unlink(USER_PREVIEW_UPLOAD_PATH . '//' . $imagepath); } catch (Exception $e) { echo $msgarray['org_image_value'] = $e->getMessage(); exit; } } } $where = array('id=?' => $id); if ($imagepath == '') { unset($data['org_image']); } else { if ($filecopy == 'error') { unset($data['org_image']); } } if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $orgInfoModel->SaveorUpdateData($data, $where); $jobtitle_id = $this->_request->getParam('jobtitle_id', null); $position_id = $this->_request->getParam('position_id', null); $date_of_joining = sapp_Global::change_date($this->_request->getParam('date_of_joining', null), 'database'); $employeeId = $this->_getParam('employeeId', null); $emprole = $this->_getParam('emprole', null); $emailaddress = $this->_getParam('emailaddress', null); $emppassword = sapp_Global::generatePassword(); $first_name = trim($this->_request->getParam('firstname_orghead', null)); $last_name = trim($this->_request->getParam('lastname_orghead', null)); $userfullname = $first_name . ' ' . $last_name; //$userfullname = $headfullname; $prefix_id = $this->_getParam('prefix_id', null); $user_id = $this->_getParam('user_id', null); $user_data = array('emprole' => $emprole, 'firstname' => $first_name, 'lastname' => $last_name, 'userfullname' => $userfullname, 'emailaddress' => $emailaddress, 'jobtitle_id' => $jobtitle_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'emppassword' => md5($emppassword), 'employeeId' => $employeeId, 'selecteddate' => $date_of_joining, 'userstatus' => 'old', 'modeofentry' => 'Direct'); $emp_data = array('user_id' => $newOrgHead, 'jobtitle_id' => $jobtitle_id, 'position_id' => $position_id, 'prefix_id' => $prefix_id, 'reporting_manager' => 0, 'date_of_joining' => $date_of_joining, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($Id == 'update') { $tableid = $id; unset($user_data['emppassword']); unset($user_data['modeofentry']); unset($user_data['userstatus']); if ($newOrgHead != '') { $user_st = $user_model->SaveorUpdateUserData($user_data, " id = " . $newOrgHead); $employeeModal->SaveorUpdateEmployeeData($emp_data, " user_id = " . $newOrgHead); } else { $user_data['userstatus'] = 'old'; $user_data['emppassword'] = md5($emppassword); $user_data['createdby'] = $loginUserId; $user_data['createddate'] = gmdate("Y-m-d H:i:s"); $user_data['isactive'] = 1; if ($emp_identity_code != '') { $emp_id = $emp_identity_code . str_pad($user_model->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT); } else { $emp_id = ''; } $user_data['employeeId'] = $emp_id; $user_id = $user_model->SaveorUpdateUserData($user_data, ''); $emp_data['user_id'] = $newOrgHead; $emp_data['createdby'] = $loginUserId; $emp_data['createddate'] = gmdate("Y-m-d H:i:s"); $emp_data['isactive'] = 1; $emp_data['is_orghead'] = 1; $employeeModal->SaveorUpdateEmployeeData($emp_data, ''); } if ($filecopy == 'success') { $this->_helper->getHelper("FlashMessenger")->addMessage("Organization information updated successfully."); } else { $this->_helper->getHelper("FlashMessenger")->addMessage("Organization information updated successfully but failed to upload the logo."); } } else { //start of saving into employee table $user_data['createdby'] = $loginUserId; $user_data['createddate'] = gmdate("Y-m-d H:i:s"); $user_data['isactive'] = 1; if ($emp_identity_code != '') { $emp_id = $emp_identity_code . str_pad($user_model->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT); } else { $emp_id = ''; } $user_data['employeeId'] = $emp_id; $user_id = $user_model->SaveorUpdateUserData($user_data, ''); $emp_data['user_id'] = $user_id; $emp_data['createdby'] = $loginUserId; $emp_data['createddate'] = gmdate("Y-m-d H:i:s"); $emp_data['isactive'] = 1; $emp_data['is_orghead'] = 1; $employeeModal->SaveorUpdateEmployeeData($emp_data, ''); $tableid = $Id; if ($filecopy == 'success') { $this->_helper->getHelper("FlashMessenger")->addMessage("Organization information saved successfully."); } else { $this->_helper->getHelper("FlashMessenger")->addMessage("Organization information saved successfully but failed to upload the logo."); } } $menuID = ORGANISATIONINFO; try { if ($Id != '' && $Id != 'update') { $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $Id); } else { $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); } } catch (Exception $e) { echo $e->getMessage(); } /* Send Mail to the user */ if ($Id != 'update') { $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $view = $this->getHelper('ViewRenderer')->view; $this->view->emp_name = $userfullname; $this->view->password = $emppassword; $this->view->emp_id = $employeeId; $this->view->base_url = $base_url; $text = $view->render('mailtemplates/newpassword.phtml'); $options['subject'] = APPLICATION_NAME . ': login credentials'; $options['header'] = 'Greetings from Sentrifugo'; $options['toEmail'] = $emailaddress; $options['toName'] = $this->view->emp_name; $options['message'] = $text; $result = sapp_Global::_sendEmail($options); } /* END */ $db->commit(); $this->_redirect('organisationinfo'); } catch (Exception $e) { $db->rollBack(); return 'failed'; } } else { $messages = $form->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } if (empty($allCountriesData)) { $msgarray['country'] = 'Countries are not configured yet.'; } if (empty($allStatesData)) { $msgarray['state'] = 'States are not configured yet.'; } if (empty($allCitiesData)) { $msgarray['city'] = 'Cities are not configured yet.'; } } if (isset($this->msgarray['domain'])) { $this->view->msMsg = 'multiselecterror'; } } } $this->view->msgarray = $msgarray; $this->view->popConfigPermission = $popConfigPermission; }
public function addAction() { $req_model = new Default_Model_Requisition(); $candsmodel = new Default_Model_Candidatedetails(); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginUserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = array(); if (sapp_Global::_checkprivileges(COUNTRIES, $loginUserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'country'); } if (sapp_Global::_checkprivileges(STATES, $loginUserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'state'); } if (sapp_Global::_checkprivileges(CITIES, $loginUserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'city'); } $managerStr = ''; $messages = array(); $inter_options = array(); $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $form = new Default_Form_Interviewrounds(); $form->setAction(BASE_URL . 'scheduleinterviews/add'); $form->id->setValue($id); $form->removeElement('cand_status'); $form->removeElement('interview_status'); $form->submit->setLabel('Save'); $data = array(); $req_data = $req_model->getReqForInterviews(); $req_options = array(); foreach ($req_data as $req) { $req_options[$req['id']] = $req['requisition_code'] . ' - ' . $req['jobtitlename']; } $form->req_id->addMultiOptions(array('' => 'Select Requisition ID') + $req_options); if (count($req_options) == 0) { $messages['req_id'] = "No approved requisitions."; $messages['candidate_name'] = "Candidates are not added yet."; $messages['interviewer_id'] = "Interviewers are not added yet."; } if (count($form->country->getMultiOptions()) == 1) { $messages['country'] = "Countries are not configured yet."; $messages['state'] = "States are not configured yet."; $messages['city'] = "Cities are not configured yet."; } if (isset($_POST['req_id']) && $_POST['req_id'] != '') { $candsData = $candsmodel->getnotscheduledcandidateData($_POST['req_id']); $cand_data_opt = array(); if (count($candsData) > 0) { foreach ($candsData as $cand) { $cand_data_opt[$cand['id']] = $cand['candidate_name']; } } $form->candidate_name->addMultiOptions(array('' => 'Select Candidate') + $cand_data_opt); if (isset($req['department_id'])) { $repmanData = $req_model->getReportingmanagers($loginUserGroup, $loginUserId, '', $req['department_id'], 'interviewer'); $managers_data_opt = array(); if (!empty($repmanData)) { foreach ($repmanData as $rep) { $inter_options[] = array('id' => $rep['id'], 'name' => $rep['name'], 'profileimg' => $rep['profileimg']); } } } else { $managerStr = "nomanagers"; } } if (isset($_POST['country']) && $_POST['country'] != '') { $statesmodel = new Default_Model_States(); $statesmodeldata = $statesmodel->getBasicStatesList(intval($_POST['country'])); $st_opt = array(); if (count($statesmodeldata) > 0) { foreach ($statesmodeldata as $dstate) { $st_opt[$dstate['state_id_org']] = $dstate['state']; } } $form->state->addMultiOptions(array('' => 'Select State') + $st_opt); } if (isset($_POST['state']) && $_POST['state'] != '') { $citiesmodel = new Default_Model_Cities(); $citiesmodeldata = $citiesmodel->getBasicCitiesList(intval($_POST['state'])); $ct_opt = array(); if (count($citiesmodeldata) > 0) { foreach ($citiesmodeldata as $dcity) { $ct_opt[$dcity['city_org_id']] = $dcity['city']; } } $form->city->addMultiOptions(array('' => 'Select City') + $ct_opt); } $this->view->form = $form; $this->view->round_count = 0; $this->view->messages = $messages; $this->view->inter_options = $inter_options; $this->view->popConfigPermission = $popConfigPermission; if ($this->getRequest()->getPost()) { $result = $this->save($form, $data); $this->view->msgarray = $result; $this->view->messages = $result; } }
public function viewpopupAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserGroup = $auth->getStorage()->read()->group_id; } Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $cand_model = new Default_Model_Candidatedetails(); $requi_model = new Default_Model_Requisition(); $jobtitleModel = new Default_Model_Jobtitles(); $intrvwModel = new Default_Model_Interviewdetails(); $interview_round_model = new Default_Model_Interviewrounddetails(); $user_model = new Default_Model_Usermanagement(); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserGroup = $auth->getStorage()->read()->group_id; } $jobtitle = ''; $deptid = $this->getRequest()->getParam('deptid'); if ($deptid == '') { $deptid = $this->getRequest()->getParam('deptidform'); } $intId = $this->getRequest()->getParam('unitId'); $roundId = $this->getRequest()->getParam('id'); $ir_form = new Default_Form_Interviewrounds(); $elements = $ir_form->getElements(); //giving only for hr,management and super admin if ($loginuserGroup == HR_GROUP || $loginuserGroup == '' || $loginuserGroup == MANAGEMENT_GROUP) { $ir_form->round_status->addMultiOptions(array('Decision pending' => 'Decision pending', 'On hold' => 'On hold')); } if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") { $element->setAttrib("disabled", "disabled"); } } } $intData = $intrvwModel->getReqByintrvwID($intId); $roundData = $interview_round_model->getSingleRoundData($roundId); $this->view->ermsg = ''; $edit_flag = 'no'; if ($roundData['interviewer_id'] == $loginUserId) { $edit_flag = 'yes'; } if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP || $loginuserGroup == '' || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP) { $countryId = $roundData['int_country']; $stateId = $roundData['int_state']; $cityId = $roundData['int_city']; $country_name = ''; $state_name = ''; $city_name = ''; if ($countryId && $stateId) { $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $countryModal = new Default_Model_Countries(); $countriesData = $countryModal->fetchAll('isactive=1', 'country'); foreach ($countriesData as $cdata) { if ($roundData['int_country'] == $cdata['country_id_org']) { $country_name = $cdata['country']; break; } } $statesData = $statesmodel->getBasicStatesList($countryId); $citiesData = $citiesmodel->getBasicCitiesList($stateId); foreach ($statesData as $res) { $ir_form->state->addMultiOption($res['state_id_org'], utf8_encode($res['state'])); if ($roundData['int_state'] == $res['state_id_org']) { $state_name = $res['state']; } } foreach ($citiesData as $res) { $ir_form->city->addMultiOption($res['city_org_id'], utf8_encode($res['city'])); if ($roundData['int_city'] == $res['city_org_id']) { $city_name = $res['city']; } } } $interviewer_data = $user_model->getUserDataById($roundData['interviewer_id']); $jobttlArr = $jobtitleModel->getsingleJobTitleData($interviewer_data['jobtitle_id']); if (!empty($jobttlArr) && $jobttlArr != 'norows') { $jobtitle = ', ' . $jobttlArr[0]['jobtitlename']; $data['jobtitlename'] = $jobttlArr[0]['jobtitlename']; } $ir_form->interviewer_id->addMultiOptions(array('' => $interviewer_data['userfullname'] . $jobtitle)); $roundData['interview_date'] = sapp_Global::change_date($roundData['interview_date'], 'view'); $roundData['interview_time'] = sapp_Global::change_time($roundData['interview_time'], 'view'); $ir_form->populate($roundData); $this->view->form = $ir_form; $this->view->intId = $intId; $this->view->deptid = $deptid; $this->view->roundId = $roundId; $this->view->ermsg = ''; $this->view->country_name = $country_name; $this->view->state_name = $state_name; $this->view->city_name = $city_name; $this->view->edit_flag = $edit_flag; } else { $this->view->ermsg = 'nodata'; } }
public function getcitiesnormalAction() { $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('getcitiesnormal', 'html')->initContext(); $state_idArr = explode("!@#", $this->_request->getParam('state_id')); $state_id = $state_idArr[0]; $con = $this->_request->getParam('con'); $state_id = intval($state_id); $citiesform = new Default_Form_cities(); $citiesmodel = new Default_Model_Cities(); if ($con == 'city') { $citiesmodeldata = $citiesmodel->getBasicCitiesList($state_id); } else { $citiesmodeldata = $citiesmodel->getCitiesList($state_id); } $this->view->citiesform = $citiesform; $this->view->con = $con; $this->view->citiesmodeldata = $citiesmodeldata; }
public function addnewcityAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->getRequest()->getParam('id'); $selectedcountryid = $this->_request->getParam('selectcountryid'); $selectedstateid = $this->_request->getParam('selectstateid'); $msgarray = array(); $setDefaultString = ''; $citystring = ''; $controllername = 'cities'; $citiesform = new Default_Form_cities(); $citiesmodel = new Default_Model_Cities(); $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); /* Changing the form */ $citiesform->setAction(BASE_URL . 'cities/addnewcity/selectcountryid/' . $selectedcountryid . '/selectstateid/' . $selectedstateid); $citiesform->removeElement('city'); $citiesform->addElement('text', 'city', array('label' => 'City', 'maxlength' => '20', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Please enter city name.'))))); /* END */ $countrieslistArr = $countriesModel->getTotalCountriesList(''); if (sizeof($countrieslistArr) > 0) { $citiesform->countryid->addMultiOption('', 'Select Country'); foreach ($countrieslistArr as $countrieslistres) { if ($selectedcountryid != '') { if ($countrieslistres['id'] == $selectedcountryid) { $citiesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); $citiesform->setDefault('countryid', $selectedcountryid); } } else { $citiesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); } $citiesform->countryid->setAttrib('onchange', 'displayParticularState_normal(this,"","state","city")'); } } else { $msgarray['countryid'] = 'Countries are not configured yet.'; } $countryid = $this->_request->getParam('countryid'); if (isset($selectedcountryid) && $selectedcountryid != '' || isset($countryid) && $countryid != '') { if ($countryid) { $statesmodeldata = $statesmodel->getStatesList($countryid, ''); } else { $statesmodeldata = $statesmodel->getStatesList($selectedcountryid, ''); } $citiesform->state->addMultiOption('', 'Select State'); foreach ($statesmodeldata as $res) { $citiesform->state->addMultiOption($res['id'], utf8_encode($res['state_name'])); if ($selectedstateid != '') { if ($res['id'] == $selectedstateid) { $setDefaultString = $res['id']; } } else { if ($countryid != '') { if ($res['id'] == $countryid) { $setDefaultString = $res['id']; } } } } $citiesform->setDefault('state', $setDefaultString); } else { $citiesform->state->addMultiOption('', 'Select State'); } if ($this->getRequest()->getPost()) { $id = $this->_request->getParam('id'); $errorflag = "true"; $msgarray = array(); $dbstate = ''; $dbcountryid = ''; $stateidstr = $this->_request->getParam('state'); $stateid = intval($stateidstr); $city = $this->_request->getParam('city'); if (isset($stateid)) { $isDuplicateCityNameArr = $citiesmodel->getDuplicateCityName($city, $stateid); if ($isDuplicateCityNameArr[0]['count'] > 0) { $errorflag = "false"; $msgarray['city'] = "City already exists."; } } else { $errorflag = "false"; $msgarray['state'] = "Please select state."; } if ($citiesform->isValid($this->_request->getPost()) && $errorflag == "true") { $menumodel = new Default_Model_Menu(); $city = $this->_request->getParam('city'); $actionflag = ''; $tableid = ''; $NewCityId = $citiesmodel->SaveMainCityData($stateid, $city); $actionflag = 1; $tableid = $NewCityId; $menuidArr = $menumodel->getMenuObjID('/cities'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); if (isset($selectedstateid) && isset($selectedcountryid)) { $cityData = $citiesmodel->getCitiesList($selectedstateid, 'city'); } else { $cityData = array(); } $opt = ''; foreach ($cityData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['city_name']); } $this->view->cityData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $citiesform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } if (isset($countryid) && $countryid != 0 && $countryid != '') { $statesmodel = new Default_Model_States(); $statesmodeldata = $statesmodel->getBasicStatesList($countryid); foreach ($statesmodeldata as $res) { $citiesform->state->addMultiOption($res['state_id_org'] . '!@#' . utf8_encode($res['state']), utf8_encode($res['state'])); } if (isset($stateidstr) && $stateidstr != 0 && $stateidstr != '') { $citiesform->setDefault('state', $stateidstr); } } } } $this->view->controllername = $controllername; $this->view->ermsg = ''; $this->view->form = $citiesform; $this->view->msgarray = $msgarray; }
public function save($form) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $cand_model = new Default_Model_Candidatedetails(); $candwork_model = new Default_Model_Candidateworkdetails(); $req_model = new Default_Model_Requisition(); $requisition_id = $this->_getParam('requisition_id', null); $cand_status = $this->_getParam('cand_status', null); $ststidflag1 = $this->_getParam('ststidflag1', null); $flag = 'true'; if ($ststidflag1 == 'true') { if ($requisition_id == '') { $msgarray['requisition_id'] = 'Please select requisition id.'; $flag = 'false'; } if ($cand_status == '') { $msgarray['cand_status'] = 'Please select status.'; $flag = 'false'; } } $this->view->ststidflag1 = $ststidflag1; $country = $this->_getParam('country', null); $state = $this->_getParam('state', null); $city = $this->_getParam('city', null); if ($form->isValid($this->_request->getPost()) && $flag == 'true') { $id = $this->getRequest()->getParam('id'); $requisition_id = $this->_getParam('requisition_id', null); $candidate_firstname = $this->_getParam('candidate_firstname', null); $candidate_lastname = $this->_getParam('candidate_lastname', null); $candidate_name = $candidate_firstname . ' ' . $candidate_lastname; $cand_resume = $this->_getParam('cand_resume', null); $emailid = $this->_getParam('emailid', null); $contact_number = $this->_getParam('contact_number', null); $qualification = $this->_getParam('qualification', null); $experience = $this->_getParam('experience', null); $skillset = $this->_getParam('skillset', null); $education_summary = $this->_getParam('education_summary', null); $summary = $this->_getParam('summary', null); $cand_location = $this->_getParam('cand_location', null); $pincode = $this->_getParam('pincode', null); $cand_status = $this->_getParam('cand_status', null); for ($i = 0; $i < 3; $i++) { $txt_cname[] = $this->_getParam('txt_cname' . $i, null); $txt_desig[] = $this->_getParam('txt_desig' . $i, null); $txt_from[] = $this->_getParam('txt_from' . $i, null); $txt_to[] = $this->_getParam('txt_to' . $i, null); $txt_cnumber[] = $this->_getParam('txt_cnumber' . $i, null); $txt_website[] = $this->_getParam('txt_website' . $i, null); $txt_address[] = $this->_getParam('txt_address' . $i, null); } $hidworkdata = $this->_getParam('hidworkdata', null); $req_records = $cand_model->getcountofrecords($requisition_id); if (empty($req_records)) { $rdata = array('req_status' => 'In process', 'modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s")); $rwhere = ' id = ' . $requisition_id; $req_model->SaveorUpdateRequisitionData($rdata, $rwhere); } $data = array('requisition_id' => $requisition_id, 'candidate_firstname' => trim($candidate_firstname), 'candidate_lastname' => trim($candidate_lastname), 'candidate_name' => trim($candidate_name), 'emailid' => trim($emailid), 'contact_number' => trim($contact_number) == '' ? NULL : trim($contact_number), 'cand_resume' => $cand_resume, 'qualification' => trim($qualification), 'experience' => trim($experience), 'skillset' => trim($skillset), 'education_summary' => trim($education_summary), 'summary' => trim($summary), 'cand_location' => trim($cand_location), 'country' => intval($country), 'state' => intval($state), 'city' => intval($city), 'pincode' => $pincode, 'cand_status' => $cand_status, 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s")); if (trim($contact_number) == '') { unset($data['contact_number']); } if (trim($emailid) == '') { unset($data['emailid']); } $where = ""; $actionflag = 1; if ($id != '') { unset($data['createdby']); unset($data['createdon']); unset($data['isactive']); $where = "id = " . $id; $tableid = $id; $actionflag = 2; } $result = $cand_model->SaveorUpdateCandidateData($data, $where); if ($id == '') { $tableid = $result; } if ($result != '') { //saving of candidate work details if (count($txt_cname) > 0) { $k = 0; foreach ($txt_cname as $cname) { if ($cname != '') { $cdata = array('cand_id' => $tableid, 'company_name' => $cname, 'contact_number' => $txt_cnumber[$k], 'company_address' => $txt_address[$k], 'company_website' => $txt_website[$k], 'cand_designation' => $txt_desig[$k], 'cand_fromdate' => sapp_Global::change_date($txt_from[$k], 'database'), 'cand_todate' => sapp_Global::change_date($txt_to[$k], 'database'), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s")); $cwhere = $hidworkdata[$k] != '' ? "id = " . $hidworkdata[$k] : ""; $candwork_model->SaveorUpdateCandidateWorkData($cdata, $cwhere); } $k++; } } //end of saving of candidate work details $menumodel = new Default_Model_Menu(); $objidArr = $menumodel->getMenuObjID('/candidatedetails'); $objID = $objidArr[0]['id']; $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid); if ($id == '') { //$this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Candidate details added successfully.'); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Candidate details added successfully.")); } else { //$this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Candidate details updated successfully.'); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Candidate details updated successfully.")); } $this->_redirect('/candidatedetails'); } } else { $messages = $form->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } if (isset($country) && $country != 0 && $country != '') { $statesmodel = new Default_Model_States(); $statesmodeldata = $statesmodel->getStatesList(intval($country)); $form->state->clearMultiOptions(); $form->city->clearMultiOptions(); $form->state->addMultiOption('', 'Select State'); foreach ($statesmodeldata as $res) { $form->state->addMultiOption($res['id'], utf8_encode($res['state_name'])); } if (isset($state) && $state != 0 && $state != '') { $form->setDefault('state', $state); } } if (isset($state) && $state != 0 && $state != '') { $citiesmodel = new Default_Model_Cities(); $citiesmodeldata = $citiesmodel->getCitiesList(intval($state)); $form->city->addMultiOption('', 'Select City'); foreach ($citiesmodeldata as $res) { $form->city->addMultiOption($res['id'], utf8_encode($res['city_name'])); } if (isset($city) && $city != 0 && $city != '') { $form->setDefault('city', $city); } } return $msgarray; } }
/** * @name save * * This function is used to save the data that comes from add and edit actions. * @author Asma * @version 1.0 */ public function save($agencylistform) { $baseUrl = BASE_URL; $baseUrl = rtrim($baseUrl, '/'); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->_request->getParam('id'); $agencyEmail = ''; $agencyContactNum = ''; $agencyuserid = ''; $agencylistmodel = new Default_Model_Agencylist(); $pocModel = new Default_Model_Bgpocdetails(); $usersModel = new Default_Model_Users(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $pocData_1 = array(); $pocData_2 = array(); $pocData_3 = array(); $contact_type_1 = $this->_request->getParam('contact_type_1'); $contact_type_2 = $this->_request->getParam('contact_type_2'); $contact_type_3 = $this->_request->getParam('contact_type_3'); $checktypeModal = new Default_Model_Bgscreeningtype(); $errorflag = "true"; $primaryphone = $this->_request->getParam('primaryphone'); $secondaryphone = $this->_request->getParam('secondaryphone'); if ($primaryphone == $secondaryphone && $secondaryphone != '' && $primaryphone != '') { $msgarray['secondaryphone'] = 'Primary and secondary phone numbers must not be same.'; $errorflag = 'false'; } if ($agencylistform->isValid($this->_request->getPost())) { if ($contact_type_1 == 1 || $contact_type_2 == 1 || $contact_type_3 == 1) { if ($contact_type_1 == 1 && $contact_type_2 == 1 || $contact_type_1 == 1 && $contact_type_3 == 1 || $contact_type_2 == 1 && $contact_type_3 == 1 || $contact_type_1 == 1 && $contact_type_2 == 1 && $contact_type_3 == 1) { $msgarray['contacttype'] = "Please set one contact type as primary."; $errorflag = "false"; } } else { $msgarray['contacttype'] = "Please set one contact type as primary."; $errorflag = "false"; } } /* Check for duplicate entry of mobile and email*/ $pocid_1 = $this->_request->getParam('pocid_1'); $mobile_1 = $this->_request->getParam('mobile_1'); $email_1 = $this->_request->getParam('email_1'); if ($mobile_1 != '' && $email_1 != '') { $exists_M1 = $pocModel->checkMobileDuplicates($pocid_1, $mobile_1); if ($exists_M1) { $msgarray['mobile_1'] = "Mobile number already exists."; $errorflag = "false"; } $exists_E1 = $pocModel->checkEmailDuplicates($pocid_1, $email_1); if ($exists_E1) { $msgarray['email_1'] = "Email already exists."; $errorflag = "false"; } } $pocid_2 = $this->_request->getParam('pocid_2'); $mobile_2 = $this->_request->getParam('mobile_2'); $email_2 = $this->_request->getParam('email_2'); if ($mobile_2 != '' && $email_2 != '') { $exists_M2 = $pocModel->checkMobileDuplicates($pocid_2, $mobile_2); if ($exists_M2) { $msgarray['mobile_2'] = "Mobile number already exists."; $errorflag = "false"; } $exists_E2 = $pocModel->checkEmailDuplicates($pocid_2, $email_2); if ($exists_E2) { $msgarray['email_2'] = "Email already exists."; $errorflag = "false"; } } $pocid_3 = $this->_request->getParam('pocid_3'); $mobile_3 = $this->_request->getParam('mobile_3'); $email_3 = $this->_request->getParam('email_3'); if ($mobile_3 != '' && $email_3 != '') { $exists_M3 = $pocModel->checkMobileDuplicates($pocid_3, $mobile_3); if ($exists_M3) { $msgarray['mobile_3'] = "Mobile number already exists."; $errorflag = "false"; } $exists_E3 = $pocModel->checkEmailDuplicates($pocid_3, $email_3); if ($exists_E3) { $msgarray['email_3'] = "Email already exists."; $errorflag = "false"; } } $contact_type_1 = $this->_request->getParam('contact_type_1'); $contact_type_2 = $this->_request->getParam('contact_type_2'); $contact_type_3 = $this->_request->getParam('contact_type_3'); if ($contact_type_1 == 1) { $agid = $id; $agencyEmail = $email_1; $agencyContactNum = $mobile_1; $pocuseremail = $pocModel->checkEmailInUsers($email_1, $agid); if (!empty($pocuseremail)) { $msgarray['email_1'] = "Email already exists."; $errorflag = "false"; } } else { if ($contact_type_2 == 1) { $agencyEmail = $email_2; $agencyContactNum = $mobile_2; $pocuseremail = $pocModel->checkEmailInUsers($email_2, $agid); if (!empty($pocuseremail)) { $msgarray['email_2'] = "Email already exists."; $errorflag = "false"; } } else { if ($contact_type_3 == 1) { $agencyEmail = $email_3; $agencyContactNum = $mobile_3; $pocuseremail = $pocModel->checkEmailInUsers($email_3, $agid); if (!empty($pocuseremail)) { $msgarray['email_3'] = "Email already exists."; $errorflag = "false"; } } } } if ($mobile_1 != '' && ($mobile_2 != '' || $mobile_3 != '')) { if ($mobile_2 != '' && $mobile_1 == $mobile_2) { $msgarray['mobile_2'] = "Contact 1 and contact 2 mobile numbers cannot be same."; $errorflag = "false"; } if ($mobile_3 != '' && $mobile_1 == $mobile_3) { $msgarray['mobile_3'] = "Contact 1 and contact 3 mobile numbers cannot be same."; $errorflag = "false"; } if ($mobile_3 != '' && $mobile_2 != '' && $mobile_2 == $mobile_3) { $msgarray['mobile_3'] = "Contact 2 and contact 3 mobile numbers cannot be same."; $errorflag = "false"; } } if ($email_1 != '' && ($email_2 != '' || $email_3 != '')) { if ($email_2 != '' && $email_1 == $email_2) { $msgarray['email_2'] = "Contact 1 and contact 2 emails cannot be same."; $errorflag = "false"; } if ($email_3 != '' && $email_1 == $email_3) { $msgarray['email_3'] = "Contact 1 and contact 3 emails cannot be same."; $errorflag = "false"; } if ($email_3 != '' && $email_2 != '' && $email_2 == $email_3) { $msgarray['email_3'] = "Contact 2 and contact 3 emails cannot be same."; $errorflag = "false"; } } /* Duplicate check END */ $country_1 = $this->_request->getParam('country_1'); $state_1 = intVal($this->_request->getParam('state_1')); $city_1 = intVal($this->_request->getParam('city_1')); if (isset($country_1) && $country_1 != 0 && $country_1 != '') { $statesData = $statesmodel->getStatesList($country_1); foreach ($statesData as $res) { $agencylistform->state_1->addMultiOption($res['id'], utf8_encode($res['state_name'])); } if (isset($state_1) && $state_1 != 0 && $state_1 != '') { $agencylistform->setDefault('state_1', $state_1); } } if (isset($state_1) && $state_1 != 0 && $state_1 != '') { $citiesData = $citiesmodel->getCitiesList($state_1); foreach ($citiesData as $res) { $agencylistform->city_1->addMultiOption($res['id'], utf8_encode($res['city_name'])); } if (isset($city_1) && $city_1 != 0 && $city_1 != '') { $agencylistform->setDefault('city_1', $city_1); } } $country_2 = $this->_request->getParam('country_2'); $state_2 = intVal($this->_request->getParam('state_2')); $city_2 = intVal($this->_request->getParam('city_2')); if (isset($country_2) && $country_2 != 0 && $country_2 != '') { $statesData = $statesmodel->getStatesList($country_2); foreach ($statesData as $res) { $agencylistform->state_2->addMultiOption($res['id'], utf8_encode($res['state_name'])); } if (isset($state_2) && $state_2 != 0 && $state_2 != '') { $agencylistform->setDefault('state_2', $state_2); } } if (isset($state_2) && $state_2 != 0 && $state_2 != '') { $citiesData = $citiesmodel->getCitiesList($state_2); foreach ($citiesData as $res) { $agencylistform->city_2->addMultiOption($res['id'], utf8_encode($res['city_name'])); } if (isset($city_2) && $city_2 != 0 && $city_2 != '') { $agencylistform->setDefault('city_2', $city_2); } } $country_3 = $this->_request->getParam('country_3'); $state_3 = intVal($this->_request->getParam('state_3')); $city_3 = intVal($this->_request->getParam('city_3')); if (isset($country_3) && $country_3 != 0 && $country_3 != '') { $statesData = $statesmodel->getStatesList($country_3); foreach ($statesData as $res) { $agencylistform->state_3->addMultiOption($res['id'], utf8_encode($res['state_name'])); } if (isset($state_3) && $state_3 != 0 && $state_3 != '') { $agencylistform->setDefault('state_3', $state_3); } } if (isset($state_3) && $state_3 != 0 && $state_3 != '') { $citiesData = $citiesmodel->getCitiesList($state_3); foreach ($citiesData as $res) { $agencylistform->city_3->addMultiOption($res['id'], utf8_encode($res['city_name'])); } if (isset($city_3) && $city_3 != 0 && $city_3 != '') { $agencylistform->setDefault('city_3', $city_3); } } $typesData = $checktypeModal->fetchAll('isactive=1', 'type')->toArray(); if (!empty($typesData)) { $this->view->configure = ''; } else { $msgarray['bg_checktype'] = 'Screening types are not configured yet.'; $errorflag = 'false'; $this->view->configure = 'notconfigured'; } $rolesData = $agencylistmodel->getagencyrole(); if (!empty($rolesData)) { $this->view->rolesconfigure = ''; } else { $msgarray['emprole'] = 'Roles are not configured yet.'; $errorflag = 'false'; $this->view->rolesconfigure = 'notconfigured'; } /* Email address validation */ $email_1 = $this->_request->getParam('email_1'); $isvalidemail = filter_var($email_1, FILTER_VALIDATE_EMAIL); if ($email_1 == $isvalidemail) { } else { $msgarray['email_1'] = "Please enter valid email."; $errorflag = "false"; } $email_2 = $this->_request->getParam('email_2'); if ($email_2 != '') { $isvalidemail = filter_var($email_2, FILTER_VALIDATE_EMAIL); if ($email_2 == $isvalidemail) { } else { $msgarray['email_2'] = "Please enter valid email."; $errorflag = "false"; } } $email_3 = $this->_request->getParam('email_3'); if ($email_3 != '') { $isvalidemail = filter_var($email_3, FILTER_VALIDATE_EMAIL); if ($email_3 == $isvalidemail) { } else { $msgarray['email_3'] = "Please enter valid email."; $errorflag = "false"; } } /* Email address validation END */ /* Website validation */ $id = $this->_request->getParam('id'); $website_url = $this->_request->getParam('website_url'); $websiteExistance = $agencylistmodel->checkSiteDuplicates($website_url, $id); if (!empty($websiteExistance)) { $eid = isset($websiteExistance['employeeId']) ? $websiteExistance['employeeId'] : 'An agency'; if ($websiteExistance['isactive'] == '1') { $msgarray['website_url'] = $eid . " with the given website URL already exists."; } else { $msgarray['website_url'] = $eid . " with the given website URL already exists but it might be inactive. Please activate it from manage external users."; } $errorflag = "false"; } /* Website validation END */ if ($agencylistform->isValid($this->_request->getPost()) && $errorflag != 'false') { $agencyname = $this->_request->getParam('agencyname'); $address = $this->_request->getParam('address'); $primaryphone = $this->_request->getParam('primaryphone'); $secondaryphone = $this->_request->getParam('secondaryphone'); $bg_checktype = $this->_request->getParam('bg_checktype'); $bg_checktype = implode(',', $bg_checktype); $website_url = $this->_request->getParam('website_url'); $pocid_1 = $this->_request->getParam('pocid_1'); $firstname_1 = $this->_request->getParam('firstname_1'); $lastname_1 = $this->_request->getParam('lastname_1'); $mobile_1 = $this->_request->getParam('mobile_1'); $email_1 = $this->_request->getParam('email_1'); $location_1 = $this->_request->getParam('location_1'); $country_1 = $this->_request->getParam('country_1'); $state_1 = $this->_request->getParam('state_1'); $city_1 = $this->_request->getParam('city_1'); $contact_type_1 = $this->_request->getParam('contact_type_1'); $pocid_2 = $this->_request->getParam('pocid_2'); $firstname_2 = $this->_request->getParam('firstname_2'); $lastname_2 = $this->_request->getParam('lastname_2'); $mobile_2 = $this->_request->getParam('mobile_2'); $email_2 = $this->_request->getParam('email_2'); $location_2 = $this->_request->getParam('location_2'); $country_2 = $this->_request->getParam('country_2'); $state_2 = $this->_request->getParam('state_2'); $city_2 = $this->_request->getParam('city_2'); $contact_type_2 = $this->_request->getParam('contact_type_2'); $pocid_3 = $this->_request->getParam('pocid_3'); $firstname_3 = $this->_request->getParam('firstname_3'); $lastname_3 = $this->_request->getParam('lastname_3'); $mobile_3 = $this->_request->getParam('mobile_3'); $email_3 = $this->_request->getParam('email_3'); $location_3 = $this->_request->getParam('location_3'); $country_3 = $this->_request->getParam('country_3'); $state_3 = $this->_request->getParam('state_3'); $city_3 = $this->_request->getParam('city_3'); $contact_type_3 = $this->_request->getParam('contact_type_3'); $emprole = $this->_request->getParam('emprole'); if (empty($websiteExistance)) { $date = new Zend_Date(); if ($contact_type_1 == 1) { $agencyEmail = $email_1; $agencyContactNum = $mobile_1; $pocfn = $firstname_1; $pocln = $lastname_1; } else { if ($contact_type_2 == 1) { $agencyEmail = $email_2; $agencyContactNum = $mobile_2; $pocfn = $firstname_2; $pocln = $lastname_2; } else { if ($contact_type_3 == 1) { $agencyEmail = $email_3; $agencyContactNum = $mobile_3; $pocfn = $firstname_3; $pocln = $lastname_3; } } } $primary_poc_name = ucfirst($pocfn); /* Create user for the agency */ if ($id == '') { $pswd = uniqid(); $userdata = array('emprole' => $emprole, 'userstatus' => 'old', 'firstname' => $firstname_1, 'lastname' => $lastname_1, 'userfullname' => $firstname_1 . ' ' . $lastname_1, 'emailaddress' => $agencyEmail, 'contactnumber' => $agencyContactNum, 'emppassword' => md5($pswd), 'isactive' => 1, 'createdby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $userWhere = ''; $usersModel = new Default_Model_Users(); $usersTableId = $usersModel->addOrUpdateUserModel($userdata, $userWhere); $agencyuserid = $usersTableId; $idcodeModel = new Default_Model_Identitycodes(); $idcode = $idcodeModel->getallcodes('bgcheck'); $userdata = array('employeeId' => $idcode . $usersTableId, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $userWhere = array('id=?' => $usersTableId); $usersTableId = $usersModel->addOrUpdateUserModel($userdata, $userWhere); $options['subject'] = APPLICATION_NAME . ' :: Agency is created'; $options['header'] = 'Greetings from ' . APPLICATION_NAME; $options['toEmail'] = $agencyEmail; $options['toName'] = $pocfn . ' ' . $pocln; $options['message'] = '<div>Dear ' . $pocfn . ',</div> <div>' . ucfirst($agencyname) . ' agency has been created. The credentials to login to your ' . APPLICATION_NAME . ' account are: <div>Login ID : ' . $idcode . $agencyuserid . ' </div> <div>Password : '******'</div> <div></div> <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 agency details.</div> </div>'; $result = sapp_Global::_sendEmail($options); $emailids = $agencylistmodel->getAllHRManagementEMails(); foreach ($emailids as $email) { $options['subject'] = APPLICATION_NAME . ' :: Agency is created'; $options['header'] = 'Agency created'; $options['toEmail'] = $email['groupEmail']; $options['toName'] = $email['group_name']; if ($email['group_id'] == 4) { $salutation = 'Dear HR,'; $options['toName'] = 'HR'; } else { $salutation = 'Dear Management,'; $options['toName'] = 'Management'; } $options['message'] = '<div> <div>' . $salutation . ' </div> <div></div> ' . ucfirst($agencyname) . ' agency has been created with ' . $pocfn . ' ' . $pocln . ' as primary point of contact. <div></div> <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 agency details.</div> </div>'; $options['cron'] = 'yes'; $result = sapp_Global::_sendEmail($options); } } else { $agencyInfo = $agencylistmodel->getSingleagencyPOCData($id); $userid = $agencyInfo[0]['user_id']; $agencyoldname = $agencyInfo[0]['agencyname']; $userdata = array('emprole' => $emprole, 'userfullname' => $agencyname, 'emailaddress' => $agencyEmail, 'contactnumber' => $agencyContactNum, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $userWhere = array('id=?' => $userid); $usersModel->addOrUpdateUserModel($userdata, $userWhere); if ($agencyoldname != $agencyname) { $agencynamemsg = '<div>Hello ' . ucfirst($primary_poc_name) . ',</div><div>Your agency name is changed to ' . ucfirst($agencyname) . '.</div>'; } else { $agencynamemsg = '<div>Hello ' . ucfirst($primary_poc_name) . ',</div><div>Your agency information has been modified. Please find the details below:</div>'; } $options['subject'] = APPLICATION_NAME . ' :: Agency details are updated'; $options['header'] = 'Agency information'; $options['toEmail'] = $agencyEmail; $options['toName'] = $pocfn . ' ' . $pocln; $options['message'] = '<div>' . $agencynamemsg . ' <div><table border="1" style="border-collapse:collapse;"><tr><td>Primary email</td><td>' . $agencyEmail . '</td></tr><tr><td>Primary Contact Number</td><td>' . $agencyContactNum . '</td></tr></table></div> <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 agency details. </div> </div>'; $options['cron'] = 'yes'; $result = sapp_Global::_sendEmail($options); } $actionflag = ''; $tableid = ''; $data = array('user_id' => $agencyuserid, 'agencyname' => $agencyname, 'address' => $address, 'primaryphone' => $primaryphone, 'secondaryphone' => $secondaryphone, 'bg_checktype' => $bg_checktype, 'website_url' => $website_url, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { unset($data['user_id']); $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $agencyId = $agencylistmodel->SaveorUpdateAgency($data, $where); if ($agencyId == 'update') { $tableid = $id; } else { $tableid = $agencyId; } $menuID = AGENCYLIST; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); if ($firstname_1 != '' && $mobile_1 != '') { $pocData_1 = array('bg_agencyid' => $tableid, 'first_name' => $firstname_1, 'last_name' => $lastname_1, 'contact_no' => $mobile_1, 'email' => $email_1, 'location' => $location_1, 'country' => $country_1, 'state' => $state_1, 'city' => $city_1, 'contact_type' => $contact_type_1, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($pocid_1 != '') { $pocWhere_1 = array('id=?' => $pocid_1); $actionflag = 2; } else { $pocData_1['createdby'] = $loginUserId; $pocData_1['createddate'] = gmdate("Y-m-d H:i:s"); $pocData_1['isactive'] = 1; $pocWhere_1 = ''; $actionflag = 1; } $savedpocId_1 = $pocModel->SaveorUpdatePOCDetails($pocData_1, $pocWhere_1); if ($savedpocId_1 == 'update') { $newpocid_1 = $pocid_1; } else { $newpocid_1 = $savedpocId_1; } } if ($firstname_2 != '' && $mobile_2 != '') { $pocData_2 = array('bg_agencyid' => $tableid, 'first_name' => $firstname_2, 'last_name' => $lastname_2, 'contact_no' => $mobile_2, 'email' => $email_2, 'location' => $location_2, 'country' => $country_2, 'state' => $state_2, 'city' => $city_2, 'contact_type' => $contact_type_2, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($pocid_2 != '') { $pocWhere_2 = array('id=?' => $pocid_2); $actionflag = 2; } else { $pocData_2['createdby'] = $loginUserId; $pocData_2['createddate'] = gmdate("Y-m-d H:i:s"); $pocData_2['isactive'] = 1; $pocWhere_2 = ''; $actionflag = 1; } $savedpocId_2 = $pocModel->SaveorUpdatePOCDetails($pocData_2, $pocWhere_2); if ($savedpocId_2 == 'update') { $newpocid_2 = $pocid_2; } else { $newpocid_2 = $savedpocId_2; } } if ($firstname_3 != '' && $mobile_3 != '') { $pocData_3 = array('bg_agencyid' => $tableid, 'first_name' => $firstname_3, 'last_name' => $lastname_3, 'contact_no' => $mobile_3, 'email' => $email_3, 'location' => $location_3, 'country' => $country_3, 'state' => $state_3, 'city' => $city_3, 'contact_type' => $contact_type_3, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($pocid_3 != '') { $pocWhere_3 = array('id=?' => $pocid_3); $actionflag = 2; } else { $pocData_3['createdby'] = $loginUserId; $pocData_3['createddate'] = gmdate("Y-m-d H:i:s"); $pocData_3['isactive'] = 1; $pocWhere_3 = ''; $actionflag = 1; } $savedpocId_3 = $pocModel->SaveorUpdatePOCDetails($pocData_3, $pocWhere_3); if ($savedpocId_3 == 'update') { $newpocid_3 = $pocid_3; } else { $newpocid_3 = $savedpocId_3; } } if ($agencyId == 'update') { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Agency data updated successfully.")); } else { $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Agency data added successfully.")); } $this->_redirect('agencylist'); } else { $msgarray['message'] = 'An Agency, with the given website address, already exists.'; $msgarray['msgtype'] = 'error'; return $msgarray; } } else { $messages = $agencylistform->getMessages(); if (isset($msgarray['mobile_1']) && !isset($messages['mobile_1'])) { $messages['mobile_1'] = $msgarray['mobile_1']; } if (isset($msgarray['email_1']) && !isset($messages['email_1'])) { $messages['email_1'] = $msgarray['email_1']; } if (isset($msgarray['mobile_2']) && !isset($messages['mobile_2'])) { $messages['mobile_2'] = $msgarray['mobile_2']; } if (isset($msgarray['email_2']) && !isset($messages['email_2'])) { $messages['email_2'] = $msgarray['email_2']; } if (isset($msgarray['mobile_3']) && !isset($messages['mobile_3'])) { $messages['mobile_3'] = $msgarray['mobile_3']; } if (isset($msgarray['email_3']) && !isset($messages['email_3'])) { $messages['email_3'] = $msgarray['email_3']; } $i = 0; $msgarray['error1dv'] = ''; $msgarray['error2dv'] = ''; $msgarray['error3dv'] = ''; foreach ($messages as $key => $val) { if (strpos($key, '_1') !== false) { $msgarray['error1dv'] = 'first'; } if (strpos($key, '_2') !== false) { $msgarray['error2dv'] = 'second'; } if (strpos($key, '_3') !== false) { $msgarray['error3dv'] = 'third'; } if (!isset($msgarray[$key])) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $i = $i + 1; if (empty($typesData)) { $msgarray['bg_checktype'] = 'Screening types are not configured yet.'; } if (empty($rolesData)) { $msgarray['emprole'] = 'Roles are not configured yet.'; } } return $msgarray; } }
public function configureorganisationAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = array(); $new_stateId = ''; if (sapp_Global::_checkprivileges(COUNTRIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'country'); } if (sapp_Global::_checkprivileges(STATES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'state'); } if (sapp_Global::_checkprivileges(CITIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'city'); } $msgarray = array(); $new_stateId = ''; $new_cityId = ''; $id = $this->getRequest()->getParam('id'); $form = new Default_Form_Organisationinfo(); $orgInfoModel = new Default_Model_Organisationinfo(); $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $wizard_model = new Default_Model_Wizard(); $wizardData = $wizard_model->getWizardData(); $orginfodata = $orgInfoModel->getOrganisationInfo(); $allCountriesData = $countriesModel->fetchAll('isactive=1', 'country')->toArray(); $allStatesData = $statesmodel->fetchAll('isactive=1', 'state')->toArray(); $allCitiesData = $citiesmodel->fetchAll('isactive=1', 'city')->toArray(); $form->setAttrib('action', DOMAIN . 'wizard/configureorganisation'); $flag = 'true'; if (empty($allCountriesData)) { $msgarray['country'] = 'Countries are not configured yet.'; $flag = 'false'; } if (empty($allStatesData)) { $msgarray['state'] = 'States are not configured yet.'; $flag = 'false'; } if (empty($allCitiesData)) { $msgarray['city'] = 'Cities are not configured yet.'; $flag = 'false'; } if (!empty($orginfodata)) { try { $data = $orginfodata[0]; $data['org_startdate'] = sapp_Global::change_date($data['org_startdate'], 'view'); $form->populate($data); $countryId = $data['country']; $stateId = $data['state']; $cityId = $data['city']; $actionpage = 'edit'; if (count($_POST) > 0) { $countryId = isset($_POST['country']) ? $_POST['country'] : ""; $stateId = isset($_POST['state']) ? $_POST['state'] : ""; $cityId = isset($_POST['city']) ? $_POST['city'] : ""; } if ($countryId != '') { $statesData = $statesmodel->getBasicStatesList((int) $countryId); foreach ($statesData as $res) { if ($stateId == $res['state_id_org']) { $new_stateId = $res['state_id_org'] . '!@#' . utf8_encode($res['state']); } $form->state->addMultiOption($res['state_id_org'] . '!@#' . utf8_encode($res['state']), utf8_encode($res['state'])); } if (count($_POST) == 0) { $stateId = $new_stateId; } } if ($stateId != '') { $citiesData = $citiesmodel->getBasicCitiesList((int) $stateId); foreach ($citiesData as $res) { if ($cityId == $res['city_org_id']) { $new_cityId = $res['city_org_id'] . '!@#' . utf8_encode($res['city']); } $form->city->addMultiOption($res['city_org_id'] . '!@#' . utf8_encode($res['city']), utf8_encode($res['city'])); } if (count($_POST) == 0) { $cityId = $new_cityId; } } $form->setDefault('country', $countryId); $form->setDefault('state', $stateId); $form->setDefault('city', $cityId); $this->view->domainValue = $data['domain']; $this->view->org_image = $data['org_image']; $this->view->ermsg = ''; $this->view->datarr = $data; } catch (Exception $e) { $this->view->ermsg = 'nodata'; } } else { sapp_Global::buildlocations($form, $wizardData); } $this->view->form = $form; if (!empty($allCountriesData) && !empty($allStatesData) && !empty($allCitiesData)) { $this->view->configuremsg = ''; } else { $this->view->configuremsg = 'notconfigurable'; } $this->view->wizarddata = $wizardData; $this->view->msgarray = $msgarray; $this->view->popConfigPermission = $popConfigPermission; $this->view->messages = $this->_helper->flashMessenger->getMessages(); if ($this->getRequest()->getPost()) { $result = $this->saveorginfo($form, $loginUserId, $wizardData); $this->view->msgarray = $result; if (isset($this->msgarray['domain'])) { $this->view->msMsg = 'multiselecterror'; } } }
/** * This function acts as a service for onchange of state to get cities(ex: in interviews). * @param array $params_arr = array of parameters * @return array Array of city options. */ public function stateOnchange($params_arr) { $result = array(); $status = 0; $message = "Invalid state."; if (isset($params_arr['state']) && $params_arr['state'] != '') { $state_id = $params_arr['state']; $status = 1; $message = "success"; $citiesmodel = new Default_Model_Cities(); $cities_data = $citiesmodel->getCitiesList($state_id); if (!empty($cities_data)) { $cities_str = sapp_Global::selectOptionBuilder("", "Select City"); foreach ($cities_data as $sdata) { $cities_str .= sapp_Global::selectOptionBuilder($sdata['id'], $sdata['city_name']); } $result['city'] = $cities_str; } else { $status = 0; $message = "Cities are not configured yet."; } } return array('status' => $status, 'message' => $message, 'result' => $result); }