本文整理汇总了PHP中Zend_Paginator::setCurrentPageNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Paginator::setCurrentPageNumber方法的具体用法?PHP Zend_Paginator::setCurrentPageNumber怎么用?PHP Zend_Paginator::setCurrentPageNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Paginator
的用法示例。
在下文中一共展示了Zend_Paginator::setCurrentPageNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCurrentItems
/**
* Get current items to display on current page
* @access public
* @return object ArrayIterator
*/
public function getCurrentItems()
{
$this->_paginator->setItemCountPerPage($this->_itemCountPerPage);
$this->_paginator->setCurrentPageNumber($this->_currentPage);
if ($this->_currentItems === null) {
$this->_currentItems = $this->_paginator->getCurrentItems();
}
return $this->_currentItems;
}
示例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;
}
示例3: indexAction
public function indexAction()
{
/**
* Form cadastro
*/
$formPropostaCadastro = new Form_Site_PropostaCadastro();
$formPropostaCadastro->submit->setLabel("CADASTRAR");
//$formPropostaCadastro->proposta_numero->setValue($this->getNumeroProposta());
$this->view->formPropostaCadastro = $formPropostaCadastro;
/**
* Busca as propostas
*/
$page = $this->getRequest()->getParam('page', 1);
//get curent page param, default 1 if param not available.
$modelProposta = new Model_DbTable_Proposta();
$data = $modelProposta->getQuery();
$adapter = new Zend_Paginator_Adapter_DbSelect($data);
//adapter
$paginator = new Zend_Paginator($adapter);
// setup Pagination
$paginator->setItemCountPerPage(Zend_Registry::get("config")->resource->rowspage);
// Items perpage, in this example is 10
$paginator->setCurrentPageNumber($page);
// current page
//Zend_Paginator::setDefaultScrollingStyle('Sliding');
//Zend_View_Helper_PaginationControl::setDefaultViewPartial('partials/pagination.phtml');
$this->view->propostas = $paginator;
}
示例4: testNoPagesBeforeSecondLastPageEqualsPageRangeMinTwo
public function testNoPagesBeforeSecondLastPageEqualsPageRangeMinTwo()
{
$this->_paginator->setPageRange(3);
$this->_paginator->setCurrentPageNumber(19);
$pages = $this->_paginator->getPages('Elastic');
$this->assertEquals(5, count($pages->pagesInRange));
}
示例5: getAll
public function getAll($active = false, $lng = 'nl', $paginator = true, $pindex = 1, $perpage = 25, $cache = true)
{
if ($cache == true) {
$cacheId = $this->generateCacheId(get_class($this) . '_' . __FUNCTION__, func_get_args());
$cache = Zend_Registry::get('cache');
if (true == ($result = $cache->load($cacheId))) {
return $result;
}
}
$db = Zend_Registry::get('db');
$select = $db->select()->from(array('n' => 'News'), array('*'))->joinLeft(array('t' => 'NewsTsl', array('lng', 'title', 'summary', 'content', 'url', 'seo_keywords', 'seo_title', 'seo_description', 'active')), 'n.nid = t.nid')->where('t.lng = ?', $lng);
if ($active) {
$select->where('t.active = 1')->where('n.date_published <= NOW()')->where('n.date_expired > NOW() OR n.date_expired is NULL')->order('n.date_message DESC')->order('n.date_published DESC');
} else {
$select->order('n.date_published DESC')->order('n.date_created DESC');
}
if ($paginator === true) {
$adapter = new Base_PaginatorAdapter($select);
$adapter->setMapper($this->_mapper);
$data = new Zend_Paginator($adapter);
$data->setCurrentPageNumber((int) $pindex);
$data->setItemCountPerPage((int) $perpage);
} else {
$results = $db->fetchAll($select);
$data = $this->_mapper->mapAll($results);
}
if ($cache == true) {
$cacheTags = $this->generateCacheTags(get_class($this) . '_' . __FUNCTION__);
$cache->save($data, $cacheId, $cacheTags);
}
return $data;
}
示例6: selectAll
public function selectAll($pageNumber = 1, $filter = array())
{
$db = $this->siteDbAdapter->select()->from($this->tablename);
foreach ($filter as $key => $val) {
if ($val) {
if (is_int($val)) {
$db->where($key . ' = ?', $val);
} else {
$db->where($key . ' LIKE ?', '%' . $val . '%');
}
}
}
$db->order('log_date DESC');
$adapter = new Zend_Paginator_Adapter_DbSelect($db);
$paginator = new Zend_Paginator($adapter);
$paginator->setCurrentPageNumber($pageNumber);
$paginator->setItemCountPerPage($this->countPerPage);
$paginator->setPageRange($this->pageRange);
return $paginator;
/*
$select = $this->siteDbAdapter->select();
$select->from($this->tablename);
$select->order(array('log_id'));
$log = $this->siteDbAdapter->fetchAll($select->__toString());
return $log;
*/
}
示例7: indexAction
public function indexAction()
{
$query = trim($this->getRequest()->getQuery('q', ''));
$this->view->query = $query;
if (!empty($query)) {
$count = 10;
$page = (int) $this->getRequest()->getQuery('p', 1);
if ($page < 1) {
$page = 1;
}
// Prepare the common options
$options = array('market' => 'en-GB');
// We want web and image search results
$sources = array('web' => array('count' => $count, 'offset' => $count * ($page - 1)));
// Adjust the query to only search the noginn.com domain
$query .= ' site:noginn.com';
// Perform the search!
$bing = new Noginn_Service_Bing('__APP_ID__');
$result = $bing->search($query, $sources, $options);
$webResults = $result->getSource('web');
$this->view->webResults = $webResults;
// Paginate the results
$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Null($webResults->getTotal()));
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($count);
$this->view->paginator = $paginator;
}
}
示例8: rpsConsultarAction
/**
* Consulta notas para exportar RPS
*/
public function rpsConsultarAction()
{
parent::noTemplate();
$aParametros = $this->getRequest()->getParams();
/**
* Verifica se foi informado mês e ano da competência
*/
if (!empty($aParametros['mes_competencia']) && !empty($aParametros['ano_competencia'])) {
$oContribuinte = $this->_session->contribuinte;
$sCodigosContribuintes = implode(',', $oContribuinte->getContribuintes());
$oPaginatorAdapter = new DBSeller_Controller_Paginator(Contribuinte_Model_Nota::getQuery(), 'Contribuinte_Model_Nota', 'Contribuinte\\Nota');
/**
* Monta a query de consulta
*/
$oPaginatorAdapter->where("e.id_contribuinte in ({$sCodigosContribuintes})");
$oPaginatorAdapter->andWhere("e.mes_comp = {$aParametros['mes_competencia']}");
$oPaginatorAdapter->andWhere("e.ano_comp = {$aParametros['ano_competencia']}");
if (!empty($aParametros['numero_rps'])) {
$oPaginatorAdapter->andWhere("e.nota = {$aParametros['numero_rps']}");
}
$oPaginatorAdapter->orderBy('e.nota', 'DESC');
/**
* Monta a paginação do GridPanel
*/
$oResultado = new Zend_Paginator($oPaginatorAdapter);
$oResultado->setItemCountPerPage(10);
$oResultado->setCurrentPageNumber($this->_request->getParam('page'));
foreach ($oResultado as $oNota) {
$oNota->oContribuinte = $oContribuinte;
$oNota->lNaoGeraGuia = !$oNota->getEmite_guia();
$oNota->lGuiaEmitida = Contribuinte_Model_Guia::existeGuia($oContribuinte, $oNota->getMes_comp(), $oNota->getAno_comp(), Contribuinte_Model_Guia::$DOCUMENTO_ORIGEM_NFSE);
/**
* Informações da nota substituta
*/
$oNota->oNotaSubstituida = NULL;
if ($oNota->getIdNotaSubstituida()) {
$oNota->oNotaSubstituida = Contribuinte_Model_Nota::getById($oNota->getIdNotaSubstituida());
}
/**
* Informações da nota substituta
*/
$oNota->oNotaSubstituta = NULL;
if ($oNota->getIdNotaSubstituta()) {
$oNota->oNotaSubstituta = Contribuinte_Model_Nota::getById($oNota->getIdNotaSubstituta());
}
}
/**
* Valores da pesquisa para montar a paginação
*/
if (is_array($aParametros)) {
foreach ($aParametros as $sParametro => $sParametroValor) {
if ($sParametroValor) {
$sParametroValor = str_replace('/', '-', $sParametroValor);
$this->view->sBusca .= "{$sParametro}/{$sParametroValor}/";
}
}
}
$this->view->oDadosNota = $oResultado;
}
}
示例9: adminlistAction
function adminlistAction()
{
$this->rowsPerPage = 4;
if ($this->_request->getParam('page')) {
$this->curPage = $this->_request->getParam('page');
} else {
$this->curPage = 1;
}
$messages = $this->_mail->getUniqueId();
//print_r($curPage);die;
$content = array();
$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($messages));
if (count($messages)) {
for ($i = ($this->curPage - 1) * $this->rowsPerPage + 1; $i <= $this->curPage * $this->rowsPerPage; $i++) {
$message[$i] = $this->_mail->getMessage($i);
$content[$i] = $message[$i]->getContent();
}
}
$this->view->paginator = $paginator;
$paginator->setCurrentPageNumber($this->curPage)->setItemCountPerPage($this->rowsPerPage);
$this->view->controller = $this->_request->getControllerName();
$this->view->action = $this->_request->getActionName();
$this->view->content = $content;
$this->view->message = $message;
$this->view->inbox = $this->_inbox;
//print_r ( $this->_inbox );
//die ();
}
示例10: indexAction
/**
* List all Queues
*/
public function indexAction()
{
$this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Queues")));
$this->view->url = $this->getFrontController()->getBaseUrl() . '/' . $this->getRequest()->getControllerName();
$db = Zend_Registry::get('db');
$select = $db->select()->from("queue");
if ($this->_request->getPost('filtro')) {
$field = mysql_escape_string($this->_request->getPost('campo'));
$query = mysql_escape_string($this->_request->getPost('filtro'));
$select->where("{$field} LIKE '%{$query}%'");
}
$page = $this->_request->getParam('page');
$this->view->page = isset($page) && is_numeric($page) ? $page : 1;
$this->view->filtro = $this->_request->getParam('filtro');
$paginatorAdapter = new Zend_Paginator_Adapter_DbSelect($select);
$paginator = new Zend_Paginator($paginatorAdapter);
$paginator->setCurrentPageNumber($this->view->page);
$paginator->setItemCountPerPage(Zend_Registry::get('config')->ambiente->linelimit);
$this->view->queues = $paginator;
$this->view->pages = $paginator->getPages();
$this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/";
$opcoes = array("name" => $this->view->translate("Name"), "musiconhold" => $this->view->translate("Audio Class"), "strategy" => $this->view->translate("Strategy"), "servicelevel" => $this->view->translate("SLA"), "timeout" => $this->view->translate("Timeout"));
$filter = new Snep_Form_Filter();
$filter->setAction($this->getFrontController()->getBaseUrl() . '/' . $this->getRequest()->getControllerName() . '/index');
$filter->setValue($this->_request->getPost('campo'));
$filter->setFieldOptions($opcoes);
$filter->setFieldValue($this->_request->getPost('filtro'));
$filter->setResetUrl("{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/page/{$page}");
$this->view->form_filter = $filter;
$this->view->filter = array(array("url" => "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/add/", "display" => $this->view->translate("Add Queue"), "css" => "include"));
}
示例11: indexAction
/**
* The default action - show the guestbook entries
*/
public function indexAction()
{
$method = __METHOD__;
$cacheid = str_replace("::", "_", $method) . intval($this->getRequest()->getParam('page', 1));
$can_edit = false;
if (Zoo::getService('acl')->checkAccess('edit')) {
$cacheid .= "_edit";
$can_edit = true;
}
$content = $this->checkCache($cacheid);
if (!$content) {
$limit = 20;
// Offset = items per page multiplied by the page number minus 1
$offset = ($this->getRequest()->getParam('page', 1) - 1) * $limit;
$options = array('active' => true, 'nodetype' => 'guestbook_entry', 'order' => 'created DESC', 'render' => true);
$select = Zoo::getService('content')->getContentSelect($options, $offset, $limit);
$this->view->items = Zoo::getService('content')->getContent($options, $offset, $limit);
// Pagination
Zend_Paginator::setDefaultScrollingStyle('Elastic');
Zend_View_Helper_PaginationControl::setDefaultViewPartial(array('pagination_control.phtml', 'zoo'));
$adapter = new Zend_Paginator_Adapter_DbSelect($select);
$paginator = new Zend_Paginator($adapter);
$paginator->setItemCountPerPage($limit);
$paginator->setCurrentPageNumber($this->getRequest()->getParam('page', 1));
$paginator->setView($this->view);
$this->view->assign('paginator', $paginator);
$this->view->can_edit = $can_edit;
$content = $this->getContent();
$this->cache($content, $cacheid, array('nodelist', 'guestbook_list'));
}
$this->view->pagetitle = Zoo::_('Guestbook');
$this->renderContent($content);
}
示例12: listAction
public function listAction()
{
// get the filter form
$listToolsForm = new Form_BugReportListToolsForm();
$listToolsForm->setAction('/bug/list');
$listToolsForm->setMethod('post');
$this->view->listToolsForm = $listToolsForm;
// set the sort and filter criteria. you need to update this to use the request,
// as these values can come in from the form post or a url parameter
$sort = $this->_request->getParam('sort', null);
$filterField = $this->_request->getParam('filter_field', null);
$filterValue = $this->_request->getParam('filter');
if (!empty($filterField)) {
$filter[$filterField] = $filterValue;
} else {
$filter = null;
}
// now you need to manually set these controls values
$listToolsForm->getElement('sort')->setValue($sort);
$listToolsForm->getElement('filter_field')->setValue($filterField);
$listToolsForm->getElement('filter')->setValue($filterValue);
// fetch the bug paginator adapter
$bugModels = new Model_Bug();
$adapter = $bugModels->fetchPaginatorAdapter($filter, $sort);
$paginator = new Zend_Paginator($adapter);
// show 10 bugs per page
$paginator->setItemCountPerPage(10);
// get the page number that is passed in the request.
//if none is set then default to page 1.
$page = $this->_request->getParam('page', 1);
$paginator->setCurrentPageNumber($page);
// pass the paginator to the view to render
$this->view->paginator = $paginator;
}
示例13: CusFevRestauarants
public function CusFevRestauarants(User_Model_FevRestById $userid, $offset)
{
try {
$id = $userid->getUserId();
$query = $this->getDbTable()->select();
$query->setIntegrityCheck(false);
$query->from(array('crc' => 'rd.customer_restaurant_choice'), array('crcfk_user', 'crcrestaurant_id'));
$query->join(array('res' => 'rd.restaurant_details'), 'res.resid = crc.crcrestaurant_id', array('resid', 'resname', 'resaddress', 'resdescription', 'resimage'));
$query->join(array('nbh' => 'rd.neighborhood_bd'), 'nbh.id = res.resneighborhood_id', array('description as neighbor'));
$query->join(array('rgn' => 'rd.region_bd'), 'rgn.id = res.resregion_id', array('description as region'));
$query->join(array('cty' => 'rd.city_bd'), 'cty.id = res.rescity_id', array('description as city'));
$query->join(array('sbd' => 'rd.state_bd'), 'sbd.id = res.resstate_id', array('description as state'));
$query->where('crc.crcstatus =? ', 'TRUE');
$query->where('crc.crcfk_user = ?', $id);
$query->where('rescategory_id = 2');
$query->order('crcid DESC');
//$Result = $this->getDbTable()->fetchAll($query);
$Result = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($query));
$Result->setItemCountPerPage(10);
$Result->setCurrentPageNumber($offset);
$resultList = array();
foreach ($Result as $value) {
$resdesc = $value->resdescription;
if (strlen($resdesc) > 1000) {
$resdesc = substr($resdesc, 0, 1000) . "...";
}
$obj = new User_Model_CustomerRestChoice();
$obj->setRestId($value->resid)->setRestaurantname($value->resname)->setRestneighboorhood($value->neighbor)->setRestRegion($value->city)->setRestCity($value->city)->setRestState($value->state)->setResAddress($value->resaddress)->setResDesc($resdesc)->setRestImage($value->resimage);
$resultList[] = $obj;
}
return $Result;
} catch (Exception $ex) {
throw new Exception($ex->getMessage());
}
}
示例14: getReviews
/**
* Get all reviews
*
*/
public function getReviews($paged = null, $order = array(), $filter = null)
{
$grid = array();
$grid['cols'] = $this->getGridColumns();
$grid['primary'] = $this->_primary;
$select = $this->select();
if (!empty($order[0])) {
$order = $order[0] . ' ' . $order[1];
} else {
$order = 'inserted ASC';
}
$select->order($order);
$select->from('reviews', array_keys($this->getGridColumns()));
if ($filter) {
$select->where('submission_id = ?', (int) $filter);
}
if ($paged) {
$adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
$paginator = new Zend_Paginator($adapter);
$paginator->setCurrentPageNumber((int) $paged)->setItemCountPerPage(20);
$grid['rows'] = $paginator;
return $grid;
}
$grid['rows'] = $this->fetchAll($select);
return $grid;
}
示例15: getUsers
public function getUsers($paged = null, $order = array(), $filter = null)
{
$grid = array();
$grid['cols'] = $this->getGridColumns();
$grid['primary'] = $this->_primary;
$select = $this->select();
if (!empty($order[0])) {
$order = 'lower(' . $order[0] . ') ' . $order[1];
} else {
$order = 'lower(lname) ASC';
}
$select->order($order)->from('vw_users', array_keys($this->getGridColumns()));
if ($filter) {
// apply filters to grid
if ($filter->filters) {
foreach ($filter->filters as $field => $value) {
if (is_array($value)) {
$select->where($field . ' IN (?)', $value);
} else {
$select->where($field . ' = ?', $value);
}
}
}
}
if ($paged) {
$adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
$paginator = new Zend_Paginator($adapter);
$paginator->setCurrentPageNumber((int) $paged)->setItemCountPerPage(20);
$grid['rows'] = $paginator;
return $grid;
}
$grid['rows'] = $this->fetchAll($select);
return $grid;
}