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


PHP Zend_Paginator::count方法代码示例

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


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

示例1: fetchByType

 public static function fetchByType($type = 1, $page = 1, $perpage = 30)
 {
     if ($type != 0 && $type != 1 && $type != 2) {
         return array();
     }
     $select = self::select();
     if ($type != 0) {
         $select->where('type = ?', $type);
     }
     $select->order('sort asc');
     $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setItemCountPerPage($perpage)->setCurrentPageNumber($page);
     $data = $paginator->getCurrentItems();
     $pages = $paginator->count();
     $destinations = array();
     if (count($data) > 0) {
         foreach ($data as $da) {
             $destinationModel = new Application_Model_O_Destination();
             $destinationModel->setId($da->id)->setCity($da->city)->setType($da->type)->setLongitude($da->longitude)->setLatitude($da->latitude)->setImg($da->img)->setSort($da->sort)->setCtime($da->ctime)->setUtime($da->utime)->setStatus($da->status);
             array_push($destinations, $destinationModel);
         }
     }
     $res = array('destinations' => $destinations, 'pages' => $pages);
     return $res;
 }
开发者ID:baiooy,项目名称:hqimt_backend,代码行数:26,代码来源:Destination.php

示例2: _addPaginator

 protected function _addPaginator($oOperation)
 {
     //dodaj standardowe metody grida
     //        list($sDBSort, $sDBOrder) = $this->_getDatabaseSort();
     //        $oOperation->setSort($sDBSort);
     //        $oOperation->setOrder($sDBOrder);
     //        $oOperation->setSearch($this->_getDatabaseSearch());
     $oOperation->init();
     //grid paginowany
     $page = $this->getRequest()->getParam('page', 1);
     //        $iResultLimit =  $this->_getDatabaseResultLimit();
     if (method_exists($oOperation, 'pageLimit')) {
         $iResultLimit = $oOperation->pageLimit();
     }
     $adapter = new Zend_Paginator_Adapter_DbSelect($oOperation->getSelect());
     $adapter->setRowCount($oOperation->getSelectCount());
     $paginator = new Zend_Paginator($adapter);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($iResultLimit);
     if ($paginator->count() == 0) {
         Message_Operation_Flash::setMsg('Brak rekordów', Message_Operation_Flash::LEVEL_DANGER);
     }
     $this->view->paginator = $paginator;
     //config
     $this->view->config_url = $this->_oConfig->url;
 }
开发者ID:Webowiec,项目名称:zendnote,代码行数:26,代码来源:OfferView.php

示例3: fetchByDepartmentHospital

 public static function fetchByDepartmentHospital($department, $hospital, $sort, $page)
 {
     $select = self::select();
     if ($department) {
         $select->where("department like '%{$department}%'")->orWhere("special like '%{$department}%'");
     }
     if ($hospital) {
         $select->where('hospital = ?', $hospital);
     }
     if ($sort == 1) {
         //asc
         $select->order('reservation_number asc');
     } elseif ($sort == 2) {
         //desc
         $select->order('reservation_number desc');
     }
     $select->where('status = 1');
     $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setItemCountPerPage(10)->setCurrentPageNumber($page);
     $data = $paginator->getCurrentItems();
     $pages = $paginator->count();
     $doctors = array();
     if (count($data) > 0) {
         foreach ($data as $da) {
             $doctorModel = new Application_Model_O_Doctor();
             $doctorModel->setId($da->id)->setName($da->name)->setAvatar($da->avatar)->setSex($da->sex)->setBirthday($da->birthday)->setEmail($da->email)->setPasswd($da->passwd)->setPhone($da->phone)->setDepartment($da->department)->setPoint($da->point)->setCity($da->city)->setCertified($da->certified)->setSpecial($da->special)->setCountry($da->country)->setIntroduction($da->introduction)->setHospital($da->hospital)->setArea($da->area)->setQualification($da->qualification)->setReservation_fee($da->reservation_fee)->setReservation_number($da->reservation_number)->setCtime($da->ctime)->setUtime($da->utime)->setStatus($da->status);
             array_push($doctors, $doctorModel);
         }
     }
     $res = array('doctors' => $doctors, 'pages' => $pages);
     return $res;
 }
