public function setSelectFilter($filter)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/project_exrates.php";
     $project_exRates = project_exrates::GetAll();
     $set_select[] = "*";
     // Мои специализации
     if ($filter['my_specs'] == 't' && $filter['user_specs']) {
         foreach ($filter['user_specs'] as $spec) {
             $select[] = "(prj_subcategory1 = {$spec} OR prj_subcategory2 = {$spec} OR prj_subcategory3 = {$spec})";
         }
         $set_select[] = "IF(" . implode(" OR ", $select) . ", 1, 0) as my_spec_filter";
         unset($select);
     }
     //Если не нужны завершенные конкурсы
     if ($filter['is_closed_contest']) {
         $set_select[] = "IF(NOT end_date OR end_date > NOW(), 1, 0) as closed_contest";
     }
     // Бюджет
     if ($filter['cost_from'] || $filter['cost_to']) {
         $cr = (int) $filter['currency'];
         $cex = array(2, 3, 4, 1);
         $cost_from = ($cost_from = (double) $filter['cost_from']) < 0 ? 0 : (double) $filter['cost_from'];
         $cost_to = ($cost_to = (double) $filter['cost_to']) < 0 ? 0 : (double) $filter['cost_to'];
         $cost_to = $cost_to < $cost_from && $cost_to != 0 ? $cost_from : $cost_to;
         if ($cost_to || $cost_from) {
             for ($i = 0; $i < 4; $i++) {
                 $exfr = round($cost_from * $project_exRates[$cex[$cr] . $cex[$i]], 4);
                 $exto = round($cost_to * $project_exRates[$cex[$cr] . $cex[$i]], 4);
                 $fSql .= ($i ? ' OR ' : '') . "(p.currency = {$i} AND p.cost >= {$exfr}" . ($cost_to ? " AND p.cost <= {$exto}" : '') . ')';
                 $select[] = "(currency = {$i} AND cost >= {$exfr}" . ($cost_to ? " AND cost <= {$exto}" : '') . ")";
             }
             if ($filter['wo_cost'] == 't') {
                 $select[] = '(cost = 0)';
             }
             $set_select[] = "IF(" . implode(" OR ", $select) . ", 1, 0) as cost_filter";
             unset($select);
         }
     } elseif ($filter['cost_from'] === '0' && $filter['cost_to'] === '0') {
         $set_select[] = "IF(cost = 0, 1, 0) as cost_filter";
     } else {
         $set_select[] = "IF(cost = 0 OR cost > 0, 1, 0) as cost_filter";
     }
     // Разделы/Подразделы
     if ($filter['categories'] && $filter['my_specs'] == 'f') {
         $categories = array();
         for ($ci = 0; $ci < 2; $ci++) {
             if (sizeof($filter['categories'][$ci])) {
                 foreach ($filter['categories'][$ci] as $ckey => $cvalue) {
                     $categories[$ci][] = (int) $ckey;
                 }
             }
         }
         $sProfCat = '';
         $sProfSubcat = '';
         // собираем подразделы выбранных разделов
         if (sizeof($categories[0])) {
             $sProfCat = professions::getProfIdForGroups($categories[0]);
         }
         // собираем выбранные подразделы
         if (sizeof($categories[1])) {
             $sProfSubcat = implode(',', $categories[1]);
         }
         // склеиваем и получаем все подразделы вместе с зеркалами
         $sProf = $sProfCat . ($sProfCat && $sProfSubcat ? ',' : '') . $sProfSubcat;
         $aProf = professions::GetMirroredProfs($sProf);
         foreach ($aProf as $prof) {
             $select[] = "(prj_subcategory1 = {$prof} OR prj_subcategory2 = {$prof} OR prj_subcategory3 = {$prof})";
         }
         if (sizeof($categories[0])) {
             foreach ($categories[0] as $cat) {
                 $select[] = "(prj_category1 = {$cat} OR prj_category2 = {$cat} OR prj_category3 = {$cat})";
             }
         }
         $set_select[] = "IF(" . implode(" OR ", $select) . ", 1, 0) as category_filter";
         unset($select);
     }
     $this->_engine->setSelect(implode(", ", $set_select));
     $this->_engine->setFilter("cost_filter", array(1));
     if ($filter['is_closed_contest']) {
         $this->_engine->setFilter("closed_contest", array(1));
     }
     if ($filter['only_sbr'] == 't') {
         $this->_engine->setFilter("prefer_sbr", array(1));
     }
     if ($filter['my_specs'] == 't' && $filter['user_specs']) {
         $this->_engine->setFilter("my_spec_filter", array(1));
     }
     if ($filter['categories'] && $filter['my_specs'] == 'f') {
         $this->_engine->setFilter("category_filter", array(1));
     }
     if ($filter['country']) {
         $this->_engine->setFilter("country", array($filter['country']));
     }
     if ($filter['city']) {
         $this->_engine->setFilter("city", array($filter['city']));
     }
 }
 /**
  * Возвращает блок ссылок для Дополнительного фильтра фрилансеров.
  * 
  * @param int $nSide   Где показывать ссылку: 0 - в левой колонке, 1 - над фильтром
  * @param int $sProfId опционально. Раздел каталога (id из professions). Если не указано - то $this->sProfId
  *
  * @return array
  */
 public function fseoGetLinksBlock($nSide = 0, $sProfId = null)
 {
     global $DB;
     $aProfId = $sProfId ? professions::GetMirroredProfs($sProfId) : array($this->sProfId);
     $sQuery = 'SELECT id, title FROM freelancer_seo WHERE side = ?i AND prof_id IN (?l)';
     $aReturn = is_array($aProfId) && count($aProfId) ? $DB->rows($sQuery, $nSide, $aProfId) : array();
     return $aReturn;
 }
