本文整理汇总了PHP中myPartnerUtils::isPartnerPermittedForCopy方法的典型用法代码示例。如果您正苦于以下问题:PHP myPartnerUtils::isPartnerPermittedForCopy方法的具体用法?PHP myPartnerUtils::isPartnerPermittedForCopy怎么用?PHP myPartnerUtils::isPartnerPermittedForCopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myPartnerUtils
的用法示例。
在下文中一共展示了myPartnerUtils::isPartnerPermittedForCopy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: copyMetadataProfiles
/**
* @param Partner $fromPartner
* @param Partner $toPartner
*/
protected function copyMetadataProfiles(Partner $fromPartner, Partner $toPartner, $permissionRequiredOnly = false)
{
$fromPartnerId = $fromPartner->getId();
$toPartnerId = $toPartner->getId();
KalturaLog::debug("Copy metadata profiles from [{$fromPartnerId}] to [{$toPartnerId}]");
$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();
}
}
}