开发者ID:baiooy,项目名称:hqimt_backend,代码行数:33,代码来源:Doctor.php

示例4: fetchAllPage

 public static function fetchAllPage($role, $page = 1, $perpage = 30)
 {
     if ($role != 0 && $role != 1 && $role != 2 && $role != 3) {
         return array();
     }
     $select = self::select();
     if ($role != 0) {
         $select->where('urole = ?', $role)->order('ctime desc');
     }
     $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setItemCountPerPage($perpage)->setCurrentPageNumber($page);
     $data = $paginator->getCurrentItems();
     $pages = $paginator->count();
     $orders = array();
     if (count($data) > 0) {
         foreach ($data as $da) {
             $orderModel = new Application_Model_O_MemberCardOrder();
             $orderModel->setId($da->id)->setOrder_id($da->order_id)->setUid($da->uid)->setUrole($da->urole)->setMember_card_id($da->member_card_id)->setTotal_price($da->total_price)->setPayment_status($da->payment_status)->setRemark($da->remark)->setCtime($da->ctime)->setUtime($da->utime)->setStatus($da->status);
             array_push($orders, $orderModel);
         }
     }
     $res = array('orders' => $orders, 'pages' => $pages);
     return $res;
 }
开发者ID:baiooy,项目名称:hqimt_backend,代码行数:25,代码来源:MemberCardOrder.php

示例5: fetchByType

 public static function fetchByType($type = 1, $filter, $order, $page = 1)
 {
     if ($type != 1 && $type != 2 && $type != 3) {
         return array();
     }
     $select = self::select();
     $select->where('type = ?', $type)->where('status =1');
     if ($filter == 1 || $filter == 2) {
         $select->where('location_type = ?', $filter);
     }
     if ($order == 1) {
         $select->order('adult_dprice desc');
     } elseif ($order == 2) {
         $select->order('adult_dprice asc');
     } elseif ($order == 3) {
         $select->order('sales desc');
     } elseif ($order == 4) {
         $select->order('sales asc');
     }
     $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setItemCountPerPage(10)->setCurrentPageNumber($page);
     $data = $paginator->getCurrentItems();
     $pages = $paginator->count();
     $travels = array();
     if (count($data) > 0) {
         foreach ($data as $da) {
             $travelModel = new Application_Model_O_Travel();
             $travelModel->setId($da->id)->setType($da->type)->setLocation_type($da->location_type)->setAdult_oprice($da->adult_oprice)->setAdult_dprice($da->adult_dprice)->setChild_oprice($da->child_oprice)->setChild_dprice($da->child_dprice)->setArea($da->area)->setSales($da->sales)->setTitle($da->title)->setSubtitle($da->subtitle)->setImg($da->img)->setCtime($da->ctime)->setUtime($da->utime)->setStatus($da->status);
             array_push($travels, $travelModel);
         }
     }
     $res = array('travels' => $travels, 'pages' => $pages);
     return $res;
 }
开发者ID:baiooy,项目名称:hqimt_backend,代码行数:35,代码来源:Travel.php

