本文整理匯總了PHP中sfPropelPager::setPeerCountMethod方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfPropelPager::setPeerCountMethod方法的具體用法?PHP sfPropelPager::setPeerCountMethod怎麽用?PHP sfPropelPager::setPeerCountMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfPropelPager
的用法示例。
在下文中一共展示了sfPropelPager::setPeerCountMethod方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getWidgetOrderedPager
public static function getWidgetOrderedPager($order, $pageSize, $page, $criteria = null)
{
$c = $criteria;
if ($c == null) {
$c = new Criteria();
}
if ($order) {
$order_dir = 1;
if ($order[0] == '+' || $order[0] == '-') {
$order_dir = $order[0] == '+' ? $order_dir = 1 : ($order_dir = -1);
$order = substr($order, 1);
}
$fixed_order = "widget_log." . strtoupper($order);
$should_sort = in_array($fixed_order, array(WidgetLogPeer::ID, WidgetLogPeer::KSHOW_ID, WidgetLogPeer::ENTRY_ID, WidgetLogPeer::REFERER, WidgetLogPeer::VIEWS, WidgetLogPeer::PLAYS, WidgetLogPeer::IP1_COUNT, WidgetLogPeer::CREATED_AT));
if ($should_sort) {
if ($order_dir == 1) {
$c->addAscendingOrderByColumn($fixed_order);
} else {
$c->addDescendingOrderByColumn($fixed_order);
}
}
}
$pager = new sfPropelPager('WidgetLog', $pageSize);
$pager->setPeerMethod("doSelectJoinentry");
$pager->setPeerCountMethod("doCountJoinentry");
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例2: getOrderedPager
/**
* This function returns a pager object holding the specified comments' entries
* sorted by a given sort order.
* each entry holds the kuser object of its host.
*
* @param int $subjectType = the type of the object the commens refers to
* @param int $subjectId = the id of the object the comments refers to
* @param int $pageSize = number of kshows in each page
* @param int $page = the requested page
* @return the pager object
*/
public static function getOrderedPager($commentType, $subjectId, $pageSize, $page)
{
$c = new Criteria();
$c->add(commentPeer::COMMENT_TYPE, $commentType);
$c->add(commentPeer::SUBJECT_ID, $subjectId);
$c->addDescendingOrderByColumn(commentPeer::BASE_DATE);
$c->addJoin(commentPeer::KUSER_ID, kuserPeer::ID, Criteria::INNER_JOIN);
$pager = new sfPropelPager('comment', $pageSize);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->setPeerMethod('doSelectJoinkuser');
$pager->setPeerCountMethod('doCountJoinkuser');
$pager->init();
return $pager;
}
示例3: getUserShowsPartOf
/**
* This function returns a pager object holding the set of shows for which given user contributed media.
*
* @param int $kuserId = the requested user
* @param int $pageSize = number of kshows in each page
* @param int $page = the requested page
* @return the pager object
*/
public static function getUserShowsPartOf($kuserId, $pageSize, $page, $order)
{
$c = new Criteria();
$c->addJoin(self::ID, entryPeer::KSHOW_ID, Criteria::INNER_JOIN);
$c->add(entryPeer::KUSER_ID, $kuserId);
$c->add(self::PRODUCER_ID, $kuserId, Criteria::NOT_EQUAL);
self::setOrder($c, $order);
$c->setDistinct();
$pager = new sfPropelPager('kshow', $pageSize);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->setPeerMethod('doSelectJoinkuser');
$pager->setPeerCountMethod('doCountJoinkuser');
$pager->init();
return $pager;
}
示例4: getUserEntries
public static function getUserEntries($kuserId, $pageSize, $page)
{
$c = new Criteria();
$c->addJoin(entryPeer::KUSER_ID, kuserPeer::ID, Criteria::INNER_JOIN);
$c->add(entryPeer::KUSER_ID, $kuserId);
$c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
$c->addAscendingOrderByColumn(entryPeer::CREATED_AT);
$pager = new sfPropelPager('entry', $pageSize);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->setPeerMethod('doSelectJoinkuser');
$pager->setPeerCountMethod('doCountJoinkuser');
$pager->init();
return $pager;
}