Exemple #3
0
 /**
  * Массовая рассылка для всех фрилансеров.
  *
  * @param string $message     текст сообщения
  * @param bool   $pro         TRUE - только для PRO, FALSE - только для НЕ PRO, NULL - для всех
  * @param array  $profs       NULL - всем фрилансерам. Или массив с идентификаторами профессий или разделов
  *                            Должен иметь члены:
  *                            id - id. профессии или раздела
  *                            is_group - раздел (true) / профессия (false)
  * @param bool   $mailFunc    имя метода класса pmail для рассылки email
  * @param array  $attachments прикрепленные файлы (массив объектов класса CFile)
  *
  * @return int 0 в случае ошибки, id созданного сообщения в случае успеха
  */
 public function masssendToFreelancers($message, $pro, $profs, $mailFunc = '', $attachments = array())
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php';
     $dbMaster = new DB('master');
     $dbProxy = new DB('plproxy');
     $files = array();
     foreach ($attachments as $file) {
         $files[] = $file->id;
     }
     $where = $dbMaster->parse("u.is_banned = B'0' AND substr(subscr::text,8,1) = '1' AND uid<>?i", $this->uid);
     if (empty($profs)) {
         if (!is_null($pro)) {
             $where .= $dbMaster->parse($pro ? ' AND u.is_pro = TRUE ' : ' AND u.is_pro <> TRUE ');
         }
     } else {
         $items = array();
         $groups = array();
         foreach ($profs as $prof) {
             if ($prof['is_group']) {
                 $groups[] = $prof['id'];
             } else {
                 $items[] = $prof['id'];
             }
         }
         if ($groups) {
             $rows = $dbMaster->col('SELECT id FROM professions WHERE prof_group IN (?l)', $groups);
             $items = array_merge($items, $rows);
         }
         if (empty($items)) {
             return 0;
         }
         $unions = array_unique($items);
         foreach ($unions as $prof) {
             $mirrors = professions::GetMirroredProfs($prof);
             $items = array_merge($items, $mirrors);
         }
         $items = array_unique($items);
         $inner = $dbMaster->parse(' LEFT JOIN spec_paid_choise sp ON sp.user_id = u.uid ', $items);
         $wprof = $dbMaster->parse('u.spec IN (?l) OR (sp.prof_id IN (?l) AND sp.paid_to >= NOW())', $items, $items);
         if ($pro === false) {
             $where .= $dbMaster->parse(' AND u.is_pro <> TRUE ');
         } else {
             $inner .= $dbMaster->parse(' LEFT JOIN spec_add_choise sa ON sa.user_id = u.uid ', $items);
             $wprof .= $dbMaster->parse(' OR (sa.prof_id IN (?l) AND u.is_pro = TRUE) ', $items);
             $where .= $pro ? $dbMaster->parse(' AND u.is_pro = TRUE ') : '';
         }
         $where = "{$where} AND ({$wprof})";
     }
     $sql = $dbMaster->parse("SELECT DISTINCT uid FROM freelancer u {$inner} WHERE {$where}");
     $msgid = $dbProxy->val('SELECT masssend(?, ?, ?a, ?)', $this->uid, $message, $files, $mailFunc);
     if ($msgid) {
         $dbProxy->query('SELECT masssend_sql(?, ?, ?)', $msgid, $this->uid, $sql);
     }
     return $msgid;
 }