示例6: getPages

 /**
  * Create the page object used in View - paginator method
  * @access public
  * @return object
  */
 public function getPages()
 {
     $pages = new stdClass();
     $pageCount = $this->_paginator->count();
     $pages->pageCount = $pageCount;
     $pages->itemCountPerPage = $this->_itemCountPerPage;
     $pages->first = 1;
     $pages->current = (int) $this->_currentPage;
     $pages->last = $pageCount;
     // Previous and next
     if ($this->_currentPage - 1 > 0) {
         $pages->previous = $this->_currentPage - 1;
     }
     if ($this->_currentPage + 1 <= $pageCount) {
         $pages->next = $this->_currentPage + 1;
     }
     // Pages in range
     $pageRange = $this->_paginator->getPageRange();
     if ($pageRange > $pageCount) {
         $pageRange = $pageCount;
     }
     $delta = ceil($pageRange / 2);
     if ($this->_currentPage - $delta > $pageCount - $pageRange) {
         $lowerBound = $pageCount - $pageRange + 1;
         $upperBound = $pageCount;
     } else {
         if ($this->_currentPage - $delta < 0) {
             $delta = $this->_currentPage;
         }
         $offset = $this->_currentPage - $delta;
         $lowerBound = $offset + 1;
         $upperBound = $offset + $pageRange;
     }
     $pages->pagesInRange = $this->_paginator->getPagesInRange($lowerBound, $upperBound);
     $pages->firstPageInRange = min($pages->pagesInRange);
     $pages->lastPageInRange = max($pages->pagesInRange);
     // Item numbers
     if ($this->_currentItems == null) {
         $this->getCurrentItems();
     }
     if ($this->_currentItems !== null) {
         $pages->currentItemCount = $this->_paginator->getCurrentItemCount();
         $pages->itemCountPerPage = $this->_paginator->getItemCountPerPage();
         $pages->totalItemCount = $this->_paginator->getTotalItemCount();
         $pages->firstItemNumber = ($this->_currentPage - 1) * $this->_paginator->getItemCountPerPage() + 1;
         $pages->lastItemNumber = $pages->firstItemNumber + $pages->currentItemCount - 1;
     }
     return $pages;
 }
开发者ID:sandeepdwarkapuria,项目名称:dotkernel,代码行数:54,代码来源:Paginator.php

示例7: search

 /**
  * Returns a paginated list of all sites matching the given parameters.
  * 
  * @param array $params
  * @return array
  */
 public static function search(array $params)
 {
     $siteDb = Yadda_Db_Table::getInstance('site');
     $select = $siteDb->select()->setIntegrityCheck(false)->from('site')->joinLeft('deal', 'site.id = deal.site_id', array('latest_deal' => 'MAX(deal.created)'))->where('site.status = ?', 'active')->group('site.id')->order('site.name');
     // fetch
     $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($select));
     $paginator->setCurrentPageNumber(isset($params['page']) ? (int) $params['page'] : 1);
     $paginator->setItemCountPerPage(isset($params['count']) ? (int) $params['count'] : 10);
     $return = array('params' => $params, 'total' => $paginator->getTotalItemCount(), 'page' => $paginator->getCurrentPageNumber(), 'pages' => $paginator->count(), 'results' => array());
     $sites = new Zend_Db_Table_Rowset(array('table' => $siteDb, 'data' => (array) $paginator->getCurrentItems()));
     foreach ($sites as $site) {
         $return['results'][] = self::toArray($site);
     }
     return $return;
 }
开发者ID:neilgarb,项目名称:yadda,代码行数:21,代码来源:Site.php

示例8: search

 public static function search($params)
 {
     // build query
     $subscriptionDb = Yadda_Db_Table::getInstance('subscription');
     $select = $subscriptionDb->select()->setIntegrityCheck(false)->from('subscription')->joinLeft('user', 'subscription.user_id = user.id', array('user_email' => 'email'))->where('subscription.status = ?', 'active')->order('created DESC');
     // fetch
     $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($select));
     $paginator->setCurrentPageNumber(isset($params['page']) ? (int) $params['page'] : 1);
     $paginator->setItemCountPerPage(isset($params['count']) ? (int) $params['count'] : 10);
     $return = array('params' => $params, 'total' => $paginator->getTotalItemCount(), 'page' => $paginator->getCurrentPageNumber(), 'pages' => $paginator->count(), 'results' => array());
     $subscriptions = new Zend_Db_Table_Rowset(array('table' => $subscriptionDb, 'data' => (array) $paginator->getCurrentItems()));
     foreach ($subscriptions as $subscription) {
         $return['results'][] = self::toArray($subscription);
     }
     return $return;
 }
