本文整理汇总了PHP中KalturaCriteria类的典型用法代码示例。如果您正苦于以下问题:PHP KalturaCriteria类的具体用法?PHP KalturaCriteria怎么用?PHP KalturaCriteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KalturaCriteria类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Called on the server side and enables you to populate the object with any data from the DB
*
* @param KalturaDistributionJobData $distributionJobData
*/
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaFreewheelGenericDistributionProfile) {
return;
}
$this->videoAssetFilePaths = new KalturaStringArray();
// loads all the flavor assets that should be submitted to the remote destination site
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
foreach ($flavorAssets as $flavorAsset) {
$videoAssetFilePath = new KalturaString();
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$videoAssetFilePath->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->videoAssetFilePaths[] = $videoAssetFilePath;
}
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets)) {
$thumbAsset = reset($thumbAssets);
$syncKey = $thumbAssets->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
// entry cue points
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
$c->add(CuePointPeer::PARTNER_ID, $distributionJobData->entryDistribution->partnerId);
$c->add(CuePointPeer::ENTRY_ID, $distributionJobData->entryDistribution->entryId);
$c->add(CuePointPeer::TYPE, AdCuePointPlugin::getCuePointTypeCoreValue(AdCuePointType::AD));
$c->addAscendingOrderByColumn(CuePointPeer::START_TIME);
$cuePointsDb = CuePointPeer::doSelect($c);
$this->cuePoints = KalturaCuePointArray::fromDbArray($cuePointsDb);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:38,代码来源:KalturaFreewheelGenericDistributionJobProviderData.php
示例2: doGetListResponse
protected function doGetListResponse(KalturaFilterPager $pager, $type = null)
{
$this->validateEntryIdFiltered();
if (!is_null($this->userIdEqualCurrent) && $this->userIdEqualCurrent) {
$this->userIdEqual = kCurrentContext::getCurrentKsKuserId();
} else {
$this->translateUserIds();
}
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
if ($type) {
$c->add(CuePointPeer::TYPE, $type);
}
$entryIds = null;
if ($this->entryIdEqual) {
$entryIds = array($this->entryIdEqual);
} else {
if ($this->entryIdIn) {
$entryIds = explode(',', $this->entryIdIn);
}
}
if (!is_null($entryIds)) {
$entryIds = entryPeer::filterEntriesByPartnerOrKalturaNetwork($entryIds, kCurrentContext::getCurrentPartnerId());
if (!$entryIds) {
return array(array(), 0);
}
$this->entryIdEqual = null;
$this->entryIdIn = implode(',', $entryIds);
}
$cuePointFilter = $this->toObject();
$cuePointFilter->attachToCriteria($c);
$pager->attachToCriteria($c);
$list = CuePointPeer::doSelect($c);
return array($list, $c->getRecordsCount());
}
示例3: applyCondition
/**
* Adds conditions, matches and where clauses to the query
* @param IKalturaIndexQuery $query
*/
public function applyCondition(IKalturaDbQuery $query)
{
switch ($this->getComparison()) {
case KalturaSearchConditionComparison::EQUAL:
$comparison = ' = ';
break;
case KalturaSearchConditionComparison::GREATER_THAN:
$comparison = ' > ';
break;
case KalturaSearchConditionComparison::GREATER_THAN_OR_EQUAL:
$comparison = ' >= ';
break;
case KalturaSearchConditionComparison::LESS_THAN:
$comparison = " < ";
break;
case KalturaSearchConditionComparison::LESS_THAN_OR_EQUAL:
$comparison = " <= ";
break;
case KalturaSearchConditionComparison::NOT_EQUAL:
$comparison = " <> ";
break;
default:
KalturaLog::ERR("Missing comparison type");
return;
}
$field = $this->getField();
$value = $this->getValue();
$fieldValue = $this->getFieldValue($field);
if (is_null($fieldValue)) {
KalturaLog::err('Unknown field [' . $field . ']');
return;
}
$newCondition = $fieldValue . $comparison . KalturaCriteria::escapeString($value);
$query->addCondition($newCondition);
}
示例4: fetchPage
public function fetchPage($action, $filter, $my_pager, $base_criteria = null)
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
$keywords = @$_REQUEST["keywords"];
// $sort_alias is what is sent from the browser
$sort_alias = $this->sort_alias != null ? $this->sort_alias : @$_REQUEST["sort"];
// $keywords_array = mySearchUtils::getKeywordsFromStr ( $keywords );
if ($base_criteria != null) {
$c = $base_criteria;
} else {
$c = KalturaCriteria::create(entryPeer::OM_CLASS);
}
$filter->addSearchMatchToCriteria($c, $keywords, $this->getSearchableColumnName());
// each entity can do specific modifications to the criteria
$this->modifyCriteria($c);
if ($this->skip_count) {
$my_pager->attachCriteria($c, $this->getPeerMethod(), $this->getPeerCountMethod());
//$res = $my_pager->fetchPage(null , true , 0);
$res = $my_pager->fetchPage(null);
// , true , 0);
} else {
$my_pager->attachCriteria($c, $this->getPeerMethod(), $this->getPeerCountMethod());
$res = $my_pager->fetchPage();
}
return $res;
}
示例5: setDefaultCriteriaFilter
/**
* Creates default criteria filter
*/
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = KalturaCriteria::create(self::OM_CLASS);
self::$s_criteria_filter->setFilter($c);
}
示例6: 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;
}
示例7: 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;
}
示例8: getCuePoints
/**
* @param $partnerId
* @param $entryId
*/
protected function getCuePoints($partnerId, $entryId)
{
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
$c->add(CuePointPeer::PARTNER_ID, $partnerId);
$c->add(CuePointPeer::ENTRY_ID, $entryId);
$c->add(CuePointPeer::TYPE, AdCuePointPlugin::getCuePointTypeCoreValue(AdCuePointType::AD));
$c->addAscendingOrderByColumn(CuePointPeer::START_TIME);
return CuePointPeer::doSelect($c);
}
示例9: setDefaultCriteriaFilter
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = KalturaCriteria::create(kuserPeer::OM_CLASS);
$c->addAnd(kuserPeer::STATUS, KuserStatus::DELETED, KalturaCriteria::NOT_EQUAL);
self::$s_criteria_filter->setFilter($c);
}
示例10: setDefaultCriteriaFilter
/**
* Creates default criteria filter
*/
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = KalturaCriteria::create(KuserKgroupPeer::OM_CLASS);
$c->addAnd(KuserKgroupPeer::STATUS, array(KuserKgroupStatus::DELETED), Criteria::NOT_IN);
$c->addAnd(KuserKgroupPeer::PARTNER_ID, kCurrentContext::getCurrentPartnerId(), Criteria::EQUAL);
self::$s_criteria_filter->setFilter($c);
}
示例11: __construct
/**
* Called on the server side and enables you to populate the object with any data from the DB
*
* @param KalturaDistributionJobData $distributionJobData
*/
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaHuluDistributionProfile) {
return;
}
// loads all the flavor assets that should be submitted to the remote destination site
$flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
if (count($flavorAssets)) {
$flavorAsset = reset($flavorAssets);
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->videoAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$thumbAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->thumbAssetIds));
if (count($thumbAssets)) {
$thumbAsset = reset($thumbAssets);
$syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$this->thumbAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
}
$additionalAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->assetIds));
$this->captionLocalPaths = new KalturaStringArray();
if (count($additionalAssets)) {
$captionAssetFilePathArray = array();
foreach ($additionalAssets as $additionalAsset) {
$assetType = $additionalAsset->getType();
$syncKey = $additionalAsset->getSyncKey(CaptionAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
if ($assetType == CaptionPlugin::getAssetTypeCoreValue(CaptionAssetType::CAPTION) || $assetType == AttachmentPlugin::getAssetTypeCoreValue(AttachmentAssetType::ATTACHMENT)) {
$string = new KalturaString();
$string->value = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$this->captionLocalPaths[] = $string;
}
}
}
}
$tempFieldValues = unserialize($this->fieldValues);
$pattern = '/[^A-Za-z0-9_\\-]/';
$seriesTitle = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::SERIES_TITLE]);
$seasonNumber = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::SEASON_NUMBER]);
$videoEpisodeNumber = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::VIDEO_EPISODE_NUMBER]);
$videoTitle = preg_replace($pattern, '', $tempFieldValues[HuluDistributionField::VIDEO_TITLE]);
$this->fileBaseName = $seriesTitle . '-' . $seasonNumber . '-' . $videoEpisodeNumber . '-' . $videoTitle;
// entry cue points
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
$c->add(CuePointPeer::PARTNER_ID, $distributionJobData->entryDistribution->partnerId);
$c->add(CuePointPeer::ENTRY_ID, $distributionJobData->entryDistribution->entryId);
$c->add(CuePointPeer::TYPE, AdCuePointPlugin::getCuePointTypeCoreValue(AdCuePointType::AD));
$c->addAscendingOrderByColumn(CuePointPeer::START_TIME);
$cuePointsDb = CuePointPeer::doSelect($c);
$this->cuePoints = KalturaCuePointArray::fromDbArray($cuePointsDb);
}
示例12: applyCondition
/**
* Adds conditions, matches and where clauses to the query
* @param IKalturaDbQuery $query
*/
public function applyCondition(IKalturaDbQuery $query)
{
if (!$query instanceof IKalturaIndexQuery) {
return;
}
$matchText = '"' . KalturaCriteria::escapeString($this->value) . '"';
if ($this->not) {
$matchText = '!' . $matchText;
}
$query->addMatch("@{$this->field} (" . $matchText . ")");
}
示例13: resolveCategoryTag
function resolveCategoryTag(Tag $tag)
{
$c = KalturaCriteria::create(categoryPeer::OM_CLASS);
$c->add(categoryPeer::PARTNER_ID, $tag->getPartnerId());
$categoryFilter = new categoryFilter();
$categoryFilter->set('_mlikeand_tags', $tag->getTag());
$categoryFilter->attachToCriteria($c);
$count = $c->getRecordsCount();
if (!$count) {
$tag->delete();
}
}
示例14: setDefaultCriteriaFilter
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = KalturaCriteria::create(UserEntryPeer::OM_CLASS);
// when session is not admin, allow access to user's userEntries only
if (kCurrentContext::$ks && !kCurrentContext::$is_admin_session) {
$c->addAnd(UserEntryPeer::KUSER_ID, kCurrentContext::getCurrentKsKuserId());
}
self::$s_criteria_filter->setFilter($c);
}
示例15: setDefaultCriteriaFilter
/**
* Creates default criteria filter
*/
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = KalturaCriteria::create(self::OM_CLASS);
if (kEntitlementUtils::getEntitlementEnforcement()) {
$privacyContexts = kEntitlementUtils::getKsPrivacyContextArray();
$c->addAnd(self::PRIVACY_CONTEXT, $privacyContexts, Criteria::IN);
}
$c->addAnd(self::INSTANCE_COUNT, 0, Criteria::GREATER_THAN);
self::$s_criteria_filter->setFilter($c);
}