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


PHP entryFilter::setAdvancedSearch方法代码示例

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


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

示例1: getFeedAction

 /**
  * @action getFeed
  * @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY
  * @param int $distributionProfileId
  * @param string $hash
  * @return file
  */
 public function getFeedAction($distributionProfileId, $hash)
 {
     if (!$this->getPartnerId() || !$this->getPartner()) {
         throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $this->getPartnerId());
     }
     $profile = DistributionProfilePeer::retrieveByPK($distributionProfileId);
     if (!$profile || !$profile instanceof SynacorHboDistributionProfile) {
         throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_NOT_FOUND, $distributionProfileId);
     }
     if ($profile->getStatus() != KalturaDistributionProfileStatus::ENABLED) {
         throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_DISABLED, $distributionProfileId);
     }
     if ($profile->getUniqueHashForFeedUrl() != $hash) {
         throw new KalturaAPIException(SynacorHboDistributionErrors::INVALID_FEED_URL);
     }
     // "Creates advanced filter on distribution profile
     $distributionAdvancedSearch = new ContentDistributionSearchFilter();
     $distributionAdvancedSearch->setDistributionProfileId($profile->getId());
     $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE);
     $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY);
     $distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE);
     $distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false);
     //Creates entry filter with advanced filter
     $entryFilter = new entryFilter();
     $entryFilter->setStatusEquel(entryStatus::READY);
     $entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED);
     $entryFilter->setPartnerSearchScope($this->getPartnerId());
     $entryFilter->setAdvancedSearch($distributionAdvancedSearch);
     $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
     $baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL);
     $entryFilter->attachToCriteria($baseCriteria);
     $entries = entryPeer::doSelect($baseCriteria);
     $feed = new SynacorHboFeed('synacor_hbo_feed_template.xml');
     $feed->setDistributionProfile($profile);
     $counter = 0;
     foreach ($entries as $entry) {
         /* @var $entry entry */
         $entryDistribution = EntryDistributionPeer::retrieveByEntryAndProfileId($entry->getId(), $profile->getId());
         if (!$entryDistribution) {
             KalturaLog::err('Entry distribution was not found for entry [' . $entry->getId() . '] and profile [' . $profile->getId() . ']');
             continue;
         }
         $fields = $profile->getAllFieldValues($entryDistribution);
         $flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
         $thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getThumbAssetIds()));
         $additionalAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getAssetIds()));
         $feed->addItem($fields, $entry, $flavorAssets, $thumbAssets, $additionalAssets);
         $counter++;
         //to avoid the cache exceeding the memory size
         if ($counter >= 100) {
             kMemoryManager::clearMemory();
             $counter = 0;
         }
     }
     header('Content-Type: text/xml');
     echo $feed->getXml();
     die;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:65,代码来源:SynacorHboService.php

