本文整理汇总了PHP中Partner::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Partner::getId方法的具体用法?PHP Partner::getId怎么用?PHP Partner::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Partner
的用法示例。
在下文中一共展示了Partner::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Prepares the environment before running a test.
*/
protected function setUp()
{
parent::setUp();
$this->UserLoginData = new UserLoginData();
$this->dummyPartner = new Partner();
$this->dummyPartner->setName('TEST ONLY PARTNER!');
$this->dummyPartner->save();
$this->UserLoginData->setConfigPartnerId($this->dummyPartner->getId());
}
示例2: copyEventNotificationTemplates
/**
* @param Partner $fromPartner
* @param Partner $toPartner
*/
protected function copyEventNotificationTemplates(Partner $fromPartner, Partner $toPartner, $permissionRequiredOnly = false)
{
$fromPartnerId = $fromPartner->getId();
$toPartnerId = $toPartner->getId();
KalturaLog::debug("Copy event-notification templates from [{$fromPartnerId}] to [{$toPartnerId}]");
$c = new Criteria();
$c->add(EventNotificationTemplatePeer::PARTNER_ID, $fromPartnerId);
$systemNameCriteria = new Criteria();
$systemNameCriteria->add(EventNotificationTemplatePeer::PARTNER_ID, $toPartnerId);
$systemNameCriteria->add(EventNotificationTemplatePeer::STATUS, EventNotificationTemplateStatus::ACTIVE);
$eventNotificationTemplates = EventNotificationTemplatePeer::doSelect($c);
foreach ($eventNotificationTemplates as $eventNotificationTemplate) {
/* @var $eventNotificationTemplate EventNotificationTemplate */
if ($permissionRequiredOnly && !count($eventNotificationTemplate->getRequiredCopyTemplatePermissions())) {
continue;
}
if (!myPartnerUtils::isPartnerPermittedForCopy($toPartner, $eventNotificationTemplate->getRequiredCopyTemplatePermissions())) {
continue;
}
if ($eventNotificationTemplate->getSystemName()) {
$c = clone $systemNameCriteria;
$c->add(EventNotificationTemplatePeer::SYSTEM_NAME, $eventNotificationTemplate->getSystemName());
if (EventNotificationTemplatePeer::doCount($c)) {
continue;
}
}
$newEventNotificationTemplate = $eventNotificationTemplate->copy();
$newEventNotificationTemplate->setPartnerId($toPartnerId);
$newEventNotificationTemplate->save();
}
}
示例3: getPartnerId
public function getPartnerId()
{
if ($this->partner) {
return $this->partner->getId();
}
return null;
}
示例4: testAdminLoginUsersQuota
/**
* Tests user->add with adminLoginUsersQuota partner parameter
*/
public function testAdminLoginUsersQuota()
{
// check test prerequisites
$c = new Criteria();
$c->addAnd(kuserPeer::PARTNER_ID, $this->dummyPartner->getId());
$c->addAnd(kuserPeer::LOGIN_DATA_ID, NULL, Criteria::NOT_EQUAL);
$loginUsersNum = kuserPeer::doCount($c);
if ($loginUsersNum != 1) {
$this->fail('Partner [' . $this->dummyPartner->getId() . '] does not have only 1 user - test cannot proceed');
return;
}
$this->startSession(KalturaSessionType::ADMIN, null);
$newUser = $this->createUser(true, false, __FUNCTION__);
$newUser2 = $this->createUser(true, true, __FUNCTION__);
$newUser3 = $this->createUser(true, false, __FUNCTION__);
$newUser4 = $this->createUser(true, true, __FUNCTION__);
$newUser5 = $this->createUser(true, true, __FUNCTION__);
// check that a negative number means no new users possible
$this->dummyPartner->setAdminLoginUsersQuota(rand(-30, -2));
$this->dummyPartner->save();
$exceptionThrown = false;
try {
$this->addUser($newUser2);
} catch (Exception $e) {
$exceptionThrown = $e;
}
$this->checkException($exceptionThrown, 'ADMIN_LOGIN_USERS_QUOTA_EXCEEDED');
// check that null means no new users possible
$this->dummyPartner->setAdminLoginUsersQuota(null);
$this->dummyPartner->save();
$exceptionThrown = false;
try {
$this->addUser($newUser2);
} catch (Exception $e) {
$exceptionThrown = $e;
}
$this->checkException($exceptionThrown, 'ADMIN_LOGIN_USERS_QUOTA_EXCEEDED');
// try to add more users than the partner's quota
$this->dummyPartner->setAdminLoginUsersQuota(3);
$this->dummyPartner->save();
$this->assertType('KalturaUser', $this->addUser($newUser));
$this->assertType('KalturaUser', $this->addUser($newUser2));
$this->assertType('KalturaUser', $this->addUser($newUser5));
$exceptionThrown = false;
try {
$this->addUser($newUser4);
} catch (Exception $e) {
$exceptionThrown = $e;
}
$this->checkException($exceptionThrown, 'ADMIN_LOGIN_USERS_QUOTA_EXCEEDED');
$this->assertType('KalturaUser', $this->addUser($newUser3));
$this->dummyPartner->setAdminLoginUsersQuota(4);
$this->dummyPartner->save();
$this->assertType('KalturaUser', $this->addUser($newUser4));
}
示例5: redirectPartnerToCorrectKmc
public static function redirectPartnerToCorrectKmc(Partner $partner, $ks, $uid, $screenName, $email, $validatingKmc)
{
if ($validatingKmc == $partner->getKmcVersion()) {
return true;
}
$subpId = $partner->getId() * 100;
switch ($partner->getKmcVersion()) {
case 1:
$kmc1 = "/index.php/kmc/kmc1?partner_id=" . $partner->getId() . "&subp_id=" . $subpId . "&ks=" . $ks . "&uid=" . $uid . "&screen_name=" . $screenName . "&email=" . $email;
header("Location: " . $kmc1);
die;
break;
case 2:
case 3:
case 4:
default:
$ver = $partner->getKmcVersion();
$kmc_url = "/index.php/kmc/kmc{$ver}";
header("Location: " . $kmc_url);
die;
break;
}
}
示例6: copyMetadataProfiles
/**
* @param Partner $fromPartner
* @param Partner $toPartner
*/
protected function copyMetadataProfiles(Partner $fromPartner, Partner $toPartner, $permissionRequiredOnly = false)
{
$fromPartnerId = $fromPartner->getId();
$toPartnerId = $toPartner->getId();
$c = new Criteria();
$c->add(MetadataProfilePeer::PARTNER_ID, $fromPartnerId);
$systemNameCriteria = new Criteria();
$systemNameCriteria->add(MetadataProfilePeer::PARTNER_ID, $toPartnerId);
$systemNameCriteria->add(MetadataProfilePeer::STATUS, MetadataProfile::STATUS_ACTIVE);
$metadataProfiles = MetadataProfilePeer::doSelect($c);
foreach ($metadataProfiles as $metadataProfile) {
/* @var $metadataProfile MetadataProfile */
if ($permissionRequiredOnly && !count($metadataProfile->getRequiredCopyTemplatePermissions())) {
continue;
}
if (!myPartnerUtils::isPartnerPermittedForCopy($toPartner, $metadataProfile->getRequiredCopyTemplatePermissions())) {
continue;
}
if ($metadataProfile->getSystemName()) {
$c = clone $systemNameCriteria;
$c->add(MetadataProfilePeer::SYSTEM_NAME, $metadataProfile->getSystemName());
if (MetadataProfilePeer::doCount($c)) {
continue;
}
}
$newMetadataProfile = $metadataProfile->copy();
$newMetadataProfile->setPartnerId($toPartnerId);
$newMetadataProfile->save();
kFileSyncUtils::createSyncFileLinkForKey($newMetadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION), $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION));
kFileSyncUtils::createSyncFileLinkForKey($newMetadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_VIEWS), $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_VIEWS));
kFileSyncUtils::createSyncFileLinkForKey($newMetadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_XSLT), $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_XSLT));
$metadataProfileFields = MetadataProfileFieldPeer::retrieveByMetadataProfileId($metadataProfile->getId());
foreach ($metadataProfileFields as $metadataProfileField) {
$newMetadataProfileField = $metadataProfileField->copy();
$newMetadataProfileField->setMetadataProfileId($newMetadataProfile->getId());
$newMetadataProfileField->setPartnerId($toPartnerId);
$newMetadataProfileField->save();
}
}
}
示例7: fromPartner
public function fromPartner(Partner $partner)
{
//$item = new KalturaVarPartnerUsageItem();
if ($partner) {
$this->partnerStatus = $partner->getStatus();
$this->partnerId = $partner->getId();
$this->partnerName = $partner->getPartnerName();
$this->partnerCreatedAt = $partner->getCreatedAt(null);
$this->partnerPackage = $partner->getPartnerPackage();
}
//return $item;
}
示例8: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Partner $value A Partner object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Partner $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例9: setPartner
/**
* Declares an association between this object and a Partner object.
*
* @param Partner $v
* @return LiveChannelSegment The current object (for fluent API support)
* @throws PropelException
*/
public function setPartner(Partner $v = null)
{
if ($v === null) {
$this->setPartnerId(NULL);
} else {
$this->setPartnerId($v->getId());
}
$this->aPartner = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Partner object, it will not be re-added.
if ($v !== null) {
$v->addLiveChannelSegment($this);
}
return $this;
}
示例10: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Partner $value A Partner object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Partner $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) {
self::$instances[$key] = $obj;
kMemoryManager::registerPeer('PartnerPeer');
}
}
}
示例11: validateTemplatePartner
/**
* Validate the amount of core and plugin objects found on the template partner.
* @param Partner $templatePartner
*/
private function validateTemplatePartner(Partner $templatePartner)
{
//access control profiles
$c = new Criteria();
$c->add(accessControlPeer::PARTNER_ID, $templatePartner->getId());
$count = accessControlPeer::doCount($c);
if ($count > kConf::get('copy_partner_limit_ac_profiles')) {
throw new kCoreException("Template partner's number of [accessControlProfiles] objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
}
//categories
categoryPeer::setUseCriteriaFilter(false);
$c = new Criteria();
$c->addAnd(categoryPeer::PARTNER_ID, $templatePartner->getId());
$c->addAnd(categoryPeer::STATUS, CategoryStatus::ACTIVE);
$count = categoryPeer::doCount($c);
if ($count > kConf::get('copy_partner_limit_categories')) {
throw new kCoreException("Template partner's number of [category] objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
}
categoryPeer::setUseCriteriaFilter(true);
//conversion profiles
$c = new Criteria();
$c->add(conversionProfile2Peer::PARTNER_ID, $templatePartner->getId());
$count = conversionProfile2Peer::doCount($c);
if ($count > kConf::get('copy_partner_limit_conversion_profiles')) {
throw new kCoreException("Template partner's number of [conversionProfile] objects exceeds allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
}
//entries
entryPeer::setUseCriteriaFilter(false);
$c = new Criteria();
$c->addAnd(entryPeer::PARTNER_ID, $templatePartner->getId());
$c->addAnd(entryPeer::TYPE, entryType::MEDIA_CLIP);
$c->addAnd(entryPeer::STATUS, entryStatus::READY);
$count = entryPeer::doCount($c);
if ($count > kConf::get('copy_partner_limit_entries')) {
throw new kCoreException("Template partner's number of MEDIA_CLIP objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
}
entryPeer::setUseCriteriaFilter(true);
//playlists
entryPeer::setUseCriteriaFilter(false);
$c = new Criteria();
$c->addAnd(entryPeer::PARTNER_ID, $templatePartner->getId());
$c->addAnd(entryPeer::TYPE, entryType::PLAYLIST);
$c->addAnd(entryPeer::STATUS, entryStatus::READY);
$count = entryPeer::doCount($c);
if ($count > kConf::get('copy_partner_limit_playlists')) {
throw new kCoreException("Template partner's number of PLAYLIST objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
}
entryPeer::setUseCriteriaFilter(true);
//flavor params
$c = new Criteria();
$c->add(assetParamsPeer::PARTNER_ID, $templatePartner->getId());
$count = assetParamsPeer::doCount($c);
if ($count > kConf::get('copy_partner_limit_flavor_params')) {
throw new kCoreException("Template partner's number of [flavorParams] objects exceeds allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
}
//uiconfs
uiConfPeer::setUseCriteriaFilter(false);
$c = new Criteria();
$c->addAnd(uiConfPeer::PARTNER_ID, $templatePartner->getId());
$c->addAnd(uiConfPeer::OBJ_TYPE, array(uiConf::UI_CONF_TYPE_KDP3, uiConf::UI_CONF_TYPE_WIDGET), Criteria::IN);
$c->addAnd(uiConfPeer::STATUS, uiConf::UI_CONF_STATUS_READY);
$count = uiConfPeer::doCount($c);
if ($count > kConf::get('copy_partner_limit_ui_confs')) {
throw new kCoreException("Template partner's number of [uiconf] objects exceeds allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
}
uiConfPeer::setUseCriteriaFilter(true);
//user roles
UserRolePeer::setUseCriteriaFilter(false);
$c = new Criteria();
$c->addAnd(UserRolePeer::PARTNER_ID, $templatePartner->getId(), Criteria::EQUAL);
$c->addAnd(UserRolePeer::STATUS, UserRoleStatus::ACTIVE, Criteria::EQUAL);
$count = UserRolePeer::doCount($c);
if ($count > kConf::get('copy_partner_limit_user_roles')) {
throw new kCoreException("Template partner's number of [userRole] objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
}
UserRolePeer::setUseCriteriaFilter(true);
$validatorPlugins = KalturaPluginManager::getPluginInstances('IKalturaObjectValidator');
foreach ($validatorPlugins as $validatorPlugins) {
$validatorPlugins->validateObject($templatePartner, IKalturaObjectValidator::OPERATION_COPY);
}
}
示例12: copyEntry
public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
{
KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
$newEntry = $entry->copy();
$newEntry->setIntId(null);
$newEntry->setCategories(null);
$newEntry->setCategoriesIds(null);
if ($toPartner instanceof Partner) {
$newEntry->setPartnerId($toPartner->getId());
$newEntry->setSubpId($toPartner->getId() * 100);
$newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
}
$newKuser = null;
if (!$dontCopyUsers) {
// copy the kuser (if the same puser id exists its kuser will be used)
kuserPeer::setUseCriteriaFilter(false);
$kuser = $entry->getKuser();
$newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
$newEntry->setKuserId($newKuser->getId());
$newEntry->setCreatorKuserId($newKuser->getId());
kuserPeer::setUseCriteriaFilter(true);
}
// copy the kshow
kshowPeer::setUseCriteriaFilter(false);
$kshow = $entry->getKshow();
if ($kshow) {
$newKshow = $kshow->copy();
$newKshow->setIntId(null);
$newKshow->setPartnerId($toPartner->getId());
$newKshow->setSubpId($toPartner->getId() * 100);
if ($newKuser) {
$newKshow->setProducerId($newKuser->getId());
}
$newKshow->save();
$newEntry->setKshowId($newKshow->getId());
}
kshowPeer::setUseCriteriaFilter(true);
// reset the statistics
myEntryUtils::resetEntryStatistics($newEntry);
// set the new partner id into the default category criteria filter
$defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
$oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
// save the entry
$newEntry->save();
// restore the original partner id in the default category criteria filter
$defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
// for any type that does not require assets:
$shouldCopyDataForNonClip = true;
if ($entry->getType() == entryType::MEDIA_CLIP) {
$shouldCopyDataForNonClip = false;
}
if ($entry->getType() == entryType::PLAYLIST) {
$shouldCopyDataForNonClip = false;
}
$shouldCopyDataForClip = false;
// only images get their data copied
if ($entry->getType() == entryType::MEDIA_CLIP) {
if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_AUDIO) {
$shouldCopyDataForClip = true;
}
}
//if entry is a static playlist, link between it and its new child entries
if ($entry->getType() == entryType::PLAYLIST) {
switch ($entry->getMediaType()) {
case entry::ENTRY_MEDIA_TYPE_TEXT:
$from = $entry->getDataContent();
KalturaLog::debug("Entries to copy from source static playlist: [{$from}]");
$fromEntryIds = explode(",", $from);
$toEntryIds = array();
foreach ($fromEntryIds as $fromEntryId) {
$toEntryIds[] = kObjectCopyHandler::getMappedId(entryPeer::OM_CLASS, $fromEntryId);
}
$newEntry->setDataContent(implode(",", $toEntryIds));
break;
case entry::ENTRY_MEDIA_TYPE_XML:
list($totalResults, $fromFiltersList) = myPlaylistUtils::getPlaylistFilterListStruct($entry->getDataContent());
$toPlaylistXml = new SimpleXMLElement("<playlist/>");
$toPlaylistXml->addChild("total_results", $totalResults);
$toFiltersXml = $toPlaylistXml->addChild("filters");
foreach ($fromFiltersList as $filterXML) {
$entryFilter = new entryFilter();
$entryFilter->fillObjectFromXml($filterXML, "_");
if (isset($entryFilter->fields["_matchand_categories_ids"])) {
$categoriesIds = explode(",", $entryFilter->fields["_matchand_categories_ids"]);
$newCategoriesIds = array();
foreach ($categoriesIds as $categoryId) {
$newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
}
$entryFilter->fields["_matchand_categories_ids"] = implode(",", $newCategoriesIds);
}
if (isset($entryFilter->fields["_matchor_categories_ids"])) {
$categoriesIds = explode(",", $entryFilter->fields["_matchor_categories_ids"]);
$newCategoriesIds = array();
foreach ($categoriesIds as $categoryId) {
$newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
}
//.........这里部分代码省略.........
示例13: addBulkUploadJob
/**
* Function adds bulk upload job to the queue
* @param Partner $partner
* @param kBulkUploadJobData $jobData
* @param string $bulkUploadType
* @throws APIException
* @return BatchJob
*/
public static function addBulkUploadJob(Partner $partner, kBulkUploadJobData $jobData, $bulkUploadType = null, $objectId = null, $objectType = null)
{
KalturaLog::debug("adding BulkUpload job");
$job = new BatchJob();
$job->setPartnerId($partner->getId());
$job->setJobType(BatchJobType::BULKUPLOAD);
$job->setJobSubType($bulkUploadType);
if (!is_null($objectId) && !is_null($objectType)) {
$job->setObjectId($objectId);
$job->setObjectType($objectType);
}
if (is_null($jobData)) {
throw new APIException(APIErrors::BULK_UPLOAD_BULK_UPLOAD_TYPE_NOT_VALID, $bulkUploadType);
}
$job->setStatus(BatchJob::BATCHJOB_STATUS_DONT_PROCESS);
$job = kJobsManager::addJob($job, $jobData, BatchJobType::BULKUPLOAD, $bulkUploadType);
if (!is_null($jobData->getFilePath())) {
$syncKey = $job->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOAD);
// kFileSyncUtils::file_put_contents($syncKey, file_get_contents($csvFileData["tmp_name"]));
try {
kFileSyncUtils::moveFromFile($jobData->getFilePath(), $syncKey, true);
} catch (Exception $e) {
KalturaLog::err($e);
throw new APIException(APIErrors::BULK_UPLOAD_CREATE_CSV_FILE_SYNC_ERROR);
}
$filePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
$jobData->setFilePath($filePath);
}
if (!$jobData->getBulkUploadObjectType()) {
$jobData->setBulkUploadObjectType(BulkUploadObjectType::ENTRY);
}
if ($jobData->getBulkUploadObjectType() == BulkUploadObjectType::ENTRY && !$jobData->getObjectData()->getConversionProfileId()) {
$jobData->setConversionProfileId($partner->getDefaultConversionProfileId());
$kmcVersion = $partner->getKmcVersion();
$check = null;
if ($kmcVersion < 2) {
$check = ConversionProfilePeer::retrieveByPK($jobData->getConversionProfileId());
} else {
$check = conversionProfile2Peer::retrieveByPK($jobData->getConversionProfileId());
}
if (!$check) {
throw new APIException(APIErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $jobData->getConversionProfileId());
}
}
$job->setData($jobData);
return kJobsManager::updateBatchJob($job, BatchJob::BATCHJOB_STATUS_PENDING);
}
示例14: copyEntry
public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
{
KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
$newEntry = $entry->copy();
$newEntry->setIntId(null);
$newEntry->setCategories(null);
$newEntry->setCategoriesIds(null);
if ($toPartner instanceof Partner) {
$newEntry->setPartnerId($toPartner->getId());
$newEntry->setSubpId($toPartner->getId() * 100);
$newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
}
$newKuser = null;
if (!$dontCopyUsers) {
// copy the kuser (if the same puser id exists its kuser will be used)
kuserPeer::setUseCriteriaFilter(false);
$kuser = $entry->getKuser();
$newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
$newEntry->setKuserId($newKuser->getId());
$newEntry->setCreatorKuserId($newKuser->getId());
kuserPeer::setUseCriteriaFilter(true);
}
// copy the kshow
kshowPeer::setUseCriteriaFilter(false);
$kshow = $entry->getKshow();
if ($kshow) {
$newKshow = $kshow->copy();
$newKshow->setIntId(null);
$newKshow->setPartnerId($toPartner->getId());
$newKshow->setSubpId($toPartner->getId() * 100);
if ($newKuser) {
$newKshow->setProducerId($newKuser->getId());
}
$newKshow->save();
$newEntry->setKshowId($newKshow->getId());
}
kshowPeer::setUseCriteriaFilter(true);
// reset the statistics
myEntryUtils::resetEntryStatistics($newEntry);
// set the new partner id into the default category criteria filter
$defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
$oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
// save the entry
$newEntry->save();
// restore the original partner id in the default category criteria filter
$defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
$defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
if ($entry->getStatus() != entryStatus::READY) {
$clonePendingEntries = $entry->getClonePendingEntries();
$clonePendingEntries[] = $newEntry->getId();
$entry->setClonePendingEntries($clonePendingEntries);
$entry->save();
} else {
self::copyEntryData($entry, $newEntry);
}
//if entry is a static playlist, link between it and its new child entries
if ($entry->getType() == entryType::PLAYLIST) {
switch ($entry->getMediaType()) {
case entry::ENTRY_MEDIA_TYPE_TEXT:
$from = $entry->getDataContent();
KalturaLog::debug("Entries to copy from source static playlist: [{$from}]");
$fromEntryIds = explode(",", $from);
$toEntryIds = array();
foreach ($fromEntryIds as $fromEntryId) {
$toEntryIds[] = kObjectCopyHandler::getMappedId(entryPeer::OM_CLASS, $fromEntryId);
}
$newEntry->setDataContent(implode(",", $toEntryIds));
break;
case entry::ENTRY_MEDIA_TYPE_XML:
list($totalResults, $fromFiltersList) = myPlaylistUtils::getPlaylistFilterListStruct($entry->getDataContent());
$toPlaylistXml = new SimpleXMLElement("<playlist/>");
$toPlaylistXml->addChild("total_results", $totalResults);
$toFiltersXml = $toPlaylistXml->addChild("filters");
foreach ($fromFiltersList as $filterXML) {
$entryFilter = new entryFilter();
$entryFilter->fillObjectFromXml($filterXML, "_");
if (isset($entryFilter->fields["_matchand_categories_ids"])) {
$categoriesIds = explode(",", $entryFilter->fields["_matchand_categories_ids"]);
$newCategoriesIds = array();
foreach ($categoriesIds as $categoryId) {
$newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
}
$entryFilter->fields["_matchand_categories_ids"] = implode(",", $newCategoriesIds);
}
if (isset($entryFilter->fields["_matchor_categories_ids"])) {
$categoriesIds = explode(",", $entryFilter->fields["_matchor_categories_ids"]);
$newCategoriesIds = array();
foreach ($categoriesIds as $categoryId) {
$newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
}
$entryFilter->fields["_matchor_categories_ids"] = implode(",", $newCategoriesIds);
}
if (isset($entryFilter->fields["_in_category_ancestor_id"])) {
$categoriesIds = explode(",", $entryFilter->fields["_in_category_ancestor_id"]);
$newCategoriesIds = array();
foreach ($categoriesIds as $categoryId) {
$newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
//.........这里部分代码省略.........
示例15: getWhitelabelData
public static function getWhitelabelData(Partner $partner, $param = null)
{
// no param, return null
if (!$param) {
return null;
}
if (kConf::hasMap("whitelabel")) {
$whitelabel = kConf::getMap("whitelabel");
$params = array();
// Search for partner Id
if (array_key_exists($partner->getId(), $whitelabel)) {
$params = $whitelabel[$partner->getId()];
} else {
if (array_key_exists($partner->getPartnerParentId(), $whitelabel)) {
$params = $whitelabel[$partner->getPartnerParentId()];
}
}
// If we have params, find out param
if (is_array($params) && array_key_exists($param, $params)) {
return $params[$param];
}
return null;
}
return null;
}