| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- /**
- * @see Zend_Paginator_Adapter_Interface
- */
- require_once 'Zend/Paginator/Adapter/Interface.php';
- /**
- * @category Thinkopen
- * @package Mooses_Paginator
- * @copyright Thinkopen s.r.l.
- * @license New BSD License
- * @author Stefan Heckler
- */
- class Mooses_Mongodb_Paginator_Adapter_Mongo implements Zend_Paginator_Adapter_Interface
- {
- /**
- * Cursor
- *
- * @var Mooses_Mongodb_Mongo_Iterator_Cursor
- */
- protected $_cursor = null;
- /**
- * Constructor.
- *
- * @param Mooses_Mongodb_Mongo_Iterator_Cursor $cursor
- */
- public function __construct(Mooses_Mongodb_Mongo_Iterator_Cursor $cursor)
- {
- $this->_cursor = $cursor;
- }
- /**
- * Returns an cursor limited to items for a page.
- *
- * @param integer $offset Page offset
- * @param integer $itemCountPerPage Number of items per page
- * @return Mooses_Mongodb_Mongo_Iterator_Cursor
- */
- public function getItems($offset, $itemCountPerPage)
- {
- $cursor = $this->_cursor->skip($offset)->limit($itemCountPerPage);
- return $cursor;
- }
- /**
- * Returns the total number of rows in the cursor.
- *
- * @return integer
- */
- public function count()
- {
- return $this->_cursor->count();
- }
- }
|