public function doSearchOpportunitiesAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $client = PR_Session::getSession(PR_Session::SESSION_USER); $CandidateProfileID = $client['CandidateProfileID']; $request = $this->getRequest(); $params = $this->getRequest()->getParams(); $industry = $request->getParam("technology_id", ""); $experienced = $request->getParam("experience_name", ""); $country = $request->getParam("country_name", ""); $city = $request->getParam("city_name", ""); if (isset($params['matchopportunitySear'])) { $opportunitiesSearchList = $request->getParam("matchopportunitySear", ""); } else { $opportunitiesSearchList = array(); } $core = new PR_Api_Core_CandidateClass(); $opportunityListID = $core->getOpportunitiesMatch($industry, $experienced, $country, $city, $opportunitiesSearchList); $PR_Api = new PR_Api_Core_CareerClass(); $oppList = array(); //$result = array(); if ($opportunityListID != "") { foreach ($opportunityListID as $key => $opportunityID) { $result = $PR_Api->getOpportunityInfoByID($opportunityID); $hadApplied = $core->opportunityCandidateHadApplied($opportunityID, $CandidateProfileID); if ($hadApplied) { $result['hadApplied'] = true; $oppList[] = $result; } else { $result['hadApplied'] = false; $oppList[] = $result; } } } $response = $this->getResponse(); $response->clearAllHeaders()->clearBody(); $oppList = json_encode($oppList); $response->setHeader('Content-type', 'application/json'); $response->setHeader('Content-Length', strlen($oppList), true)->setBody($oppList); //$this->_helper->viewRenderer('matchopportunities'); }