protected function _initPaginator() { $options = $this->getOptions(); if (array_key_exists('cache', $options) && $options['cache']) { // ensure the cache is initialized... $this->getBootstrap()->bootstrap('cachemanager'); // get the cache manager object $manager = $this->getBootstrap()->getResource('cachemanager'); // get the paginator cache object $cache = $manager->getCache(self::PAGINATOR_CACHE); if (!is_null($cache)) { Zend_Paginator::setCache($cache); } } if (!empty($options['scrollingType'])) { Zend_Paginator::setDefaultScrollingStyle($options['scrollingType']); } else { Zend_Paginator::setDefaultScrollingStyle(self::DEFAULT_SCROLLING_TYPE); } if (!empty($options['recordsPerPage'])) { Zend_Paginator::setDefaultItemCountPerPage($options['recordsPerPage']); } else { Zend_Paginator::setDefaultItemCountPerPage(self::DEFAULT_RECORDS_PER_PAGE); } if (!empty($options['viewScript'])) { Zend_View_Helper_PaginationControl::setDefaultViewPartial($options['viewScript']); } }
protected function _initTranslation() { $cache = $this->_getCache('core'); Zend_Translate::setCache($cache); Zend_Date::setOptions(array('cache' => $cache)); Zend_Paginator::setCache($cache); }
/** Retrieval of all HERs * @return array $data */ public function getAll($params) { $types = $this->getAdapter(); $select = $types->select()->from($this->_name)->order('name'); $paginator = Zend_Paginator::factory($select); Zend_Paginator::setCache(Zend_Registry::get('cache')); if (isset($params['page']) && $params['page'] != "") { $paginator->setCurrentPageNumber((int) $params['page']); } $paginator->setItemCountPerPage(20)->setPageRange(10); return $paginator; }
/** Get a list of va types paginated * @access public * @param array $params * @return array */ public function getVaTypes($params) { $types = $this->getAdapter(); $select = $types->select()->from($this->_name); $paginator = Zend_Paginator::factory($select); $paginator->setItemCountPerPage(30)->setPageRange(10); if (isset($params['page']) && $params['page'] != "") { $paginator->setCurrentPageNumber((int) $params['page']); } Zend_Paginator::setCache($this->_cache); return $paginator; }
/** Retrieve paginated mack types * @access public * @param integer $page * @return array $paginator */ public function getMackTypes($params) { $types = $this->getAdapter(); $select = $types->select()->from($this->_name)->joinLeft('coins', 'coins.mack_type = macktypes.type', array())->order($this->_name . '.type')->group($this->_name . '.type'); $paginator = Zend_Paginator::factory($select); Zend_Paginator::setCache($this->_cache); $paginator->setItemCountPerPage(30)->setPageRange(10); if (isset($params['page']) && $params['page'] != "") { $paginator->setCurrentPageNumber($params['page']); } return $paginator; }
/** Retrieve ip address count and addresses used per user for logins * @access public * @param string $user username * @return array */ public function myIps($user, $page) { $logins = $this->getAdapter(); $select = $logins->select()->from($this->_name, array('count' => 'COUNT(ipAddress)', 'ipAddress'))->where('username = ? ', $user)->group('ipAddress')->order('id DESC'); $paginator = Zend_Paginator::factory($select); $paginator->setItemCountPerPage(10)->setPageRange(10); Zend_Paginator::setCache($this->_cache); if (isset($page) && $page != "") { $paginator->setCurrentPageNumber($page); } return $paginator; }
/** Get all current opps as paginated list * @param integer $params['page'] the current page * @return array */ public function getCurrentOpps($params) { $vols = $this->getAdapter(); $select = $vols->select()->from($this->_name)->joinLeft('projecttypes', $this->_name . '.suitableFor = projecttypes.id', array('type' => 'title'))->joinLeft('people', $this->_name . '.managedBy = people.secuid', array('fullname'))->where($this->_name . '.status = ?', (int) 1)->order(array($this->_name . '.created')); $data = $vols->fetchAll($select); $paginator = Zend_Paginator::factory($data); Zend_Paginator::setCache($this->_cache); if (isset($params['page']) && $params['page'] != "") { $paginator->setCurrentPageNumber((int) $params['page']); } $paginator->setItemCountPerPage(50)->setPageRange(10); return $paginator; }
/** Get a paginated list of TVC dates * @access public * @param integer $page * @return \Zend_Paginator */ public function listDates($page) { $tvcs = $this->getAdapter(); $select = $tvcs->select()->from($this->_name)->joinLeft('tvcDatesToCases', 'tvcDatesToCases.tvcID = ' . $this->_name . '.secuid', array('total' => 'COUNT(*)'))->order($this->_name . '.date DESC')->group($this->_name . '.' . $this->_primary); $data = $tvcs->fetchAll($select); $paginator = Zend_Paginator::factory($data); Zend_Paginator::setCache($this->_cache); if (isset($page) && $page != "") { $paginator->setCurrentPageNumber((int) $page); } $paginator->setItemCountPerPage(20)->setPageRange(10); return $paginator; }
/** Retrieve all submitted error messages so far * @param array $params * @return object $paginator */ public function getMessages($params) { $messages = $this->getAdapter(); $select = $messages->select()->from($this->_name)->joinLeft('finds', 'finds.id = comment_findID', array('broadperiod', 'objecttype', 'old_findID'))->order($this->_name . '.id DESC'); $data = $messages->fetchAll($select); $paginator = Zend_Paginator::factory($data); Zend_Paginator::setCache($this->_cache); $paginator->setItemCountPerPage(20)->setPageRange(10); if (isset($params['page']) && $params['page'] != "") { $paginator->setCurrentPageNumber((int) $params['page']); } return $paginator; }
/** Get paginated list of institutions that are valid * @access public * @param array $params * @return \Zend_Paginator $paginator */ public function getValidInsts($params) { $roles = $this->getAdapter(); $select = $roles->select()->from($this->_name)->joinLeft('users', 'users.id = ' . $this->_name . '.createdBy', array('fullname'))->joinLeft('users', 'users_2.id = ' . $this->_name . '.updatedBy', array('fn' => 'fullname')); $data = $roles->fetchAll($select); $paginator = Zend_Paginator::factory($data); Zend_Paginator::setCache(Zend_Registry::get('cache')); if (isset($params['page']) && $params['page'] != "") { $paginator->setCurrentPageNumber((int) $params['page']); } $paginator->setItemCountPerPage(20)->setPageRange(10); return $paginator; }
/** Retrieve a list of users and paginate * @access public * @param type $params * @return \Zend_Paginator */ public function getUsersAdmin(array $params) { $select = $this->select()->from($this->_name)->where('valid = ?', 1)->order('lastlogin DESC'); if (isset($params['username']) && $params['username'] != "") { $un = strip_tags($params['username']); $select->where('username LIKE ?', (string) '%' . $un . '%'); } if (isset($params['role']) && $params['role'] != "") { $r = strip_tags($params['role']); $select->where('role = ?', (string) $r); } if (isset($params['fullname']) && $params['fullname'] != "") { $fn = strip_tags($params['fullname']); $select->where('fullname = ?', (string) $fn); } if (isset($params['visits']) && $params['visits'] != "") { $v = strip_tags($params['visits']); $select->where('visits >= ?', (string) $v); } if (isset($params['lastlogin']) && $params['lastlogin'] != "") { $ll = strip_tags($params['lastlogin']); $select->where('lastLogin >= ?', $ll . ' 00:00:00'); } $paginator = Zend_Paginator::factory($select); Zend_Paginator::setCache($this->_cache); $paginator->setItemCountPerPage(20)->setPageRange(10); if (isset($params['page']) && $params['page'] != "") { $paginator->setCurrentPageNumber($params['page']); } return $paginator; }
/** Get vacancies for admin * @access public * @param integer $page * @return \Zend_Paginator */ public function getJobsAdmin($page) { $livejobs = $this->getAdapter(); $select = $livejobs->select()->from($this->_name)->joinLeft(array('locality' => 'staffregions'), 'locality.ID = vacancies.regionID', array('staffregions' => 'description'))->joinLeft('users', 'users.id = ' . $this->_name . '.createdBy', array('fullname'))->joinLeft('users', 'users_2.id = ' . $this->_name . '.updatedBy', array('fn' => 'fullname'))->order('id DESC'); $data = $livejobs->fetchAll($select); $paginator = Zend_Paginator::factory($data); Zend_Paginator::setCache($this->_cache); $paginator->setItemCountPerPage(30)->setPageRange(10); if (isset($page) && $page != "") { $paginator->setCurrentPageNumber((int) $page); } return $paginator; }
public function paginatorcache() { $cache = $this->getResource('cachemanager')->getCache('requestcache'); Zend_Paginator::setCache($cache); }
/** Get paginated list of mints for admin console * @access public * @param array $params * @return \Zend_Paginator */ public function getMintsListAllAdmin($params) { $mints = $this->getAdapter(); $select = $mints->select()->from($this->_name)->joinLeft('periods', 'periods.id = mints.period', array('t' => 'term'))->joinLeft('users', $this->_name . '.createdBy = users.id', array('fullname'))->joinLeft('users', $this->_name . '.updatedBy = users_2.id', array('fn' => 'fullname'))->where($this->_name . '.valid = ?', (int) 1); if (isset($params['period']) && $params['period'] != "") { $select->where('period = ?', (int) $params['period']); } $paginator = Zend_Paginator::factory($select); Zend_Paginator::setCache($this->_cache); $paginator->setItemCountPerPage(30)->setPageRange(10); if (isset($params['page']) && $params['page'] != "") { $paginator->setCurrentPageNumber((int) $params['page']); } return $paginator; }
/** Get paginated gazetteer list of osdata * @access public * @param integer $page * @param string $county * @param string $district * @param string $parish * @param string $monumentName * @return \Zend_Paginator */ public function getSmrs($page, $county, $district, $parish, $monumentName) { $acros = $this->getAdapter(); $select = $acros->select()->from($this->_name, array('county' => 'full_county', 'gridref' => 'km_ref', 'monumentName' => 'name', 'id', 'f_code'))->where(new Zend_Db_Expr('f_code = "R" OR f_code = "A"'))->order('county'); if (isset($monumentName) && $monumentName != "") { $select->where('monumentName LIKE ?', (string) '%' . $monumentName . '%'); } if (isset($district) && $district != "") { $select->where('district = ?', (string) $district); } if (isset($county) && $county != "") { $select->where('county = ?', (string) $county); } if (isset($parish) && $parish != "") { $select->where('parish = ?', (string) $parish); } $data = $acros->fetchAll($select); $paginator = Zend_Paginator::factory($data); Zend_Paginator::setCache($this->_cache); $paginator->setItemCountPerPage(20)->setPageRange(10); if (isset($page) && $page != "") { $paginator->setCurrentPageNumber($page); } return $paginator; }
/** * Find images */ public function findimageAction() { $request = $this->getRequest(); $pageIndex = $request->getParam('pageIndex', 1); $perPage = $request->getParam('perpage'); $perPage = $perPage ? $perPage : 20; $offset = ($pageIndex - 1) * $perPage; $params = null; $exp = array(); $params = $request->getParam('q'); if (null != $params) { $exp = rawurldecode(base64_decode($params)); $exp = Zend_Json::decode($exp); } else { $params = rawurlencode(base64_encode(Zend_Json::encode($exp))); } $indexingEngine = Pandamp_Search::manager(); if ($exp['keyword'] == '*' || $exp['keyword'] == '') { $exp['keyword'] = '*:*'; } $hits = $indexingEngine->find($exp['keyword'] . ' mimeType:image* profile:kutu_doc', $offset, $perPage, 'createdDate desc'); $solrNumFound = count($hits->response->docs); $num_rows = $hits->response->numFound; $paginator = Zend_Paginator::factory($num_rows); $cache = Pandamp_Cache::getInstance(); if ($cache) { Zend_Paginator::setCache($cache); } $paginator->setCacheEnabled(true); $paginator->setCurrentPageNumber($pageIndex); $paginator->setItemCountPerPage($perPage); $paginator = get_object_vars($paginator->getPages('Sliding')); $paginatorOptions = array('path' => $this->view->url(array('lang' => $this->view->getLanguage()), 'search_catalog_findimage'), 'itemLink' => null == $params ? 'page-%d' : 'page-%d?perpage=' . $perPage . '&q=' . $params); /** * Support searching from other page * For example, search files at adding set page */ if (isset($exp['format']) && $exp['format'] == 'JSON') { $this->_helper->getHelper('viewRenderer')->setNoRender(); $this->_helper->getHelper('layout')->disableLayout(); $config = Pandamp_Application::getOption('cdn'); if ($solrNumFound > $perPage) { $numRowset = $perPage; } else { $numRowset = $solrNumFound; } $res = array('files' => array(), 'paginator' => $this->view->paginator()->slide($paginator, $paginatorOptions)); for ($i = 0; $i < $numRowset; $i++) { $row = $hits->response->docs[$i]; $fs = 'thumbnail_'; //$filename = $row->systemName; <-- metode ini kadang suka kosong $filename = $this->view->getCatalogAttribute($row->id, 'docSystemName'); $fn = pathinfo($filename, PATHINFO_FILENAME); $ext = pathinfo($filename, PATHINFO_EXTENSION); //$ext = strtolower($ext); if (substr($fn, 0, 2) !== 'lt') { $fn = $row->id; $fs = 'tn_'; $filename = $fn . '.' . strtolower($ext); } $title = $this->view->getCatalogAttribute($fn, 'fixedTitle'); $relDb = new App_Model_Db_Table_RelatedItem(); $rel = $relDb->fetchRow("itemGuid='" . $fn . "' AND relateAs='RELATED_IMAGE'"); $relGuid = isset($rel->relatedGuid) ? $rel->relatedGuid : ''; if (is_array(@getimagesize($config['static']['url']['images'] . '/' . $relGuid . '/' . $fs . $filename))) { $url = $config['static']['url']['images'] . '/' . $relGuid . '/' . $fs . $filename; } elseif (is_array(@getimagesize($config['static']['url']['images'] . '/' . $fs . $filename))) { $url = $config['static']['url']['images'] . '/' . $fs . $filename; } else { $url = 'http://static.hukumonline.com/frontend/default/images/kaze/karticle-img.jpg'; } //$url = $config['static']['url']['images'].'/'.$rel->relatedGuid.'/'.$rel->itemGuid.'.'.strtolower($ext); //$url = $config['static']['url']['images'].'/upload/'.$pd1.'/'.$pd2.'/'.$pd3.'/'.$pd4.'/'.$fn.'_square'.'.'.$ext; $res['files'][] = array('id' => isset($fn) ? $fn : '', 'relatedGuid' => isset($relGuid) ? $relGuid : '', 'title' => isset($title) ? $title : '', 'url' => isset($url) ? $url : ''); } $this->getResponse()->setBody(Zend_Json::encode($res)); } }
/** Get paginated list of all searches for admin interface * @access public * @param integer $page * @param integer $userid * @return \Zend_Paginator */ public function getAllSearchesAdmin($page, $userid) { $search = $this->getAdapter(); $select = $search->select()->from($this->_name)->joinLeft('users', 'users.id = searches.userid', array('username'))->order('id DESC'); if (isset($userid)) { $select->where($this->_name . '.userID = ?', $userid); } $paginator = Zend_Paginator::factory($select); Zend_Paginator::setCache($this->_cache); if (isset($page) && $page != "") { $paginator->setCurrentPageNumber((int) $page); } $paginator->setItemCountPerPage(20)->setPageRange(10); return $paginator; }
protected function setUp() { if (!extension_loaded('pdo_sqlite')) { $this->markTestSkipped('Pdo_Sqlite extension is not loaded'); } $this->_adapter = new Zend_Db_Adapter_Pdo_Sqlite(array('dbname' => dirname(__FILE__) . '/Paginator/_files/test.sqlite')); $this->_query = $this->_adapter->select()->from('test'); $this->_testCollection = range(1, 101); $this->_paginator = Zend_Paginator::factory($this->_testCollection); $this->_config = new Zend_Config_Xml(dirname(__FILE__) . '/Paginator/_files/config.xml'); // get a fresh new copy of ViewRenderer in each tests Zend_Controller_Action_HelperBroker::resetHelpers(); $fO = array('lifetime' => 3600, 'automatic_serialization' => true); $bO = array('cache_dir' => $this->_getTmpDir()); $this->_cache = Zend_Cache::factory('Core', 'File', $fO, $bO); Zend_Paginator::setCache($this->_cache); $this->_restorePaginatorDefaults(); }
/** Get a paginated list of all rulers * @access public * @param array $params * @return array */ public function getRulerList(array $params) { $actives = $this->getAdapter(); $select = $actives->select()->from($this->_name)->joinLeft('periods', 'periods.id = rulers.period', array('term', 'i' => 'id'))->joinLeft('users', 'users.id = ' . $this->_name . '.createdBy', array('fullname'))->joinLeft('users', 'users_2.id = ' . $this->_name . '.updatedBy', array('fn' => 'fullname'))->joinLeft('emperors', 'emperors.pasID = rulers.id', array('pasID' => 'emperors.id'))->where($this->_name . '.valid = ?', (int) 1)->group('issuer'); if (isset($params['period']) && $params['period'] != "") { $select->where('period = ?', (int) $params['period']); } $paginator = Zend_Paginator::factory($select); Zend_Paginator::setCache($this->_cache); $paginator->setItemCountPerPage(30)->setPageRange(10); if (isset($params['page']) && $params['page'] != "") { $paginator->setCurrentPageNumber((int) $params['page']); } return $paginator; }
/** The lister function of all guardian articles * @access public */ public function indexAction() { $page = $this->getParam('page'); $key = md5('pas' . self::QUERY); if (!$this->getCache()->test($key)) { $guardian = self::GUARDIANAPI_URL . 'search?q=' . urlencode(self::QUERY) . '&page-size=50&order-by=newest&format=' . self::FORMAT . '&show-fields=all&show-tags=all&show-factboxes=all&show-references=all&api-key=' . $this->_apikey; $this->_curl->setUri($guardian); $this->_curl->getRequest(); $articles = $this->_curl->getJson(); $this->getCache()->save($articles); } else { $articles = $this->getCache()->load($key); } $results = array(); foreach ($articles->response->results as $article) { if (isset($article->fields->thumbnail)) { $image = $article->fields->thumbnail; } else { $image = null; } if (isset($article->fields->standfirst)) { $stand = $article->fields->standfirst; } else { $stand = null; } $tags = array(); foreach ($article->tags as $k => $v) { $tags[$k] = $v; } if (isset($article->fields->byline)) { $byline = $article->fields->byline; } else { $byline = null; } $results[] = array('id' => $article->id, 'headline' => $article->fields->headline, 'byline' => $byline, 'image' => $image, 'pubDate' => $article->webPublicationDate, 'content' => $article->fields->body, 'trailtext' => $article->fields->trailText, 'publication' => $article->fields->publication, 'sectionName' => $article->sectionName, 'linkText' => $article->webTitle, 'standfirst' => $stand, 'section' => $article->sectionName, 'url' => $article->webUrl, 'shortUrl' => $article->fields->shortUrl, 'publication' => $article->fields->publication, 'tags' => $tags); } $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($results)); Zend_Paginator::setCache($this->getCache()); if (isset($page) && $page != "") { $paginator->setCurrentPageNumber((int) $page); } $paginator->setItemCountPerPage(20)->setPageRange(10); if (in_array($this->_helper->contextSwitch()->getCurrentContext(), array('xml', 'json', 'rss', 'atom'))) { $paginated = array(); foreach ($paginator as $k => $v) { $paginated[$k] = $v; } $data = array('pageNumber' => $paginator->getCurrentPageNumber(), 'total' => number_format($paginator->getTotalItemCount(), 0), 'itemsReturned' => $paginator->getCurrentItemCount(), 'totalPages' => number_format($paginator->getTotalItemCount() / $paginator->getItemCountPerPage(), 0)); $this->view->data = $data; $this->view->guardianStories = array('guardianStory' => $paginated); } else { $this->view->data = $paginator; } }
/** * Get the array of records satisfying the criteria specified in the parameter $options using Zend_Paginator * * @param Zend_Db_Adapter_Abstract $db * @param array $options * @return array Default_Model_DbTable_BlogPost objects */ public static function GetPaginatorPosts($db, $options = array()) { $arrResult = array(); $_config = Zend_Registry::get('config'); $itemCountPerPage = (int) $_config['paginator']['itemCountPerPage']; $pagesInRange = (int) $_config['paginator']['pagesInRange']; //--------------------------------------------------------- // инициализация опций $defaults = array('itemCountPerPage' => $itemCountPerPage, 'pagesInRange' => $pagesInRange, 'page' => 1, 'offset' => 0, 'limit' => 0, 'order' => 'p.ts_created', 'sort' => true); foreach ($defaults as $k => $v) { $options[$k] = array_key_exists($k, $options) ? $options[$k] : $v; } $select = self::_GetBaseQuery($db, $options); // установим поля таблицы для запроса $select->from(null, 'p.*'); // set the offset, limit, and ordering of results if ($options['limit'] > 0) { $select->limit($options['limit'], $options['offset']); } // Установим параметры сортировки для таблицы if ($options['sort']) { $select = self::GetSelectForSort($select, $options); } //------ Создадим обьект Zend_Paginator --------- $strSelect = $select->__toString(); $adapter = new Zend_Paginator_Adapter_DbSelect($select); $count = self::GetPostsCount($db, $options); $adapter->setRowCount($count); $paginator = new Zend_Paginator($adapter); // Установим максимальное количество отображаемых на странице элементов $paginator->setItemCountPerPage($options['itemCountPerPage']); // Установи массив страниц, возвращенный текущим стилем прокрутки $paginator->setPageRange($options['pagesInRange']); // Установим текущую страницу $paginator->setCurrentPageNumber($options['page']); //----- Конфигурирование кеша для Paginator ----- $pgCache = Default_Plugin_SysBox::getCache('paginator'); if ($pgCache->getOption('caching')) { // Установим кеш для Paginator Zend_Paginator::setCache($pgCache); // Очищение кеша if (Default_Plugin_SysBox::isCleanCache()) { $paginator->clearPageItemCache(); } } // получим данные в виде массива обьектов Default_Model_DbTable_BlogPost $posts = self::BuildMultiple($db, __CLASS__, $paginator); $post_ids = array_keys($posts); if (count($post_ids) == 0) { return array(); } // получим данные о загруженных сообщениях $profiles = Default_Model_Profile::BuildMultiple($db, 'Default_Model_DbTable_BlogPostProfile', array($post_ids)); foreach ($posts as $post_id => $post) { if (array_key_exists($post_id, $profiles) && $profiles[$post_id] instanceof Default_Model_DbTable_BlogPostProfile) { $posts[$post_id]->profile = $profiles[$post_id]; } else { $posts[$post_id]->profile->setPostId($post_id); } //!!!!------ Начало установки признака сортировки -----!!!!! if (isset($options['sortColumn'])) { $posts[$post_id]->sortColumn = $options['sortColumn']; } if (isset($options['ascDescFlg'])) { $posts[$post_id]->ascDescFlg = $options['ascDescFlg']; } //!!!!------ Конец установки признака сортировки -----!!!!! } // load the images for each post $options = array('post_id' => $post_ids); $images = Default_Model_DbTable_BlogPostImage::GetImages($db, $options); foreach ($images as $image) { $posts[$image->post_id]->images[$image->getId()] = $image; } // load the locations for each post $locations = Default_Model_DbTable_BlogPostLocation::GetLocations($db, $options); foreach ($locations as $l) { $posts[$l->post_id]->locations[$l->getId()] = $l; } // load the audio for each post $audios = Default_Model_DbTable_BlogPostAudio::GetAudio($db, $options); foreach ($audios as $audio) { $posts[$audio->post_id]->audio[$audio->getId()] = $audio; } // load the video for each post $videos = Default_Model_DbTable_BlogPostVideo::GetVideo($db, $options); foreach ($videos as $video) { $posts[$video->post_id]->video[$video->getId()] = $video; } // load the comments for each post $comments = Default_Model_DbTable_BlogPostComment::GetComments($db, $options); foreach ($comments as $comment) { $posts[$comment->post_id]->comments[$comment->getId()] = $comment; } $arrResult['pages'] = $paginator->getPages(); $arrResult['items'] = $posts; return $arrResult; }
/** * Shares the cache instance * to all Zend objects that accept one statically * * @return Zend_Application_Resource_Cache */ protected function _shareToZendObjects() { Zend_Paginator::setCache($this->_cache); Zend_Db_Table::setDefaultMetadataCache($this->_cache); Zend_Date::setOptions(array('cache' => $this->_cache)); Zend_Translate::setCache($this->_cache); Zend_Locale::setCache($this->_cache); return $this; }
/** Get a paginated list of Scheduled monuments by Yahoo WOEID * @access public * @param integer $id * @param integer $page * @return \Zend_Paginator */ public function getSmrsByWoeid($id, $page) { $nearbys = $this->getAdapter(); $select = $nearbys->select()->from($this->_name)->order('county')->where('woeid = ?', (int) $id); $paginator = Zend_Paginator::factory($select); Zend_Paginator::setCache($this->_cache); $paginator->setItemCountPerPage(20)->setPageRange(10); if (isset($page) && $page != "") { $paginator->setCurrentPageNumber((int) $page); } return $paginator; }