示例2: getFeedAction

 /**
  * @action getFeed
  * @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY
  * @param int $distributionProfileId
  * @param string $hash
  * @return file
  */
 public function getFeedAction($distributionProfileId, $hash)
 {
     if (!$this->getPartnerId() || !$this->getPartner()) {
         throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $this->getPartnerId());
     }
     $profile = DistributionProfilePeer::retrieveByPK($distributionProfileId);
     if (!$profile || !$profile instanceof UverseDistributionProfile) {
         throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_NOT_FOUND, $distributionProfileId);
     }
     if ($profile->getStatus() != KalturaDistributionProfileStatus::ENABLED) {
         throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_DISABLED, $distributionProfileId);
     }
     if ($profile->getUniqueHashForFeedUrl() != $hash) {
         throw new KalturaAPIException(UverseDistributionErrors::INVALID_FEED_URL);
     }
     // "Creates advanced filter on distribution profile
     $distributionAdvancedSearch = new ContentDistributionSearchFilter();
     $distributionAdvancedSearch->setDistributionProfileId($profile->getId());
     $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE);
     $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY);
     $distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false);
     //Creates entry filter with advanced filter
     $entryFilter = new entryFilter();
     $entryFilter->setStatusEquel(entryStatus::READY);
     $entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED);
     $entryFilter->setPartnerSearchScope($this->getPartnerId());
     $entryFilter->setAdvancedSearch($distributionAdvancedSearch);
     $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
     $baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL);
     $entryFilter->attachToCriteria($baseCriteria);
     $entries = entryPeer::doSelect($baseCriteria);
     $feed = new UverseFeed('uverse_template.xml');
     $feed->setDistributionProfile($profile);
     $feed->setChannelFields();
     $lastBuildDate = $profile->getUpdatedAt(null);
     foreach ($entries as $entry) {
         /* @var $entry entry */
         $entryDistribution = EntryDistributionPeer::retrieveByEntryAndProfileId($entry->getId(), $profile->getId());
         if (!$entryDistribution) {
             KalturaLog::err('Entry distribution was not found for entry [' . $entry->getId() . '] and profile [' . $profile->getId() . ']');
             continue;
         }
         $fields = $profile->getAllFieldValues($entryDistribution);
         $flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
         $flavorAsset = reset($flavorAssets);
         $flavorAssetRemoteUrl = $entryDistribution->getFromCustomData(UverseEntryDistributionCustomDataField::REMOTE_ASSET_URL);
         $thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getThumbAssetIds()));
         $feed->addItem($fields, $flavorAsset, $flavorAssetRemoteUrl, $thumbAssets);
         // we want to find the newest update time between all entries
         if ($entry->getUpdatedAt(null) > $lastBuildDate) {
             $lastBuildDate = $entry->getUpdatedAt(null);
         }
     }
     $feed->setChannelLastBuildDate($lastBuildDate);
     header('Content-Type: text/xml');
     echo $feed->getXml();
     die;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:65,代码来源:UverseService.php

示例3: getEntryFilter

 protected function getEntryFilter($context, $keepScheduling = true)
 {
     // "Creates advanced filter on distribution profile
     $distributionAdvancedSearch = new ContentDistributionSearchFilter();
     $distributionAdvancedSearch->setDistributionProfileId($this->profile->getId());
     $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE);
     $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY);
     $distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false);
     //Creates entry filter with advanced filter
     $entryFilter = new entryFilter();
     $entryFilter->setStatusEquel(entryStatus::READY);
     $entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED);
     $entryFilter->setPartnerSearchScope($this->getPartnerId());
     $entryFilter->setAdvancedSearch($distributionAdvancedSearch);
     return $entryFilter;
 }
开发者ID:DBezemer,项目名称:server,代码行数:16,代码来源:UverseService.php

示例4: postInsert

 public function postInsert(PropelPDO $con = null)
 {
     parent::postInsert($con);
     if (!$this->getFeedId() || !$this->getId()) {
         return;
     }
     $syndicationFeed = syndicationFeedPeer::retrieveByPK($this->getFeedId());
     if (!$syndicationFeed || !$syndicationFeed instanceof genericSyndicationFeed) {
         return;
     }
     // "Creates advanced filter on distribution profile
     $distributionAdvancedSearch = new ContentDistributionSearchFilter();
     $distributionAdvancedSearch->setDistributionProfileId($this->getId());
     $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE);
     $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY);
     $distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE);
     //Creates entry filter with advanced filter
     $entryFilter = new entryFilter();
     $entryFilter->setPartnerIdEquel($this->getPartnerId());
     $entryFilter->setAdvancedSearch($distributionAdvancedSearch);
     // Creates playlist with entry filter
     $playlistXml = new SimpleXMLElement("<playlist/>");
     $filtersXml = $playlistXml->addChild("filters");
     $filterXml = $filtersXml->addChild("filter");
     $entryFilter->toXml($filterXml);
     $playlistContent = $playlistXml->asXML();
     // creates playlist based on the filter XML
     $playlist = new entry();
     $playlist->setKuserId(kCurrentContext::$uid);
     $playlist->setCreatorKuserId(kCurrentContext::$uid);
     $playlist->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM);
     $playlist->setPartnerId($this->getPartnerId());
     $playlist->setStatus(entryStatus::READY);
     $playlist->setKshowId(null);
     $playlist->setType(entryType::PLAYLIST);
     $playlist->setMediaType(entry::ENTRY_MEDIA_TYPE_XML);
     $playlist->setDataContent($playlistContent);
     $playlist->save();
     KalturaLog::log("Playlist [" . $playlist->getId() . "] created");
     // creates feed based on the playlist
     $syndicationFeed->setPlaylistId($playlist->getId());
     $syndicationFeed->save();
 }
