Ejemplo n.º 1
0
 /**
  * Сохраняет данные для статистики посещений страницы пользователя по ключевым словам.
  *
  * @param int $user_id UID хозяина страницы
  * @param int $guest_id UID гостя или ноль, если гость неавторизован
  * @param string $guest_ip IP адрес гостя
  * @param bool $is_emp был ли гость работодателем
  * @param string $words строка ключевых слов, разделенных запятыми (если несколько)
  */
 function wordsStatLog($user_id, $guest_id, $guest_ip, $is_emp, $words)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/kwords.php';
     if ($keywords = kwords::getKeys(stripslashes(urldecode($words)))) {
         foreach ($keywords as $k => $v) {
             $aWords[] = $v['id'];
         }
     } else {
         return false;
     }
     global $DB;
     $sQuery = "SELECT wid FROM portf_word WHERE uid=? AND wid IN (?l)";
     $aRows = $DB->rows($sQuery, $user_id, $aWords);
     if ($DB->error) {
         return false;
     }
     if ($aRows) {
         $aData = array();
         foreach ($aRows as $aOne) {
             $aData[] = array('user_id' => $user_id, 'word_id' => $aOne['wid'], 'guest_id' => $guest_id, 'guest_ip' => $guest_ip, 'is_emp' => $is_emp);
         }
         if (!$DB->insert('stat_word_log', $aData)) {
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * Возвращает количество подходящих соискателей по фильтру, переданному с http://hh.ru/employer/resumesSearch.do
  * а также линк на результаты.
  *
  * @param array $filter
  *   <hh:getFrlCount>
  *     <v-p> <!-- фильтр, массив -->
  *       <v k="kword">тест,программирование, буш, Java Script</v> <!-- ключевые слова, через запятую -->
  *       <v k="regions">1001,456</v> <!-- ид. ХХ-регионов. Если выбран родитель, то подразумевается, что должны быть включены все дети -->
  *       <v k="fields">1,2,3</v> <!-- ид. ХХ-профобластей. Если указана, то необходимо включить все специализации, относящиеся к этой области -->
  *       <v k="specs">1,2,3</v> <!-- ид. отдельный ХХ-специализаций -->
  *       <v k="cost">          <!-- месячная зарплата -->
  *         <v k="from">12</v>       <!-- от -->
  *         <v k="to">999</v>        <!-- до -->
  *         <v k="currency">USD</v>  <!-- валюта -->
  *       </v>
  *       <v k="wo_cost">1</v> <!-- включать ли в поиск людей, не указавших ЗП -->
  *       <v k="age">          <!-- возраст -->
  *         <v k="from">12</v>  <!-- от -->
  *         <v k="to">999</v>   <!-- до -->
  *       </v>
  *       <v k="wo_age">1</v>  <!-- включать ли в поиск людей, не указавших возраст -->
  *     </v-p>
  *   </hh:getFrlCount>
  *
  * @return array 
  */
 protected function x____getFrlCount($args)
 {
     list($filter) = $args;
     require_once ABS_PATH . '/classes/freelancer.php';
     require_once ABS_PATH . '/classes/memBuff.php';
     if (!is_array($filter)) {
         $filter = array();
     }
     $hh = new hh();
     $memBuff = new memBuff();
     $memkey = md5($hh->packFilter($filter));
     if ($mret = $memBuff->get($memkey)) {
         return $mret;
     }
     if ($filter['kword']) {
         require_once ABS_PATH . '/classes/kwords.php';
         $kwords = new kwords();
         $filter['orig_kwords'] = $filter['kword'];
         $filter['kword'] = $kwords->getKeys($filter['kword']);
     }
     if ($filter['regions']) {
         list($filter['country'], $filter['city']) = $hh->getCCByHHRegions($filter['regions']);
         unset($filter['regions']);
     }
     $pp1 = $pp2 = array();
     if ($filter['fields']) {
         if ($ppx = $hh->getProfessionsByHHFields($filter['fields'])) {
             $pp1 = $ppx;
         }
         unset($filter['fields']);
     }
     if ($filter['specs']) {
         if ($ppx = $hh->getProfessionsByHHSpecs($filter['specs'])) {
             $pp2 = $ppx;
         }
         unset($filter['specs']);
     }
     if ($pp1 || $pp2) {
         $filter['prof'][1] = $pp1 + $pp2;
     }
     if ($filter['cost']) {
         $filter['cost']['type_date'] = 1;
         $filter['cost']['cost_from'] = $filter['cost']['from'];
         $filter['cost']['cost_to'] = $filter['cost']['to'];
         if (($filter['cost']['cost_type'] = hh::$hh_currency2ex[strtoupper($filter['cost']['currency'])]) < 0) {
             $hhc = $hh->getHHCurrency($filter['cost']['currency']);
             $filter['cost']['cost_type'] = freelancer::RUR;
             $filter['cost']['cost_from'] /= $hhc['rate'];
             $filter['cost']['cost_to'] /= $hhc['rate'];
         }
         $filter['cost'] = array($filter['cost']);
     }
     if (isset($filter['wo_cost'])) {
         $filter['wo_cost'] = $this->ex2pg($filter['wo_cost'], EXTERNAL_DT_BOOL);
     }
     if ($filter['age']) {
         $filter['age'][0] = (int) $filter['age']['from'];
         $filter['age'][1] = (int) $filter['age']['to'];
     }
     if (isset($filter['wo_age'])) {
         $filter['wo_age'] = $this->ex2pg($filter['wo_age'], EXTERNAL_DT_BOOL);
     }
     if ($count = freelancer::getFrlCount($filter)) {
         $link = $hh->saveFilter($filter);
     }
     $ret = array('count' => $count, 'link' => $GLOBALS['host'] . '/freelancers/?hhf=' . $link);
     $memBuff->set($memkey, $ret, 1800);
     return $ret;
 }
Ejemplo n.º 3
0
         }
     }
 }
 if ($_POST['action'] == "search_advanced") {
     $filter = array("active" => "t", "categories" => $_POST['pf_categofy'], "prof" => $_POST['pf_categofy'], "kwords" => $_POST['kword'], "cost_type" => is_array($_POST['cost_type']) ? array_map("intval", $_POST['cost_type']) : $_POST['cost_type'], "from_cost" => is_array($_POST['from_cost']) ? array_map("intval", $_POST['from_cost']) : $_POST['from_cost'], "to_cost" => is_array($_POST['to_cost']) ? array_map("intval", $_POST['to_cost']) : $_POST['to_cost'], "curr_type" => is_array($_POST['curr_type']) ? array_map("intval", $_POST['curr_type']) : $_POST['curr_type'], "exp" => is_array($_POST['exp']) ? array_map("intval", $_POST['exp']) : $_POST['exp'], "exp_from" => (int) $_POST['exp'][0], "exp_to" => (int) $_POST['exp'][1], "login" => htmlspecialchars($_POST['login']), "age" => is_array($_POST['age']) ? array_map("intval", $_POST['age']) : $_POST['age'], "age_from" => (int) $_POST['age'][0], "age_to" => (int) $_POST['age'][1], "country" => (int) $_POST['pf_country'], "city" => (int) $_POST['pf_city'], "in_office" => $_POST['in_office'], "in_fav" => $_POST['in_fav'], "only_free" => $_POST['only_free'], "is_pro" => $_POST['is_pro'], "is_verify" => $_POST['is_verify'], "sbr_is_positive" => $_POST['sbr_is_positive'], "is_preview" => $_POST['is_preview'], "sbr_not_negative" => $_POST['sbr_not_negative'], "opi_is_positive" => $_POST['opi_is_positive'], "opi_not_negative" => $_POST['opi_not_negative'], "success_sbr" => $_POST['success_sbr']);
     $_SESSION['search_advanced'][$type] = $filter;
 } elseif ($_POST['action'] == "search") {
     unset($_SESSION['search_advanced'][$type]);
 }
 if (!$filter) {
     $filter = $_SESSION['search_advanced'][$type];
 }
 if ($filter['kwords']) {
     $key_word = stripslashes(urldecode($filter['kwords']));
     if ($key_word) {
         $word = kwords::getKeys($key_word);
         $filter['orig_kwords'] = 1;
         $_SESSION['search_advanced'][$type]['orig_kwords'] = 1;
         if ($word) {
             $filter['kword'] = $word;
             $_SESSION['search_advanced'][$type]['kword'] = $filter['kword'];
         }
     }
 }
 if ($filter['cost_type']) {
     foreach ($filter['cost_type'] as $key => $value) {
         $cFilter[] = array("cost_type" => $filter['curr_type'][$key], "cost_from" => $filter['from_cost'][$key], "cost_to" => $filter['to_cost'][$key], "type_date" => $value);
     }
     $filter['cost'] = $cFilter;
     $_SESSION['search_advanced'][$type]['cost'] = $filter['cost'];
 }
