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


PHP professions::GetProfessionsByUser2方法代码示例

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


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

示例1: getProjectPromo

 public function getProjectPromo($uid)
 {
     global $DB;
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
     $user_specs = professions::GetProfessionsByUser2($uid, true);
     if ($user_specs) {
         $category = implode(", ", $user_specs['prof_group']);
         $subcategory = implode(", ", $user_specs['prof']);
     }
     $sql = "SELECT \n                p.id, p.post_date as create_date, p.cost, p.priceby, p.currency, p.name AS project_name, NULL AS cat_name, NULL AS subcat_name,\n                p.kind, p.end_date, p.budget_type,\n                co.country_name, ci.city_name, p.descr, e.uname as e_name, e.usurname as e_surname, e.login as e_login   \n            FROM projects p\n            INNER JOIN employer e ON e.uid = p.user_id \n            LEFT JOIN country co ON co.id = p.country \n            LEFT JOIN city ci ON ci.id = p.city \n            LEFT JOIN projects_blocked pb ON pb.project_id = p.id \n            WHERE \n                p.pro_only = true \n                AND pb.project_id IS NULL\n                AND p.cost > 0\n                AND budget_type = 3\n                AND p.closed = false\n                AND p.kind <> 9 \n                AND e.is_banned < 1::bit\n                AND p.post_date > DATE_TRUNC('hour', now() - interval '2 day')\n                " . (!empty($user_specs) ? " AND EXISTS (SELECT 1 from project_to_spec WHERE project_id = p.id AND (subcategory_id IN ({$subcategory}) OR ( category_id IN ({$category}) AND subcategory_id = 0 )))" : "") . "\n            ORDER BY RANDOM() LIMIT 20";
     $result = $DB->cache(300)->rows($sql);
     if ($result) {
         if (count($result) > 3) {
             //выбираем произвольно первые 3 проекта из запроса
             $rnd = array_rand($result, 3);
             return array($result[$rnd[0]], $result[$rnd[1]], $result[$rnd[2]]);
         } else {
             return $result;
         }
     } else {
         return false;
     }
 }
开发者ID:amage,项目名称:fl-ru-damp,代码行数:23,代码来源:projects.php


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