开发者ID:neilgarb,项目名称:yadda,代码行数:16,代码来源:Subscription.php

示例9: search

 /**
  * Returns a paginated list of regions matching the given parameters.
  * 
  * @param array $params
  * @return array
  */
 public static function search(array $params)
 {
     // build query
     $regionDb = Yadda_Db_Table::getInstance('region');
     $select = $regionDb->select()->from('region')->where('status = ?', 'active')->order('name');
     // fetch
     $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($select));
     $paginator->setCurrentPageNumber(isset($params['page']) ? (int) $params['page'] : 1);
     $paginator->setItemCountPerPage(isset($params['count']) ? (int) $params['count'] : 10);
     $return = array('params' => $params, 'total' => $paginator->getTotalItemCount(), 'page' => $paginator->getCurrentPageNumber(), 'pages' => $paginator->count(), 'results' => array());
     $regions = new Zend_Db_Table_Rowset(array('table' => $regionDb, 'data' => (array) $paginator->getCurrentItems()));
     foreach ($regions as $region) {
         $return['results'][] = self::toArray($region);
     }
     return $return;
 }
开发者ID:neilgarb,项目名称:yadda,代码行数:22,代码来源:Region.php

示例10: testPaginator

 public function testPaginator()
 {
     $countries = My_ShantyMongo_Country::all();
     $this->assertEquals(239, $countries->count());
     $paginator = new Zend_Paginator(new Shanty_Paginator_Adapter_Mongo($countries));
     $paginator->setItemCountPerPage(10);
     $paginator->setCurrentPageNumber(3);
     $this->assertEquals(24, $paginator->count());
     // Count pages
     $this->assertEquals(239, $paginator->getTotalItemCount());
     // count total items
     $this->assertEquals(10, $paginator->getCurrentItemCount());
     // count items on this page
     $paginator->getCurrentItems()->rewind();
     $firstItem = $paginator->getCurrentItems()->current();
     $this->assertEquals($firstItem->code, 'BB');
     $this->assertEquals($firstItem->name, 'Barbados');
 }
开发者ID:hongliang,项目名称:Shanty-Mongo,代码行数:18,代码来源:MongoTest.php

示例11: fetchAllPage

 public static function fetchAllPage($page = 1, $perpage = 30)
 {
     $select = self::select();
     $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setItemCountPerPage($perpage)->setCurrentPageNumber($page);
     $data = $paginator->getCurrentItems();
     $pages = $paginator->count();
     $applys = array();
     if (count($data) > 0) {
         foreach ($data as $da) {
             $applyModel = new Application_Model_O_GlobalConsultationApply();
             $applyModel->setId($da->id)->setDepartment_category_id($da->department_category_id)->setDepartment_id($da->department_id)->setEmail($da->email)->setMobile($da->mobile)->setAge($da->age)->setSex($da->sex)->setLocation($da->location)->setTreatment_time($da->treatment_time)->setOpinion($da->opinion)->setReport($da->report)->setCtime($da->ctime)->setUtime($da->utime)->setStatus($da->status);
             array_push($applys, $applyModel);
         }
     }
     $res = array('applys' => $applys, 'pages' => $pages);
     return $res;
 }
开发者ID:baiooy,项目名称:hqimt_backend,代码行数:19,代码来源:GlobalConsultationApply.php

示例12: fetchAllPage

 public static function fetchAllPage($page = 1, $perpage = 30)
 {
     $select = self::select();
     $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setItemCountPerPage($perpage)->setCurrentPageNumber($page);
     $data = $paginator->getCurrentItems();
     $pages = $paginator->count();
     $feedbacks = array();
     if (count($data) > 0) {
         foreach ($data as $da) {
             $feedbackModel = new Application_Model_O_Feedback();
             $feedbackModel->setId($da->id)->setContent($da->content)->setContact($da->contact)->setCtime($da->ctime)->setUtime($da->utime)->setStatus($da->status);
             array_push($feedbacks, $feedbackModel);
         }
     }
     $res = array('feedbacks' => $feedbacks, 'pages' => $pages);
     return $res;
 }
