当前位置: 首页>>代码示例>>PHP>>正文


PHP professions::getProfsByKeywords方法代码示例

本文整理汇总了PHP中professions::getProfsByKeywords方法的典型用法代码示例。如果您正苦于以下问题:PHP professions::getProfsByKeywords方法的具体用法?PHP professions::getProfsByKeywords怎么用?PHP professions::getProfsByKeywords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在professions的用法示例。


在下文中一共展示了professions::getProfsByKeywords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createCatalogFilterSql

 /**
  * Формирует SQL-условия по заданному фильтру.
  *
  * @param array $filter    фильтр, см. функцию.
  * @param $prof_id   ид. специализации (если находимся в конкретном разделе каталога).
  * @return array   [where-условие, join-вставки].
  */
 function createCatalogFilterSql($filter, $prof_id = 0)
 {
     if (!$filter) {
         return NULL;
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/teams.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/project_exrates.php";
     global $project_exRates, $DB;
     $filter_join = array();
     $filter_where = array();
     if ($filter['prof'] && !$prof_id) {
         if (count($filter['prof'][0]) > 0) {
             $p1 = professions::getProfIdForGroups(array_keys($filter['prof'][0]), true);
         }
         if (count($filter['prof'][1]) > 0) {
             $p2 = professions::GetProfessionOrigin(implode(",", array_keys($filter['prof'][1])));
         }
         $in_sql = ($p2 ? $p2 : "") . ($p1 && $p2 ? ", " : "") . ($p1 ? $p1 : "");
         if ($in_sql) {
             $filter_where[] = "s.spec_orig IN ({$in_sql})";
             $has_prof_filter = true;
         }
     }
     if ($filter['orig_kwords']) {
         if (!$has_prof_filter && !$prof_id) {
             if ($kprofs = professions::getProfsByKeywords($filter['orig_kwords'])) {
                 $kprofs = professions::GetProfessionOrigin($kprofs);
                 $kf[] = "s.spec_orig IN ({$kprofs})";
             }
             $m = array();
             $e = explode(',', $filter['orig_kwords']);
             foreach ($e as $k => $v) {
                 if ($v = trim($v)) {
                     $m[] = strtolower($v);
                 }
             }
             if ($m) {
                 $kf[] = $DB->parse('s.uid IN (SELECT portf_word.uid FROM words JOIN portf_word ON portf_word.wid=words.id JOIN users ON users.uid=portf_word.uid where lower(name) IN (?l))', $m);
             }
         }
         if (!empty($filter['kword']) && is_array($filter['kword'])) {
             foreach ($filter['kword'] as $k => $v) {
                 $g[$v['group_id']] = $v['group_id'];
                 $w[$v['id']] = $v['id'];
             }
             $kf[] = 's.uid IN (SELECT DISTINCT pw.uid FROM words w JOIN portf_word pw ON pw.wid = w.id WHERE w.group_id IN (' . implode(',', $g) . '))';
         }
         if ($kf) {
             $filter_where[] = '(' . implode(' OR ', $kf) . ') ';
         } else {
             return -1;
         }
     }
     if ($filter['in_fav']) {
         $teams = new teams();
         if ($tt = $teams->teamsFavorites($uid, $error)) {
             foreach ($tt as $t) {
                 $favs[] = $t['uid'];
             }
             if ($favs) {
                 $filter_where[] = $DB->parse('s.uid IN (?l)', $favs);
             }
         }
     }
     $jstr_rating = 'INNER JOIN rating r ON r.user_id = s.uid';
     if ($filter['success_sbr'][0] == 1) {
         $filter_join['rating'] = $jstr_rating;
         for ($i = 1; $i < 4; $i++) {
             if ($filter['success_sbr'][$i] == 1) {
                 $s[] = $i;
             }
         }
         if ($s) {
             $filter_where[] = $DB->parse('r.rank IN (?l)', $s);
         }
         $filter_where[] = 'r.sbr_sum > 0';
     }
     if ($filter['is_preview']) {
         $filter_join['rating'] = $jstr_rating;
         $filter_where[] = 'r.o_wrk_factor_a > 0';
     }
     if ($filter['is_pro']) {
         $filter_where[] = 's.is_pro = true';
     }
     if ($filter['is_verify']) {
         $filter_where[] = 's.is_verify = true';
     }
     if ($filter['only_tu']) {
         $filter_where[] = ' s.uid IN (SELECT tservices.user_id FROM tservices WHERE tservices.active=true AND tservices.deleted=false) ';
     }
     if ($filter['sbr_is_positive']) {
//.........这里部分代码省略.........
开发者ID:amage,项目名称:fl-ru-damp,代码行数:101,代码来源:freelancer.php


注:本文中的professions::getProfsByKeywords方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。