本文整理汇总了PHP中sfDoctrinePager类的典型用法代码示例。如果您正苦于以下问题:PHP sfDoctrinePager类的具体用法?PHP sfDoctrinePager怎么用?PHP sfDoctrinePager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfDoctrinePager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPager
/**
*
* @return sfDoctrinePager
*/
protected function getPager()
{
$p = new sfDoctrinePager('sfGuardUser', 10);
$p->setQuery($this->getQuery());
$p->setPage($this->getPage());
return $p;
}
示例2: getPager
protected function getPager(Doctrine_Query $q, $page, $size)
{
$pager = new sfDoctrinePager('Bbs', $size);
$pager->setQuery($q);
$pager->setPage($page);
return $pager;
}
示例3: listRecentChangesPager
/**
* Retrieves a pager of recent associations
* @param string model name
* @return Pager
*/
public static function listRecentChangesPager($doc_id = null, $users = null, $orderby = null, $npp = 25)
{
// TODO: possibility to filter on association type?
$pager = new sfDoctrinePager('AssociationLog', $npp);
$q = $pager->getQuery();
$q->select('al.*, mi.name, mi.search_name, li.name, li.search_name, u.username, u.login_name, u.topo_name')->from('AssociationLog al')->leftJoin('al.mainI18n mi')->leftJoin('al.linkedI18n li')->leftJoin('al.user_private_data u');
// filter on a specific doc if needed
if ($doc_id) {
$q->addWhere('al.main_id=? OR al.linked_id=?', array($doc_id, $doc_id));
}
// filter on a specific user if needed
if ($users) {
$users = explode('-', $users);
if (count($users)) {
$where_ids = array();
foreach ($users as $uid) {
$where_ids[] = '?';
}
$where_ids = implode(', ', $where_ids);
if (count($where_ids) == 1) {
$where = ' = ' . $where_ids;
} else {
$where = ' IN ( ' . $where_ids . ' )';
}
$q->addWhere('u.id' . $where, $users);
}
}
if (empty($orderby)) {
$q->orderBy('al.associations_log_id DESC');
// ~ decreasing time (but faster, since there is an index on this field).
} elseif ($orderby == 'uid') {
$q->orderBy('u.id ASC');
}
return $pager;
}
示例4: 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;
}
示例5: get_sympal_pager_navigation
/**
* Get the navigation links for given sfDoctrinePager instance
*
* @param sfDoctrinePager $pager
* @param string $uri The uri to prefix to the links
* @return string $html
*/
function get_sympal_pager_navigation($pager, $uri, $requestKey = 'page')
{
sympal_use_stylesheet('/sfSympalPlugin/css/pager.css');
$navigation = '<div class="sympal_pager_navigation">';
if ($pager->haveToPaginate()) {
$uri .= (preg_match('/\\?/', $uri) ? '&' : '?') . $requestKey . '=';
// First and previous page
if ($pager->getPage() != 1) {
$navigation .= link_to(image_tag('/sf/sf_admin/images/first.png', 'align=absmiddle'), $uri . '1');
$navigation .= link_to(image_tag('/sf/sf_admin/images/previous.png', 'align=absmiddle'), $uri . $pager->getPreviousPage()) . ' ';
}
// Pages one by one
$links = array();
foreach ($pager->getLinks() as $page) {
$links[] = '<span>' . link_to_unless($page == $pager->getPage(), $page, $uri . $page) . '</span>';
}
$navigation .= join(' ', $links);
// Next and last page
if ($pager->getPage() != $pager->getLastPage()) {
$navigation .= ' ' . link_to(image_tag('/sf/sf_admin/images/next.png', 'align=absmiddle'), $uri . $pager->getNextPage());
$navigation .= link_to(image_tag('/sf/sf_admin/images/last.png', 'align=absmiddle'), $uri . $pager->getLastPage());
}
}
$navigation .= '</div>';
return $navigation;
}
示例6: 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;
}
示例7: 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;
}
示例8: getPager
public function getPager()
{
$pager = new sfDoctrinePager('NewItem', 5);
$pager->setQuery($this->getNewsQuery());
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
return $pager;
}
示例9: 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;
}
示例10: 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;
}
示例11: getMangaListPagerByMemberId
public function getMangaListPagerByMemberId($memberId, $page = 1, $size = 20)
{
$q = $this->createQuery()->where('member_id', $memberId)->orderBy('updated_at');
$pager = new sfDoctrinePager('CcccManga', $size);
$pager->setQuery($q);
$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($memberId, $page = 1, $size = 20)
{
$pager = new sfDoctrinePager('OpenIDTrustLog', $size);
$q = $this->createQuery()->andWhere('member_id = ?', $memberId);
$pager->setQuery($q);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例14: getPager
/**
* get pager for assets
* @param array $params
* @param string $sort
* @param integer $page
* @param integer $size
* @return sfPager
*/
public function getPager(array $params, $sort = 'name', $page = 1, $size = 20)
{
$query = $this->search($params, $sort);
$pager = new sfDoctrinePager('sfAsset', $size);
$pager->setQuery($query);
$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;
}