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


PHP entryPeer::prepareEntitlementCriteriaAndFilters方法代码示例

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


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

示例1: executeDynamicPlaylist


//.........这里部分代码省略.........
         $entry_filter->fillObjectFromXml($entry_filter_xml, "_");
         // make sure there is alway a limit for each filter - if not an explicit one - the system limit should be used
         if ($entry_filter->getLimit() == null || $entry_filter->getLimit() < 1) {
             $entry_filter->setLimit(self::TOTAL_RESULTS);
         }
         // merge the current_filter with the correcponding extra_filter
         // allow the extra_filter to override properties of the current filter
         if ($filter) {
             if ($filterLimit && $i == $numFiltersInList - 1) {
                 // Hack (in order to preserve old behavior):
                 // If the filter contained a limit, we'll add it to the last XML filter on the list
                 // in order to make sure the number of requested ($limit) entries will be supplied.
                 // This handles requests of a $limit which is higher than the total sum of inner XML filter limits.
                 $filter->setLimit($filterLimit);
             }
             $entry_filter->fillObjectFromObject($filter, myBaseObject::CLONE_FIELD_POLICY_THIS, myBaseObject::CLONE_POLICY_PREFER_NEW, null, null, false);
             $entry_filter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE);
         }
         self::updateEntryFilter($entry_filter, $partner_id, true);
         $entry_filters[] = $entry_filter;
     }
     if ($pager) {
         $startOffset = $pager->calcOffset();
         $pageSize = $pager->calcPageSize();
         if ($startOffset > $total_results) {
             return array();
         }
         $total_results = min($total_results, $startOffset + $pageSize);
     }
     $entry_ids_list = array();
     foreach ($entry_filters as $entry_filter) {
         $current_limit = max(0, $total_results - count($entry_ids_list));
         // if the current_limit is < 0 - set it to be 0
         // no need to fetch any more results
         if ($current_limit <= 0) {
             break;
         }
         $c = KalturaCriteria::create(entryPeer::OM_CLASS);
         // don't fetch the same entries twice - filter out all the entries that were already fetched
         if ($entry_ids_list) {
             $c->add(entryPeer::ID, $entry_ids_list, Criteria::NOT_IN);
         }
         $filter_limit = $entry_filter->getLimit();
         if ($filter_limit > $current_limit) {
             // set a smaller limit incase the filter's limit is to high
             $entry_filter->setLimit($current_limit);
         }
         // read the _eq_display_in_search field but ignore it because it's part of a more complex criterion
         $display_in_search = $entry_filter->get("_eq_display_in_search");
         if ($display_in_search >= 2) {
             $entry_filter->set("_eq_display_in_search", null);
         }
         $entry_filter->attachToCriteria($c);
         // add some hard-coded criteria
         $c->addAnd(entryPeer::TYPE, array(entryType::MEDIA_CLIP, entryType::MIX, entryType::LIVE_STREAM), Criteria::IN);
         // search only for clips or roughcuts
         $c->addAnd(entryPeer::STATUS, entryStatus::READY);
         // search only for READY entries
         $c->addAnd(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL);
         if ($display_in_search >= 2) {
             // We don't allow searching in the KalturaNEtwork anymore (mainly for performance reasons)
             // allow only assets for the partner
             $c->addAnd(entryPeer::PARTNER_ID, $partner_id);
             //
             /*				
             				$crit = $c->getNewCriterion ( entryPeer::PARTNER_ID , $partner_id );
             				$crit->addOr ( $c->getNewCriterion ( entryPeer::DISPLAY_IN_SEARCH , $display_in_search ) );
             				$c->addAnd ( $crit );
             */
         }
         if (!self::$isAdminKs) {
             self::addSchedulingToCriteria($c);
         }
         self::addModerationToCriteria($c);
         $c = entryPeer::prepareEntitlementCriteriaAndFilters($c);
         $entry_ids_list_for_filter = $c->getFetchedIds();
         // update total count and merge current result with the global list
         $entry_ids_list = array_merge($entry_ids_list, $entry_ids_list_for_filter);
     }
     if ($pager) {
         // Keep the paged entries only
         $entry_ids_list = array_slice($entry_ids_list, $startOffset, $pageSize);
     }
     // Disable entitlement, which was already applied in entryPeer::prepareEntitlementCriteriaAndFilters()
     // otherwise we will hit the 150 entries limit from SphinxCriterion
     KalturaCriterion::disableTag(KalturaCriterion::TAG_ENTITLEMENT_ENTRY);
     $db_entry_list = entryPeer::retrieveByPKs($entry_ids_list);
     KalturaCriterion::restoreTag(KalturaCriterion::TAG_ENTITLEMENT_ENTRY);
     // Map the entries to their IDs
     $entry_map = array();
     foreach ($db_entry_list as $entry) {
         $entry_map[$entry->getId()] = $entry;
     }
     // Build entry_list according to the playlist order
     $entry_list = array();
     foreach ($entry_ids_list as $entryId) {
         $entry_list[] = $entry_map[$entryId];
     }
     return $entry_list;
 }
开发者ID:GElkayam,项目名称:server,代码行数:101,代码来源:myPlaylistUtils.class.php


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