本文整理汇总了PHP中sfPropelPager::setPeerMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP sfPropelPager::setPeerMethod方法的具体用法?PHP sfPropelPager::setPeerMethod怎么用?PHP sfPropelPager::setPeerMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfPropelPager
的用法示例。
在下文中一共展示了sfPropelPager::setPeerMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPager
/**
* Searches passengers by some criteria
* @param int $max Maximum people per page
* @param int $page
* @return sfPropelPager
*/
public static function getPager($max = 10, $page = 1, $firstname = null, $lastname = null, $city = null, $state = null, $country = null, $county = null, $exclude_ids = array())
{
$c = new Criteria();
$c->addJoin(self::PERSON_ID, PersonPeer::ID, Criteria::LEFT_JOIN);
if ($firstname) {
$c->add(PersonPeer::FIRST_NAME, $firstname . '%', Criteria::LIKE);
}
if ($lastname) {
$c->add(PersonPeer::LAST_NAME, $lastname . '%', Criteria::LIKE);
}
if ($city) {
$c->add(PersonPeer::CITY, $city . '%', Criteria::LIKE);
}
if ($state) {
$c->add(PersonPeer::STATE, $state . '%', Criteria::LIKE);
}
if ($country) {
$c->add(PersonPeer::COUNTRY, $country . '%', Criteria::LIKE);
}
if ($county) {
$c->add(PersonPeer::COUNTY, $county . '%', Criteria::LIKE);
}
if (!empty($exclude_ids)) {
$c->add(self::ID, $exclude_ids, Criteria::NOT_IN);
}
$c->addAscendingOrderByColumn(PersonPeer::FIRST_NAME);
$pager = new sfPropelPager('Passenger', $max);
$pager->setPeerMethod('doSelectJoinPerson');
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例2: executeIndex
/**
* Executes index action
*
* @param sfWebRequest $request
*/
public function executeIndex(sfWebRequest $request)
{
$this->filter = new PropertyFormFilter();
//$this->property_list = PropertyPeer::doSelect(new Criteria());
$this->sort = $this->getRequestParameter('sort');
$this->sort_type = $this->getRequestParameter('sort_type');
$criteria = new Criteria();
if (!is_null($this->sort)) {
if (!is_null($this->sort_type) && $this->sort_type == 'desc') {
$criteria->addDescendingOrderByColumn(PropertyPeer::$this->sort);
} elseif (!is_null($this->sort_type) && $this->sort_type == 'asc') {
$criteria->addAscendingOrderByColumn(PropertyPeer::$this->sort);
}
}
if ($request->hasParameter('property_filters')) {
$property_filters = $request->getParameter('property_filters');
$this->filter->bind($property_filters);
if ($this->filter->isValid()) {
!empty($property_filters['municipality']['text']) ? $criteria->add(PropertyPeer::MUNICIPALITY, "%" . $property_filters['municipality']['text'] . "%", Criteria::LIKE) : null;
!empty($property_filters['offer_id']) ? $criteria->add(PropertyPeer::OFFER_ID, $property_filters['offer_id']) : null;
!empty($property_filters['type_id']) ? $criteria->add(PropertyPeer::TYPE_ID, $property_filters['type_id']) : null;
!empty($property_filters['typology_id']) ? $criteria->add(PropertyPeer::TYPOLOGY_ID, $property_filters['typology_id']) : null;
!empty($property_filters['state_id']) ? $criteria->add(PropertyPeer::STATE_ID, $property_filters['state_id']) : null;
!empty($property_filters['price']['text']) ? $criteria->add(PropertyPeer::PRICE, $property_filters['price']['text'], Criteria::LESS_EQUAL) : null;
}
}
$pager = new sfPropelPager('Property', sfConfig::get('app_max_propertyes_list', 20));
$pager->setPeerMethod('doSelectJoinAll');
$pager->setCriteria($criteria);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$this->pager = $pager;
}
示例3: 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;
}
示例4: executeList
public function executeList()
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$c = new Criteria();
$c->add(JobPeer::CODE, $this->getModuleName());
$job = JobPeer::doSelectOne($c);
$acl = AclPeer::retrieveByPK($group_id, $job->getId());
if (!$acl) {
$this->forward('default', 'error404');
}
$this->can_add = $acl->getAddPriv() == 1;
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$c = new Criteria();
$dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
$c->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
$filters = null;
if ($this->getRequest()->hasParameter('filters')) {
$filters = $this->getRequestParameter('filters');
if ($filters == 'clear') {
$this->filters = null;
} else {
$defined_filter = false;
foreach ($filters as $f) {
if (is_array($f)) {
if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
$defined_filter = true;
break;
}
} else {
if ($f != null && $f != '') {
$defined_filter = true;
break;
}
}
}
if ($defined_filter) {
$this->filters = $filters;
$this->filter($c, $this->getRequestParameter('filters'));
}
}
}
$rpp = $this->getRequestParameter('max_per_page', 999);
$pager = new sfPropelPager('AcademicCalendar', $rpp);
$pager->setPeerMethod('doSelectOrdered');
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$this->pager = $pager;
$actions = array(array('name' => 'filter', 'color' => 'white'));
$filter_string = "";
if ($filters) {
foreach ($filters as $key => $val) {
$filter_string .= "&filters[{$key}]={$val}";
}
$filter_string = preg_replace('/^&/', '', $filter_string);
}
$this->actions = $actions;
}
示例5: executeList
public function executeList()
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$c = new Criteria();
$c->add(JobPeer::CODE, $this->getModuleName());
$job = JobPeer::doSelectOne($c);
$acl = AclPeer::retrieveByPK($group_id, $job->getId());
if (!$acl) {
$this->forward('default', 'error404');
}
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$c = new Criteria();
$dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
$c->add(ClassGroupPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
$this->sort($c);
if ($this->getRequest()->hasParameter('filters')) {
$filters = $this->getRequestParameter('filters');
if ($filters == 'clear') {
$this->filters = null;
} else {
$defined_filter = false;
foreach ($filters as $f) {
if (is_array($f)) {
if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
$defined_filter = true;
break;
}
} else {
if ($f != null && $f != '') {
$defined_filter = true;
break;
}
}
}
if ($defined_filter) {
$this->filters = $filters;
$this->filter($c, $this->getRequestParameter('filters'));
}
}
}
$rpp = $this->getRequestParameter('max_per_page', 999);
$this->getUser()->setAttribute('max_per_page', $rpp, 'class_group');
$pager = new sfPropelPager('ClassGroup', $rpp);
$pager->setCriteria($c);
$pager->setPeerMethod('doSelectFiltered');
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'class_group'));
$this->getUser()->setAttribute('page', $page, 'class_group');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$actions = array();
if ($acl->getAddPriv()) {
array_unshift($actions, array('name' => 'add', 'url' => 'class_group/create', 'color' => 'black'));
}
$this->actions = $actions;
}
示例6: executeList
public function executeList()
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$c = new Criteria();
$c->add(JobPeer::CODE, $this->getModuleName());
$job = JobPeer::doSelectOne($c);
$acl = AclPeer::retrieveByPK($group_id, $job->getId());
if (!$acl) {
$this->forward('default', 'error404');
}
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$c = new Criteria();
$this->sort($c);
if ($this->getRequest()->hasParameter('filters')) {
$filters = $this->getRequestParameter('filters');
if ($filters == 'clear') {
$this->filters = null;
} else {
$defined_filter = false;
foreach ($filters as $f) {
if (is_array($f)) {
if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
$defined_filter = true;
break;
}
} else {
if ($f != null && $f != '') {
$defined_filter = true;
break;
}
}
}
if ($defined_filter) {
$this->filters = $filters;
$this->filter($c, $this->getRequestParameter('filters'));
}
}
}
$rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'counseling_spec'));
$this->getUser()->setAttribute('max_per_page', $rpp, 'counseling_spec');
$pager = new sfPropelPager('CounselingSpec', $rpp);
$pager->setPeerMethod('doSelectOrdered');
$pager->setCriteria($c);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'counseling_spec'));
$this->getUser()->setAttribute('page', $page, 'counseling_spec');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$actions = array();
if ($acl->getAddPriv()) {
array_unshift($actions, array('name' => 'Tambah', 'url' => 'counseling_spec/create', 'color' => 'black'));
}
$this->actions = $actions;
$this->subtitle = '';
}
示例7: getPager
/**
* get pager for assets
* @param array $params
* @param string $sort
* @param integer $page
* @param integer $size
* @return sfPager
*/
public static function getPager(array $params, $sort = 'name', $page = 1, $size = 20)
{
$c = self::search($params, $sort);
$pager = new sfPropelPager('sfAsset', $size);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->setPeerMethod('doSelectJoinFolder');
$pager->init();
return $pager;
}
示例8: getForUserPager
public static function getForUserPager($user_id, $page = 1, $max_per_page = 10)
{
$c = self::getForUserCriteria($user_id);
$pager = new sfPropelPager('sfSimpleForumTopic', $max_per_page);
$pager->setPage($page);
$pager->setCriteria($c);
$pager->setPeerMethod('doSelectJoinAll');
$pager->init();
return $pager;
}
示例9: getTopicsPager
public function getTopicsPager($page = 1, $max_per_page = 10)
{
$c = $this->getTopicsCriteria();
$pager = new sfPropelPager('sfSimpleForumTopic', $max_per_page);
$pager->setPage($page);
$pager->setCriteria($c);
$pager->setPeerMethod('doSelectJoinsfSimpleForumPost');
$pager->init();
return $pager;
}
示例10: getRecentPager
public static function getRecentPager($page)
{
$pager = new sfPropelPager('Answer', sfConfig::get('app_pager_homepage_max'));
$c = new Criteria();
$c->addDescendingOrderByColumn(self::CREATED_AT);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->setPeerMethod('doSelectJoinUser');
$pager->init();
return $pager;
}
示例11: getTaggedPager
public static function getTaggedPager($tag, $max, $page)
{
$pager = new sfPropelPager('sfSimpleBlogPost', $max);
$c = new Criteria();
$c->addJoin(sfSimpleBlogTagPeer::SF_BLOG_POST_ID, self::ID);
$c->add(sfSimpleBlogTagPeer::TAG, $tag);
$c->add(self::IS_PUBLISHED, true);
$c->addDescendingOrderByColumn(self::CREATED_AT);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->setPeerMethod('doSelectJoinAll');
$pager->init();
return $pager;
}
示例12: retrievePager
public static function retrievePager($c = null, $page = 1, $max = 10)
{
if ($c == null) {
$c = new Criteria();
}
$c->addDescendingOrderByColumn(self::LAST_NAME);
$c->setIgnoreCase(true);
$pager = new sfPropelPager('sfGuardUserProfile', $max);
$pager->setCriteria($c);
$pager->setPeerMethod('doSelectJoinSfGuardUser');
$pager->setPage($page);
$pager->init();
return $pager;
}
示例13: executeList
public function executeList()
{
$type = $this->getRequestParameter('type', 'all');
$c = $this->{'list' . $type}();
$c->addDescendingOrderByColumn(PostPeer::CREATED_AT);
$c->add(PostPeer::DELETED, false);
$pager = new sfPropelPager('Post', sfConfig::get('app_post_per_page', 7));
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->setPeerMethod('doSelectJoinAll');
$pager->init();
$this->pager = $pager;
$r = sfRouting::getInstance();
$this->iuri = $r->getCurrentRouteName() == 'homepage' ? '@posts?page=1' : $r->getCurrentInternalUri(true);
}
示例14: getPager
protected function getPager($feed_id)
{
$pager = new sfPropelPager('Torrent', 20);
$pager->setPeerMethod('doSelectJoinAll');
$c = new Criteria();
$c->addAscendingOrderByColumn(TorrentPeer::UPDATED_AT);
$c->addAscendingOrderByColumn(TorrentPeer::CREATED_AT);
// todo exclude future
if ($feed_id) {
$c->add(TorrentPeer::FEED_ID, $feed_id);
}
$pager->setCriteria($c);
$pager->setPage(1);
return $pager;
}
示例15: getReportedSpamPager
public static function getReportedSpamPager($page)
{
$pager = new sfPropelPager('Answer', sfConfig::get('app_pager_homepage_max'));
$c = new Criteria();
$c->add(self::REPORTS, 0, Criteria::GREATER_THAN);
$c->setLimit(20);
$c->addDescendingOrderByColumn(self::REPORTS);
$c->addAscendingOrderByColumn(self::CREATED_AT);
$c = self::addPermanentTagToCriteria($c);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->setPeerMethod('doSelectJoinUser');
$pager->init();
return $pager;
}