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


PHP professions::loadProfessionUserKeyword方法代码示例

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


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

示例1: editProfession

function editProfession($uid = '', $params = '')
{
    $objResponse =& new xajaxResponse();
    $uid = intval($uid);
    if ($uid != get_uid(false) || !get_uid(false)) {
        return $objResponse;
    }
    $params = stripslashes($params);
    parse_str($params, $params);
    $params['portf_text'] = _htmlentities($params['portf_text'], 'UTF-8');
    $params['old_portf_text'] = _htmlentities($params['old_portf_text'], 'UTF-8');
    $params['user_keys'] = _htmlentities($params['user_keys'], 'UTF-8');
    $params = uploader::encodeCharset($params, array('utf-8', 'cp1251'));
    $prof_id = intval($params['prof_id']);
    $profession = new professions();
    $profession->updateUserKeywordsProfessions($uid, $prof_id, $params['user_keys']);
    $profession->updateProfessionUser($uid, $prof_id, $params);
    if (!empty($profession->errors)) {
        $errors = json_encode(array_map('win2utf', $profession->errors));
        $objResponse->script("portfolio.viewError({$errors}, 'profession_edit_popup')");
    } else {
        $stop_words = new stop_words(hasPermissions('users'));
        $user = new users();
        $user->login = $_SESSION['login'];
        $user->uid = $_SESSION['uid'];
        $user->is_pro = is_pro() ? 't' : 'f';
        $is_owner = $uid == $_SESSION['uid'];
        $success = true;
        $pinfo = current(portfolio::getPortfolioCategory($prof_id));
        $pinfo['mainprofname'] = $pinfo['group_name'];
        $pinfo['profname'] = $pinfo['prof_name'];
        $pinfo['gr_prevs'] = $pinfo['show_preview'];
        $pinfo = $profession->prepareCostText($pinfo, $stop_words);
        $ukeys[$prof_id] = $profession->loadProfessionUserKeyword($user->uid, $prof_id);
        if ($params['position'] == 2) {
            $afterProfID = (int) $params['position_category_db_id'];
            $afterProf = current(portfolio::getPortfolioCategory($afterProfID));
            $newPosition = $afterProf['ordering'] + 1;
            if ($newPosition != $pinfo['ordering']) {
                if ($newPosition > $pinfo['ordering']) {
                    $newPosition--;
                }
                $profession->changePositionProfessionsUser($newPosition, $uid, $prof_id);
                $change_position = true;
            }
        } else {
            if ($params['position'] != $pinfo['ordering']) {
                if (!is_pro()) {
                    // Если пользователь не ПРо у него скрыты два раздела которые существуют они стоят на первых позициях всегда, и поэтому нельзя ставить разделу 1 позицию
                    // позицию надо ставить исходя из позиций этих скрытых разделов.
                    $fpos = $profession->GetProfDesc($uid, professions::BEST_PROF_ID);
                    $spos = $profession->GetProfDesc($uid, professions::CLIENTS_PROF_ID);
                    if ($fpos['ordering'] == $spos['ordering']) {
                        // Оба на первой позиции
                        $first = 2;
                    } else {
                        // Позиции корректны
                        $first = 3;
                    }
                }
                $afterProfID = 0;
                $profession->changePositionProfessionsUser(is_pro() ? 1 : $first, $uid, $prof_id);
                $change_position = true;
                $is_first = true;
            }
        }
        ob_start();
        include_once $_SERVER['DOCUMENT_ROOT'] . '/user/tpl.profession.item.php';
        $sHtml = ob_get_contents();
        ob_end_clean();
        if ($pinfo['show_preview'] == 't' && $params['on_preview_default'] == '0' || $pinfo['show_preview'] == 'f' && $params['on_preview_default'] == '1') {
            // Меняем вид работ
            $portfolio = new portfolio();
            $works = $portfolio->GetPortf($user->uid, $prof_id, true);
            if (!empty($works)) {
                $result = portfolio::prepareDataPortfolio($works, $uid, $stop_words, true);
                extract($result);
                $work[0]['id'] = 100;
                ob_start();
                include_once $_SERVER['DOCUMENT_ROOT'] . '/user/tpl.portfolio.works.php';
                $sWorks = ob_get_contents();
                ob_end_clean();
            } else {
                $work[0]['id'] = null;
                $pp_noblocks[$prof_id] = array();
                ob_start();
                include $_SERVER['DOCUMENT_ROOT'] . '/user/tpl.portfolio.works.php';
                $sWorks = ob_get_contents();
                ob_end_clean();
            }
        }
        $objResponse->assign("profession_{$prof_id}", 'innerHTML', $sHtml);
        if ($sWorks != '') {
            $objResponse->assign("prof_works_{$prof_id}", 'innerHTML', $sWorks);
        }
        $objResponse->script("\$('profession_edit_popup').dispose(); ");
        if (!empty($change_position)) {
            $action = $is_first ? 'before' : 'after';
            $objResponse->script("portfolio.setPosition({$prof_id}, {$afterProfID}, '{$action}')");
        }
//.........这里部分代码省略.........
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:101,代码来源:portfolio.server.php

示例2: prepareDataPortfolio

 /**
  * Рассортировываем портфолио.
  * 
  * @param array   $prjs       Работы портфолио @see self::GetPortf();
  * @param integer $uid        Ид пользователя
  * @param object  $stop_words @see class new stop_words()
  * @param integer $one_select Костыль для подгрузки работ в определенную категорию профессии, создает переменную $prjs которая необходима в шаблоне 
  */
 public function prepareDataPortfolio($works, $uid, $stop_words, $one_select = false)
 {
     $i = $block = 0;
     $size_block = 3;
     $is_owner = $uid == get_uid(false);
     // Рассортировываем портфолио
     foreach ($works as $prj) {
         if ($prj['is_blocked'] == 't' && $uid != get_uid(false) && !hasPermissions('users')) {
             continue;
         }
         if ($i >= $size_block || $prj['prof_id'] != $old_prof) {
             ++$block;
             $i = 0;
             //$i = $is_owner && !$add_work_block[$prj['prof_id']] ? 1 : 0;
             //$add_work_block[$prj['prof_id']] = true;
         }
         if ($one_select) {
             $prjs[$block][] = $prj;
         }
         $pp[$prj['prof_id']][$block][] = $prj;
         $pp_noblocks[$prj['prof_id']][] = $prj;
         $sName = $prj['name'];
         $pt[$prj['prof_id']][$block][$prj['id']] = $sName;
         if (!isset($pname[$prj['prof_id']])) {
             $prj = professions::prepareCostText($prj, $stop_words);
             $pname[$prj['prof_id']] = $prj;
         }
         ++$i;
         $old_prof = $prj['prof_id'];
         // Ключевые слова
         if (empty($ukeys[$prj['prof_id']])) {
             $ukeys[$prj['prof_id']] = professions::loadProfessionUserKeyword($uid, $prj['prof_id']);
         }
     }
     $result = array('add_work_block' => $add_work_block, 'pp' => $pp, 'pp_noblocks' => $pp_noblocks, 'pt' => $pt, 'pname' => $pname, 'ukeys' => $ukeys);
     if ($one_select) {
         $result['prjs'] = $prjs;
     }
     return $result;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:48,代码来源:portfolio.php


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