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


PHP Pagination::setTotalRows方法代码示例

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


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

示例1: index

 public function index()
 {
     $data = array();
     $blogCollection = new BlogCollection();
     $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
     $perPage = 5;
     $offset = $page ? ($page - 1) * $perPage : 0;
     $rows = count($blogCollection->getAll());
     $pagination = new Pagination();
     $pagination->setPerPage($perPage);
     $pagination->setTotalRows($rows);
     $pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/index.php?c=blog&m=index");
     $blogs = $blogCollection->getAll(array(), $offset, $perPage);
     $data['blogs'] = $blogs;
     $data['pagination'] = $pagination;
     $this->loadFrontView('blog/listing', $data);
 }
开发者ID:dbcdeathdreamer,项目名称:SoftAcad,代码行数:17,代码来源:BlogController.php

示例2: index

 public function index()
 {
     if (!$this->loggedIn()) {
         header('Location: index.php?c=login&m=login');
     }
     $data = array();
     $usersCollection = new UserCollection();
     $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
     $perPage = 5;
     $offset = $page ? ($page - 1) * $perPage : 0;
     $rows = count($usersCollection->getAll());
     $pagination = new Pagination();
     $pagination->setPerPage($perPage);
     $pagination->setTotalRows($rows);
     $pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/admin/index.php?c=user&m=index");
     $users = $usersCollection->getAll(array(), $offset, $perPage);
     $data['users'] = $users;
     $data['pagination'] = $pagination;
     $this->loadView('users/listing', $data);
 }
开发者ID:dbcdeathdreamer,项目名称:SoftAcad,代码行数:20,代码来源:UserController.php

示例3: index

 public function index()
 {
     $data = array();
     $categoryId = isset($_GET['id']) ? $_GET['id'] : 0;
     $toursCollection = new ToursCollection();
     $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
     $perPage = 6;
     $offset = $page ? ($page - 1) * $perPage : 0;
     if ($categoryId > 0) {
         $where = array('category_id' => $categoryId);
         $rows = count($toursCollection->getAll($where));
         $tours = $toursCollection->getAll($where, $offset, $perPage);
     } else {
         $rows = count($toursCollection->getAll());
         $tours = $toursCollection->getAll(array(), $offset, $perPage);
     }
     $pagination = new Pagination();
     $pagination->setPerPage($perPage);
     $pagination->setTotalRows($rows);
     $pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/index.php?c=tours&m=index&id=" . $categoryId);
     $data['pagination'] = $pagination;
     $data['tours'] = $tours;
     $this->loadFrontView('tours/listing', $data);
 }
开发者ID:dbcdeathdreamer,项目名称:SoftAcad,代码行数:24,代码来源:ToursController.php

示例4: index

 public function index()
 {
     $data = array();
     if (!$this->loggedIn()) {
         header('Location: index.php?c=login&m=login');
     }
     $search = isset($_GET['search']) ? $_GET['search'] : '';
     if (trim($search) != '') {
         $like = array('name', htmlspecialchars(trim($search)));
     } else {
         $like = array();
     }
     $perPageSelect = isset($_GET['perPage']) ? (int) $_GET['perPage'] : 0;
     switch ($perPageSelect) {
         case 0:
             $perPage = 10;
             break;
         case 1:
             $perPage = 5;
             break;
         case 2:
             $perPage = 10;
             break;
         case 3:
             $perPage = 20;
             break;
         case 4:
             $perPage = 50;
             break;
         default:
             $perPage = 10;
     }
     $orderBy = isset($_GET['orderBy']) ? (int) $_GET['orderBy'] : 0;
     switch ($orderBy) {
         case 0:
             $order = array('id', 'DESC');
             break;
         case 1:
             $order = array('name', 'ASC');
             break;
         case 2:
             $order = array('name', 'DESC');
             break;
         case 3:
             $order = array('category_id', 'ASC');
             break;
         case 4:
             $order = array('category_id', 'DESC');
             break;
         default:
             $order = array('id', 'DESC');
     }
     $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
     $offset = $page ? ($page - 1) * $perPage : 0;
     $toursCollection = new ToursCollection();
     $rows = count($toursCollection->getAll(array(), -1, 0, $order, $like)) == 0 ? 1 : count($toursCollection->getAll(array(), -1, 0, $order, $like));
     $pagination = new Pagination();
     $pagination->setPerPage($perPage);
     $pagination->setTotalRows($rows);
     $pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/admin/index.php?c=tour&m=index&perPage={$perPageSelect}&orderBy={$orderBy}&search={$search}");
     $tours = $toursCollection->getAll(array(), $offset, $perPage, $order, $like);
     $data['tours'] = $tours;
     $data['pagination'] = $pagination;
     $data['search'] = $search;
     $data['perPageSelect'] = $perPageSelect;
     $data['orderBy'] = $orderBy;
     $data['page'] = $page;
     $this->loadView('tours/listing', $data);
 }
开发者ID:dbcdeathdreamer,项目名称:SoftAcad,代码行数:69,代码来源:TourController.php

示例5: UserCollection

                    <tr>
                        <th>Username</th>
                        <th>Email</th>
                        <th>Description</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
$usersCollection = new UserCollection();
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$perPage = 5;
$offset = $page ? ($page - 1) * $perPage : 0;
$rows = count($usersCollection->getAll());
$pagination = new Pagination();
$pagination->setPerPage($perPage);
$pagination->setTotalRows($rows);
$pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/admin/users.php");
$users = $usersCollection->getAll(array(), $offset, $perPage);
foreach ($users as $user) {
    ?>
                        <tr>
                            <td><?php 
    echo $user->getUsername();
    ?>
</td>
                            <td class="center"><?php 
    echo $user->getEmail();
    ?>
</td>
                            <td class="center"><?php 
    echo $user->getDescription();
开发者ID:dbcdeathdreamer,项目名称:SoftAcad,代码行数:31,代码来源:users.php


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