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


PHP category::getPermissionLevelName方法代码示例

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


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

示例1: applyFilterFields

 protected function applyFilterFields(baseObjectFilter $filter)
 {
     $partnerId = kCurrentContext::getCurrentPartnerId();
     $categories = $filter->get("_matchor_likex_full_name");
     if ($categories !== null) {
         $categories = explode(',', $categories);
         $parsedCategories = array();
         foreach ($categories as $category) {
             if (trim($category) == '') {
                 continue;
             }
             $parsedCategories[] = $category . '\\*';
         }
         $fullNameMatchOr = '';
         if (count($parsedCategories)) {
             $fullNameMatchOr = implode(',', $parsedCategories);
         }
         if ($fullNameMatchOr != '') {
             $filter->set("_matchor_full_name", $fullNameMatchOr);
         }
     }
     $filter->unsetByName('_matchor_likex_full_name');
     if ($filter->get('_free_text')) {
         $freeTexts = $filter->get('_free_text');
         $additionalConditions = array();
         $advancedSearch = $filter->getAdvancedSearch();
         if ($advancedSearch) {
             $additionalConditions = $advancedSearch->getFreeTextConditions($filter->getPartnerSearchScope(), $freeTexts);
         }
         $this->addFreeTextToMatchClauseByMatchFields($freeTexts, categoryFilter::FREE_TEXT_FIELDS, $additionalConditions);
     }
     $filter->unsetByName('_free_text');
     if ($filter->get('_eq_privacy_context') && $filter->get('_eq_privacy_context') == '*') {
         $filter->set('_matchor_privacy_context', kEntitlementUtils::NOT_DEFAULT_CONTEXT);
         $filter->unsetByName('_eq_privacy_context');
     }
     if ($filter->get('_eq_manager')) {
         $puserId = $filter->get('_eq_manager');
         $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $puserId);
         if ($kuser) {
             $manager = category::getPermissionLevelName(CategoryKuserPermissionLevel::MANAGER);
             $this->matchClause[] = '(@(' . categoryFilter::MEMBERS . ') ' . $manager . '_' . $kuser->getid() . ')';
         }
     }
     $filter->unsetByName('_eq_manager');
     if ($filter->get('_eq_member')) {
         $puserId = $filter->get('_eq_member');
         $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $puserId);
         if ($kuser) {
             $manager = category::getPermissionLevelName(CategoryKuserPermissionLevel::MANAGER);
             $member = category::getPermissionLevelName(CategoryKuserPermissionLevel::MEMBER);
             $moderator = category::getPermissionLevelName(CategoryKuserPermissionLevel::MODERATOR);
             $contributor = category::getPermissionLevelName(CategoryKuserPermissionLevel::CONTRIBUTOR);
             $kuserId = $kuser->getid();
             $this->matchClause[] = '(@(' . categoryFilter::MEMBERS . ') ' . "({$member}_{$kuserId} | {$moderator}_{$kuserId} | {$contributor}_{$kuserId} ) !({$manager}_{$kuserId}))";
         }
     }
     $filter->unsetByName('_eq_member');
     if ($filter->get('_eq_full_name')) {
         $filter->set('_matchor_full_name', $filter->get('_eq_full_name') . category::FULL_NAME_EQUAL_MATCH_STRING);
     }
     $filter->unsetByName('_eq_full_name');
     if ($filter->get('_in_full_name')) {
         $fullnames = explode(',', $filter->get('_in_full_name'));
         $fullnameIn = '';
         foreach ($fullnames as $fullname) {
             $fullnameIn .= $fullname . category::FULL_NAME_EQUAL_MATCH_STRING . ',';
         }
         $filter->set('_matchor_full_name', $fullnameIn);
         $filter->unsetByName('_in_full_name');
     }
     $categories = $filter->get("_in_ancestor_id");
     if ($categories !== null) {
         //if the category exist or the category name is an empty string
         $categoriesParsed = $filter->categoryIdsToAllSubCategoriesIdsParsed($categories);
         if ($categoriesParsed !== '' || $categories == '') {
             $filter->set("_matchor_full_ids", $categoriesParsed);
         } else {
             $filter->set("_matchor_full_ids", category::CATEGORY_ID_THAT_DOES_NOT_EXIST);
         }
     }
     $filter->unsetByName('_in_ancestor_id');
     if ($filter->get('_likex_full_ids')) {
         $fullids = explode(',', $filter->get('_likex_full_ids'));
         $fullIdsIn = '';
         foreach ($fullids as $fullid) {
             $fullIdsIn .= $fullid . '\\*,';
         }
         $filter->set('_matchor_full_ids', $fullIdsIn);
         $filter->unsetByName('_likex_full_ids');
     }
     if ($filter->get('_eq_full_ids')) {
         $filter->set('_matchor_full_ids', $filter->get('_eq_full_ids') . category::FULL_IDS_EQUAL_MATCH_STRING);
     }
     $filter->unsetByName('_eq_full_ids');
     if ($filter->get('_likex_name_or_reference_id')) {
         $names = $filter->get('_likex_name_or_reference_id');
         $this->addFreeTextToMatchClauseByMatchFields($names, categoryFilter::NAME_REFERNCE_ID, null, true);
     }
     $filter->unsetByName('_likex_name_or_reference_id');
