public function profileAction()
 {
     $request = $this->getRequest();
     $sestionClient = PR_Session::getSession(PR_Session::SESSION_USER);
     $companyid = $request->getParam("companyid");
     $api = new PR_Api_Core_ClientClass();
     $company = $api->getCompany($companyid);
     $rslState = "";
     if (count($company) > 0 && !empty($company)) {
         $rslState = $api->getStateByStateCode(trim($company['state']));
         if (empty($rslState)) {
             $stateName = trim($company['state']);
         } else {
             $stateInfo = $rslState[0];
             $stateName = $stateInfo['state_name'];
         }
     }
     $this->view->company = $company;
     $this->view->stateOfCompany = $stateName;
     $Industry = $company["Industry"];
     $listOrtherCompany = $api->getCompany_Industry($Industry);
     //echo("tetstt:<pre>");print_r($listOrtherCompany); echo("</pre>");
     $this->view->listOrtherCompany = $listOrtherCompany;
     $Oppotunity_PR_Api = new PR_Api_Core_CareerClass();
     $getListOpp = $Oppotunity_PR_Api->getListOpportunity(array('CompanyID' => $companyid));
     $this->view->getListOpp = $getListOpp;
     $this->render('companyprofileview');
 }
 public function publibOpportunityAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $client = PR_Session::getSession(PR_Session::SESSION_USER);
     $request = $this->getRequest();
     $params = $this->getRequest()->getParams();
     $opportunityID = $params['oppotunityID'];
     $status = $params['status'];
     /*
             if(isset($params['oppotunityID'])){
                 $opportunityID = $params['oppotunityID'];
             } else{
                 $opportunityID ="";
             }
     
             if(isset($params['status'])){
                 $status = $params['status'];
             } else{
                 $status ="";
             }
     
             $Career_PR_Api = new PR_Api_Core_CareerClass();
             if($opportunityID !="" && $status!=""){
     
                 $result=  $Career_PR_Api->publibOpportunityByOpportunityID($opportunityID,$status);
             } */
     $Career_PR_Api = new PR_Api_Core_CareerClass();
     $result = $Career_PR_Api->publibOpportunityByOpportunityID($opportunityID, $status);
     // $sestionClient = PR_Session::getSession(PR_Session::SESSION_USER);
     // $CompanyID = $sestionClient['CompanyID'];
     //$getListOpp = $Career_PR_Api->getListOpportunity(array('CompanyID'=>$CompanyID));
     /*echo "<pre>";
       print_r($getListOpp);
       echo "</pre>"; die(); */
     if ($result) {
         $return = array("success" => 1, "error" => "");
     } else {
         $return = array("success" => 0, "error" => "");
     }
     $response = $this->getResponse();
     $response->clearAllHeaders()->clearBody();
     $return = json_encode($return);
     $response->setHeader('Content-type', 'application/json');
     $response->setHeader('Content-Length', strlen($return), true)->setBody($return);
 }
 public function careermatchPremiumAccountAction()
 {
     $this->_helper->layout->disableLayout();
     $client = PR_Session::getSession(PR_Session::SESSION_USER);
     $CandidateProfileID = $client['CandidateProfileID'];
     $request = $this->getRequest();
     $params = $this->getRequest()->getParams();
     if (isset($params['skill_match_premium'])) {
         $skill_match_premium = $request->getParam("skill_match_premium", "");
     } else {
         $skill_match_premium = array();
     }
     if (isset($params['keyword_match_premium'])) {
         $keyword_match_premium = $request->getParam("keyword_match_premium", "");
     } else {
         $keyword_match_premium = array();
     }
     $PR_Api = new PR_Api_Core_CareerClass();
     $listCandidateID = $PR_Api->getCandidateProfileIDsForCareerMatchPremiumAccount($keyword_match_premium, $skill_match_premium);
     $result = $PR_Api->getCandidateProfiles_byProfileIDs($listCandidateID);
     $candidateInfo = array();
     if ($result) {
         $PR_Api_CandidateClass = new PR_Api_Core_CandidateClass();
         foreach ($result as $k => $info) {
             $skID = $PR_Api_CandidateClass->getList_CandidateSkillsOnly($info['UserID']);
             $sk = array();
             if ($skID) {
                 foreach ($skID as $key => $skInfo) {
                     $sk[] = $skInfo['SkillName'];
                 }
             } else {
                 $sk[] = "";
             }
             $info['skillName'] = $sk;
             $candidateInfo[] = $info;
         }
     }
     $this->view->CandidateProfileID = $CandidateProfileID;
     $this->view->result = $candidateInfo;
 }
 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');
 }
 public function addOpportunityAction()
 {
     $this->_helper->layout->disableLayout();
     //$BYTES =8;
     //$token  = openssl_random_pseudo_bytes($BYTES);
     $request = $this->getRequest();
     $username = $request->getParam("Email", "");
     $password = $request->getParam("Password", "");
     //$username = $_REQUEST['Email'];
     //$password = $_REQUEST['Password'];
     $errs = array();
     $userApi = new PR_Api_User();
     $authData = array('emailaddress' => $username, 'password' => $password);
     if ($userApi->loadAndCheckAuthentication($authData)) {
     } else {
         $errs[] = array("err" => "Username and password must be required.");
     }
     $postedby = $request->getParam("UserID", "");
     $posteddate = "";
     $title = $request->getParam("CareerName", "");
     //$companyname = $_REQUEST['companyname'];
     $OppCompanyID = $request->getParam("CompanyID", "");
     $careerdescription = $request->getParam("CareerDescription", "");
     $status = 1;
     $industry = $request->getParam("Industry", "");
     $jobtype = $request->getParam("JobType", "");
     $duration = $request->getParam("Duration", "");
     $location = $request->getParam("Location", "");
     $zipcode = $request->getParam("ZipCode", "");
     $minimuneducation = $request->getParam("MinimunEducation", "");
     $degreetitle = $request->getParam("DegreeTitle", "");
     $StaffFavorite = "";
     $SkillID = array();
     $SkillID[] = $request->getParam("SkillID", "");
     $requiredExperience = $request->getParam("RequiredExperience", "");
     $salaryRangeF = $request->getParam("SalaryRangeF", "");
     $salaryRangeT = $request->getParam("SalaryRangeT", "");
     $testid = array();
     $testid[] = $request->getParam("TestID", "");
     $return = "";
     if ($title == "") {
         $errs[] = array("err" => "Career Name cannot be empty.");
     }
     if ($postedby == "") {
         $errs[] = array("err" => "UserID cannot be empty.");
     }
     if ($careerdescription == "") {
         $errs[] = array("err" => "Career description cannot be empty.");
     }
     if ($industry == "") {
         $errs[] = array("err" => "Career Industry cannot be empty.");
     }
     if ($minimuneducation == "") {
         $errs[] = array("err" => "Minimun Education cannot be empty.");
     }
     if ($degreetitle == "") {
         $errs[] = array("err" => "Degree Title cannot be empty.");
     }
     if ($SkillID == "") {
         $errs[] = array("err" => "Required Skills cannot be empty.");
     }
     if ($requiredExperience == "") {
         $errs[] = array("err" => "Required Experience cannot be empty.");
     }
     if ($salaryRangeF == "" || $salaryRangeT == "") {
         $errs[] = array("err" => "Salary Range cannot be empty.");
     }
     if (empty($errs)) {
         $career_PR_Api = new PR_Api_Career(null);
         $updateFields = array('CompanyID' => $OppCompanyID, 'postedby' => $postedby, 'posteddate' => $posteddate, 'title' => $title, 'careerdescription' => $careerdescription, 'status' => $status, 'industry' => $industry, 'industry' => $industry, 'jobtype' => $jobtype, 'duration' => $duration, 'location' => $location, 'zipcode' => $zipcode, 'minimuneducation' => $minimuneducation, 'degreetitle' => $degreetitle, 'StaffFavorite' => $StaffFavorite, 'salaryrangefrom' => $salaryRangeF, 'salaryrangeto' => $salaryRangeT, 'experienced' => $requiredExperience);
         /*echo "<pre>";
           print_r($updateFields);
           echo "</pre>"; die(); */
         $result = $career_PR_Api->saveCareer($updateFields);
         if ($result) {
             $OpportunityID = $result->OpportunityID;
             $edit_PR_Api = new PR_Api_Core_CareerClass();
             $edit_PR_Api->saveCareerSkills($OpportunityID, $SkillID);
             $edit_PR_Api->saveCareerTests($OpportunityID, $testid);
             $return = "<result>\n\t                <success>true</success>\n                    <errors></errors>\n                    </result>";
         } else {
             $return = "<result><success>false</success> <errors><error>Can not create the opportunity.</error></errors></result>";
         }
     } else {
         $return = "\n                    <result><success>false</success>\n            <errors>";
         $i = 0;
         foreach ($errs as $err) {
             $return .= "<error>" . $err['err'] . "</error>";
         }
         $return .= "</errors></result>";
     }
     header('Content-type: application/xml');
     header("Content-Length: " . strlen($return));
     print_r($return);
 }