开发者ID:DBezemer,项目名称:server,代码行数:43,代码来源:SyndicationDistributionProfile.php

示例5: getFeedAction

 /**
  * @action getFeed
  * @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY
  * @param int $distributionProfileId
  * @param string $hash
  * @return file
  */
 public function getFeedAction($distributionProfileId, $hash)
 {
     if (!$this->getPartnerId() || !$this->getPartner()) {
         throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $this->getPartnerId());
     }
     $profile = DistributionProfilePeer::retrieveByPK($distributionProfileId);
     if (!$profile || !$profile instanceof AttUverseDistributionProfile) {
         throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_NOT_FOUND, $distributionProfileId);
     }
     if ($profile->getStatus() != KalturaDistributionProfileStatus::ENABLED) {
         throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_DISABLED, $distributionProfileId);
     }
     if ($profile->getUniqueHashForFeedUrl() != $hash) {
         throw new KalturaAPIException(AttUverseDistributionErrors::INVALID_FEED_URL);
     }
     // "Creates advanced filter on distribution profile
     $distributionAdvancedSearch = new ContentDistributionSearchFilter();
     $distributionAdvancedSearch->setDistributionProfileId($profile->getId());
     $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE);
     $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY);
     $distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE);
     $distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false);
     //Creates entry filter with advanced filter
     $entryFilter = new entryFilter();
     $entryFilter->setStatusEquel(entryStatus::READY);
     $entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED);
     $entryFilter->setPartnerSearchScope($this->getPartnerId());
     $entryFilter->setAdvancedSearch($distributionAdvancedSearch);
     $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
     $baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL);
     $entryFilter->attachToCriteria($baseCriteria);
     $entries = entryPeer::doSelect($baseCriteria);
     $feed = new AttUverseDistributionFeedHelper('feed_template.xml', $profile);
     $channelTitle = $profile->getChannelTitle();
     $counter = 0;
     foreach ($entries as $entry) {
         /* @var $entry entry */
         /* @var $entryDistribution Entrydistribution */
         $entryDistribution = EntryDistributionPeer::retrieveByEntryAndProfileId($entry->getId(), $profile->getId());
         if (!$entryDistribution) {
             KalturaLog::err('Entry distribution was not found for entry [' . $entry->getId() . '] and profile [' . $profile->getId() . ']');
             continue;
         }
         $fields = $profile->getAllFieldValues($entryDistribution);
         //flavors assets and remote flavor asset file urls
         $flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFromCustomData(AttUverseEntryDistributionCustomDataField::DISTRIBUTED_FLAVOR_IDS)));
         $remoteAssetFileUrls = unserialize($entryDistribution->getFromCustomData(AttUverseEntryDistributionCustomDataField::REMOTE_ASSET_FILE_URLS));
         //thumb assets and remote thumb asset file urls
         $thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFromCustomData(AttUverseEntryDistributionCustomDataField::DISTRIBUTED_THUMBNAIL_IDS)));
         $remoteThumbailFileUrls = unserialize($entryDistribution->getFromCustomData(AttUverseEntryDistributionCustomDataField::REMOTE_THUMBNAIL_FILE_URLS));
         //thumb assets and remote thumb asset file urls
         $captionAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFromCustomData(AttUverseEntryDistributionCustomDataField::DISTRIBUTED_CAPTION_IDS)));
         $feed->addItem($fields, $flavorAssets, $remoteAssetFileUrls, $thumbAssets, $remoteThumbailFileUrls, $captionAssets);
         $counter++;
         //to avoid the cache exceeding the memory size
         if ($counter >= 100) {
             kMemoryManager::clearMemory();
             $counter = 0;
         }
     }
     //set channel title
     if (isset($fields)) {
         $channelTitle = $fields[AttUverseDistributionField::CHANNEL_TITLE];
     }
     $feed->setChannelTitle($channelTitle);
     header('Content-Type: text/xml');
     echo str_replace('&', '&amp;', html_entity_decode($feed->getXml(), ENT_QUOTES, 'UTF-8'));
     die;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:76,代码来源:AttUverseService.php

