本文整理汇总了PHP中assetParamsPeer::filterPartner方法的典型用法代码示例。如果您正苦于以下问题:PHP assetParamsPeer::filterPartner方法的具体用法?PHP assetParamsPeer::filterPartner怎么用?PHP assetParamsPeer::filterPartner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetParamsPeer
的用法示例。
在下文中一共展示了assetParamsPeer::filterPartner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPartnerToCriteria
public static function addPartnerToCriteria($partnerId, $privatePartnerData = false, $partnerGroup = null, $kalturaNetwork = null)
{
self::$filterPartner = $partnerId;
if (!self::$isDefaultInDefaultCriteria) {
return parent::addPartnerToCriteria($partnerId, $privatePartnerData, $partnerGroup, $kalturaNetwork);
}
$criteriaFilter = self::getCriteriaFilter();
$criteria = $criteriaFilter->getFilter();
if (!$privatePartnerData) {
// the private partner data is not allowed -
if ($kalturaNetwork) {
// allow only the kaltura network stuff
if ($partnerId) {
$orderBy = "(" . self::PARTNER_ID . "<>{$partnerId})";
// first take the pattner_id and then the rest
myCriteria::addComment($criteria, "Only Kaltura Network");
$criteria->addAscendingOrderByColumn($orderBy);
//, Criteria::CUSTOM );
}
} else {
// no private data and no kaltura_network -
// add a criteria that will return nothing
$criteria->addAnd(self::PARTNER_ID, Partner::PARTNER_THAT_DOWS_NOT_EXIST);
}
} else {
// private data is allowed
if (empty($partnerGroup) && empty($kalturaNetwork)) {
// the default case
$criteria->addAnd(self::PARTNER_ID, $partnerId);
} elseif ($partnerGroup == myPartnerUtils::ALL_PARTNERS_WILD_CHAR) {
// all is allowed - don't add anything to the criteria
} else {
$criterion = null;
if ($partnerGroup) {
// $partnerGroup hold a list of partners separated by ',' or $kalturaNetwork is not empty (should be mySearchUtils::KALTURA_NETWORK = 'kn')
$partners = explode(',', trim($partnerGroup));
$hasPartnerZero = false;
foreach ($partners as $index => &$p) {
trim($p);
// make sure there are not leading or trailing spaces
if ($p == 0) {
unset($partners[$index]);
$hasPartnerZero = true;
}
}
// add the partner_id to the partner_group
$partners[] = strval($partnerId);
$criterion = $criteria->getNewCriterion(self::PARTNER_ID, $partners, Criteria::IN);
if ($hasPartnerZero) {
$query = "(" . self::PARTNER_ID . " = 0 AND " . self::IS_DEFAULT . " = 1)";
$criterion->addOr($criteria->getNewCriterion(self::PARTNER_ID, $query, Criteria::CUSTOM));
}
} else {
$criterion = $criteria->getNewCriterion(self::PARTNER_ID, $partnerId);
}
$criteria->addAnd($criterion);
}
}
$criteriaFilter->enable();
}