本文整理汇总了PHP中PartnerPeer::doCount方法的典型用法代码示例。如果您正苦于以下问题:PHP PartnerPeer::doCount方法的具体用法?PHP PartnerPeer::doCount怎么用?PHP PartnerPeer::doCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PartnerPeer
的用法示例。
在下文中一共展示了PartnerPeer::doCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$this->forceSystemAuthentication();
$start = microtime(true);
$limit = 7;
// new partners
$c = new Criteria();
$this->partner_count = PartnerPeer::doCount($c);
// count before setting the limit
$c->setLimit($limit);
$c->addDescendingOrderByColumn(PartnerPeer::CREATED_AT);
$newest_partners = PartnerPeer::doSelect($c);
// $new_partners_ids = self::getIds( $new_partners );
// fetch stats for these partners
// TODO - if new - what statistics could it have ??
// fdb::populateObjects( $newest_partners , new PartnerStatsPeer() , "id" , "partnerStats" , false ,"partnerId");
$exclude = $this->getP("exclude");
if ($exclude) {
self::addToExceludeList($exclude);
}
$exclude_list = self::getExceludeList();
// most viewed
$c = new Criteria();
$c->add(PartnerStatsPeer::PARTNER_ID, $exclude_list, Criteria::NOT_IN);
$c->setLimit($limit);
$c->addDescendingOrderByColumn(PartnerStatsPeer::VIEWS);
$stats_most_views = PartnerStatsPeer::doSelect($c);
$most_views = self::getPartnerListFromStats($stats_most_views);
// most entries
$c = new Criteria();
$c->add(PartnerStatsPeer::PARTNER_ID, $exclude_list, Criteria::NOT_IN);
$c->setLimit($limit);
$c->addDescendingOrderByColumn(PartnerStatsPeer::ENTRIES);
$stats_most_entries = PartnerStatsPeer::doSelect($c);
$most_entries = self::getPartnerListFromStats($stats_most_entries);
$end = microtime(true);
$this->newest_partners = $newest_partners;
$this->most_views = $most_views;
$this->most_entries = $most_entries;
$this->bench = $end - $start;
}
示例2: countPartners
/**
* Returns the number of related Partner objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related Partner objects.
* @throws PropelException
*/
public function countPartners(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if ($criteria === null) {
$criteria = new Criteria(kuserPeer::DATABASE_NAME);
} else {
$criteria = clone $criteria;
}
if ($distinct) {
$criteria->setDistinct();
}
$count = null;
if ($this->collPartners === null) {
if ($this->isNew()) {
$count = 0;
} else {
$criteria->add(PartnerPeer::ANONYMOUS_KUSER_ID, $this->id);
$count = PartnerPeer::doCount($criteria, false, $con);
}
} else {
// criteria has no effect for a new object
if (!$this->isNew()) {
// the following code is to determine if a new query is
// called for. If the criteria is the same as the last
// one, just return count of the collection.
$criteria->add(PartnerPeer::ANONYMOUS_KUSER_ID, $this->id);
if (!isset($this->lastPartnerCriteria) || !$this->lastPartnerCriteria->equals($criteria)) {
$count = PartnerPeer::doCount($criteria, false, $con);
} else {
$count = count($this->collPartners);
}
} else {
$count = count($this->collPartners);
}
}
return $count;
}
示例3: listAction
/**
* @action list
* @param KalturaPartnerFilter $filter
* @param KalturaFilterPager $pager
* @return KalturaPartnerListResponse
*/
public function listAction(KalturaPartnerFilter $filter = null, KalturaFilterPager $pager = null)
{
if (is_null($filter)) {
$filter = new KalturaPartnerFilter();
}
if (is_null($pager)) {
$pager = new KalturaFilterPager();
}
$partnerFilter = new partnerFilter();
$filter->toObject($partnerFilter);
$partnerFilter->set('_gt_id', 0);
$c = new Criteria();
$partnerFilter->attachToCriteria($c);
$totalCount = PartnerPeer::doCount($c);
$pager->attachToCriteria($c);
$list = PartnerPeer::doSelect($c);
$newList = KalturaPartnerArray::fromPartnerArray($list);
$response = new KalturaPartnerListResponse();
$response->totalCount = $totalCount;
$response->objects = $newList;
return $response;
}
示例4: countAction
/**
* Count partner's existing sub-publishers (count includes the partner itself).
*
* @action count
* @param KalturaPartnerFilter $filter
* @return int
*/
public function countAction(KalturaPartnerFilter $filter = null)
{
if (!$filter) {
$filter = new KalturaPartnerFilter();
}
$dbFilter = new partnerFilter();
$filter->toObject($dbFilter);
$c = PartnerPeer::getDefaultCriteria();
$dbFilter->attachToCriteria($c);
return PartnerPeer::doCount($c);
}
示例5: getPartnerUsageAction
/**
* Function which calulates partner usage of a group of a VAR's sub-publishers
*
* @action getPartnerUsage
* @param KalturaPartnerFilter $partnerFilter
* @param KalturaReportInputFilter $usageFilter
* @param KalturaFilterPager $pager
* @return KalturaPartnerUsageListResponse
* @throws KalturaVarConsoleErrors::MAX_SUB_PUBLISHERS_EXCEEDED
*/
public function getPartnerUsageAction(KalturaPartnerFilter $partnerFilter = null, KalturaReportInputFilter $usageFilter = null, KalturaFilterPager $pager = null)
{
if (is_null($partnerFilter)) {
$partnerFilter = new KalturaPartnerFilter();
}
if (is_null($usageFilter)) {
$usageFilter = new KalturaReportInputFilter();
$usageFilter->fromDate = time() - 60 * 60 * 24 * 30;
// last 30 days
$usageFilter->toDate = time();
} else {
//The first time the filter is sent, it it sent with 0 as fromDate
if (!$usageFilter->fromDate) {
$usageFilter->fromDate = time() - 60 * 60 * 24 * 30;
}
if (!$usageFilter->interval) {
$usageFilter->interval = KalturaReportInterval::MONTHS;
}
}
if (is_null($pager)) {
$pager = new KalturaFilterPager();
}
//Create a propel filter for the partner
$partnerFilterDb = new partnerFilter();
$partnerFilter->toObject($partnerFilterDb);
//add filter to criteria
$c = PartnerPeer::getDefaultCriteria();
$partnerFilterDb->attachToCriteria($c);
$partnersCount = PartnerPeer::doCount($c);
if ($partnersCount > self::MAX_SUB_PUBLISHERS) {
throw new KalturaAPIException(KalturaVarConsoleErrors::MAX_SUB_PUBLISHERS_EXCEEDED);
}
$partners = PartnerPeer::doSelect($c);
$partnerIds = array();
foreach ($partners as &$partner) {
$partnerIds[] = $partner->getId();
}
// add pager to criteria
$pager->attachToCriteria($c);
$c->addAscendingOrderByColumn(PartnerPeer::ID);
// select partners
$items = array();
$inputFilter = new reportsInputFilter();
$inputFilter->from_date = $usageFilter->fromDate;
$inputFilter->to_date = $usageFilter->toDate;
$inputFilter->from_day = date("Ymd", $usageFilter->fromDate);
$inputFilter->to_day = date("Ymd", $usageFilter->toDate);
$inputFilter->timeZoneOffset = $usageFilter->timeZoneOffset;
$inputFilter->interval = $usageFilter->interval;
if (!count($partnerIds)) {
$total = new KalturaVarPartnerUsageTotalItem();
// no partners fit the filter - don't fetch data
$totalCount = 0;
// the items are set to an empty KalturaSystemPartnerUsageArray
} else {
$totalCount = 0;
$orderBy = ($inputFilter->interval == reportInterval::MONTHS ? "+month_id" : "+date_id") . ",+partner_id";
list($reportHeader, $reportData, $totalCount) = myReportsMgr::getTable(null, myReportsMgr::REPORT_TYPE_VAR_USAGE, $inputFilter, $pager->pageSize, $pager->pageIndex, $orderBy, implode(",", $partnerIds));
foreach ($reportData as $line) {
$item = new KalturaVarPartnerUsageItem();
$item->fromString($reportHeader, $line);
if ($item) {
$items[] = $item;
}
}
list($reportHeader, $reportData) = myReportsMgr::getTotal(null, myReportsMgr::REPORT_TYPE_PARTNER_USAGE, $inputFilter, implode(",", $partnerIds));
$total = new KalturaVarPartnerUsageTotalItem();
$total->fromString($reportHeader, $reportData);
list($peakStoragereportHeader, $peakStoragereportData) = myReportsMgr::getTotal(null, myReportsMgr::REPORT_TYPE_PEAK_STORAGE, $inputFilter, implode(",", $partnerIds));
if ($peakStoragereportData[0]) {
$total->peakStorage = ceil(@$peakStoragereportData[0]);
}
}
$response = new KalturaPartnerUsageListResponse();
//Sort according to dateId and partnerId
uasort($items, array($this, 'sortByDate'));
$response->total = $total;
$response->totalCount = $totalCount;
$response->objects = $items;
return $response;
}