public function init()
 {
     parent::init();
     $client = PR_Session::getSession(PR_Session::SESSION_USER);
     if ($this->view->ajax == 1 && empty($client)) {
         $this->_helper->json(array('logined' => 0));
     } else {
         if (empty($client)) {
             // $this->_helper->redirector("index", "login");
             $this->_helper->redirector("index", "star");
         }
     }
 }
Example #2
0
 public function init()
 {
     /* Initialize action controller here */
     // for URL
     $uri = new Zend_View_Helper_BaseUrl();
     define('URL_BASE', $uri->getBaseUrl() . "/");
     define('URL_MEDIA_COMPANY_PROFILE', URL_BASE . 'library/media/companyprofiles/');
     define('URL_MEDIA_PORTFOLIO', URL_BASE . 'library/media/portfolio/');
     define('URL_MEDIA_VIDEO', URL_BASE . 'library/media/video/');
     define('URL_MEDIA_PHOTO', URL_BASE . 'library/media/photo/');
     define('URL_THEMES', URL_BASE . "library/themes/standard/");
     //Mobile
     define('URL_THEMES_MOBILE', URL_BASE . "library/themes/mobile/");
     //End Mobile
     define('URL_MEDIA', URL_BASE . "library/media/");
     define('URL_MEDIA_PROFILE', URL_MEDIA . "profiles/");
     define('URL_MEDIA_TEMP', URL_MEDIA . "temp/");
     define('URL_MEDIA_SCHOOLLOGO', URL_MEDIA . "schoollogos/");
     //define('URL_MEDIA_PROFILE_NOAVATAR', "DefaultPerson.jpg");
     define('URL_MEDIA_PROFILE_NOAVATAR', "none.png");
     //define('LAYOUT', "");
     // for DIR
     define('DIR_BASE', realpath(APPLICATION_PATH . '/../'));
     define('DIR_MEDIA_COMPANY_PROFILE', DIR_BASE . '/library/media/companyprofiles/');
     define('DIR_MEDIA_PORTFOLIO', DIR_BASE . '/library/media/portfolio/');
     define('DIR_MEDIA_VIDEO', DIR_BASE . '/library/media/video/');
     define('DIR_MEDIA_PHOTO', DIR_BASE . '/library/media/photo/');
     define('DIR_MEDIA', DIR_BASE . '/library/media/');
     define('DIR_MEDIA_TEMP', DIR_MEDIA . 'temp/');
     define('LIMIT_PAGE_LEFT', 10);
     define('LIMIT_PAGE_NUMBER_LEFT', 3);
     define('USER_TYPE_COMPANY', 1);
     define('USER_TYPE_CANDIDATE', 2);
     //  $this->_client = PR_Session::getSession(PR_Session::SESSION_CLIENT);pii
     $this->_client = PR_Session::getSession(PR_Session::SESSION_USER);
     $this->view->loginclient = $this->_client;
     //$this->layout()-
     $this->_layout = $this->_helper->layout->getLayoutInstance();
     $this->_layout->loginclient = $this->_client;
     $this->_layout->logout = $this->_helper->url('do-logout', 'user');
     $this->_layout->_helper = $this->_helper;
     //for querystring
     $this->_request = $this->getRequest();
     $ajax = $this->_request->getParam('ajax', 0);
     $this->view->ajax = $ajax;
     if ($ajax == 1) {
         $this->_helper->layout->disableLayout();
     }
     $pageajax = $this->_request->getParam('pageajax', "");
     $this->view->pageajax = $pageajax;
 }
 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 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 doUploadVideoAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $request = $this->getRequest();
     $params = $request->getParams();
     $client = PR_Session::getSession(PR_Session::SESSION_USER);
     //echo("testt:");print_r($user);
     $core = new PR_Api_Core_ClientClass();
     $CompanyID = $client["CompanyID"];
     $return = array("status" => "", "message" => "", "CompanyID" => "");
     $allowedExts = array("jpg", "jpeg", "gif", "png", "mp3", "mp4", "wma", "flv", "mpeg", "mov", "m4v", "dat", "aac", "avi");
     $extension = pathinfo($_FILES['myfile']['name'], PATHINFO_EXTENSION);
     $mimes = array('image/jpeg', 'image/png', 'image/gif', 'image/pjpeg', 'video/mp4', 'audio/mp3', 'audio/wma');
     if (in_array($extension, $allowedExts)) {
         sleep(2);
         if (isset($_FILES['myfile'])) {
             $fileName = $_FILES['myfile']['name'];
             $fileType = $_FILES['myfile']['type'];
             $fileError = $_FILES['myfile']['error'];
             $fileStatus = array('status' => 0, 'message' => '');
             if ($fileError == 1) {
                 $fileStatus['message'] = 'Size over the allowed limit';
                 $fileStatus['status'] = 0;
                 //} //elseif (!in_array($fileType, $mimes)) {
                 //  $fileStatus['message'] = 'format error';
                 //  $fileStatus['status'] = 0;
             } else {
                 move_uploaded_file($_FILES['myfile']['tmp_name'], DIR_MEDIA_VIDEO . $fileName);
                 $fileStatus['status'] = 1;
                 $fileStatus['message'] = "Completed";
                 $core->uploadVideo($CompanyID, $fileName);
             }
             $return["status"] = $fileStatus['status'];
             $return["message"] = $fileStatus['message'];
             $return["CompanyID"] = $CompanyID;
             // header("Location: profile");
             echo json_encode($return);
         }
     } else {
         echo "format error";
     }
 }
 public function doUpdateSkillsnewAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $ajaxRes = array('success' => 0, 'info' => null);
     if ($this->getRequest()->isXmlHttpRequest()) {
         $params = $this->getRequest()->getParams();
         if (!empty($params['data']) && sizeof($params['data']) > 0) {
             $core = new PR_Api_Core_CandidateClass();
             $client = PR_Session::getSession(PR_Session::SESSION_USER);
             if ($core->updateCandidateSkill($client['CandidateProfileID'], $params['data'])) {
                 $ajaxRes['success'] = 1;
             }
         }
     }
     $response = $this->getResponse();
     $response->clearAllHeaders()->clearBody();
     $ajaxRes = json_encode($ajaxRes);
     $response->setHeader('Content-type', 'application/json');
     $response->setHeader('Content-Length', strlen($ajaxRes), true)->setBody($ajaxRes);
 }
 public function adduserAction()
 {
     $request = $this->getRequest();
     $client = PR_Session::getSession(PR_Session::SESSION_USER);
     $role = $client["Role"];
     $this->view->Role = $role;
     $this->render('adduser');
     // echo ("role:".$role);
 }
 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 doLogoutAction()
 {
     $this->_helper->layout->disableLayout();
     PR_Session::clearSessions();
     $this->_helper->redirector("index", "login");
 }
 public function saveEditNotificationsAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $request = $this->getRequest();
     $subject = $request->getParam("editNotification", "");
     $content = $request->getParam("editcontentNotification", "");
     $ModalEditNotiID = $request->getParam("ModalEditNotiID", "");
     $ModalEditNotiID = trim($ModalEditNotiID);
     // echo "<pre>";
     //print_r($ModalEditNotiID);
     // echo "</pre>"; die();
     $sestionClient = PR_Session::getSession(PR_Session::SESSION_USER);
     $clientID = $sestionClient['UserID'];
     $noti = new PR_Api_Noti($ModalEditNotiID);
     //$updateFields = array('subjecttext'=>$content,'sender_iduser'=>$clientID,'sender_iduser'=>$clientID, 'receiver_iduser'=>$receideid);
     $updateFields = array('subjecttext' => $subject, 'sender_iduser' => $clientID, 'content' => $content);
     $result = $noti->save($updateFields);
     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 testoppAction()
 {
     $request = $this->getRequest();
     $sestionClient = PR_Session::getSession(PR_Session::SESSION_USER);
 }
 public function editNameAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $ajaxRes = array('success' => 0, 'info' => null);
     $request = $this->getRequest();
     $testName = $request->getParam('name', null);
     $testId = $request->getParam('testId', null);
     $user = PR_Session::getSession(PR_Session::SESSION_USER);
     $companyId = $user['CompanyID'];
     if (!empty($testName) && is_numeric($testId)) {
         $core = new PR_Api_Core_TestClass();
         $arrResult = $core->updateTest($testId, $companyId, $testName);
         if ($arrResult['success']) {
             $ajaxRes = array('success' => 1);
         }
     }
     $response = $this->getResponse();
     $response->clearAllHeaders()->clearBody();
     $ajaxRes = json_encode($ajaxRes);
     $response->setHeader('Content-type', 'application/json');
     $response->setHeader('Content-Length', strlen($ajaxRes), true)->setBody($ajaxRes);
 }