本文整理汇总了PHP中entryPeer::doSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP entryPeer::doSelect方法的具体用法?PHP entryPeer::doSelect怎么用?PHP entryPeer::doSelect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entryPeer
的用法示例。
在下文中一共展示了entryPeer::doSelect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntryFilter
protected function getEntryFilter($context, $keepScheduling = true)
{
$keepScheduling = $keepScheduling === true && $this->profile->getIgnoreSchedulingInFeed() !== true;
$entryFilter = parent::getEntryFilter($context, $keepScheduling);
$entryFilter->set('_order_by', '-created_at');
if ($context->period && $context->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);
$context->totalCount = $baseCriteria->getRecordsCount();
// Add the state data to proceed to next page
$this->fillStateDependentFields($context);
if ($context->stateLastEntryCreatedAt) {
$entryFilter->set('_lte_created_at', $context->stateLastEntryCreatedAt);
}
if ($context->stateLastEntryIds) {
$entryFilter->set('_notin_id', $context->stateLastEntryIds);
}
return $entryFilter;
}
示例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 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;
}
示例3: 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;
}
示例4: getEntries
function getEntries($con, $lastEntry, $entryLimitEachLoop)
{
$c = new Criteria();
$c->add(entryPeer::INT_ID, $lastEntry, Criteria::GREATER_THAN);
$c->addAnd(entryPeer::TYPE, entryType::LIVE_STREAM);
$c->addAscendingOrderByColumn(entryPeer::INT_ID);
$c->setLimit($entryLimitEachLoop);
return entryPeer::doSelect($c, $con);
}
示例5: doGetListResponse
protected function doGetListResponse(KalturaFilterPager $pager, array $types = null)
{
$this->validateEntryIdFiltered();
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
// verify access to the relevant entries - either same partner as the KS or kaltura network
if ($this->entryIdEqual) {
$entryIds = array($this->entryIdEqual);
} else {
if ($this->entryIdIn) {
$entryIds = explode(',', $this->entryIdIn);
} else {
throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL, 'KalturaAssetFilter::entryIdEqual/KalturaAssetFilter::entryIdIn');
}
}
$entryIds = array_slice($entryIds, 0, baseObjectFilter::getMaxInValues());
$c = KalturaCriteria::create(entryPeer::OM_CLASS);
$c->addAnd(entryPeer::ID, $entryIds, Criteria::IN);
$criterionPartnerOrKn = $c->getNewCriterion(entryPeer::PARTNER_ID, kCurrentContext::getCurrentPartnerId());
$criterionPartnerOrKn->addOr($c->getNewCriterion(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK));
$c->addAnd($criterionPartnerOrKn);
$dbEntries = entryPeer::doSelect($c);
if (!$dbEntries) {
return array(array(), 0);
}
$entryIds = array();
foreach ($dbEntries as $dbEntry) {
$entryIds[] = $dbEntry->getId();
}
$this->entryIdEqual = null;
$this->entryIdIn = implode(',', $entryIds);
// get the flavors
$flavorAssetFilter = new AssetFilter();
$this->toObject($flavorAssetFilter);
$c = new Criteria();
$flavorAssetFilter->attachToCriteria($c);
if ($types) {
$c->add(assetPeer::TYPE, $types, Criteria::IN);
}
$pager->attachToCriteria($c);
$list = assetPeer::doSelect($c);
$resultCount = count($list);
if ($resultCount && $resultCount < $pager->pageSize) {
$totalCount = ($pager->pageIndex - 1) * $pager->pageSize + $resultCount;
} else {
KalturaFilterPager::detachFromCriteria($c);
$totalCount = assetPeer::doCount($c);
}
myDbHelper::$use_alternative_con = null;
return array($list, $totalCount);
}
示例6: getListResponse
public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
{
$entryFilter = new QuizEntryFilter();
$entryFilter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE);
$this->toObject($entryFilter);
$c = KalturaCriteria::create(entryPeer::OM_CLASS);
if ($pager) {
$pager->attachToCriteria($c);
}
$entryFilter->attachToCriteria($c);
$list = entryPeer::doSelect($c);
$response = new KalturaQuizListResponse();
$response->objects = KalturaQuizArray::fromDbArray($list, $responseProfile);
$response->totalCount = $c->getRecordsCount();
return $response;
}
示例7: executeImpl
protected function executeImpl(kshow $kshow)
{
$asset_type = $this->getRequestParameter("type", entry::ENTRY_MEDIA_TYPE_VIDEO);
if ($asset_type > entry::ENTRY_MEDIA_TYPE_AUDIO || $asset_type < entry::ENTRY_MEDIA_TYPE_VIDEO) {
// TODO -
// trying to fetch invalid media type
}
$show_entry_id = $kshow->getShowEntryId();
$intro_id = $kshow->getIntroId();
$c = new Criteria();
$c->add(entryPeer::KUSER_ID, kuser::KUSER_KALTURA);
$c->add(entryPeer::TYPE, kuser::KUSER_KALTURA);
$this->entry_list = entryPeer::doSelect($c);
if ($this->entry_list == NULL) {
$this->entry_list = array();
}
}
示例8: execute
/**
* Will display errornous entries
*/
public function execute()
{
$this->forceSystemAuthentication();
entryPeer::setUseCriteriaFilter(false);
// find entries with status error
$c = new Criteria();
$c->add(entryPeer::STATUS, entryStatus::ERROR_CONVERTING);
$this->error_converting = entryPeer::doSelect($c);
$date_format = 'Y-m-d H:i:s';
$this->several_minutes_ago = time() - 5 * 60;
// 5 minutes ago //mktime(0, 0, 0, date("m"), date("d"), date("Y"));
$start_date = date($date_format, $this->several_minutes_ago);
$c = new Criteria();
$c->add(entryPeer::STATUS, array(entryStatus::IMPORT, entryStatus::PRECONVERT), Criteria::IN);
$c->add(entryPeer::UPDATED_AT, $start_date, Criteria::LESS_THAN);
$this->error_waiting_too_long = entryPeer::doSelect($c);
$this->start_date = $start_date;
}
示例9: createMetadata
public function createMetadata($kshow_id)
{
// echo ( "createMetadata for [$kshow_id]\n" );
$kshow = kshowPeer::retrieveByPK($kshow_id);
$show_entry_id = $kshow->getShowEntryId();
$intro_id = $kshow->getIntroId();
// fetch all entries for a kshow without the kshow entry or the intro
// the order is ascending by creation date of the entry
// if ordering by ascending ID - the intro will always be first
$c = new Criteria();
$c->add(entryPeer::KSHOW_ID, $kshow_id);
$c->add(entryPeer::ID, array($show_entry_id, $intro_id), Criteria::NOT_IN);
// $c->addDescendingOrderByColumn('(' . entryPeer::ID . '=' . $intro_id . ')');
$c->addAscendingOrderByColumn(entryPeer::ID);
// $c->add ( entryPeer::STATUS , entryStatus::READY );
// $c->addAscendingOrderByColumn( entryPeer::CREATED_AT );
$entry_list = entryPeer::doSelect($c);
// echo ( "kshow [$kshow_id] has " . count ( $entry_list ) . " entries\n" );
return $this->createMetadataForList($entry_list);
}
示例10: retrievEntriesByRoughcutIds
public static function retrievEntriesByRoughcutIds($entry_criteria, $roughcut_ids)
{
// first get all the roughcuts
$c = new Criteria();
// myCriteria::addComment( $c , __METHOD__ );
$c->addAnd(roughcutEntryPeer::ROUGHCUT_ID, $roughcut_ids, Criteria::IN);
$res = roughcutEntryPeer::doSelect($c);
if ($res) {
$entry_ids = array();
foreach ($res as $roughcut_entry) {
$entry_ids[] = $roughcut_entry->getEntryId();
}
// now fetch all the relevant entries
if ($entry_criteria == null) {
$entry_criteria = new Criteria();
}
$entry_criteria->add(entryPeer::ID, $entry_ids, Criteria::IN);
return entryPeer::doSelect($entry_criteria);
}
return array();
}
示例11: 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('&', '&', html_entity_decode($feed->getXml(), ENT_QUOTES, 'UTF-8'));
die;
}
示例12: getentrys
/**
* Gets an array of entry objects which contain a foreign key that references this object.
*
* If this collection has already been initialized with an identical Criteria, it returns the collection.
* Otherwise if this kuser has previously been saved, it will retrieve
* related entrys from storage. If this kuser is new, it will return
* an empty collection or the current collection, the criteria is ignored on a new object.
*
* @param PropelPDO $con
* @param Criteria $criteria
* @return array entry[]
* @throws PropelException
*/
public function getentrys($criteria = null, PropelPDO $con = null)
{
if ($criteria === null) {
$criteria = new Criteria(kuserPeer::DATABASE_NAME);
} elseif ($criteria instanceof Criteria) {
$criteria = clone $criteria;
}
if ($this->collentrys === null) {
if ($this->isNew()) {
$this->collentrys = array();
} else {
$criteria->add(entryPeer::KUSER_ID, $this->id);
entryPeer::addSelectColumns($criteria);
$this->collentrys = entryPeer::doSelect($criteria, $con);
}
} else {
// criteria has no effect for a new object
if (!$this->isNew()) {
// the following code is to determine if a new query is
// called for. If the criteria is the same as the last
// one, just return the collection.
$criteria->add(entryPeer::KUSER_ID, $this->id);
entryPeer::addSelectColumns($criteria);
if (!isset($this->lastentryCriteria) || !$this->lastentryCriteria->equals($criteria)) {
$this->collentrys = entryPeer::doSelect($criteria, $con);
}
}
}
$this->lastentryCriteria = $criteria;
return $this->collentrys;
}
示例13: sendAlertsForNewRoughcut
public static function sendAlertsForNewRoughcut($kshow, $likuser_id, $user_screenname)
{
$kshow_id = $kshow->getId();
// Send an email alert to producer
if ($kshow->getProducerId() != $likuser_id) {
// don't send producer alerts when the producer is the editor
alertPeer::sendEmailIfNeeded($kshow->getProducerId(), alert::KALTURAS_PRODUCED_ALERT_TYPE_ROUGHCUT_CREATED, array('screenname' => $user_screenname, 'kshow_name' => $kshow->getName(), 'kshow_id' => $kshow->getId()));
}
// TODO: efficiency: see if there is a wa to search for contributors based on some other method than full entry table scan
// Send email alerts to contributors
$c = new Criteria();
$c->add(entryPeer::KSHOW_ID, $kshow_id);
$c->add(entryPeer::KUSER_ID, $likuser_id, Criteria::NOT_EQUAL);
// the current user knows they just edited
$c->addAnd(entryPeer::KUSER_ID, $kshow->getProducerId(), Criteria::NOT_EQUAL);
// the producer knows they just edited
$c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
$c->addGroupByColumn(entryPeer::KUSER_ID);
$entries = entryPeer::doSelect($c);
$already_received_alert_array = array();
foreach ($entries as $entry) {
alertPeer::sendEmailIfNeeded($entry->getKuserId(), alert::KALTURAS_PARTOF_ALERT_TYPE_ROUGHCUT_CREATED, array('screenname' => $user_screenname, 'kshow_name' => $kshow->getName(), 'kshow_id' => $kshow->getId()));
$already_received_alert_array[$entry->getKuserId()] = true;
}
// send email alert to subscribers
$c = new Criteria();
$c->add(KshowKuserPeer::KSHOW_ID, $kshow_id);
//only subsribers of this show
$c->add(KshowKuserPeer::KUSER_ID, $likuser_id, Criteria::NOT_EQUAL);
// the current user knows they just edited
$c->add(KshowKuserPeer::SUBSCRIPTION_TYPE, KshowKuser::KSHOW_SUBSCRIPTION_NORMAL);
// this table stores other relations too
$subscriptions = KshowKuserPeer::doSelect($c);
foreach ($subscriptions as $subscription) {
if (!isset($already_received_alert_array[$subscription->getKuserId()])) {
// don't send emails to subscribed users who are also contributors
alertPeer::sendEmailIfNeeded($subscription->getKuserId(), alert::KALTURAS_SUBSCRIBEDTO_ALERT_TYPE_ROUGHCUT_CREATED, array('screenname' => $user_screenname, 'kshow_name' => $kshow->getName(), 'kshow_id' => $kshow->getId()));
}
}
}
示例14: executeImpl
/**
* This is not a regular service.
* Because the caller is not a partner but rather a 3rd party provider that wishs to query our system,
* The security is slightly different and the respons is in the format of mRss which is related to entries only.
*/
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
header("Content-Type: text/xml; charset=utf-8");
// TODO - verify permissions for viewing lists
// validate the ks of the caller
$code = $this->getP("code");
if ($code != 'fsalh5423a43g') {
return "<xml></xml>";
die;
}
$detailed = $this->getP("detailed", false);
$limit = $this->getP("page_size", 100);
$limit = $this->maxPageSize($limit);
$operated_partner_id = $this->getP("operated_partner_id");
$page = $this->getP("page", 1);
$offset = ($page - 1) * $limit;
// kuserPeer::setUseCriteriaFilter( false );
if ($operated_partner_id) {
entryPeer::setUseCriteriaFilter(true);
} else {
entryPeer::setUseCriteriaFilter(false);
}
// FOR now - display only 2 partners
// 2460 - dorimedia
$partner_list = array(593, 2460);
$c = KalturaCriteria::create(entryPeer::OM_CLASS);
$c->addAnd(entryPeer::STATUS, entryStatus::READY);
// for now display only entries that are part of the kaltura network
// $c->addAnd ( entryPeer::DISPLAY_IN_SEARCH , mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK );
// filter
$filter = new entryFilter();
$fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null);
$this->setExtraFilters($filter);
$offset = ($page - 1) * $limit;
$c->setLimit($limit);
if ($offset > 0) {
$c->setOffset($offset);
}
$filter->attachToCriteria($c);
//if ($order_by != -1) entryPeer::setOrder( $c , $order_by );
$c->addAnd(entryPeer::PARTNER_ID, $partner_list, Criteria::IN);
$start_1 = microtime(true);
if ($detailed) {
// for some entry types - there are no kshow or kusers - don't join even when detailed
if ($this->joinOnDetailed()) {
$list = entryPeer::doSelectJoinAll($c);
} else {
$list = entryPeer::doSelect($c);
}
$level = objectWrapperBase::DETAIL_LEVEL_DETAILED;
} else {
$list = entryPeer::doSelect($c);
$level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
}
$count = $c->getRecordsCount();
$end_1 = microtime(true);
KalturaLog::log("benchmark db: [" . ($end_1 - $start_1) . "]");
$result_count = count($list);
$start_2 = microtime(true);
$mrss_renderer = new kalturaRssRenderer(kalturaRssRenderer::TYPE_TABOOLA);
$str = $mrss_renderer->renderMrssFeed($list, $page, $result_count);
$end_2 = microtime(true);
KalturaLog::log("benchmark render: [" . ($end_2 - $start_2) . "]");
echo $str;
// don't return to the rest of the implementation - the base class manipulates the content.
die;
}
示例15: array
/**
return array('status' => $status, 'message' => $message, 'objects' => $objects);
objects - array of
'thumb'
'title'
'description'
'id' - unique id to be passed to getMediaInfo
*/
public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null)
{
$page_size = $pageSize > 20 ? 20 : $pageSize;
$page--;
if ($page < 0) {
$page = 0;
}
$status = "ok";
$message = '';
$objects = array();
$should_serach = true;
if (defined("KALTURA_API_V3")) {
$kuser = kuserPeer::getKuserByPartnerAndUid(self::$partner_id, self::$puser_id);
$should_serach = true;
$kuser_id = $kuser->getId();
} else {
$puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid(self::$partner_id, self::$subp_id, self::$puser_id, true);
if (!$puser_kuser) {
// very bad - does not exist in system
$should_serach = false;
} else {
$kuser = $puser_kuser->getKuser();
if (!$kuser) {
$should_serach = false;
} else {
$kuser_id = $kuser->getId();
}
}
}
// echo "[" . self::$partner_id . "],[". self::$subp_id . "],[" . self::$puser_id . "],[$kuser_id]";
if ($should_serach) {
$c = KalturaCriteria::create(entryPeer::OM_CLASS);
$c->add(entryPeer::KUSER_ID, $kuser_id);
$c->add(entryPeer::MEDIA_TYPE, $media_type);
$c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
// $keywords_array = mySearchUtils::getKeywordsFromStr ( $searchText );
$filter = new entryFilter();
$filter->setPartnerSearchScope(self::$partner_id);
$filter->addSearchMatchToCriteria($c, $searchText, entry::getSearchableColumnName());
$c->setLimit($pageSize);
$c->setOffset($page * $pageSize);
$entry_results = entryPeer::doSelect($c);
//JoinAll( $c );
$number_of_results = $c->getRecordsCount();
$number_of_pages = (int) ($number_of_results / $pageSize);
if ($number_of_results % $pageSize != 0) {
$number_of_pages += 1;
}
// if there are some left-overs - there must be a nother page
// add thumbs when not image or video
$should_add_thumbs = $media_type != entry::ENTRY_MEDIA_TYPE_AUDIO;
foreach ($entry_results as $entry) {
// send the id as the url
$object = array("id" => $entry->getId(), "url" => $entry->getDataUrl(), "tags" => $entry->getTags(), "title" => $entry->getName(), "description" => $entry->getDescription());
if ($should_add_thumbs) {
$object["thumb"] = $entry->getThumbnailUrl();
}
$objects[] = $object;
}
}
return array('status' => $status, 'message' => $message, 'objects' => $objects, "needMediaInfo" => self::$NEED_MEDIA_INFO);
}