本文整理汇总了PHP中kshowPeer::doCount方法的典型用法代码示例。如果您正苦于以下问题:PHP kshowPeer::doCount方法的具体用法?PHP kshowPeer::doCount怎么用?PHP kshowPeer::doCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kshowPeer
的用法示例。
在下文中一共展示了kshowPeer::doCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: countkshows
/**
* Returns the number of related kshow objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related kshow objects.
* @throws PropelException
*/
public function countkshows(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->collkshows === null) {
if ($this->isNew()) {
$count = 0;
} else {
$criteria->add(kshowPeer::PRODUCER_ID, $this->id);
$count = kshowPeer::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(kshowPeer::PRODUCER_ID, $this->id);
if (!isset($this->lastkshowCriteria) || !$this->lastkshowCriteria->equals($criteria)) {
$count = kshowPeer::doCount($criteria, false, $con);
} else {
$count = count($this->collkshows);
}
} else {
$count = count($this->collkshows);
}
}
return $count;
}
示例2: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
// 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 ) );
$puser_kuser = null;
$use_filter_puser_id = $this->getP("use_filter_puser_id", 1);
if ($use_filter_puser_id == "false") {
$use_filter_puser_id = false;
}
$offset = ($page - 1) * $limit;
kuserPeer::setUseCriteriaFilter(false);
entryPeer::setUseCriteriaFilter(false);
$c = new Criteria();
// filter
$filter = new kshowFilter();
$fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null);
$this->setExtraFilters($filter);
if ($use_filter_puser_id) {
// if so - assume the producer_id is infact a puser_id and the kuser_id should be retrieved
$target_puser_id = $filter->get("_eq_producer_id");
//$this->getP ( "filter__eq_producer_id" );
if ($target_puser_id) {
// TODO - shoud we use the subp_id to retrieve the puser_kuser ?
$puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id, null, $target_puser_id, false);
if ($puser_kuser) {
$filter->set("_eq_producer_id", $puser_kuser->getkuserId());
//$this->setP ( "filter__eq_producer_id" , $puser_kuser->getkuserId() );
}
}
}
$filter->attachToCriteria($c);
//if ($order_by != -1) kshowPeer::setOrder( $c , $order_by );
$count = kshowPeer::doCount($c);
$offset = ($page - 1) * $limit;
$c->setLimit($limit);
if ($offset > 0) {
$c->setOffset($offset);
}
if ($detailed) {
$list = kshowPeer::doSelectJoinAll($c);
$level = objectWrapperBase::DETAIL_LEVEL_DETAILED;
// will have to populate the show_entry before according to the ids
fdb::populateObjects($list, new entryPeer(), "showentryid", "showentry", false);
} else {
$list = kshowPeer::doSelect($c);
$level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
// will have to populate the show_entry before according to the ids - we display the thumbnail from the showentry
fdb::populateObjects($list, new entryPeer(), "showentryid", "showentry", false);
}
$this->addMsg("count", $count);
$this->addMsg("page_size", $limit);
$this->addMsg("page", $page);
$wrapper = objectWrapperBase::getWrapperClass($list, $level);
$this->addMsg("kshows", $wrapper);
if ($use_filter_puser_id) {
$this->addMsg("user", objectWrapperBase::getWrapperClass($puser_kuser, objectWrapperBase::DETAIL_LEVEL_REGULAR));
}
/*
$i=0;
foreach ( $list as $kshow )
{
$i++;
$wrapper = objectWrapperBase::getWrapperClass( $kshow , $level );
$this->addMsg ( "kshow$i" , $wrapper ) ;
}
*/
// echo "bbb count: " . count ($list );
// echo "ccc";
//$this->addMsg ( "kshows" , $wrapper ) ;
}
示例3: execute
/**
* Gives a system applicative snapsot
*/
public function execute()
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
$this->forceSystemAuthentication();
$partner_id = $this->getRequestParameter('partner_id', -1);
if ($partner_id >= 0) {
myPartnerUtils::applyPartnerFilters($partner_id);
}
$this->partner_id = $partner_id;
$limit = $this->getRequestParameter('limit', '30');
if ($limit > 300) {
$limit = 300;
}
$bands_only = $this->getRequestParameter("bands", false) != null;
$modified_only = $this->getRequestParameter("modified", false) != null;
$this->bands_only = $bands_only;
$this->modified_only = $modified_only;
$this->kshows_with_new_entries = $modified_only ? dashboardUtils::getUpdatedKshows() : null;
$yesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
$lastweek = mktime(0, 0, 0, date("m"), date("d") - 7, date("Y"));
$query_esterday = date('Y-m-d', $yesterday);
$query_lastweek = date('Y-m-d', $lastweek);
$modified_band_ids = $modified_only ? array_keys($this->kshows_with_new_entries) : null;
if ($modified_only) {
// TODO - this chunk was copied from the code bellow with minor changes - generalize !
$c = new Criteria();
// $c->add ( kshowPeer::ID , $modified_band_ids , Criteria::IN ); // search only the given IDs
$this->bandsOnly($bands_only, $modified_band_ids, $c, kshowPeer::PARTNER_ID);
$this->kshow_count = kshowPeer::doCount($c);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
$c->add($criterion);
$this->kshow_count1 = kshowPeer::doCount($c);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
$c->add($criterion);
$this->kshow_count7 = kshowPeer::doCount($c);
$c->setLimit($limit);
//$c->hints = array(kshowPeer::TABLE_NAME => "created_at_index");
$c->addDescendingOrderByColumn(kshowPeer::CREATED_AT);
$c->remove(kshowPeer::CREATED_AT);
$c->addJoin(kshowPeer::PRODUCER_ID, kuserPeer::ID, Criteria::LEFT_JOIN);
$this->kshows = kshowPeer::doSelectJoinkuser($c);
$this->bands_only = $bands_only;
$this->entry_count = 0;
$this->entry_count1 = 0;
$this->entry_count7 = 0;
$this->entries = array();
$this->kuser_count = 0;
$this->kuser_count1 = 0;
$this->kuser_count7 = 0;
$this->kusers = array();
dashboardUtils::updateKshowsRoughcutCount($this->kshows);
return sfView::SUCCESS;
}
$c = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $c, kshowPeer::PARTNER_ID);
$this->kshow_count = kshowPeer::doCount($c);
$d = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $d, kshowPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
$d->add($criterion);
$this->kshow_count1 = kshowPeer::doCount($d);
$e = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $e, kshowPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
$e->add($criterion);
$this->kshow_count7 = kshowPeer::doCount($e);
//$this->kshow_count = kshowPeer::doCount( $c );
$c->setLimit($limit);
//$c->hints = array(kshowPeer::TABLE_NAME => "created_at_index");
$c->addDescendingOrderByColumn(kshowPeer::CREATED_AT);
$c->addJoin(kshowPeer::PRODUCER_ID, kuserPeer::ID, Criteria::LEFT_JOIN);
$this->kshows = kshowPeer::doSelectJoinkuser($c);
$c = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $c, entryPeer::PARTNER_ID);
$this->entry_count = entryPeer::doCount($c);
$d = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $d, entryPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(entryPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
$d->add($criterion);
$this->entry_count1 = entryPeer::doCount($d);
$e = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $e, entryPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(entryPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
$e->add($criterion);
$this->entry_count7 = entryPeer::doCount($e);
$c->setLimit($limit);
//$c->hints = array(entryPeer::TABLE_NAME => "created_at_index");
$c->addDescendingOrderByColumn(entryPeer::CREATED_AT);
$c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
// we don't want entries that
// $c->addJoin(entryPeer::KUSER_ID, kuserPeer::ID, Criteria::INNER_JOIN);
// $c->addJoin(entryPeer::KSHOW_ID, kshowPeer::ID, Criteria::INNER_JOIN);
$this->entries = entryPeer::doSelectJoinAll($c);
$c = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $c, kuserPeer::PARTNER_ID);
$d = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $d, kuserPeer::PARTNER_ID);
//.........这里部分代码省略.........
示例4: isContributor
private static function isContributor($kuser_id, $show_id)
{
$cache_res = self::getFromCache("isContributor", $kuser_id, $show_id);
if ($cache_res == NULL) {
//- from entry table - count ( id ) where show_id = show_id && kuser_id = kuser_id > 0 - fast if will add index ( show_id , kuser_id )
$c = new Criteria();
$c->add(entryPeer::KUSER_ID, $kuser_id);
$c->add(entryPeer::KSHOW_ID, $show_id);
$count = kshowPeer::doCount($c);
self::putCache("isContributor", $kuser_id, $show_id, $count > 0);
return $count > 0;
} else {
return $cache_res;
}
}