當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sfDoctrinePager類代碼示例

本文整理匯總了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;
 }
開發者ID:JoshuaEstes,項目名稱:Office-Merit-Badges,代碼行數:11,代碼來源:actions.class.php

示例2: getPager

 protected function getPager(Doctrine_Query $q, $page, $size)
 {
     $pager = new sfDoctrinePager('Bbs', $size);
     $pager->setQuery($q);
     $pager->setPage($page);
     return $pager;
 }
開發者ID:uzura8,項目名稱:opSimpleBbsPlugin,代碼行數:7,代碼來源:PluginBbsTable.class.php

示例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;
 }
開發者ID:snouhaud,項目名稱:camptocamp.org,代碼行數:40,代碼來源:AssociationLog.class.php

示例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;
 }
開發者ID:slemoigne,項目名稱:sympal,代碼行數:27,代碼來源:PluginsfSympalContentList.class.php

示例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;
}
開發者ID:RafalJachimczyk,項目名稱:sympal,代碼行數:33,代碼來源:SympalPagerHelper.php

示例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;
 }
開發者ID:balibali,項目名稱:opPluginChannelServerPlugin,代碼行數:8,代碼來源:PluginPluginReleaseTable.class.php

示例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;
 }
開發者ID:n1k0,項目名稱:sftunes,代碼行數:8,代碼來源:actions.class.php

示例8: getPager

 public function getPager()
 {
     $pager = new sfDoctrinePager('NewItem', 5);
     $pager->setQuery($this->getNewsQuery());
     $pager->setPage($this->getRequestParameter('page', 1));
     $pager->init();
     return $pager;
 }
開發者ID:vcgato29,項目名稱:poff,代碼行數:8,代碼來源:components.class.php

示例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;
 }
開發者ID:meruto,項目名稱:opDiaryPlugin,代碼行數:8,代碼來源:PluginDiaryCommentUpdateTable.class.php

示例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;
 }
開發者ID:te-koyama,項目名稱:openpne,代碼行數:8,代碼來源:PluginCommunityTopicTable.class.php

示例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;
 }
開發者ID:nothan,項目名稱:opCCCCPlugin,代碼行數:9,代碼來源:PluginCcccMangaTable.class.php

示例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;
  }
開發者ID:romankallweit,項目名稱:swingmachine,代碼行數:9,代碼來源:actions.class.php

示例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;
 }
開發者ID:te-koyama,項目名稱:openpne,代碼行數:9,代碼來源:OpenIDTrustLogTable.class.php

示例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;
 }
開發者ID:joanteixi,項目名稱:sfDoctrineAssetsLibraryPlugin,代碼行數:17,代碼來源:PluginsfAssetTable.class.php

示例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;
 }
開發者ID:77web,項目名稱:opMapPlugin,代碼行數:9,代碼來源:PluginGeocodeTable.class.php


注:本文中的sfDoctrinePager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。