Ejemplo n.º 4
0
 /**
  * Гнерирует переменную с данными всего фильтра
  *
  * @return array Фильтр
  */
 function getAllFilter()
 {
     if (!$this->filter) {
         self::getFilter();
     }
     if ($this->filter[0]['active'] == 'f') {
         return false;
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/kwords.php";
     $kword = new kwords();
     $filter['orig_kwords'] = $this->filter[0]['kwords'];
     $filter['kword'] = $kword->getKeys($this->filter[0]['kwords'], $filter['is_kword']);
     $filter['sex'] = $this->filter[0]['sex'];
     $filter['country'] = $this->filter[0]['country'];
     $filter['city'] = $this->filter[0]['city'];
     $filter['age'] = array($this->filter[0]['age_from'], $this->filter[0]['age_to']);
     $filter['login'] = trim($this->filter[0]['login']);
     $filter['exp'] = array($this->filter[0]['exp_from'], $this->filter[0]['exp_to']);
     $filter['cost'] = $this->filter[1];
     $filter['prof'] = $this->filter[2];
     $filter['in_office'] = $this->filter[0]['in_office'] == 't' ? true : false;
     $filter['in_fav'] = $this->filter[0]['in_fav'] == 't' ? true : false;
     $filter['only_free'] = $this->filter[0]['only_free'] == 't' ? true : false;
     $filter['sbr_is_positive'] = $this->filter[0]['sbr_is_positive'] == 't' ? true : false;
     $filter['sbr_not_negative'] = $this->filter[0]['sbr_not_negative'] == 't' ? true : false;
     $filter['opi_is_positive'] = $this->filter[0]['opi_is_positive'] == 't' ? true : false;
     $filter['opi_not_negative'] = $this->filter[0]['opi_not_negative'] == 't' ? true : false;
     $filter['is_preview'] = $this->filter[0]['is_preview'] == 't' ? true : false;
     $filter['success_sbr'] = $this->filter[0]['success_sbr'];
     $filter['is_pro'] = $this->filter[0]['is_pro'] == 't' ? true : false;
     $filter['is_verify'] = $this->filter[0]['is_verify'] == 't' ? true : false;
     $filter['only_tu'] = $this->filter[0]['only_tu'] == 't' ? true : false;
     $filter['only_online'] = $this->filter[0]['only_online'] == 't' ? true : false;
     return $filter;
 }