require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/rating.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"; //------------------------------------------------------------------------------ $results = array(); if (count($argv) > 1) { parse_str(implode('&', array_slice($argv, 1)), $_GET); } //------------------------------------------------------------------------------ $login = @$_GET['login']; isAllowProfi(); $user = new users(); $user->GetUser($login); if ($user->uid > 0) { $rating = new rating($user->uid, $user->is_pro, $user->is_verify, $user->is_profi); $r_data = $rating->data; $user_profs = professions::GetProfessionsByUser($user->uid); if ($user_profs) { foreach ($user_profs as $up) { $rating_pos[] = professions::GetCatalogPosition($user->uid, $user->spec_orig, $r_data['total'], $up, $user->is_pro == 't'); } if ($rating_pos) { $results['rating_total'] = $r_data['total']; foreach ($rating_pos as $pos) { $results[iconv('CP1251', 'UTF-8', $pos['prof_name'])] = $pos['pos']; } } } } //------------------------------------------------------------------------------ array_walk($results, function (&$value, $key) { $value = sprintf('%s = %s' . PHP_EOL, $key, $value);
function GetFilter($user_id) { global $DB; if (!$user_id) { return false; } $sql = "SELECT * FROM projects_filters_pda WHERE user_id=?i"; $ret = $DB->row($sql, $user_id); if ($DB->error || !$ret) { return false; } if (isset($ret['cost_from']) && $ret['cost_from'] == 0) { $ret['cost_from'] = ''; } if (isset($ret['cost_to']) && $ret['cost_to'] == 0) { $ret['cost_to'] = ''; } require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"; $ret['user_specs'] = professions::GetProfessionsByUser($user_id, false, true); return $ret; }
/** * Определяет, нужно ли добавлять специализацию в профиль * @param type $uid ИД пользователя * @param type $prof_id ИД специализации * @return int 0 если не нужно, 1 если доп. специализацию, 2 если основную спец-ю */ public function needAddProf($uid, $prof_id) { $user_profs = professions::GetProfessionsByUser($uid, true, true); $selected_profs_count = count(professions::GetProfessionsByUser($uid, false)); $has_free_spec_slot = $selected_profs_count < 1 + (is_pro(true, $uid) ? PROF_SPEC_ADD : 0); if (!in_array($prof_id, $user_profs) && $has_free_spec_slot) { $user = new freelancer(); $user->GetUserByUID($uid); return $user->spec == 0 ? 2 : 1; } return 0; }
$u_last_prm_width += $MSIZES[$i] * 2 + 1; } $u_last_prm_width += $lp_to_d * 2 + 1; // ($lp_to_d - 1)*2 + 1 } else { $u_last_prm_width += ($lp_to_d - $lp_d + 1) * 2; } } } $u_has_ps = $u_has_ps_fp || $u_has_ps_ctg; $u_has_prm = $prm_is_FP ? $u_has_ps_fp : ($prm_is_CTG ? $u_has_ps_ctg : $u_is_pro); if (!$u_is_pro) { $u_pro_rating = rating::GetByFormula($u_rating + (int) rating::GetWorkFactorPlusIfPro($uid), 't', $u_is_verify); } // Определяем места в каталоге. if ($u_profs = professions::GetProfessionsByUser($uid, false)) { foreach ($u_profs as $prof_id) { if (!$u_is_pro) { $pro_pos = professions::GetCatalogPosition($uid, $u_spec, $u_pro_rating, $prof_id, TRUE, TRUE); } $cur_pos = professions::GetCatalogPosition($uid, $u_spec, $u_rating, $prof_id, $u_is_pro); $u_ctlg_pos[] = array('prof_name' => $cur_pos['prof_name'], 'prof_id' => $prof_id, 'pos' => $cur_pos['pos'], 'propos' => $pro_pos['pos'], 'link' => $cur_pos['link']); } } // Получаем статистику юзера для графика за месяц и за год. if ($mdays = promotion::GetFromDaily($uid, $MONTHDAY, $TODAY)) { foreach ($mdays as $d) { if (($mc = $d['by_e'] + $d['by_f'] + $d['by_u']) > $cur_month_max_h) { $cur_month_max_h = $mc; } if ($mc > $cur_year_max_h) {
$_SESSION['search_advanced'][$type]['cost'] = $filter['cost']; } $gFilter = $filter['categories']; if ($filter["prof"][1] && is_array($filter["prof"][1])) { $raw_professions = professions::GetProfessionsTitles(array_keys($filter["prof"][1])); $a_professions = array(); foreach ($raw_professions as $profession_item) { $a_professions[$profession_item["name"]] = '(@name_prof "' . $profession_item["name"] . '" | @additional_specs "' . $profession_item["name"] . '")'; } $_SESSION['string_professions'] = join(" ", $a_professions); } break; case "projects": require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"; if (get_uid()) { $user_specs = professions::GetProfessionsByUser($_SESSION['uid'], false, true); } if (!isset($_SESSION['search_elms']['projects'])) { $_SESSION['search_elms'] = array('projects' => 0); } if ($_POST['pf_cost_from'] > $_POST['pf_cost_to'] && $_POST['pf_cost_to'] != 0) { $a = $_POST['pf_cost_from']; $_POST['pf_cost_from'] = $_POST['pf_cost_to']; $_POST['pf_cost_to'] = $a; } if ($_POST['action'] == "search_advanced") { $_POST['pf_country'] = intval($_POST['pf_country']); $_POST['pf_city'] = intval($_POST['pf_city']); $filter = array("active" => "t", "cost_from" => $_POST['pf_cost_from'], "cost_to" => $_POST['pf_cost_to'], "currency" => $_POST['pf_currency'], "wo_cost" => $_POST['pf_wo_budjet'] == 1 ? 't' : 'f', "only_sbr" => $_POST['pf_only_sbr'] == 1 ? 't' : 'f', "category" => $_POST['pf_category'], "my_specs" => $_POST['pf_my_specs'] == 1 ? 't' : 'f', "categories" => $_POST['pf_categofy'], "country" => (int) $_POST['pf_country'], "city" => (int) $_POST['pf_city']); if ($filter['my_specs'] == 't') { $filter['user_specs'] = $user_specs;
/** * Возвращает ленту проектов. * * @param int $kind тип проектов (-1=5=Все проекты; 2=Конкурсы; 4=В офис; 6=Только для про) * @param array $filter массив с фильтром проектов (тот же, что для projects::getProjects(), но разделы в таком виде: [[1,2,3], [44,55,66]], где по индексу 0 -- разделы, по 1 -- подразделы) * @param int $page_size кол-во проектов на странице. * * @return array */ protected function x____getProjects($args) { list($kind, $filter, $page_size) = $args; require_once ABS_PATH . '/classes/projects.php'; require_once ABS_PATH . '/classes/projects_filter.php'; require_once ABS_PATH . '/classes/professions.php'; $result = null; $projects = new new_projects(); $kind = $kind ? (int) $kind : $this->_mCfg['default_kind']; $page_size = (int) $page_size; $limit = $page_size > $this->_mCfg['max_page_size'] ? $this->_mCfg['max_page_size'] : ($page_size < $this->_mCfg['min_page_size'] ? $this->_mCfg['page_size'] : $page_size); if ($filter) { $filter['active'] = $this->ex2pg(EXTERNAL_TRUE, EXTERNAL_DT_BOOL); $filter['wo_cost'] = $this->ex2pg($filter['wo_cost'], EXTERNAL_DT_BOOL); $filter['only_sbr'] = $this->ex2pg($filter['prefer_sbr'], EXTERNAL_DT_BOOL); if ($filter['my_specs']) { $filter['my_specs'] = $this->ex2pg($filter['my_specs'], EXTERNAL_DT_BOOL); $filter['user_specs'] = professions::GetProfessionsByUser($this->_sess->_uid, false, true); } if (isset($filter['categories']) && is_array($filter['categories'])) { $filter['categories'] = intarrPgSql($filter['categories']); $cats = $filter['categories']; $filter['categories'] = array(); foreach ($cats as $i => $arr) { if ($i > 1) { break; } if (is_array($arr) && !isNulArray($arr)) { if ($i == 1) { $arr = professions::GetMirroredProfs(implode(',', $arr)); } $filter['categories'][$i] = array_fill_keys($arr, $i); } } } list($filter['cost_from'], $filter['cost_to']) = projects_filters::preCosts($filter['cost_from'], $filter['cost_to']); } if ($prjs = $projects->getLastProjects($kind, $filter, $limit, true)) { foreach ($prjs as $key => $p) { $row = $this->pg2exRow($this->_mCfg['fields'], $p); if ($row['logo']) { $row['logo'] = WDCPREFIX . '/' . $row['logo']; } if ($attach = $projects->getAllAttach($p['id'])) { $row['attach'] = array(); foreach ($attach as $a) { $att = $this->pg2exRow($this->_mCfg['attach-fields'], $a); $att['link'] = WDCPREFIX . '/' . $a['path'] . $a['name']; $row['attach'][] = $att; } } $result[$key] = $row; } } return $result; }
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php"; if ($uid && !is_emp()) { if ($specs = professions::GetProfessionsByUser($uid, FALSE)) { $specs = professions::GetMirroredProfs(implode(',', $specs)); } } ?> <div class="b-catalog b-fon b-fon_bg_eef1f2 <?php if (is_emp()) { ?> b-catalog_emp<?php } ?> " data-menu="true" data-menu-descriptor="freelancer-type"> <b class="b-fon__b1"></b> <b class="b-fon__b2"></b> <div class="b-fon__body"> <ul class="b-catalog__list " id="accordion"> <?php $sTagB = '<div class="b-catalog__item-inner b-catalog__item-inner_pad_5_10">' . ($cat_menu_employers ? ($page > 1 ? '<a href="/employers/" class="b-catalog__link b-catalog__link_bold b-catalog__link_color_000">' : '') . '<span class="b-catalog__item-current b-catalog__item-current_color_000">' : '<a href="/employers/" class="b-catalog__link b-catalog__link_bold b-catalog__link_color_000">'); $sTagE = ($cat_menu_employers ? '</span>' . ($page > 1 ? '</a>' : '') : '</a>') . '</div>'; ?> <!-- <li class="b-catalog__item b-catalog__item_bg_74bb54"><?php echo $sTagB; ?> Работодатели<?php echo $sTagE; ?>
/** * Получение данных филтьтра. * * @param integer $user_id id пользователя * * @return array */ public function GetFilter($user_id) { global $session; if ($user_id > 0) { global $DB; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php'; $sql = 'SELECT * FROM offers_filter WHERE user_id=?'; $ret = $DB->row($sql, $user_id); if ($DB->error || !$ret) { $ret['user_specs'] = professions::GetProfessionsByUser($user_id, false, true); return $ret; } $sql = 'SELECT group_id, group_level FROM offers_filter_groups WHERE filter_id=?i'; $wrk = $DB->rows($sql, $ret['id']); if (is_array($wrk)) { for ($i = 0; $i < sizeof($wrk); ++$i) { $level = $wrk[$i]['group_level'] == 't' ? 1 : 0; $ret['categories'][$level][$wrk[$i]['group_id']] = $level; } } $error .= $DB->error; if (isset($ret['cost_from']) && $ret['cost_from'] == 0) { $ret['cost_from'] = ''; } if (isset($ret['cost_to']) && $ret['cost_to'] == 0) { $ret['cost_to'] = ''; } $ret['user_specs'] = professions::GetProfessionsByUser($user_id, false, true); } return $ret; }
$op_data = opinions::getHeaderData($from, $user, $user->uid); if (!$rating || !$rating instanceof rating || $rating->data['user_id'] != $user->uid) { $rating = new rating($user->uid, $user->is_pro, $user->is_verify, $user->is_profi); } $r_data = $rating->data; if ($iWantPro) { $r_data['total'] = rating::GetPredictionPRO($p_user->uid, 't', $p_user->is_verify); } //$samerank = rating::CountByRank($r_data['rank']); $banblog = $user->GetBan($user->uid, 1); if ($user->birthday && $user->birthday > "1910-01-01") { $user_ago = ElapsedYears(strtotime($user->birthday)); } $info_for_reg = @unserialize($user->info_for_reg); $rating_pos = NULL; if (($user->is_pro == 'f' || $user->cat_show == 't') && ($user_profs = professions::GetProfessionsByUser($user->uid))) { if ($user->is_pro == 'f') { $dop_user_profs = professions::GetProfsAddSpec($user->uid); if (is_array($dop_user_profs)) { $user_profs = array_merge($user_profs, $dop_user_profs); } } foreach ($user_profs as $up) { $rating_pos[] = professions::GetCatalogPosition($user->uid, $user->spec_orig, $r_data['total'], $up, $user->is_pro == 't'); } } $team = new teams(); switch ($user->status_type) { case 1: $status_cls = 'b-status_busy'; break;