本文整理汇总了PHP中entryPeer::retrieveByPKs方法的典型用法代码示例。如果您正苦于以下问题:PHP entryPeer::retrieveByPKs方法的具体用法?PHP entryPeer::retrieveByPKs怎么用?PHP entryPeer::retrieveByPKs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entryPeer
的用法示例。
在下文中一共展示了entryPeer::retrieveByPKs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
if (!$puser_kuser) {
$this->addError(APIErrors::INVALID_USER_ID, $puser_id);
return;
}
$time_offset = $this->getPM("time_offset");
$entry_ids = $this->getPM("entry_ids");
$detailed = $this->getP("detailed", false);
$separator = $this->getP("separator", ",");
$id_arr = explode($separator, $entry_ids);
$limit = 50;
$id_arr = array_splice($id_arr, 0, $limit);
$entries = entryPeer::retrieveByPKs($id_arr);
$updated_entries = array();
if (!$entries) {
$this->addError(APIErrors::INVALID_ENTRY_IDS, $entry_ids);
} else {
foreach ($entries as $entry) {
if (!myEntryUtils::createThumbnailFromEntry($entry, $entry, $time_offset)) {
$this->addError(APIErrors::INVALID_ENTRY_TYPE, "ENTRY_TYPE_MEDIACLIP [" . $entry->getId() . "]");
continue;
}
$updated_entries[] = $entry;
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_THUMBNAIL, $entry);
$wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_DETAILED);
$wrapper->removeFromCache("entry", $entry->getId());
}
}
$this->addMsg("entries", objectWrapperBase::getWrapperClass($updated_entries, objectWrapperBase::DETAIL_LEVEL_REGULAR));
}
示例2: execute
/**
* Will investigate a single entry
*/
public function execute()
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
$this->forceSystemAuthentication();
entryPeer::setUseCriteriaFilter(false);
$this->result = NULL;
$kshow_ids = @$_REQUEST["kshow_ids"];
$this->kshow_ids = $kshow_ids;
$this->kshow = NULL;
$entry_ids = @$_REQUEST["entry_ids"];
$this->entry_ids = $entry_ids;
$this->entry = NULL;
$this->show_entry = null;
$show_entry_list = array();
if (!empty($kshow_ids)) {
$ids_arr = explode(",", $kshow_ids);
$kshows = kshowPeer::retrieveByPKs($ids_arr);
if (!$kshows) {
$this->result = "No kshows [{$kshow_ids}] in DB";
return;
}
foreach ($kshows as $kshow) {
$show_entry = $kshow->getShowEntry();
$show_entry_list[] = $show_entry;
}
} else {
if (empty($entry_ids)) {
$this->result = "Submit an entry_id of a kshow_id to fix";
return;
}
$ids_arr = explode(",", $entry_ids);
$entries = entryPeer::retrieveByPKs($ids_arr);
if (!$entries) {
$this->result = "No entries [{$entry_ids}] in DB";
return;
}
foreach ($entries as $entry) {
if ($entry->getType() != entryType::MIX) {
continue;
}
$show_entry_list[] = $entry;
}
}
$fixed_data_list = array();
foreach ($show_entry_list as $show_entry) {
$fix_data = new fixData();
$fix_data->show_entry = $show_entry;
if ($show_entry->getType() != entryType::MIX) {
$fix_data->error = "Entry is not a roughcut";
} else {
$fix_data->old_content = $show_entry->getMetadata();
$fix_data->old_duration = $show_entry->getLengthInMsecs();
$fix_data->fixed_content = $show_entry->fixMetadata(false);
$fix_data->fixed_duration = $show_entry->getLengthInMsecs();
}
$fixed_data_list[] = $fix_data;
}
$this->fixed_data_list = $fixed_data_list;
}
示例3: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
$entry_ids = str_replace(" ", "", $this->getPM("entry_ids"));
$detailed = $this->getP("detailed", false);
$separator = $this->getP("separator", ",");
$id_arr = explode($separator, $entry_ids);
$limit = 50;
$id_arr = array_splice($id_arr, 0, $limit);
$entries = entryPeer::retrieveByPKs($id_arr);
if (!$entries) {
$this->addError(APIErrors::INVALID_ENTRY_IDS, $entry_ids);
} else {
$level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
$extra_fields = $this->getExtraFields();
if ($extra_fields) {
$this->addMsg("entries", objectWrapperBase::getWrapperClass($entries, $level, objectWrapperBase::DETAIL_VELOCITY_DEFAULT, 0, $extra_fields));
} else {
$this->addMsg("entries", objectWrapperBase::getWrapperClass($entries, $level));
}
}
}
示例4: exportToCsvAction
/**
* @action exportToCsv
* @param KalturaLiveReportExportType $reportType
* @param KalturaLiveReportExportParams $params
* @return KalturaLiveReportExportResponse
*/
public function exportToCsvAction($reportType, KalturaLiveReportExportParams $params)
{
if (!$params->recpientEmail) {
$kuser = kCurrentContext::getCurrentKsKuser();
if ($kuser) {
$params->recpientEmail = $kuser->getEmail();
} else {
$partnerId = kCurrentContext::getCurrentPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
$params->recpientEmail = $partner->getAdminEmail();
}
}
// Validate input
if ($params->entryIds) {
$entryIds = explode(",", $params->entryIds);
$entries = entryPeer::retrieveByPKs($entryIds);
if (count($entryIds) != count($entries)) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $params->entryIds);
}
}
$dbBatchJob = kJobsManager::addExportLiveReportJob($reportType, $params);
$res = new KalturaLiveReportExportResponse();
$res->referenceJobId = $dbBatchJob->getId();
$res->reportEmail = $params->recpientEmail;
return $res;
}
示例5: ini_set
<?php
ini_set("memory_limit", "256M");
define('ROOT_DIR', realpath(dirname(__FILE__) . '/../../'));
require_once ROOT_DIR . '/infra/bootstrap_base.php';
require_once ROOT_DIR . '/infra/KAutoloader.php';
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"));
KAutoloader::setClassMapFilePath('../cache/classMap.cache');
KAutoloader::register();
error_reporting(E_ALL);
KalturaLog::setLogger(new KalturaStdoutLogger());
$dbConf = array('datasources' => array('default' => 'propel', 'propel' => array('adapter' => 'mysql', 'connection' => array('classname' => 'KalturaPDO', 'phptype' => 'mysql', 'database' => 'kaltura', 'hostspec' => '192.168.192.4', 'user' => 'kaltura', 'password' => 'kaltura', 'dsn' => 'mysql:host=192.168.192.4;dbname=kaltura;user=kaltura;password=kaltura;')), 'propel2' => array('adapter' => 'mysql', 'connection' => array('classname' => 'KalturaPDO', 'phptype' => 'mysql', 'database' => 'kaltura', 'hostspec' => '192.168.192.4', 'user' => 'kaltura_read', 'password' => 'kaltura_read', 'dsn' => 'mysql:host=192.168.192.4;dbname=kaltura;user=kaltura_read;password=kaltura_read;')), 'propel3' => array('adapter' => 'mysql', 'connection' => array('classname' => 'KalturaPDO', 'phptype' => 'mysql', 'database' => 'kaltura', 'hostspec' => '192.168.192.4', 'user' => 'kaltura_read', 'password' => 'kaltura_read', 'dsn' => 'mysql:host=192.168.192.4;dbname=kaltura;user=kaltura_read;password=kaltura_read;'))), 'log' => array('ident' => 'kaltura', 'level' => '7'));
//$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
$entryIds = array("0_dborm9lg", "0_imoflf6p", "0_3wm9a6t5", "0_cic44kil", "0_t4yew63l", "0_j1w2l0uo", "0_hmfl6yqm", "0_j4ciu5i8", "0_9exkfida", "0_t8i28aed", "0_mfzy6fk8", "0_8iy78nc9", "0_k8ymic7i", "0_kebpfp7z", "0_f4wb8f7o", "0_21hgvyre", "0_yc4frw3n", "0_xcrrzimo", "0_ttu09fn8", "0_nv77ncna", "0_dx18o48f", "0_ssuzmxjb", "0_7o9752ad", "0_pdzuunaa", "0_tymuie23", "0_vt8j64df", "0_dn3be3s1", "0_1naibde2", "0_0215mb05", "0_l1qu67u2", "0_0qpt6fbl", "0_o9xrvyv3", "0_rjlbesk0", "0_0riz850n", "8ix7p4nf6s", "0_3bpvujdf", "0_ddhyy406", "0_jdzti6gj", "g940g7miui", "0_o6m9rxsx", "0_qbujfju1", "s5qjpsjdnq", "s1m3dg09dw", "4tl281rhe8", "0_r6ehikfb", "0_s1ymi20f", "0_c087s9fw", "0_0jxtpm3o", "0_bi1oond7", "0_26xr3ht9", "0_tt5bc5xi", "0_3vxvcx0c", "0_336gw1eq", "0_a7nnunh6", "0_bs3jytlv", "0_r5abi3sz", "0_107z8t15", "0_5y5jlxga", "8z8ejn2c05", "0_ls0qsskt", "scs2tb20nc", "kuag5odijy", "c3o8gn8zoy", "0_pjmp0pk5", "0_qepjemqa", "0_phw09gy2", "0_byhgfhm2", "0_cgdx8az5", "0_jyfskrz1", "0_taz94tkf", "0_tpg7dxfz", "0_jdnikam7", "0_faxgi5zh", "0_8q6agy4v", "0_za7d1dlv", "0_9rq9j3ue", "0_90x6alrf", "0_sgj0jpbp", "0_dzqp2hve", "0_2vo8i3zm", "0_pbj0mewb", "0_ecjqlvcx", "0_qwx5tnnh", "0_csow76ak", "0_ippmvqxb", "0_5haayn3s", "0_scx59ihb", "0_e3c218nb", "0_tsokmp6i", "0_6ffche90", "0_qo5oa2aa", "0_grjmi99x", "0_c43tio3q", "0_wdp2nukp", "0_im7bqzvs", "0_8znu0fzn", "0_r88o5k28", "0_lm0ctgv4", "0_861czc6n", "0_fxybu3tb", "0_dl09yagk", "fgh8g7uc4c", "0_3ruyl4so", "0_uz9wwbi0", "0_i0wm8ylp", "0_gj2hfml9", "0_k5fttrmg", "0_ucqrdlm7", "0_semkx9jy", "0_js9xbszt", "0_oho170pf", "kzawobh3ty", "0_a2ph89tt", "irp1nztkts", "66r541rpjs", "0_lrrvlb7w", "0_0k002875", "0_vx5hb6jn", "0_l4liidjf", "0_g3nzwjdz", "0_uqxgy01f", "0_ugw90c4t", "0_tf1dd91a", "0_30eeu66b", "mov5ips91k", "6ir3dui0d0", "0_opitrvgr", "0_oc5vhd33", "0_plefn9cl", "0_0stl9gvz", "0_vth1aakn", "0_eyqbhsq9", "0_52na77mr", "0_7yi05auv", "0_dh11mjm2", "0_4evhzdbl", "dz727fptf0", "0_xqncw5pv", "0_2rl97bry", "0_x8uxq77g", "0_9784h9p5", "0_hwhdajmr", "0_fuqs22j4", "4la8ruega0", "0_zoq8xc3k", "0_beiaainf", "0_v0agxi9k", "umuobsfqos", "sfmrr36r5c", "0_63sprljk", "0_ktgi5sdv", "0_j5w9grsg", "0_z4rvq5m3", "sns6g8rp40", "0_szhtu39v", "wkwm07e2mw", "0_3mp68oqn", "0_un7q4ujm", "0_k9yu4jt2", "h2a4caf7nk", "fvjac6zlmk", "36ko97bsy4", "0_6pqen4pp", "gmvioznyq0", "gkiq0jsp90", "q6ojro0zhg", "0_fwectuev", "0_n04gvx36", "0_5aot3gzv", "p21ippxs70", "ncrww3l4j4", "q3fucnyueo", "58bjik2zbc", "3ck2qf1rnk", "dk2957a76g", "heo5zst99c", "ri5waxv6hs", "gtthmlm78s", "yzcgjotw0o", "6o4z2tp314", "0_d90mqlli", "qfnu55tt7k", "ybugoe78ai", "6h1pb6f3to", "1k9vxhvpk0", "2lvaw1odvm", "2i8t6vxyuo", "3nkrks76w4", "0_xjdcym4v", "0_ez86zub3", "0_xjnit0g7", "0_njp5gk8s", "dfoymlus6t");
$sizeFile = fopen('size.csv', 'a');
$entries = entryPeer::retrieveByPKs($entryIds);
foreach ($entries as $entry) {
$size = myEntryUtils::calcStorageSize($entry);
fputcsv($sizeFile, array($size, $entry->getId()));
}
fclose($sizeFile);
echo 'Done';
示例6: 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;
}
示例7: deepClone
public static function deepClone(kshow $source_kshow, &$new_entries)
{
$target_kshow = $source_kshow->copy();
// will have to save to retrieve the id from the DB.
$target_kshow->save();
$target_id = $target_kshow->getId();
echo "Creating new kshow {$target_id}\n";
$special_entries = array();
$special_entries[] = $source_kshow->getShowEntryId();
$special_entries[] = $source_kshow->getIntroId();
$skin = $source_kshow->getSkinObj();
///bg_entry_id=2171&bg_entry_path=/content/entry/data/0/2/2171_100000.jpg
$bg_entry_id = $skin->get("bg_entry_id");
$special_entries[] = $bg_entry_id;
echo "special entry_ids: " . print_r($special_entries, true);
// clone the show_entry and intro
$entries = entryPeer::retrieveByPKs($special_entries);
echo "special entries count " . count($entries) . "\n";
// it's hard to assume the order - if a PK was not found, there is no placeholder
foreach ($entries as $entry) {
$new_entry = myEntryUtils::deepClone($entry, $target_id, NULL);
$new_entries[] = $new_entry;
if ($entry->getId() == $source_kshow->getShowEntryId()) {
echo "ShowEntry:\n";
$target_kshow->setShowEntryId($new_entry->getId());
} elseif ($entry->getId() == $source_kshow->getIntroId()) {
echo "Intro:\n";
$target_kshow->setIntroId($new_entry->getId());
} elseif ($entry->getId() == $bg_entry_id) {
echo "Background:\n";
$skin->set("bg_entry_id", $new_entry->getId());
$skin->set("bg_entry_path", $new_entry->getDataPath());
// replaced__getDataPath
} else {
// ERROR !
}
}
$source_thumbnail_path = $source_kshow->getThumbnailPath();
$target_kshow->setThumbnail($source_kshow->getThumbnail());
$target_thumbnail_path = $target_kshow->getThumbnailPath();
// TODO - don't copy files if poiting to templates !
$content = myContentStorage::getFSContentRootPath();
// echo ( "Background - copying file: " . $content . $source_thumbnail_path . " -> " . $content . $target_thumbnail_path ."\n");
// myContentStorage::moveFile( $content . $source_thumbnail_path , $content . $target_thumbnail_path , false , true );
self::resetKshowStats($target_kshow);
$target_kshow->save();
$c = new Criteria();
$c->add(entryPeer::KSHOW_ID, $source_kshow->getId());
// don't clope the entries that were alredt cloned
$c->add(entryPeer::ID, $special_entries, Criteria::NOT_IN);
$entries = entryPeer::doSelect($c);
foreach ($entries as $entry) {
$new_entry = myEntryUtils::deepClone($entry, $target_id, NULL);
$new_entries[] = $new_entry;
}
echo "Ended creating new kshow {$target_id}. " . count($new_entries) . " entries copied\n";
return $target_kshow;
}
示例8: getAllRoughcuts
public static function getAllRoughcuts($entry_id)
{
$roughcut_id_list = array();
$roughcut_entry_list = roughcutEntryPeer::retrievByEntryId($entry_id);
// print_r ( $roughcut_entry_list );
foreach ($roughcut_entry_list as $roughcut_entry) {
$roughcut_id = $roughcut_entry->getRoughcutId();
// see there will be
if (in_array($roughcut_id, $roughcut_id_list)) {
continue;
}
if (self::isEntryInRoughcut($roughcut_entry_list, $entry_id, $roughcut_id)) {
// $roughcut = $roughcut_entry->getRoughcut();
$roughcut_id_list[] = $roughcut_id;
}
}
if (count($roughcut_id_list) > 0) {
$roughcut_list = entryPeer::retrieveByPKs($roughcut_id_list);
} else {
$roughcut_list = array();
}
return $roughcut_list;
}
示例9: getListResponse
public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
{
if ($this->entryIdEqual == null && $this->categoryIdIn == null && $this->categoryIdEqual == null && (kEntitlementUtils::getEntitlementEnforcement() || !kCurrentContext::$is_admin_session)) {
throw new KalturaAPIException(KalturaErrors::MUST_FILTER_ON_ENTRY_OR_CATEGORY);
}
if (kEntitlementUtils::getEntitlementEnforcement()) {
//validate entitl for entry
if ($this->entryIdEqual != null) {
$entry = entryPeer::retrieveByPK($this->entryIdEqual);
if (!$entry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $this->entryIdEqual);
}
}
//validate entitl for entryIn
if ($this->entryIdIn != null) {
$entry = entryPeer::retrieveByPKs($this->entryIdIn);
if (!$entry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $this->entryIdIn);
}
}
//validate entitl categories
if ($this->categoryIdIn != null) {
$categoryIdInArr = explode(',', $this->categoryIdIn);
if (!categoryKuserPeer::areCategoriesAllowed($categoryIdInArr)) {
$categoryIdInArr = array_unique($categoryIdInArr);
}
$entitledCategories = categoryPeer::retrieveByPKs($categoryIdInArr);
if (!count($entitledCategories) || count($entitledCategories) != count($categoryIdInArr)) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->categoryIdIn);
}
$categoriesIdsUnlisted = array();
foreach ($entitledCategories as $category) {
if ($category->getDisplayInSearch() == DisplayInSearchType::CATEGORY_MEMBERS_ONLY) {
$categoriesIdsUnlisted[] = $category->getId();
}
}
if (count($categoriesIdsUnlisted)) {
if (!categoryKuserPeer::areCategoriesAllowed($categoriesIdsUnlisted)) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->categoryIdIn);
}
}
}
//validate entitl category
if ($this->categoryIdEqual != null) {
$category = categoryPeer::retrieveByPK($this->categoryIdEqual);
if (!$category && kCurrentContext::$master_partner_id != Partner::BATCH_PARTNER_ID) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->categoryIdEqual);
}
if ($category->getDisplayInSearch() == DisplayInSearchType::CATEGORY_MEMBERS_ONLY && !categoryKuserPeer::retrievePermittedKuserInCategory($category->getId(), kCurrentContext::getCurrentKsKuserId())) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->categoryIdEqual);
}
}
}
$categoryEntryFilter = $this->toObject();
$c = KalturaCriteria::create(categoryEntryPeer::OM_CLASS);
$categoryEntryFilter->attachToCriteria($c);
if (!kEntitlementUtils::getEntitlementEnforcement() || $this->entryIdEqual == null) {
$pager->attachToCriteria($c);
}
$dbCategoriesEntry = categoryEntryPeer::doSelect($c);
if (kEntitlementUtils::getEntitlementEnforcement() && count($dbCategoriesEntry) && $this->entryIdEqual != null) {
//remove unlisted categories: display in search is set to members only
$categoriesIds = array();
foreach ($dbCategoriesEntry as $dbCategoryEntry) {
$categoriesIds[] = $dbCategoryEntry->getCategoryId();
}
$c = KalturaCriteria::create(categoryPeer::OM_CLASS);
$c->add(categoryPeer::ID, $categoriesIds, Criteria::IN);
$pager->attachToCriteria($c);
$c->applyFilters();
$categoryIds = $c->getFetchedIds();
foreach ($dbCategoriesEntry as $key => $dbCategoryEntry) {
if (!in_array($dbCategoryEntry->getCategoryId(), $categoryIds)) {
KalturaLog::info('Category [' . print_r($dbCategoryEntry->getCategoryId(), true) . '] is not listed to user');
unset($dbCategoriesEntry[$key]);
}
}
$totalCount = $c->getRecordsCount();
} else {
$resultCount = count($dbCategoriesEntry);
if ($resultCount && $resultCount < $pager->pageSize) {
$totalCount = ($pager->pageIndex - 1) * $pager->pageSize + $resultCount;
} else {
KalturaFilterPager::detachFromCriteria($c);
$totalCount = categoryEntryPeer::doCount($c);
}
}
$categoryEntrylist = KalturaCategoryEntryArray::fromDbArray($dbCategoriesEntry, $responseProfile);
$response = new KalturaCategoryEntryListResponse();
$response->objects = $categoryEntrylist;
$response->totalCount = $totalCount;
// no pager since category entry is limited to ENTRY::MAX_CATEGORIES_PER_ENTRY
return $response;
}
示例10: getUserPrecentageByUserAndEntryTable
protected function getUserPrecentageByUserAndEntryTable($entryIds, $inputFilter, $orderBy)
{
$userIds = $this->getUserIdsFromFilter($inputFilter);
$noEntryIds = QuizPlugin::isWithoutValue($entryIds);
$noUserIds = QuizPlugin::isWithoutValue($userIds);
if ($noEntryIds && $noUserIds) {
return array();
}
$c = new Criteria();
if (!$noUserIds) {
$c->add(UserEntryPeer::KUSER_ID, $this->getKuserIds($userIds), Criteria::IN);
}
if (!$noEntryIds) {
$entryIdsArray = explode(",", $entryIds);
$dbEntries = entryPeer::retrieveByPKs($entryIdsArray);
if (empty($dbEntries)) {
throw new kCoreException("", kCoreException::INVALID_ENTRY_ID, $entryIds);
}
$c->add(UserEntryPeer::ENTRY_ID, $entryIdsArray, Criteria::IN);
$hasAnonymous = false;
foreach ($dbEntries as $dbEntry) {
$anonKuserIds = $this->getAnonymousKuserIds($dbEntry->getPartnerId());
if (!empty($anonKuserIds)) {
$hasAnonymous = true;
break;
}
}
if ($hasAnonymous) {
$c->addAnd(UserEntryPeer::KUSER_ID, $anonKuserIds, Criteria::NOT_IN);
}
}
$userEntries = UserEntryPeer::doSelect($c);
return $this->getAggregateDataForUsers($userEntries, $orderBy);
}
示例11: getByIdsAction
/**
* Get an array of KalturaBaseEntry objects by a comma-separated list of ids.
*
* @action getByIds
* @param string $entryIds Comma separated string of entry ids
* @return KalturaBaseEntryArray Array of base entry ids
*/
function getByIdsAction($entryIds)
{
$entryIdsArray = explode(",", $entryIds);
// remove white spaces
foreach ($entryIdsArray as &$entryId) {
$entryId = trim($entryId);
}
$list = entryPeer::retrieveByPKs($entryIdsArray);
$newList = array();
$ks = $this->getKs();
$isAdmin = false;
if ($ks) {
$isAdmin = $ks->isAdmin();
}
foreach ($list as $dbEntry) {
$entry = KalturaEntryFactory::getInstanceByType($dbEntry->getType(), $isAdmin);
$entry->fromObject($dbEntry);
$newList[] = $entry;
}
return $newList;
}
示例12: getBulkUploadMrssXml
/**
* Returns the log file for bulk upload job
* @param BatchJob $batchJob bulk upload batchjob
* @return SimpleXMLElement
*/
public static function getBulkUploadMrssXml($batchJob)
{
$actionsMap = array(BulkUploadAction::ADD => 'add', BulkUploadAction::UPDATE => 'update', BulkUploadAction::DELETE => 'delete');
$bulkUploadResults = BulkUploadResultPeer::retrieveByBulkUploadId($batchJob->getId());
if (!count($bulkUploadResults)) {
return null;
}
header("Content-Type: text/xml; charset=UTF-8");
$data = $batchJob->getData();
$xmlElement = new SimpleXMLElement('<mrss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>');
$xmlElement->addAttribute('version', '2.0');
// $xmlElement->addAttribute('xmlns:content', 'http://www.w3.org/2001/XMLSchema-instance');
// $xmlElement->addAttribute('xmlns', 'http://' . kConf::get('www_host') . '/' . SchemaType::SYNDICATION);
// $xmlElement->addAttribute('xsi:noNamespaceSchemaLocation', 'http://' . kConf::get('cdn_host') . '/api_v3/service/schema/action/serve/type/' . SchemaType::SYNDICATION);
$channel = $xmlElement->addChild('channel');
// insert all entries to instance pool
$pks = array();
foreach ($bulkUploadResults as $bulkUploadResult) {
/* @var $bulkUploadResult BulkUploadResult */
$pks[] = $bulkUploadResult->getEntryId();
}
entryPeer::retrieveByPKs($pks);
foreach ($bulkUploadResults as $bulkUploadResult) {
/* @var $bulkUploadResult BulkUploadResult */
$item = $channel->addChild('item');
$result = $item->addChild('result');
$result->addChild('errorDescription', self::stringToSafeXml($bulkUploadResult->getErrorDescription()));
// $result->addChild('entryStatus', self::stringToSafeXml($bulkUploadResult->getEntryStatus()));
// $result->addChild('entryStatusName', self::stringToSafeXml($title));
$action = isset($actionsMap[$bulkUploadResult->getAction()]) ? $actionsMap[$bulkUploadResult->getAction()] : $actionsMap[BulkUploadAction::ADD];
$item->addChild('action', $action);
$entry = $bulkUploadResult->getObject();
if (!$entry) {
continue;
}
kMrssManager::getEntryMrssXml($entry, $item);
}
return $xmlElement;
}
示例13: searchEntriesAction
/**
* Search caption asset items by filter, pager and free text
*
* @action searchEntries
* @param KalturaBaseEntryFilter $entryFilter
* @param KalturaCaptionAssetItemFilter $captionAssetItemFilter
* @param KalturaFilterPager $captionAssetItemPager
* @return KalturaBaseEntryListResponse
*/
public function searchEntriesAction(KalturaBaseEntryFilter $entryFilter = null, KalturaCaptionAssetItemFilter $captionAssetItemFilter = null, KalturaFilterPager $captionAssetItemPager = null)
{
if (!$captionAssetItemPager) {
$captionAssetItemPager = new KalturaFilterPager();
}
if (!$captionAssetItemFilter) {
$captionAssetItemFilter = new KalturaCaptionAssetItemFilter();
}
$captionAssetItemFilter->validatePropertyNotNull(array("contentLike", "contentMultiLikeOr", "contentMultiLikeAnd"));
$captionAssetItemCoreFilter = new CaptionAssetItemFilter();
$captionAssetItemFilter->toObject($captionAssetItemCoreFilter);
$entryIdChunks = array(NULL);
if ($entryFilter || kEntitlementUtils::getEntitlementEnforcement()) {
$entryCoreFilter = new entryFilter();
if ($entryFilter) {
$entryFilter->toObject($entryCoreFilter);
}
$entryCoreFilter->setPartnerSearchScope($this->getPartnerId());
$this->addEntryAdvancedSearchFilter($captionAssetItemFilter, $entryCoreFilter);
$entryCriteria = KalturaCriteria::create(entryPeer::OM_CLASS);
$entryCoreFilter->attachToCriteria($entryCriteria);
$entryCriteria->setLimit(self::MAX_NUMBER_OF_ENTRIES);
$entryCriteria->applyFilters();
$entryIds = $entryCriteria->getFetchedIds();
if (!$entryIds || !count($entryIds)) {
$entryIds = array('NOT_EXIST');
}
$entryIdChunks = array_chunk($entryIds, self::SIZE_OF_ENTRIES_CHUNK);
}
$entries = array();
$counter = 0;
$shouldSortCaptionFiltering = $entryFilter->orderBy ? true : false;
$captionAssetItemCriteria = KalturaCriteria::create(CaptionAssetItemPeer::OM_CLASS);
$captionAssetItemCoreFilter->attachToCriteria($captionAssetItemCriteria);
$captionAssetItemCriteria->setGroupByColumn('str_entry_id');
$captionAssetItemCriteria->setSelectColumn('str_entry_id');
foreach ($entryIdChunks as $chunk) {
$currCriteria = clone $captionAssetItemCriteria;
if ($chunk) {
$currCriteria->add(CaptionAssetItemPeer::ENTRY_ID, $chunk, KalturaCriteria::IN);
} else {
$captionAssetItemPager->attachToCriteria($currCriteria);
}
$currCriteria->applyFilters();
$currEntries = $currCriteria->getFetchedIds();
//sorting this chunk according to results of first sphinx query
if ($shouldSortCaptionFiltering) {
$currEntries = array_intersect($entryIds, $currEntries);
}
$entries = array_merge($entries, $currEntries);
$counter += $currCriteria->getRecordsCount();
}
$inputPageSize = $captionAssetItemPager->pageSize;
$inputPageIndex = $captionAssetItemPager->pageIndex;
//page index & size validation - no negative values & size not too big
$pageSize = max(min($inputPageSize, baseObjectFilter::getMaxInValues()), 0);
$pageIndex = max($captionAssetItemPager::MIN_PAGE_INDEX, $inputPageIndex) - 1;
$firstIndex = $pageSize * $pageIndex;
$entries = array_slice($entries, $firstIndex, $pageSize);
$dbList = entryPeer::retrieveByPKs($entries);
if ($shouldSortCaptionFiltering) {
//results ids mapping
$entriesMapping = array();
foreach ($dbList as $item) {
$entriesMapping[$item->getId()] = $item;
}
$dbList = array();
foreach ($entries as $entryId) {
if (isset($entriesMapping[$entryId])) {
$dbList[] = $entriesMapping[$entryId];
}
}
}
$list = KalturaBaseEntryArray::fromDbArray($dbList, $this->getResponseProfile());
$response = new KalturaBaseEntryListResponse();
$response->objects = $list;
$response->totalCount = $counter;
return $response;
}
示例14: getBulkUploadMrssXml
/**
* Returns the log file for bulk upload job
* @param BatchJob $batchJob bulk upload batchjob
* @return SimpleXMLElement
*/
public static function getBulkUploadMrssXml($batchJob)
{
$actionsMap = array(BulkUploadAction::ADD => 'add', BulkUploadAction::UPDATE => 'update', BulkUploadAction::DELETE => 'delete');
$criteria = new Criteria();
$criteria->add(BulkUploadResultPeer::BULK_UPLOAD_JOB_ID, $batchJob->getId());
$criteria->addAscendingOrderByColumn(BulkUploadResultPeer::LINE_INDEX);
$criteria->setLimit(100);
$bulkUploadResults = BulkUploadResultPeer::doSelect($criteria);
if (!count($bulkUploadResults)) {
return null;
}
header("Content-Type: text/xml; charset=UTF-8");
$data = $batchJob->getData();
$xmlElement = new SimpleXMLElement('<mrss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>');
$xmlElement->addAttribute('version', '2.0');
$channel = $xmlElement->addChild('channel');
$handledResults = 0;
while (count($bulkUploadResults)) {
$handledResults += count($bulkUploadResults);
// insert all entries to instance pool
$pks = array();
foreach ($bulkUploadResults as $bulkUploadResult) {
/* @var $bulkUploadResult BulkUploadResult */
$pks[] = $bulkUploadResult->getEntryId();
}
entryPeer::retrieveByPKs($pks);
foreach ($bulkUploadResults as $bulkUploadResult) {
/* @var $bulkUploadResult BulkUploadResult */
$item = $channel->addChild('item');
$result = $item->addChild('result');
$result->addChild('errorDescription', self::stringToSafeXml($bulkUploadResult->getErrorDescription()));
// $result->addChild('entryStatus', self::stringToSafeXml($bulkUploadResult->getEntryStatus()));
// $result->addChild('entryStatusName', self::stringToSafeXml($title));
$action = isset($actionsMap[$bulkUploadResult->getAction()]) ? $actionsMap[$bulkUploadResult->getAction()] : $actionsMap[BulkUploadAction::ADD];
$item->addChild('action', $action);
$entry = $bulkUploadResult->getObject();
if (!$entry) {
continue;
}
kMrssManager::getEntryMrssXml($entry, $item);
}
if (count($bulkUploadResults) < $criteria->getLimit()) {
break;
}
kMemoryManager::clearMemory();
$criteria->setOffset($handledResults);
$bulkUploadResults = BulkUploadResultPeer::doSelect($criteria);
}
return $xmlElement;
}
示例15: dirname
<?php
require_once dirname(__FILE__) . '/../bootstrap.php';
$playlists = entryPeer::retrieveByPKs(array('_KMCSPL1', '_KMCSPL2'));
foreach ($playlists as $playlist) {
/* @var $playlist entry */
$criteria = new Criteria();
$criteria->add(FileSyncPeer::OBJECT_TYPE, FileSyncObjectType::ENTRY);
$criteria->add(FileSyncPeer::OBJECT_SUB_TYPE, entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
$criteria->add(FileSyncPeer::OBJECT_ID, $playlist->getId());
$criteria->add(FileSyncPeer::PARTNER_ID, 0);
$criteria->add(FileSyncPeer::DC, 0);
$criteria->add(FileSyncPeer::ORIGINAL, true);
$criteria->add(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
$criteria->addDescendingOrderByColumn(FileSyncPeer::ID);
$fileSync = FileSyncPeer::doSelectOne($criteria);
$playlist->setData($fileSync->getVersion(), true);
$playlist->save();
}
KalturaLog::debug('Done');