本文整理汇总了PHP中myCriteria类的典型用法代码示例。如果您正苦于以下问题:PHP myCriteria类的具体用法?PHP myCriteria怎么用?PHP myCriteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了myCriteria类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultCriteriaFilter
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = new myCriteria();
$c->add(kvotePeer::STATUS, KVoteStatus::REVOKED, Criteria::NOT_EQUAL);
self::$s_criteria_filter->setFilter($c);
}
示例2: setDefaultCriteriaFilter
/**
* Creates default criteria filter
*/
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = new myCriteria();
$c->addAnd(EntryDistributionPeer::STATUS, EntryDistributionStatus::DELETED, Criteria::NOT_EQUAL);
self::$s_criteria_filter->setFilter($c);
}
示例3: setDefaultCriteriaFilter
public static function setDefaultCriteriaFilter()
{
parent::setDefaultCriteriaFilter();
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = new myCriteria();
$c->addAnd(UserRolePeer::STATUS, UserRoleStatus::DELETED, Criteria::NOT_EQUAL);
self::$s_criteria_filter->setFilter($c);
}
示例4: setDefaultCriteriaFilter
public static function setDefaultCriteriaFilter()
{
parent::setDefaultCriteriaFilter();
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = new myCriteria();
$c->addAnd(self::STATUS, DropFolderFileStatus::PURGED, Criteria::NOT_EQUAL);
self::$s_criteria_filter->setFilter($c);
}
示例5: setDefaultCriteriaFilter
/**
* Creates default criteria filter
*/
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = new myCriteria();
$c->addAnd(DistributionProfilePeer::PROVIDER_TYPE, DistributionProviderType::GENERIC);
$c->addAnd(DistributionProfilePeer::STATUS, DistributionProfileStatus::DELETED, Criteria::NOT_EQUAL);
self::$s_criteria_filter->setFilter($c);
}
示例6: 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();
}
示例7: addPartnerToCriteria
public static function addPartnerToCriteria($partnerId, $privatePartnerData = false, $partnerGroup = null, $kalturaNetwork = null)
{
$criteriaFilter = self::getCriteriaFilter();
$criteria = $criteriaFilter->getFilter();
if (!$privatePartnerData) {
// the private partner data is not allowed -
if ($kalturaNetwork) {
// allow only the kaltura network stuff
$criteria->addAnd(self::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK);
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 {
$criterion = null;
// private data is allowed
if (!strlen(strval($partnerGroup))) {
// the default case
$criterion = $criteria->getNewCriterion(self::PARTNER_ID, $partnerId);
$criteria->addAnd($criterion);
} elseif ($partnerGroup == myPartnerUtils::ALL_PARTNERS_WILD_CHAR) {
// all is allowed - don't add anything to the criteria
} else {
// $partnerGroup hold a list of partners separated by ',' or $kalturaNetwork is not empty (should be mySearchUtils::KALTURA_NETWORK = 'kn')
$partners = explode(',', trim($partnerGroup));
foreach ($partners as &$p) {
trim($p);
}
// make sure there are not leading or trailing spaces
// add the partner_id to the partner_group
if (!in_array(strval($partnerId), $partners)) {
$partners[] = strval($partnerId);
}
if (count($partners) == 1 && reset($partners) == $partnerId) {
$criterion = $criteria->getNewCriterion(self::PARTNER_ID, $partnerId);
$criteria->addAnd($criterion);
} else {
$criterion = $criteria->getNewCriterion(self::PARTNER_ID, $partners, Criteria::IN);
if ($kalturaNetwork) {
$criterionNetwork = $criteria->getNewCriterion(self::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK);
$criterion->addOr($criterionNetwork);
}
$criteria->addAnd($criterion);
}
}
if ($criterion && $criterion instanceof KalturaCriterion) {
$criterion->addTag(KalturaCriterion::TAG_PARTNER_SESSION);
}
}
$criteriaFilter->enable();
}
示例8: retrieveByPartnerAndUid
public static function retrieveByPartnerAndUid($partner_id, $subp_id, $puser_id, $join_kuser = false)
{
$c = new Criteria();
myCriteria::addComment($c, "PuserKuserPeer::retrieveByPartnerAndUid");
$c->add(self::PARTNER_ID, $partner_id);
if ($subp_id) {
$c->add(self::SUBP_ID, $subp_id);
}
$c->add(self::PUSER_ID, $puser_id);
if ($join_kuser) {
$puser_kusers = self::doSelectJoinkuser($c);
} else {
$puser_kusers = self::doSelect($c);
}
if (count($puser_kusers) > 0) {
$puser_kuser = $puser_kusers[0];
} else {
$puser_kuser = null;
}
return $puser_kuser;
}
示例9: getDefaultKshow
/**
* Will search for a kshow for the specific partner & key.
* The key can be combined from the kuser_id and the group_id
* If not found - will create one
* If both the kuser_id & group_id are null - always create one
*/
public static function getDefaultKshow($partner_id, $subp_id, $puser_kuser, $group_id = null, $allow_quick_edit = null, $create_anyway = false, $default_name = null)
{
$kuser_id = null;
// make sure puser_kuser object exists so function will not exit with FATAL
if ($puser_kuser) {
$kuser_id = $puser_kuser->getKuserId();
}
$key = $group_id != null ? $group_id : $kuser_id;
if (!$create_anyway) {
$c = new Criteria();
myCriteria::addComment($c, "myKshowUtils::getDefaultKshow");
$c->add(kshowPeer::GROUP_ID, $key);
$kshow = kshowPeer::doSelectOne($c);
if ($kshow) {
return $kshow;
}
// no kshow - create using the service
$name = "{$key}'s generated show'";
} else {
$name = "a generated show'";
}
if ($default_name) {
$name = $default_name;
}
$extra_params = array("kshow_groupId" => $key, "kshow_allowQuickEdit" => $allow_quick_edit);
// set the groupId with the key so we'll find it next time round
$kshow = myPartnerServicesClient::createKshow("", $puser_kuser->getPuserId(), $name, $partner_id, $subp_id, $extra_params);
return $kshow;
}
示例10: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
// $this->applyPartnerFilterForClass( new ConversionProfilePeer() , $partner_id );
// TODO - verify permissions for viewing lists
$detailed = $this->getP("detailed", false);
$limit = $this->getP("page_size", 10);
$page = $this->getP("page", 1);
//$order_by = int( $this->getP ( "order_by" , -1 ) );
$offset = ($page - 1) * $limit;
$partner_current_conversion_profile = myPartnerUtils::getCurrentConversionProfile($partner_id);
$c = new Criteria();
// filter
$filter = new ConversionProfileFilter();
$fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null);
$filter->set("_order_by", null);
// ignore the order_by for now
$filter->attachToCriteria($c);
// partner_id either the partner or partner_id=0
$crit = $c->getNewCriterion(ConversionProfilePeer::PARTNER_ID, 0);
$c->addAnd($crit->addOr($c->getNewCriterion(ConversionProfilePeer::PARTNER_ID, $partner_id)));
// for now - only enabled profiles
$c->addAnd(ConversionProfilePeer::ENABLED, 1);
// make sure the partner's profiles will appear first ordered by id desc - last will come first
$order_by = "(" . ConversionProfilePeer::PARTNER_ID . "<>{$partner_id})";
// first take the patner_id and then the rest
myCriteria::addComment($c, "Only Kaltura Network");
$c->addAscendingOrderByColumn($order_by);
//, Criteria::CUSTOM );
$c->addDescendingOrderByColumn(ConversionProfilePeer::UPDATED_AT);
//, Criteria::CUSTOM );
$c->addDescendingOrderByColumn(ConversionProfilePeer::ID);
//, Criteria::CUSTOM );
//if ($order_by != -1) kshowPeer::setOrder( $c , $order_by );
$count = ConversionProfilePeer::doCount($c);
$offset = ($page - 1) * $limit;
$c->setLimit($limit);
if ($offset > 0) {
$c->setOffset($offset);
}
$list = ConversionProfilePeer::doSelect($c);
if (count($list) > 0) {
// reorder the list so the first will always be the best default for the partner
$partner_list = array($partner_current_conversion_profile);
// the first is always the partner's default
// $this->addDebug( "partner_current_conversion_profile" , objectWrapperBase::getWrapperClass( $partner_current_conversion_profile ) );
$global_list = array();
$default_prof = array();
foreach ($list as $conv_profile) {
if ($conv_profile->getPartnerId() == ConversionProfile::GLOBAL_PARTNER_PROFILE) {
if ($conv_profile->getProfileType() == ConversionProfile::DEFAULT_COVERSION_PROFILE_TYPE) {
$default_prof[] = $conv_profile;
} else {
$global_list[] = $conv_profile;
}
} elseif ($conv_profile->getPartnerId() == $partner_id) {
$partner_list[] = $conv_profile;
}
}
// $level = objectWrapperBase::DETAIL_LEVEL_REGULAR ;
// $this->addMsg ( "par-list" , objectWrapperBase::getWrapperClass( $partner_list , $level ) ) ;
// $this->addMsg ( "def-list" , objectWrapperBase::getWrapperClass( $default_prof , $level ) ) ;
// $this->addMsg ( "rest-list" , objectWrapperBase::getWrapperClass( $global_list , $level ) ) ;
// this is the correct order - the partners , the default and all the rest of the globals
$list = array_merge($partner_list, $default_prof, $global_list);
}
$level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
$this->addMsg("count", $count);
$this->addMsg("page_size", $limit);
$this->addMsg("page", $page);
$wrapper = objectWrapperBase::getWrapperClass($list, $level);
$this->addMsg("conversionProfiles", $wrapper);
}
示例11: addPartnerToCriteria
public static function addPartnerToCriteria($partnerId, $privatePartnerData = false, $partnerGroup = null, $kalturaNetwork = null)
{
$criteriaFilter = self::getCriteriaFilter();
$criteria = $criteriaFilter->getFilter();
if (!$privatePartnerData) {
// the private partner data is not allowed -
if ($kalturaNetwork) {
// allow only the kaltura netword stuff
$criteria->addAnd(self::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK);
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));
foreach ($partners as &$p) {
trim($p);
}
// make sure there are not leading or trailing spaces
// add the partner_id to the partner_group
if (!in_array($partnerId, $partners)) {
// NOTE: we need to add the partner as a string since we want all
// the PATNER_ID IN () values to be of the same type.
// otherwise mysql will fail choosing the right index and will
// do a full table scan
$partners[] = "" . $partnerId;
}
$criterion = $criteria->getNewCriterion(self::PARTNER_ID, $partners, Criteria::IN);
} else {
$criterion = $criteria->getNewCriterion(self::PARTNER_ID, $partnerId);
}
if ($kalturaNetwork) {
$criterionNetwork = $criteria->getNewCriterion(self::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK);
$criterion->addOr($criterionNetwork);
}
$criteria->addAnd($criterion);
}
}
$criteriaFilter->enable();
}
示例12: setDefaultCriteriaFilter
/**
* Creates default criteria filter
*/
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = new myCriteria();
// We'd like to retrieve only active delivery profiles, and the ones we consider to remove but haven't removed yet.
$c->addAnd(DeliveryProfilePeer::STATUS, array(DeliveryStatus::ACTIVE, DeliveryStatus::STAGING_OUT), Criteria::IN);
self::$s_criteria_filter->setFilter($c);
}
示例13: doCountWithCache
public static function doCountWithCache(Criteria $criteria, $cache_expiry_in_seconds = 600)
{
$cache_key = myCriteria::getCriteriaCacheKey($criteria);
if (!self::$entry_count_cache) {
self::$entry_count_cache = new myCache("entry_count_cache", $cache_expiry_in_seconds);
}
if ($count_result = self::$entry_count_cache->get($cache_key)) {
KalturaLog::log(__METHOD__ . ": count from cache [{$count_result}] for cacheKey [{$cache_key}]");
return $count_result;
} else {
KalturaLog::log(__METHOD__ . ": NO count from cache [{$count_result}] for cacheKey [{$cache_key}]");
$count_result = self::doCount($criteria);
// if we have a count result worth caching - cache it.
// one the one hand, for few results, it's nice to display rapid differences, therefore cache only if above the MIN_COUNT_RESULT_TO_CACHE threshold
// one the other hand - it can be that there are very little few resuls (sometimes 0) and still importatn to cache even more than when many results
// for now - go for the first version - cache above threshold.
if ($count_result && $count_result > self::MIN_COUNT_RESULT_TO_CACHE) {
self::$entry_count_cache->put($cache_key, $count_result);
KalturaLog::log(__METHOD__ . ": Setting count in cache [{$count_result}] for cacheKey [{$cache_key}]");
} else {
KalturaLog::log(__METHOD__ . ": Did NOT Set count in cache [{$count_result}] for cacheKey [{$cache_key}]");
}
}
return $count_result;
}
示例14: deleteEntry
public static function deleteEntry(entry $entry)
{
$kshow = $entry->getkshow();
if ($kshow) {
$v = $kshow->getEntries();
self::dec($v);
$kshow->setEntries($v);
$c = new Criteria();
myCriteria::addComment($c, __METHOD__);
$c->add(entryPeer::KSHOW_ID, $entry->getKshowId());
$c->add(entryPeer::KUSER_ID, $entry->getKuserId());
$c->setLimit(2);
$res = entryPeer::doCount($c);
if ($res == 1) {
// if $res > 1 - this kuser contributed more than one entry, deleting this one should still leave him a contributor
// if $res < 1 - this kuser never contributed - strange! but no need to dec the contributors
// kuser did contribute to this kshow - decrement
$v = $kshow->getContributors();
self::dec($v);
$kshow->setContributors($v);
}
$kuser = $entry->getkuser();
if ($kuser) {
$v = $kuser->getEntries();
self::dec($v);
$kuser->setEntries($v);
}
self::add($kshow);
self::add($kuser);
}
}