本文整理汇总了PHP中myPartnerUtils::getPartnersArray方法的典型用法代码示例。如果您正苦于以下问题:PHP myPartnerUtils::getPartnersArray方法的具体用法?PHP myPartnerUtils::getPartnersArray怎么用?PHP myPartnerUtils::getPartnersArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myPartnerUtils
的用法示例。
在下文中一共展示了myPartnerUtils::getPartnersArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
sfView::SUCCESS;
/** check parameters and verify user is logged-in **/
$this->ks = $this->getP("kmcks");
if (!$this->ks) {
// if kmcks from cookie doesn't exist, try ks from REQUEST
$this->ks = $this->getP('ks');
}
/** if no KS found, redirect to login page **/
if (!$this->ks) {
$this->redirect("kmc/kmc");
die;
}
$ksObj = kSessionUtils::crackKs($this->ks);
// Set partnerId from KS
$this->partner_id = $ksObj->partner_id;
// Check if the KMC can be framed
$allowFrame = PermissionPeer::isValidForPartner(PermissionName::FEATURE_KMC_ALLOW_FRAME, $this->partner_id);
if (!$allowFrame) {
header('X-Frame-Options: DENY');
}
// Check for forced HTTPS
$force_ssl = PermissionPeer::isValidForPartner(PermissionName::FEATURE_KMC_ENFORCE_HTTPS, $this->partner_id);
if ($force_ssl && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) {
header("Location: " . infraRequestUtils::PROTOCOL_HTTPS . "://" . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"]);
die;
}
/** END - check parameters and verify user is logged-in **/
/** Get array of allowed partners for the current user **/
$allowedPartners = array();
$this->full_name = "";
$currentUser = kuserPeer::getKuserByPartnerAndUid($this->partner_id, $ksObj->user, true);
if ($currentUser) {
$partners = myPartnerUtils::getPartnersArray($currentUser->getAllowedPartnerIds());
foreach ($partners as $partner) {
$allowedPartners[] = array('id' => $partner->getId(), 'name' => $partner->getName());
}
$this->full_name = $currentUser->getFullName();
}
$this->showChangeAccount = count($allowedPartners) > 1 ? true : false;
// Load partner
$this->partner = $partner = PartnerPeer::retrieveByPK($this->partner_id);
if (!$partner) {
KExternalErrors::dieError(KExternalErrors::PARTNER_NOT_FOUND);
}
if (!$partner->validateApiAccessControl()) {
KExternalErrors::dieError(KExternalErrors::SERVICE_ACCESS_CONTROL_RESTRICTED);
}
kmcUtils::redirectPartnerToCorrectKmc($partner, $this->ks, null, null, null, self::CURRENT_KMC_VERSION);
$this->templatePartnerId = $this->partner ? $this->partner->getTemplatePartnerId() : self::SYSTEM_DEFAULT_PARTNER;
$ignoreEntrySeoLinks = PermissionPeer::isValidForPartner(PermissionName::FEATURE_IGNORE_ENTRY_SEO_LINKS, $this->partner_id);
$useEmbedCodeProtocolHttps = PermissionPeer::isValidForPartner(PermissionName::FEATURE_EMBED_CODE_DEFAULT_PROTOCOL_HTTPS, $this->partner_id);
$showFlashStudio = PermissionPeer::isValidForPartner(PermissionName::FEATURE_SHOW_FLASH_STUDIO, $this->partner_id);
$showHTMLStudio = PermissionPeer::isValidForPartner(PermissionName::FEATURE_SHOW_HTML_STUDIO, $this->partner_id);
$deliveryTypes = $partner->getDeliveryTypes();
$embedCodeTypes = $partner->getEmbedCodeTypes();
$defaultDeliveryType = $partner->getDefaultDeliveryType() ? $partner->getDefaultDeliveryType() : 'http';
$defaultEmbedCodeType = $partner->getDefaultEmbedCodeType() ? $partner->getDefaultEmbedCodeType() : 'auto';
$this->previewEmbedV2 = PermissionPeer::isValidForPartner(PermissionName::FEATURE_PREVIEW_AND_EMBED_V2, $this->partner_id);
/** set values for template **/
$this->service_url = requestUtils::getRequestHost();
$this->host = $this->stripProtocol($this->service_url);
$this->embed_host = $this->stripProtocol(myPartnerUtils::getHost($this->partner_id));
if (kConf::hasParam('cdn_api_host') && kConf::hasParam('www_host') && $this->host == kConf::get('cdn_api_host')) {
$this->host = kConf::get('www_host');
}
if ($this->embed_host == kConf::get("www_host") && kConf::hasParam('cdn_api_host')) {
$this->embed_host = kConf::get('cdn_api_host');
}
$this->embed_host_https = kConf::hasParam('cdn_api_host_https') ? kConf::get('cdn_api_host_https') : kConf::get('www_host');
$this->cdn_url = myPartnerUtils::getCdnHost($this->partner_id);
$this->cdn_host = $this->stripProtocol($this->cdn_url);
$this->rtmp_host = kConf::get("rtmp_url");
$this->flash_dir = $this->cdn_url . myContentStorage::getFSFlashRootPath();
/** set payingPartner flag **/
$this->payingPartner = 'false';
if ($partner && $partner->getPartnerPackage() != PartnerPackages::PARTNER_PACKAGE_FREE) {
$this->payingPartner = 'true';
$ignoreSeoLinks = true;
} else {
$ignoreSeoLinks = $this->partner->getIgnoreSeoLinks();
}
/** get partner languae **/
$language = null;
if ($partner->getKMCLanguage()) {
$language = $partner->getKMCLanguage();
}
$first_login = $partner->getIsFirstLogin();
if ($first_login === true) {
$partner->setIsFirstLogin(false);
$partner->save();
}
/** get logout url **/
$logoutUrl = null;
if ($partner->getLogoutUrl()) {
$logoutUrl = $partner->getLogoutUrl();
}
$this->kmc_swf_version = kConf::get('kmc_version');
$akamaiEdgeServerIpURL = null;
//.........这里部分代码省略.........
示例2: execute
public function execute()
{
sfView::SUCCESS;
/** check parameters and verify user is logged-in **/
$this->partner_id = $this->getP("pid");
$this->subp_id = $this->getP("subpid", (int) $this->partner_id * 100);
$this->uid = $this->getP("uid");
$this->ks = $this->getP("kmcks");
if (!$this->ks) {
// if kmcks from cookie doesn't exist, try ks from REQUEST
$this->ks = $this->getP('ks');
}
$this->screen_name = $this->getP("screen_name");
$this->email = $this->getP("email");
/** if no KS found, redirect to login page **/
if (!$this->ks) {
$this->redirect("kmc/kmc");
die;
}
$ksObj = kSessionUtils::crackKs($this->ks);
/** END - check parameters and verify user is logged-in **/
/** Get array of allowed partners for the current user **/
$this->allowedPartners = array();
$currentUser = kuserPeer::getKuserByPartnerAndUid($this->partner_id, $ksObj->user, true);
if ($currentUser) {
$partners = myPartnerUtils::getPartnersArray($currentUser->getAllowedPartnerIds());
foreach ($partners as $partner) {
$this->allowedPartners[] = array('id' => $partner->getId(), 'name' => $partner->getName());
}
$this->full_name = $currentUser->getFullName();
}
/** load partner from DB, and set templatePartnerId **/
$this->partner = $partner = null;
$this->templatePartnerId = self::SYSTEM_DEFAULT_PARTNER;
$this->ignoreSeoLinks = false;
$this->ignoreEntrySeoLinks = false;
$this->useEmbedCodeProtocolHttps = false;
$this->v2Flavors = false;
if ($this->partner_id !== NULL) {
$this->partner = $partner = PartnerPeer::retrieveByPK($this->partner_id);
kmcUtils::redirectPartnerToCorrectKmc($partner, $this->ks, $this->uid, $this->screen_name, $this->email, self::CURRENT_KMC_VERSION);
$this->templatePartnerId = $this->partner ? $this->partner->getTemplatePartnerId() : self::SYSTEM_DEFAULT_PARTNER;
$this->ignoreSeoLinks = $this->partner->getIgnoreSeoLinks();
$this->ignoreEntrySeoLinks = PermissionPeer::isValidForPartner(PermissionName::FEATURE_IGNORE_ENTRY_SEO_LINKS, $this->partner_id);
$this->useEmbedCodeProtocolHttps = PermissionPeer::isValidForPartner(PermissionName::FEATURE_EMBED_CODE_DEFAULT_PROTOCOL_HTTPS, $this->partner_id);
$this->v2Flavors = PermissionPeer::isValidForPartner(PermissionName::FEATURE_V2_FLAVORS, $this->partner_id);
}
/** END - load partner from DB, and set templatePartnerId **/
/** set default flags **/
$this->payingPartner = 'false';
$this->kdp508_players = array();
$this->first_login = false;
/** END - set default flags **/
/** set values for template **/
$this->service_url = myPartnerUtils::getHost($this->partner_id);
$this->host = $this->stripProtocol($this->service_url);
$this->embed_host = $this->host;
if (kConf::hasParam('cdn_api_host') && kConf::hasParam('www_host') && $this->host == kConf::get('cdn_api_host')) {
$this->host = kConf::get('www_host');
}
$this->cdn_url = myPartnerUtils::getCdnHost($this->partner_id);
$this->cdn_host = $this->stripProtocol($this->cdn_url);
$this->rtmp_host = myPartnerUtils::getRtmpUrl($this->partner_id);
$this->flash_dir = $this->cdn_url . myContentStorage::getFSFlashRootPath();
// Decide if to hide akamai delivery type
$this->hideAkamaiHDNetwork = $partner->getDisableAkamaiHDNetwork();
/** set payingPartner flag **/
if ($partner && $partner->getPartnerPackage() != PartnerPackages::PARTNER_PACKAGE_FREE) {
$this->payingPartner = 'true';
}
/** END - set payingPartner flag **/
/** get partner languae **/
$this->language = null;
if ($partner->getKMCLanguage()) {
$this->language = $partner->getKMCLanguage();
}
/** END - get partner languae **/
/** set first_login flag **/
$this->first_login = $partner->getIsFirstLogin();
if ($this->first_login === true) {
$partner->setIsFirstLogin(false);
$partner->save();
}
/** END - set first_login flag **/
/** get logout url **/
$this->logoutUrl = null;
if ($partner->getLogoutUrl()) {
$this->logoutUrl = $partner->getLogoutUrl();
}
/** END - get logout url**/
/** partner-specific: change KDP version for partners working with auto-moderaion **/
// set content kdp version according to partner id
$moderated_partners = array(31079, 28575, 32774);
$this->content_kdp_version = 'v2.7.0';
if (in_array($this->partner_id, $moderated_partners)) {
$this->content_kdp_version = 'v2.1.2.29057';
}
/** END - partner-specific: change KDP version for partners working with auto-moderaion **/
$this->kmc_swf_version = kConf::get('kmc_version');
/** uiconf listing work **/
//.........这里部分代码省略.........
示例3: listPartnersForUserAction
/**
* Retrieve a list of partner objects which the current user is allowed to access.
*
* @action listPartnersForUser
* @param KalturaPartnerFilter $partnerFilter
* @param KalturaFilterPager $pager
* @return KalturaPartnerListResponse
*
*/
public function listPartnersForUserAction(KalturaPartnerFilter $partnerFilter = null, KalturaFilterPager $pager = null)
{
$partnerId = kCurrentContext::$master_partner_id;
if (isset(kCurrentContext::$partner_id)) {
$partnerId = kCurrentContext::$partner_id;
}
$c = new Criteria();
$currentUser = kuserPeer::getKuserByPartnerAndUid($partnerId, kCurrentContext::$ks_uid, true);
if (!$currentUser) {
$userId = kCurrentContext::$ks_uid;
throw new kCoreException("User with id {$userId} not found", kCoreException::INVALID_USER_ID, $userId);
}
if (!$pager) {
$pager = new KalturaFilterPager();
}
$dbFilter = null;
if ($partnerFilter) {
$dbFilter = new partnerFilter();
$partnerFilter->toObject($dbFilter);
}
$allowedIds = $currentUser->getAllowedPartnerIds($dbFilter);
$pager->attachToCriteria($c);
$partners = array();
$partners = myPartnerUtils::getPartnersArray($allowedIds, $c);
$kalturaPartners = KalturaPartnerArray::fromPartnerArray($partners);
$response = new KalturaPartnerListResponse();
$response->objects = $kalturaPartners;
$response->totalCount = count($partners);
return $response;
}