Exemple #4
0
 /**
  * Изменение "избранности" фрилансера - добавление в избранные, если еще не выбран и удаление, если уже выбран.
  *
  * @param    integer   $frl_id   код фрилансера
  * @param    integer   $prof_id  код профессии
  * @param    integer   $uid      код юзера
  * @return   array               результат (0-ой элемент: количество выбранных юзеров) и тип выполненой операции (1-ый элемент: 0 - удален, 1 - добавлен)
  */
 function ChangeFav($frl_id, $prof_id, $uid)
 {
     global $DB;
     if ($frl_id != $uid) {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/teams.php';
         $teams = new teams();
         $ret = array(0, 0);
         if (!$teams->teamsIsInFavorites($uid, $frl_id)) {
             if ($prof_id > 0) {
                 require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
                 $mirrored = professions::GetMirroredProfs($prof_id);
                 $profs = "'" . implode("', '", $mirrored) . "'";
                 $teams->teamsAddFavorites($uid, $frl_id, false);
                 $m = $teams->teamsFavorites($uid, $error);
                 $myteam = array();
                 for ($i = 0; $i < count($m); $i++) {
                     $myteam[] = $m[$i]['uid'];
                 }
                 if ($myteam) {
                     //$DB->debug = '/var/tmp/DB.log';
                     $sql = "SELECT COUNT(*) FROM portf_choise WHERE user_id IN (" . implode(',', $myteam) . ") AND prof_id IN ({$profs})";
                     $ret[0] = $DB->val($sql);
                     //$DB->debug = '';
                 }
             } else {
                 $teams->teamsAddFavorites($uid, $frl_id, false);
                 $ret[0] = $teams->teamsFavoritesCount($uid, $error);
             }
             $ret[1] = 1;
         } else {
             if ($prof_id > 0) {
                 require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
                 $mirrored = professions::GetMirroredProfs($prof_id);
                 $profs = "'" . implode("', '", $mirrored) . "'";
                 $teams->user_id = $uid;
                 $teams->target_id = $frl_id;
                 $teams->teamsDelFavorites();
                 $m = $teams->teamsFavorites($uid, $error);
                 $myteam = array();
                 for ($i = 0; $i < count($m); $i++) {
                     $myteam[] = $m[$i]['uid'];
                 }
                 if ($myteam) {
                     $sql = "SELECT COUNT(*) FROM portf_choise WHERE user_id IN (" . implode(',', $myteam) . ") AND prof_id IN ({$profs})";
                     $ret[0] = $DB->val($sql);
                 }
             } else {
                 $teams->user_id = $uid;
                 $teams->target_id = $frl_id;
                 $teams->teamsDelFavorites();
                 $ret[0] = $teams->teamsFavoritesCount($uid, $error);
             }
             return $ret;
         }
     } else {
         $ret[0] = $teams->teamsFavoritesCount($uid, $error);
     }
     return $ret;
 }
 /**
  * Проверяет по специализациям, может ли текущий пользователь ответить на проект.
  * 
  * @param int $projec_id ид проекта
  *
  * @return boolean
  */
 public static function offerSpecIsAllowed($projec_id)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
     // ПРО отвечают без ограничений
     if (is_pro()) {
         return true;
     }
     if (!get_uid(false)) {
         return false;
     }
     $is_send_offers = false;
     $spec_project = new_projects::getSpecs($projec_id);
     $user_spec = professions::GetProfsAddSpec($_SESSION['uid']);
     if (is_array($user_spec)) {
         $user_spec = array_merge($user_spec, $_SESSION['specs']);
     } else {
         $user_spec = $_SESSION['specs'];
     }
     if ($user_spec) {
         $user_spec = array_merge($user_spec, professions::GetMirroredProfs(professions::GetProfessionOrigin(implode(',', $user_spec))));
         $user_spec = array_unique($user_spec);
         //@todo запехать в один запрос
         foreach ($user_spec as $spec) {
             $prof_group[$spec] = professions::GetProfField($spec, 'prof_group');
         }
     }
     foreach ($spec_project as $specs) {
         if (is_array($prof_group) && in_array($specs['category_id'], $prof_group)) {
             $is_send_offers = true;
             // Разрашаем оставлять отзыв
             break;
         }
     }
     return $is_send_offers;
 }