示例6: addEntryAdvancedSearchFilter

 private function addEntryAdvancedSearchFilter(KalturaCaptionAssetItemFilter $captionAssetItemFilter, entryFilter $entryCoreFilter)
 {
     //create advanced filter on entry caption
     $entryCaptionAdvancedSearch = new EntryCaptionAssetSearchFilter();
     $entryCaptionAdvancedSearch->setContentLike($captionAssetItemFilter->contentLike);
     $entryCaptionAdvancedSearch->setContentMultiLikeAnd($captionAssetItemFilter->contentMultiLikeAnd);
     $entryCaptionAdvancedSearch->setContentMultiLikeOr($captionAssetItemFilter->contentMultiLikeOr);
     $inputAdvancedSearch = $entryCoreFilter->getAdvancedSearch();
     if (!is_null($inputAdvancedSearch)) {
         $advancedSearchOp = new AdvancedSearchFilterOperator();
         $advancedSearchOp->setType(AdvancedSearchFilterOperator::SEARCH_AND);
         $advancedSearchOp->setItems(array($inputAdvancedSearch, $entryCaptionAdvancedSearch));
         $entryCoreFilter->setAdvancedSearch($advancedSearchOp);
     } else {
         $entryCoreFilter->setAdvancedSearch($entryCaptionAdvancedSearch);
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:17,代码来源:CaptionAssetItemService.php

示例7: getFeedAction

 /**
  * @action getFeed
  * @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY
  * @param int $distributionProfileId
  * @param string $hash
  * @param int $page
  * @param int $period
  * @param string $state
  * @param bool $ignoreScheduling
  * @return file
  */
 public function getFeedAction($distributionProfileId, $hash, $page = 1, $period = -1, $state = '', $ignoreScheduling = false)
 {
     if (!$this->getPartnerId() || !$this->getPartner()) {
         throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $this->getPartnerId());
     }
     $profile = DistributionProfilePeer::retrieveByPK($distributionProfileId);
     /* @var $profile DoubleClickDistributionProfile */
     if (!$profile || !$profile instanceof DoubleClickDistributionProfile) {
         throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_NOT_FOUND, $distributionProfileId);
     }
     if ($profile->getStatus() != KalturaDistributionProfileStatus::ENABLED) {
         throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_DISABLED, $distributionProfileId);
     }
     if ($profile->getUniqueHashForFeedUrl() != $hash) {
         throw new KalturaAPIException(DoubleClickDistributionErrors::INVALID_FEED_URL);
     }
     if (!$page || $page < 1) {
         $page = 1;
     }
     $stateLastEntryCreatedAt = null;
     $stateLastEntryIds = array();
     if ($state) {
         $stateDecoded = base64_decode($state);
         if (strpos($stateDecoded, '|') !== false) {
             $stateExploded = explode('|', $stateDecoded);
             $stateLastEntryCreatedAt = $stateExploded[0];
             $stateLastEntryIdsStr = $stateExploded[1];
             $stateLastEntryIds = explode(',', $stateLastEntryIdsStr);
         }
     }
     // "Creates advanced filter on distribution profile
     $distributionAdvancedSearch = new ContentDistributionSearchFilter();
     $distributionAdvancedSearch->setDistributionProfileId($profile->getId());
     if ($ignoreScheduling !== true && $profile->getIgnoreSchedulingInFeed() !== true) {
         $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE);
     }
     $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY);
     $distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE);
     $distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false);
     // Creates entry filter with advanced filter
     $entryFilter = new entryFilter();
     $entryFilter->setStatusEquel(entryStatus::READY);
     $entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED);
     $entryFilter->setPartnerSearchScope($this->getPartnerId());
     $entryFilter->setAdvancedSearch($distributionAdvancedSearch);
     $entryFilter->set('_order_by', '-created_at');
     if ($period && $period > 0) {
         $entryFilter->set('_gte_updated_at', time() - 24 * 60 * 60);
     }
     // last 24 hours
     // Dummy query to get the total count
     $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
     $baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL);
     $baseCriteria->setLimit(1);
     $entryFilter->attachToCriteria($baseCriteria);
     $entries = entryPeer::doSelect($baseCriteria);
     $totalCount = $baseCriteria->getRecordsCount();
     // Add the state data to proceed to next page
     if ($stateLastEntryCreatedAt) {
         $entryFilter->set('_lte_created_at', $stateLastEntryCreatedAt);
     }
     if ($stateLastEntryIds) {
         $entryFilter->set('_notin_id', $stateLastEntryIds);
     }
     $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
     $baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL);
     $baseCriteria->setLimit($profile->getItemsPerPage() + 1);
     // get +1 to check if we have next page
     $entryFilter->attachToCriteria($baseCriteria);
     $entries = entryPeer::doSelect($baseCriteria);
     $hasNextPage = false;
     if (count($entries) === $profile->getItemsPerPage() + 1) {
         // we tried to get (itemsPerPage + 1) entries, meaning we have another page
         $hasNextPage = true;
         unset($entries[$profile->getItemsPerPage()]);
     }
     // Find the state
     $entryIds = array();
     $nextPageStateLastEntryCreatedAt = $stateLastEntryCreatedAt;
     $nextPageStateLastEntryIds = $stateLastEntryIds;
     foreach ($entries as $entry) {
         $entryIds[] = $entry->getId();
         if ($nextPageStateLastEntryCreatedAt > $entry->getCreatedAt(null)) {
             $nextPageStateLastEntryIds = array();
         }
         $nextPageStateLastEntryIds[] = $entry->getId();
         $nextPageStateLastEntryCreatedAt = $entry->getCreatedAt(null);
     }
     // Construct the feed
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:DoubleClickService.php

