function doResetPassAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $request = $this->getRequest();
     $params = $request->getParams();
     $return = array("success" => 0, "error" => "", "UserID" => "");
     $useid = $request->getParam("UserID");
     $username = $request->getParam("emailaddress");
     $password = $params["password"];
     $authData = array('emailaddress' => $username, 'password' => $password);
     $userApi = new PR_Api_User();
     $client = $userApi->loadAndCheckAuthentication($authData);
     if (!empty($useid)) {
         $userApi->UpdatePass($useid, $password);
         $return['success'] = 1;
         //  header("Location:".URL_BASE."login");
     }
     // header("Location:".URL_BASE."login");
     $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 indexAction()
 {
     $this->view->headerstring = "Confirm";
     $request = $this->getRequest();
     $params = $request->getParams();
     $useid = $request->getParam("UserID");
     $username = $request->getParam("emailaddress");
     $password = $request->getParam("password");
     $useid = base64_decode($useid);
     $username = base64_decode($username);
     $password = base64_decode($password);
     $authData = array('emailaddress' => $username, 'password' => $password);
     $userApi = new PR_Api_User();
     $client = $userApi->loadAndCheckAuthentication($authData);
     if (!empty($client)) {
         $userApi->UpdateActive($useid);
         // header("Location:".URL_BASE."login");
     }
 }
 function doLoginAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $request = $this->getRequest();
     $username = $request->getParam("email", "");
     $password = $request->getParam("password", "");
     $return = array("success" => 0, "error" => "usertype", "" => "");
     //echo ("username:"******"active"] == 1) {
         PR_Session::setSession($client, PR_Session::SESSION_USER);
         $user = PR_Session::getSession(PR_Session::SESSION_USER);
         //echo("user:"******"userID:".$userID);
         $userApi->UpdateLastsigned($userID);
         $return['success'] = 1;
         $return['usertype'] = $user["usertype"];
         if ($user["usertype"] == USER_TYPE_CANDIDATE) {
             $coreCandi = new PR_Api_Core_CandidateClass();
             $coreCandi->createCandidateProfileID($userID);
         }
     } else {
         // $return['error'] = PR_Api_Error::getInstance()->getFirstError();
         $return['error'] = "Account not activated. Please check email and active.";
     }
     //echo ("etsttt:<pre>");print_r($client);echo("</pre>");die();
     //return
     $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 doRegisterAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $request = $this->getRequest();
     $params = $request->getParams();
     $return = array("success" => 0, "error" => "", "usertype" => "");
     // echo ("params:<pre>");print_r($params);echo("</pre>");die();
     if (!empty($params)) {
         $firstname = $params['firstname'];
         $lasttname = $params['lastname'];
         $Acount_type = $params['usertype'];
         $email = $params['emailaddress'];
         $pass = $params['password'];
         $About_us = $params['About_us'];
         $accept = $params['accept'];
         $Companyname = $params['Companyname'];
         $PostalCode = $params['PostalCode'];
     }
     $datacompany = array("Companyname" => $Companyname);
     // echo ("data:<pre>");print_r($data);echo("</pre>");die();
     $api = new PR_Api_Core_Register();
     $core = new PR_Api_Core_ClientClass();
     $data = array("firstname" => $firstname, "lastname" => $lasttname, "usertype" => $Acount_type, "emailaddress" => $email, "password" => $pass, "HeardFrom" => $About_us, "PostalCode" => $PostalCode, "Companyname" => $Companyname);
     /*if(isset($Companyname)&& $Companyname!=""){
          $record=$core->AddCompany($datacompany); 
          if($record["error"]!=''){
              $return['success'] = 0;
              $return['error'] =$record["error"] ;
          }
       }*/
     if (isset($accept)) {
         // echo("test");die();
         $tets = $api->registerClient($data);
     }
     // print_r($tets);
     if ($tets["error"] == "") {
         $return['success'] = 1;
         $userApi = new PR_Api_User();
         $authData = array('emailaddress' => $data["emailaddress"], 'password' => $data["password"]);
         if ($User = $userApi->loadAndCheckAuthentication($authData)) {
             // PR_Session::setSession($User,PR_Session::SESSION_USER);
             // $user = PR_Session::getSession(PR_Session::SESSION_USER);
             //echo("user:"******"s";
                 }
             }
             $pageURL .= "://";
             if ($_SERVER["SERVER_PORT"] != "80") {
                 $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"];
             } else {
                 $pageURL .= $_SERVER["SERVER_NAME"];
             }
             //echo $pageURL;
             //send mail
             $toEmail = $email;
             //$techEmail;base64_encode($User["password"])
             $fromName = "Pocket Recruiter";
             $fromEmail = "*****@*****.**";
             $link = $pageURL . URL_BASE . "confirm?UserID=" . base64_encode($User["UserID"]) . "&&emailaddress=" . base64_encode($User["emailaddress"]) . "&&password="******"password"]);
             $subject = "Welcome to Pocket Recruiter!";
             $body = "Thank you for signing up for a Company account with Pocket Recruiter. Please click on the following link to validate your email address:      \n                                                \n" . $link . " \n            \nThank you,                    \nYour Pocket Recruiter Team\n                ";
             $mail = new PR_Api_Core_Mail();
             // $mail1=new PR_Mail();
             $mail->setBodyText($body);
             $mail->setFromName($fromName);
             $mail->setFromEmail($fromEmail);
             $mail->setToEmail($toEmail);
             $mail->setSubject($subject);
             $mail->send();
             // echo("tetstst:".$Acount_type);
             $return['success'] = 1;
             $return['usertype'] = $Acount_type;
         }
     } else {
         $return['success'] = 0;
         $return['error'] = $tets["error"];
     }
     //return
     $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);
     // echo("testt:".$tets["error"]);
 }
 public function skilltestAction()
 {
     $client = PR_Session::getSession(PR_Session::SESSION_USER);
     $UserID = $client["UserID"];
     $emailaddress = $client["emailaddress"];
     $password = $client["password"];
     $Api = new PR_Api_User();
     $authData = array('emailaddress' => $emailaddress, 'password' => $password);
     $getUserArray = $Api->getUserArray($authData);
     $this->view->client = $getUserArray;
     $CandidateID = $client["CandidateProfileID"];
     $PR_Api = new PR_Api_Core_CandidateClass();
     $candidate_applied = $PR_Api->getOpportunityCandidateMatchActivities($CandidateID);
     $candidate_applied_list = array();
     if (!empty($candidate_applied) && count($candidate_applied) > 0) {
         foreach ($candidate_applied as $kk => $candidate_appliedInfo) {
             $candidate_applied_list[] = $candidate_appliedInfo['OpportunityID'];
         }
         $listTestID = $PR_Api->getTestIDbyOpportunity($candidate_applied_list);
     }
     $getCandidates = $PR_Api->getCandidateProfile($CandidateID);
     $this->view->getCandidates = $getCandidates;
     /*echo "<pre>";
       print_r($listTestID);
       echo "</pre>"; die();*/
     $this->view->listTestID = $listTestID;
 }
 public function edituserAction()
 {
     $request = $this->getRequest();
     $client = PR_Session::getSession(PR_Session::SESSION_USER);
     $userid = $request->getParam("UserID");
     //  echo ("userid:");print_r($client);die();
     $role = $client["Role"];
     $companyid = $request->getParams();
     //echo("CompanyID");print_r($companyid);
     $Api = new PR_Api_User();
     $authData = array('UserID' => $userid);
     $this->view->client = $Api->getListUserArray($authData);
     $this->view->companyid = $companyid;
     $this->view->Role = $role;
     $this->render('userprofile');
 }
 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);
 }