本文整理匯總了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();
}