示例8: getFeedAction

 /**
  * @action getFeed
  * @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY
  * @param int $distributionProfileId
  * @param string $hash
  * @return file
  */
 public function getFeedAction($distributionProfileId, $hash)
 {
     if (!$this->getPartnerId() || !$this->getPartner()) {
         throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $this->getPartnerId());
     }
     $profile = DistributionProfilePeer::retrieveByPK($distributionProfileId);
     if (!$profile || !$profile instanceof UverseClickToOrderDistributionProfile) {
         throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_NOT_FOUND, $distributionProfileId);
     }
     if ($profile->getStatus() != KalturaDistributionProfileStatus::ENABLED) {
         throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_DISABLED, $distributionProfileId);
     }
     if ($profile->getUniqueHashForFeedUrl() != $hash) {
         throw new KalturaAPIException(UverseClickToOrderDistributionErrors::INVALID_FEED_URL);
     }
     // "Creates advanced filter on distribution profile
     $distributionAdvancedSearch = new ContentDistributionSearchFilter();
     $distributionAdvancedSearch->setDistributionProfileId($profile->getId());
     $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE);
     $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY);
     $distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE);
     $distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false);
     //Creates entry filter with advanced filter
     $entryFilter = new entryFilter();
     $entryFilter->setStatusEquel(entryStatus::READY);
     $entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED);
     $entryFilter->setPartnerSearchScope($this->getPartnerId());
     $entryFilter->setAdvancedSearch($distributionAdvancedSearch);
     $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
     $baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL);
     $entryFilter->attachToCriteria($baseCriteria);
     $baseCriteria->addDescendingOrderByColumn(entryPeer::UPDATED_AT);
     $entries = entryPeer::doSelect($baseCriteria);
     $feed = new UverseClickToOrderFeed('feed_template.xml');
     $feed->setDistributionProfile($profile);
     //setting background images
     $wideBackgroundImageEntryId = $profile->getBackgroundImageWide();
     $standardBackgroundImageEntryId = $profile->getBackgroundImageStandard();
     $widedBackgroundImageUrl = $this->getImageUrl($wideBackgroundImageEntryId, '854', '480');
     $standardBackgroundImageUrl = $this->getImageUrl($standardBackgroundImageEntryId, '640', '480');
     $feed->setBackgroudImage($widedBackgroundImageUrl, $standardBackgroundImageUrl);
     //getting array of all related entries (categories that will appear in the xml)
     $relatedEntriesArray = array();
     //going through all entries and preparing an array with all related entries (categories) directing to the entires
     foreach ($entries as $entry) {
         $entryDistribution = EntryDistributionPeer::retrieveByEntryAndProfileId($entry->getId(), $profile->getId());
         if (!$entryDistribution) {
             KalturaLog::err('Entry distribution was not found for entry [' . $entry->getId() . '] and profile [' . $profile->getId() . ']');
             continue;
         }
         $fields = $profile->getAllFieldValues($entryDistribution);
         $relatedEntryId = $fields[UverseClickToOrderDistributionField::CATEGORY_ENTRY_ID];
         if (!isset($relatedEntriesArray[$relatedEntryId])) {
             $relatedEntry = entryPeer::retrieveByPK($relatedEntryId);
             $relatedEntrySortValue = $this->getRelatedEntrySortValue($profile, $relatedEntryId);
             $relatedEntriesArray[$relatedEntryId] = array();
             $relatedEntriesArray[$relatedEntryId]['sortValue'] = $relatedEntrySortValue;
             $relatedEntriesArray[$relatedEntryId]['updatedAt'] = $relatedEntry->getUpdatedAt();
             $relatedEntriesArray[$relatedEntryId]['relatedEntryId'] = $relatedEntryId;
         }
         $flavorAssets = array_map('trim', explode(',', $entryDistribution->getFlavorAssetIds()));
         $flavorAssetId = isset($flavorAssets[0]) ? $flavorAssets[0] : null;
         $flavorAsset = assetPeer::retrieveById($flavorAssetId);
         $flavorUrl = $flavorAsset ? $flavorAsset->getDownloadUrl() : $entry->getDownloadUrl();
         $thumbAssets = array_map('trim', explode(',', $entryDistribution->getThumbAssetIds()));
         $thumbAssetId = isset($thumbAssets[0]) ? $thumbAssets[0] : null;
         $thumbAsset = assetPeer::retrieveById($thumbAssetId);
         $thumbUrl = $thumbAsset ? $thumbAsset->getDownloadUrl() : $entry->getThumbnailUrl();
         $relatedEntriesArray[$relatedEntryId][] = array('id' => $entry->getId(), 'thumbnailUrl' => $thumbUrl, 'downloadUrl' => $flavorUrl, 'updatedAt' => $entry->getUpdatedAt(), 'sortValue' => $profile->getFieldValue($entryDistribution, UverseClickToOrderDistributionField::SORT_ITEMS_BY_FIELD));
     }
     //sorting the related entries.
     usort($relatedEntriesArray, array($this, 'sortItems'));
     //removing the values that where used for sorting.
     foreach ($relatedEntriesArray as $key => $relatedEntry) {
         $relatedEntryId = $relatedEntry['relatedEntryId'];
         unset($relatedEntry['relatedEntryId']);
         unset($relatedEntry['sortValue']);
         unset($relatedEntry['updatedAt']);
         unset($relatedEntriesArray[$key]);
         $relatedEntriesArray[$relatedEntryId] = $relatedEntry;
     }
     //retreive each category and add it to the xml
     foreach ($relatedEntriesArray as $relatedEntryId => $entriesUnderCategory) {
         //getting the related entry id object
         $relatedEntryObject = entryPeer::retrieveByPK($relatedEntryId);
         if (!$relatedEntryObject) {
             KalturaLog::err('Related Entry [' . $relatedEntryId . '] was not found');
             continue;
         }
         $categoryName = $relatedEntryObject->getName();
         $categoryFile = $relatedEntryObject->getThumbnailUrl() . '/width/' . $fields[UverseClickToOrderDistributionField::CATEGORY_IMAGE_WIDTH] . '/height/' . $fields[UverseClickToOrderDistributionField::CATEGORY_IMAGE_HEIGHT];
         $categoryNode = $feed->addCategory($categoryName, $categoryFile);
         usort($entriesUnderCategory, array($this, 'sortItems'));
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:UverseClickToOrderService.php


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