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


PHP sfDoctrinePager::setQuery方法代碼示例

本文整理匯總了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;
 }
開發者ID:slemoigne,項目名稱:sympal,代碼行數:27,代碼來源:PluginsfSympalContentList.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: 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

示例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;
 }
開發者ID:nixilla,項目名稱:sfImagePoolPlugin,代碼行數:41,代碼來源:PluginsfImagePoolImageTable.class.php

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

示例6: 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

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

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

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

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

示例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;
  }
開發者ID:nise-nabe,項目名稱:opIntroFriendPlugin,代碼行數:16,代碼來源:PluginIntroFriendTable.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($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;
 }
開發者ID:rysk92,項目名稱:opVotePlugin,代碼行數:9,代碼來源:PluginVoteQuestionTable.class.php

示例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;
 }
開發者ID:balibali,項目名稱:opPluginChannelServerPlugin,代碼行數:9,代碼來源:PluginPluginMemberTable.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::setQuery方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。