本文整理匯總了PHP中sfDoctrinePager::setQuery方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfDoctrinePager::setQuery方法的具體用法?PHP sfDoctrinePager::setQuery怎麽用?PHP sfDoctrinePager::setQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfDoctrinePager
的用法示例。
在下文中一共展示了sfDoctrinePager::setQuery方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: buildDataGrid
public function buildDataGrid(sfWebRequest $request)
{
if ($this->table_method) {
$typeTable = Doctrine_Core::getTable($this->ContentType->name);
$method = $this->table_method;
$q = $typeTable->{$method}($this, $request);
if ($q instanceof sfSympalDataGrid) {
$dataGrid = $q;
} else {
if ($q instanceof sfDoctrinePager || $q instanceof Doctrine_Query_Abstract) {
$dataGrid = sfSympalDataGrid::create($q);
} else {
throw new sfException(sprintf('ContentList table_method must return an instance of sfSympalDataGrid, sfDoctrinePager or Doctrine_Query_Abstract. An instance of "%s" was returned.', get_class($q)));
}
}
} else {
$pager = new sfDoctrinePager('sfSympalContent');
$pager->setQuery($this->_buildQuery($request));
$dataGrid = sfSympalDataGrid::create($pager)->addColumn('c.title', 'renderer=sympal_data_grid/default_title')->addColumn('c.date_published')->addColumn('u.username', 'label=Created By');
}
if ($this->sort_column) {
$dataGrid->setDefaultSort($this->sort_column, $this->sort_order);
}
$dataGrid->setMaxPerPage($this->rows_per_page > 0 ? $this->rows_per_page : sfSympalConfig::get('rows_per_page', null, 10));
$dataGridRequestInfo = $request->getParameter($dataGrid->getId());
return $dataGrid;
}
示例2: getPager
protected function getPager(Doctrine_Query $q, $page, $size)
{
$pager = new sfDoctrinePager('Bbs', $size);
$pager->setQuery($q);
$pager->setPage($page);
return $pager;
}
示例3: getPager
/**
*
* @return sfDoctrinePager
*/
protected function getPager()
{
$p = new sfDoctrinePager('sfGuardUser', 10);
$p->setQuery($this->getQuery());
$p->setPage($this->getPage());
return $p;
}
示例4: getPager
/**
* Fetch images from pool according to any default tag(s) option specified
* in the global schema.yml.
* Override added to specify per tag in MooEditable
*
* @return sfDoctrinePager
*/
public function getPager($per_page = 12, $page = 1, $tagged_object = null, $tag = null)
{
$pager = new sfDoctrinePager($this->getClassnameToReturn(), $per_page);
$im = new sfImagePoolImage();
if (!$im->option('tagging')) {
$tagged_object = $tag = null;
}
$im->free(true);
if (isset($tagged_object) && ($tag = $tagged_object->getTagRestriction())) {
$query = TagTable::getObjectTaggedWithQuery($this->getClassnameToReturn(), $tag, $pager->getQuery(), array('nb_common_tags' => 1));
$pager->setQuery($query);
} else {
if (!empty($tag)) {
// If only tags we have no taggable object
// So get images tagged with this query and do a whereIn on the ids
$tags = explode(',', $tag);
$images = TagTable::getObjectTaggedWith($tags, array('model' => 'sfImagePoolImage', 'nb_common_tags' => 1));
$image_ids = array();
foreach ($images as $image) {
$image_ids[] = $image->id;
}
if (!empty($image_ids)) {
$pager->getQuery()->whereIn('sfImagePoolImage.id', $image_ids);
} else {
$pager->getQuery()->where('false');
}
// we have no images tagged
}
}
$pager->getQuery()->orderBy('updated_at DESC');
$pager->setPage($page);
$pager->init();
return $pager;
}
示例5: getPager
protected function getPager(Doctrine_Query $query)
{
$pager = new sfDoctrinePager('Fortune', sfConfig::get('app_fortunes_max_items', 10));
$pager->setQuery($query);
$pager->setPage($this->getRequest()->getParameter('page', 1));
$pager->init();
return $pager;
}
示例6: getPager
public function getPager()
{
$pager = new sfDoctrinePager('NewItem', 5);
$pager->setQuery($this->getNewsQuery());
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
return $pager;
}
示例7: getPager
public function getPager(Member $member, $page = 1, $size = 20)
{
$q = $this->getQuery($member);
$pager = new sfDoctrinePager('DiaryCommentUpdate', $size);
$pager->setQuery($q);
$pager->setPage($page);
return $pager;
}
示例8: getResultListPager
public function getResultListPager(Doctrine_Query $query, $page = 1, $size = 20)
{
$pager = new sfDoctrinePager('CommunityTopic', $size);
$pager->setQuery($query);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例9: getRecentPager
public function getRecentPager($page = 1, $size = 20)
{
$pager = new sfDoctrinePager('PluginPackage', $size);
$pager->setQuery($this->getRecentReleaseQuery($size));
$pager->setPage($page);
$pager->init();
return $pager;
}
示例10: getPager
protected function getPager(sfWebRequest $request)
{
$q = Doctrine::getTable('AlbumComment')->createQuery()->where('album_id = ?', $this->album->id)->orderBy('created_at DESC');
$pager = new sfDoctrinePager('AlbumComment');
$pager->setQuery($q);
$pager->setPage($request['commentPage']);
$pager->setMaxPerPage($this->size);
return $pager;
}
示例11: getListPager
/**
* Get introFriend pager
* @param int $memberIdTo member id
* @param int $page page number
* @param int $size show number
* @return pager pager
*/
public function getListPager($memberIdTo, $page = 1, $size = 20)
{
$pager = new sfDoctrinePager('IntroFriend', $size);
$pager->setQuery($this->getListQuery($memberIdTo));
$pager->setPage($page);
$pager->init();
return $pager;
}
示例12: getPager
protected function getPager( $size = 50 )
{
$pager = new sfDoctrinePager('dsPerson', $size); // adusting size possible !! set 0 to deactivate
$pager->setQuery($this->buildQuery());
$pager->setPage($this->getRequest()->getParameter('page'));
$pager->init();
return $pager;
}
示例13: getListPager
public function getListPager($page = 1, $size = 20)
{
$query = $this->createQuery()->orderBy('updated_at DESC');
$pager = new sfDoctrinePager('VoteQuestion', $size);
$pager->setQuery($query);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例14: getPager
public function getPager($packageId, $page = 1, $size = 20)
{
$q = Doctrine::getTable('Member')->createQuery('m')->where('p.package_id = ?', $packageId)->innerJoin('m.PluginMember p');
$pager = new sfDoctrinePager('Member', $size);
$pager->setQuery($q);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例15: getMemberPager
public function getMemberPager($memberId, $accessMemberId, $size, $page = 1)
{
$q = $this->createQuery("g")->where("g.member_id = ?", $memberId)->orderBy("id DESC");
$pager = new sfDoctrinePager("Geocode", $size);
$pager->setQuery($q);
$pager->setPage($page);
$pager->init();
return $pager;
}