开发者ID:baiooy,项目名称:hqimt_backend,代码行数:19,代码来源:Feedback.php

示例13: fetchAllPage

 public static function fetchAllPage($page = 1, $perpage = 30)
 {
     $select = self::select();
     $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setItemCountPerPage($perpage)->setCurrentPageNumber($page);
     $data = $paginator->getCurrentItems();
     $pages = $paginator->count();
     $cards = array();
     if (count($data) > 0) {
         foreach ($data as $da) {
             $cardModel = new Application_Model_O_MemberCard();
             $cardModel->setId($da->id)->setName($da->name)->setOprice($da->oprice)->setDprice($da->dprice)->setPoints($da->points)->setCtime($da->ctime)->setUtime($da->utime)->setStatus($da->status);
             array_push($cards, $cardModel);
         }
     }
     $res = array('cards' => $cards, 'pages' => $pages);
     return $res;
 }
开发者ID:baiooy,项目名称:hqimt_backend,代码行数:19,代码来源:MemberCard.php

示例14: indexAction

 /**
  * Lists all servicePacks matching a criteria
  */
 public function indexAction()
 {
     // Check permissions
     $sp = new ServicePackModel();
     $this->_helper->allowed('list', $sp);
     // Pagination
     $params = $this->_getPaginatorParams();
     // Filters
     $filters = $this->_mapToFilter($this->_getFilterParams());
     $this->_checkFilterParams($filters, ServicePackFilterFields::getWhiteList());
     try {
         $filterList = $this->_spSrv->buildFilterList($filters, true);
     } catch (ValidateException $e) {
         throw $this->_mapException($e, $this->_mapParamToFilter, true);
     }
     $this->_helper->filterNotAllowedFilters('filter_by', $filterList);
     // Search
     $spList = $this->_spSrv->listAll($filterList, $params);
     if ($spList) {
         $list = array();
         foreach ($spList->getItems() as $item) {
             try {
                 $this->_helper->allowed('read', $item);
                 $this->_helper->filterNotAllowedFields('read_field', $item);
                 $list[] = $item;
             } catch (Exception $e) {
                 // Do nothing
             }
         }
         // Simulate pagination
         $it = new ArrayIterator($list);
         $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Iterator($it));
         $paginator->setItemCountPerPage($params['count']);
         // Result
         if ($params['page'] <= $paginator->count()) {
             $iterator = $paginator->getItemsByPage($params['page']);
             $this->view->servicePacks = iterator_to_array($iterator, false);
         } else {
             $this->view->servicePacks = array();
         }
     }
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:45,代码来源:ServicepackController.php

示例15: fetchAllPage

 public static function fetchAllPage($page = 1, $perpage = 30)
 {
     $select = self::select();
     $select->order('sort asc');
     $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setItemCountPerPage($perpage)->setCurrentPageNumber($page);
     $data = $paginator->getCurrentItems();
     $pages = $paginator->count();
     $departments = array();
     if (count($data) > 0) {
         foreach ($data as $da) {
             $departmentModel = new Application_Model_O_Departments();
             $departmentModel->setId($da->id)->setName($da->name)->setImg($da->img)->setCategory_id($da->category_id)->setSort($da->sort)->setCtime($da->ctime)->setUtime($da->utime)->setStatus($da->status);
             array_push($departments, $departmentModel);
         }
     }
     $res = array('departments' => $departments, 'pages' => $pages);
     return $res;
 }
开发者ID:baiooy,项目名称:hqimt_backend,代码行数:20,代码来源:Departments.php


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