Exemple #6
0
 /**
  * Формирует SQL-условие по заданному фильтру (который у фрилансеров на главной и в меню "Проекты").
  *
  * @global $project_exRates Курс обмены валюты
  * 
  * @param array   $filter параметры фильтра. Если фильтр выключен можно передать NULL или в $filter['is_active'] задать false.
  * @param integer $kind   тип закладки проектов (@see new_projects::getProjects()), если находимся на главной странице.
  * @return string   SQL-условие для использования в запросе.
  */
 function createFilterSql($filter, $kind = NULL)
 {
     global $DB, $project_exRates;
     if (!$filter || $filter['active'] != 't') {
         return '';
     }
     $fSql = '';
     //Ислючаем из выборки перечисленные проекты
     if (isset($filter['not_project_ids']) && is_array($filter['not_project_ids'])) {
         $fSql .= $DB->parse(" AND p.id NOT IN(?l) ", $filter['not_project_ids']);
     }
     if ($filter['only_sbr'] == 't') {
         $fSql .= ' AND  p.prefer_sbr = true ';
     }
     if ($filter['urgent_only'] == 't') {
         $fSql .= ' AND  p.urgent = true ';
     }
     if ($filter['urgent'] == 't') {
         $fSql .= ' AND  p.urgent = true ';
     }
     if ($filter['pro_only'] == 't') {
         $fSql .= ' AND  p.pro_only = true ';
     }
     if ($filter['verify_only'] == 't') {
         $fSql .= ' AND  p.verify_only = true ';
     }
     if ($filter['less_offers'] == 't') {
         $fSql .= ' AND p.offers_count < 2 ';
     }
     //Только проекты с выбранным исполнителем
     if (isset($filter['hide_exec']) && $filter['hide_exec'] == 't') {
         $fSql .= ' AND (p.exec_id <= 0 OR p.exec_id IS NULL) ';
     }
     if (hasPermissions('projects')) {
         if ($filter['block_only'] == 't') {
             $fSql .= ' AND EXISTS (SELECT 1 FROM projects_blocked WHERE project_id=p.id) ';
         }
     }
     if ($kind != 1 && $kind != 2 && $kind != 7) {
         if (intval($filter['country'])) {
             $fSql .= 'AND (p.country=' . intval($filter['country']) . ' ';
             if (intval($filter['city'])) {
                 $fSql .= 'AND p.city=' . intval($filter['city']);
             }
             $fSql .= ') AND kind = 4 ';
         }
     }
     if ($filter['wo_cost'] == 'f') {
         $fSql .= 'AND p.cost > 0 ';
     }
     if ($filter['my_specs'] == 't' && $filter['user_specs']) {
         $profsWithMirrors = professions::GetMirroredProfs(implode(',', $filter['user_specs']));
         $fSql .= 'AND EXISTS (SELECT 1 from project_to_spec WHERE project_id = p.id AND subcategory_id IN (' . implode(',', $profsWithMirrors) . '))';
     } elseif ($filter['categories']) {
         $categories = array();
         for ($ci = 0; $ci < 2; $ci++) {
             if (sizeof($filter['categories'][$ci])) {
                 foreach ($filter['categories'][$ci] as $ckey => $cvalue) {
                     $categories[$ci][] = (int) $ckey;
                 }
             }
         }
         $fSql .= 'AND EXISTS (SELECT 1 from project_to_spec WHERE project_id = p.id AND (';
         $sProfCat = '';
         $sProfSubcat = '';
         // собираем подразделы выбранных разделов
         if (sizeof($categories[0])) {
             $sProfCat = professions::getProfIdForGroups($categories[0]);
         }
         // собираем выбранные подразделы
         if (sizeof($categories[1])) {
             $sProfSubcat = implode(',', $categories[1]);
         }
         // склеиваем и получаем все подразделы вместе с зеркалами
         $sProf = $sProfCat . ($sProfCat && $sProfSubcat ? ',' : '') . $sProfSubcat;
         $aProf = professions::GetMirroredProfs($sProf);
         $fSql .= 'subcategory_id in (' . implode(',', $aProf) . ') ';
         if (sizeof($categories[0])) {
             $fSql .= 'OR category_id IN (' . implode(',', $categories[0]) . ')';
         }
         $fSql .= ')) ';
     }
     if ($filter['keywords'] = trim($filter['keywords'])) {
         if (defined('FTS_PROJECTS') && FTS_PROJECTS) {
             if ($filter_keywords = $DB->parse('?ts', $filter['keywords'])) {
                 // При добавлении полей необходимо создать новый индекс вместо "ixts projects/name_descr".
                 $fSql .= "\n                      AND ( to_tsvector('pg_catalog.russian', COALESCE(p.name, '') || ' ' || COALESCE(p.descr, ''))\n                            @@ to_tsquery('pg_catalog.russian', {$filter_keywords}) )\n                    ";
             }
         } else {
             foreach (explode(',', $filter['keywords']) as $val) {
                 $val = trim(preg_replace('/([%_])/', '\\\\\\\\$1', htmlspecialchars($val, ENT_QUOTES, 'cp1251')));
                 if ($val) {
                     $filter_keywords[] = $val;
                 }
             }
             $fSql .= 'AND ( ';
             $fSql .= "(p.name ILIKE '%" . implode("%' OR p.name ILIKE '%", $filter_keywords) . "%') OR ";
             $fSql .= "(p.descr ILIKE '%" . implode("%' OR p.descr ILIKE '%", $filter_keywords) . "%') ";
             $fSql .= ') ';
         }
     }
     if ($filter['cost_from'] || $filter['cost_to']) {
         $cr = (int) $filter['currency'];
         $cex = array(2, 3, 4, 1);
         if (($cost_from = (double) $filter['cost_from']) < 0) {
             $cost_from = 0;
         }
         if (($cost_to = (double) $filter['cost_to']) < 0) {
             $cost_to = 0;
         }
         if ($cost_to < $cost_from && $cost_to != 0) {
             $cost_to = $cost_from;
         }
         if ($cost_to || $cost_from) {
             $fSql .= 'AND (';
             //##0028132
             /*
             $priceby = (int)$filter['priceby'];
             if($kind == 7) {
                 $priceby = NULL;
             }
             if($priceby) {
                 $fSql .= 'p.priceby = ' . $priceby . ' AND (';
             }
             */
             for ($i = 0; $i < 4; $i++) {
                 $exfr = round($cost_from * $project_exRates[$cex[$cr] . $cex[$i]], 4);
                 $exto = round($cost_to * $project_exRates[$cex[$cr] . $cex[$i]], 4);
                 $fSql .= ($i ? ' OR ' : '') . "(p.currency = {$i} AND p.cost >= {$exfr}" . ($cost_to ? " AND p.cost <= {$exto}" : '') . ')';
             }
             //##0028132
             /*
             if($priceby) {
                 $fSql .= ')';
             }
             */
             if ($filter['wo_cost'] == 't') {
                 $fSql .= ' OR p.cost = 0';
             }
             $fSql .= ')';
         }
     }
     if ($kind == 2 || $kind == 7) {
         if ($filter['konkurs_end_days_from'] !== null) {
             $fSql .= $DB->parse(' AND p.end_date::date - NOW()::date >= ? ', $filter['konkurs_end_days_from']);
         }
         if ($filter['konkurs_end_days_to'] !== null) {
             $fSql .= $DB->parse(' AND p.end_date::date - NOW()::date <= ? ', $filter['konkurs_end_days_to']);
         }
     }
     return $fSql;
 }