//.........这里部分代码省略.........
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:SphinxCategoryCriteria.php

示例2: applyFilterFields

 protected function applyFilterFields(baseObjectFilter $filter)
 {
     $categories = $filter->get("_matchor_likex_full_name");
     if ($categories !== null) {
         $categories = explode(',', $categories);
         $parsedCategories = array();
         foreach ($categories as $category) {
             if (trim($category) == '') {
                 continue;
             }
             $parsedCategories[] = $category . '\\*';
         }
         $fullNameMatchOr = '';
         if (count($parsedCategories)) {
             $fullNameMatchOr = implode(',', $parsedCategories);
         }
         if ($fullNameMatchOr != '') {
             $filter->set("_matchor_full_name", $fullNameMatchOr);
         }
     }
     $filter->unsetByName('_matchor_likex_full_name');
     if ($filter->get('_free_text')) {
         $freeTexts = $filter->get('_free_text');
         KalturaLog::debug("Attach free text [{$freeTexts}]");
         $additionalConditions = array();
         $advancedSearch = $filter->getAdvancedSearch();
         if ($advancedSearch) {
             $additionalConditions = $advancedSearch->getFreeTextConditions($freeTexts);
         }
         if (preg_match('/^"[^"]+"$/', $freeTexts)) {
             $freeText = str_replace('"', '', $freeTexts);
             $freeText = SphinxUtils::escapeString($freeText);
             $freeText = "^{$freeText}\$";
             $additionalConditions[] = "@(" . categoryFilter::FREE_TEXT_FIELDS . ") {$freeText}";
         } else {
             if (strpos($freeTexts, baseObjectFilter::IN_SEPARATOR) > 0) {
                 str_replace(baseObjectFilter::AND_SEPARATOR, baseObjectFilter::IN_SEPARATOR, $freeTexts);
                 $freeTextsArr = explode(baseObjectFilter::IN_SEPARATOR, $freeTexts);
                 foreach ($freeTextsArr as $valIndex => $valValue) {
                     if (!is_numeric($valValue) && strlen($valValue) <= 0) {
                         unset($freeTextsArr[$valIndex]);
                     } else {
                         $freeTextsArr[$valIndex] = SphinxUtils::escapeString($valValue);
                     }
                 }
                 foreach ($freeTextsArr as $freeText) {
                     $additionalConditions[] = "@(" . categoryFilter::FREE_TEXT_FIELDS . ") {$freeText}";
                 }
             } else {
                 $freeTextsArr = explode(baseObjectFilter::AND_SEPARATOR, $freeTexts);
                 foreach ($freeTextsArr as $valIndex => $valValue) {
                     if (!is_numeric($valValue) && strlen($valValue) <= 0) {
                         unset($freeTextsArr[$valIndex]);
                     } else {
                         $freeTextsArr[$valIndex] = SphinxUtils::escapeString($valValue);
                     }
                 }
                 $freeTextsArr = array_unique($freeTextsArr);
                 $freeTextExpr = implode(baseObjectFilter::AND_SEPARATOR, $freeTextsArr);
                 $additionalConditions[] = "@(" . categoryFilter::FREE_TEXT_FIELDS . ") {$freeTextExpr}";
             }
         }
         if (count($additionalConditions)) {
             $additionalConditions = array_unique($additionalConditions);
             $matches = reset($additionalConditions);
             if (count($additionalConditions) > 1) {
                 $matches = '( ' . implode(' ) | ( ', $additionalConditions) . ' )';
             }
             $this->matchClause[] = $matches;
         }
     }
     $filter->unsetByName('_free_text');
     if ($filter->get('_eq_privacy_context') && $filter->get('_eq_privacy_context') == '*') {
         $filter->set('_matchor_privacy_context', kEntitlementUtils::NOT_DEFAULT_CONTEXT);
         $filter->unsetByName('_eq_privacy_context');
     }
     if ($filter->get('_eq_manager')) {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $puserId = $filter->get('_eq_manager');
         $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $puserId);
         if ($kuser) {
             $manager = category::getPermissionLevelName(CategoryKuserPermissionLevel::MANAGER);
             $this->matchClause[] = '(@(' . categoryFilter::MEMBERS . ') ' . $manager . '_' . $kuser->getid() . ')';
         }
     }
     $filter->unsetByName('_eq_manager');
     if ($filter->get('_eq_member')) {
         //memeber but not a menager
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $puserId = $filter->get('_eq_member');
         $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $puserId);
         if ($kuser) {
             $manager = category::getPermissionLevelName(CategoryKuserPermissionLevel::MANAGER);
             $member = category::getPermissionLevelName(CategoryKuserPermissionLevel::MEMBER);
             $moderator = category::getPermissionLevelName(CategoryKuserPermissionLevel::MODERATOR);
             $contributor = category::getPermissionLevelName(CategoryKuserPermissionLevel::CONTRIBUTOR);
             $kuserId = $kuser->getid();
             $this->matchClause[] = '(@(' . categoryFilter::MEMBERS . ') ' . "({$member}_{$kuserId} | {$moderator}_{$kuserId} | {$contributor}_{$kuserId} ) !({$manager}_{$kuserId}))";
         }
     }
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:SphinxCategoryCriteria.php


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