当前位置: 首页>>代码示例>>PHP>>正文


PHP PaginatedList::getTotalItems方法代码示例

本文整理汇总了PHP中PaginatedList::getTotalItems方法的典型用法代码示例。如果您正苦于以下问题:PHP PaginatedList::getTotalItems方法的具体用法?PHP PaginatedList::getTotalItems怎么用?PHP PaginatedList::getTotalItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PaginatedList的用法示例。


在下文中一共展示了PaginatedList::getTotalItems方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleList

 /**
  * Displays a list of all members on the site that belong to the selected
  * groups.
  *
  * @return string
  */
 public function handleList($request)
 {
     $fields = $this->parent->Fields()->filter('MemberListVisible', true);
     $members = $this->parent->Groups()->relation('Members');
     $members = new PaginatedList($members, $request);
     $list = new PaginatedList(new ArrayList(), $request);
     $list->setLimitItems(false);
     $list->setTotalItems($members->getTotalItems());
     foreach ($members as $member) {
         $cols = new ArrayList();
         $public = $member->getPublicFields();
         $link = $this->Link($member->ID);
         foreach ($fields as $field) {
             if ($field->PublicVisibility == 'MemberChoice' && !in_array($field->MemberField, $public)) {
                 $value = null;
             } else {
                 $value = $member->{$field->MemberField};
             }
             $cols->push(new ArrayData(array('Name' => $field->MemberField, 'Title' => $field->Title, 'Value' => $value, 'Sortable' => $member->hasDatabaseField($field->MemberField), 'Link' => $link)));
         }
         $list->push($member->customise(array('Fields' => $cols)));
     }
     $this->data()->Title = _t('MemberProfiles.MEMBERLIST', 'Member List');
     $this->data()->Parent = $this->parent;
     $controller = $this->customise(array('Members' => $list));
     return $controller->renderWith(array('MemberProfileViewer_list', 'MemberProfileViewer', 'Page'));
 }
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-memberprofiles,代码行数:33,代码来源:MemberProfileViewer.php

示例2: requests

 /**
  * Show the "login" page
  *
  * @return string Returns the "login" page as HTML code.
  */
 public function requests()
 {
     // Vorerst keine Seite erstellt
     $Contacts = new PaginatedList(Member::currentUser()->OpenConfirmations(), $this->request);
     $Contacts->setPageLength(10);
     if ($Contacts->getTotalItems() == 0) {
         return $this->redirect('contacts/index');
     }
     return $this->customise(new ArrayData(array("Title" => _t('Contacts.REQUESTSTITLE', 'Contacts.REQUESTSTITLE'), "Contacts" => $Contacts)))->renderWith(array('Contacts_requests', 'Contacts', $this->stat('template_main'), $this->stat('template')));
 }
开发者ID:andrelohmann,项目名称:roof-for-refugees.org,代码行数:15,代码来源:ContactsController.php

示例3: testSetPaginationFromQuery

 public function testSetPaginationFromQuery()
 {
     $query = $this->getMock('SQLQuery');
     $query->expects($this->once())->method('getLimit')->will($this->returnValue(array('limit' => 15, 'start' => 30)));
     $query->expects($this->once())->method('unlimitedRowCount')->will($this->returnValue(100));
     $list = new PaginatedList(new ArrayList());
     $list->setPaginationFromQuery($query);
     $this->assertEquals(15, $list->getPageLength());
     $this->assertEquals(30, $list->getPageStart());
     $this->assertEquals(100, $list->getTotalItems());
 }
开发者ID:nomidi,项目名称:sapphire,代码行数:11,代码来源:PaginatedListTest.php

示例4: testGetIterator

 public function testGetIterator()
 {
     $list = new PaginatedList(new ArrayList(array(new DataObject(array('Num' => 1)), new DataObject(array('Num' => 2)), new DataObject(array('Num' => 3)), new DataObject(array('Num' => 4)), new DataObject(array('Num' => 5)))));
     $list->setPageLength(2);
     $this->assertDOSEquals(array(array('Num' => 1), array('Num' => 2)), $list->getIterator());
     $list->setCurrentPage(2);
     $this->assertDOSEquals(array(array('Num' => 3), array('Num' => 4)), $list->getIterator());
     $list->setCurrentPage(3);
     $this->assertDOSEquals(array(array('Num' => 5)), $list->getIterator());
     $list->setCurrentPage(999);
     $this->assertDOSEquals(array(), $list->getIterator());
     $players = DataObjectTest_Player::get();
     $list = new PaginatedList($players);
     $list->setPageLength(1);
     $list->getIterator();
     $this->assertEquals(4, $list->getTotalItems(), 'Getting an iterator should not trim the list to the page length.');
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:17,代码来源:PaginatedListTest.php

示例5: serialize

 /**
  * @param $sort
  * @param $sortAscending
  * @param $start
  * @param $length
  * @return array
  */
 public function serialize($sort, $sortAscending, $start, $length)
 {
     $list = $this->list;
     $start = intval($start);
     $length = intval($length);
     $sortAscending = $sortAscending == 'true';
     $direction = $sortAscending ? 'ASC' : 'DESC';
     $results = array('data' => array(), 'start' => $start, 'length' => $length);
     if (in_array($sort, $this->columns)) {
         if ($this->list->canSortBy($sort)) {
             $list = $list->sort($sort, $direction);
             $results['sort'] = $sort;
             $results['ascending'] = $sortAscending;
         }
     }
     $paginatedList = new PaginatedList($list, array('start' => $start));
     $paginatedList->setPageLength($length);
     $results['total'] = $paginatedList->getTotalItems();
     foreach ($paginatedList as $key => $record) {
         foreach ($this->getColumnMappings() as $name => $map) {
             $results['data'][$key][$name] = $this->getValue($record, $map);
         }
     }
     return $results;
 }
开发者ID:helpfulrobot,项目名称:tom-alexander-silverstripe-griddle,代码行数:32,代码来源:GriddleFieldSource.php

示例6: Products

 /**
  * Return the products for this group.
  */
 public function Products($recursive = true)
 {
     $products = $this->ProductsShowable($recursive);
     //sort the products
     $products = $this->getSorter()->sortList($products);
     //paginate the products, if necessary
     $pagelength = ProductCategory::config()->page_length;
     if ($pagelength > 0) {
         $products = new PaginatedList($products, $this->request);
         $products->setPageLength($pagelength);
         $products->TotalCount = $products->getTotalItems();
     }
     return $products;
 }
开发者ID:8secs,项目名称:cocina,代码行数:17,代码来源:ProductCategory.php


注:本文中的PaginatedList::getTotalItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。