Exemple #7
0
 /**
  * Возвращает ленту проектов.
  * 
  * @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;
 }
$prfs = new professions();
$profs = $prfs->GetAllProfessionsSpec($user->uid);
$main_spec = null;
foreach ($profs as $p) {
    if ($p['checked']) {
        $main_spec = $p['id'];
    }
}
$specs_add = array();
if (is_pro()) {
    $specs_add = $prfs->GetProfsAddSpec($uid);
}
$mirr_specs = array();
$all_checked = $specs_add;
if (count($all_checked)) {
    $mirr_specs = $prfs->GetMirroredProfs(implode(",", $all_checked));
    if (count($mirr_specs)) {
        $mirr_specs = array_diff($mirr_specs, $all_checked);
    }
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/xajax/quickpro.common.php";
$xajax->printJavascript('/xajax/');
?>
<div class="b-layout b-layout_padtop_20">
<form id='idProfs' action="/users/<?php 
echo $user->login;
?>
/setup/portfolio/" method="post">
<h3 class="b-layout__h3">Выберите вашу специализацию:</h3>

<div class="b-radio b-radio__item_padbot_20">
<?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;
?>
Exemple #10
0
 /**
  * Обновить количество пользователей в профессиях
  *
  * @param integer $prof      ИД Профессий
  * @param integer $count     Количество пользователей
  * @param integr  $pro_count Количество ПРО пользователей
  * @return string Сообщение об ошибке если есть
  */
 function UpdateProfessionCount($prof, $count, $pro_count)
 {
     global $DB;
     $mirrored = professions::GetMirroredProfs($prof);
     $DB->update('professions', array('pcount' => $count, 'pro_count' => $pro_count), "id IN (?l)", $mirrored);
     return $DB->error;
 }
Exemple #11
0
 public function createSqlFilter($filter, $cl = 'WHERE')
 {
     if ($filter['categories']) {
         $categories = array();
         for ($ci = 0; $ci < 2; ++$ci) {
             if (sizeof($filter['categories'][$ci])) {
                 foreach ($filter['categories'][$ci] as $ckey => $cvalue) {
                     $categories[$ci][] = (int) $ckey;
                 }
             }
         }
         $fSql .= "{$cl} (";
         $sProfCat = '';
         $sProfSubcat = '';
         // собираем подразделы выбранных разделов
         if (sizeof($categories[0])) {
             $sProfCat = professions::getProfIdForGroups($categories[0]);
         }
         // собираем выбранные подразделы
         if (sizeof($categories[1])) {
             $sProfSubcat = implode(',', $categories[1]);
         }
         // склеиваем и получаем все подразделы вместе с зеркалами
         $sProf = $sProfCat . ($sProfCat && $sProfSubcat ? ',' : '') . $sProfSubcat;
         $aProf = professions::GetMirroredProfs($sProf);
         $fSql .= ' subcategory_id in (' . implode(',', $aProf) . ') ';
         if (sizeof($categories[0])) {
             $fSql .= 'OR category_id IN (' . implode(',', $categories[0]) . ')';
         }
         $fSql .= ') ';
     }
     if ($filter['only_my_offs'] == 't') {
         $fSql .= ' AND fo.user_id = ' . get_uid(0);
     }
     return $fSql;
 }