public function testNoPagesBeforeSecondLastPageEqualsPageRangeMinTwo() { $this->_paginator->setPageRange(3); $this->_paginator->setCurrentPageNumber(19); $pages = $this->_paginator->getPages('Elastic'); $this->assertEquals(5, count($pages->pagesInRange)); }
public function indexAction() { $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Pickup Groups"))); $db = Zend_Registry::get('db'); $select = $db->select()->from("pickup_group"); 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->pickupgroups = $paginator; $this->view->pages = $paginator->getPages(); $this->view->URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/"; $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/"; $opcoes = array("ds_name" => $this->view->translate("Name")); // Formulário de filtro. $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 Pickup Group"), "css" => "include")); }
public function indexAction() { // @todo localização das datas na listagem da view $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Users"))); $this->view->url = $this->getFrontController()->getBaseUrl() . '/' . $this->getRequest()->getControllerName(); $db = Zend_Registry::get('db'); $select = $db->select()->from("user"); 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->users = $paginator; $this->view->pages = $paginator->getPages(); $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/"; $opcoes = array('ds_login' => $this->view->translate('Name'), 'ds_mail' => $this->view->translate('E-mail')); $this->view->active = array(1 => $this->view->translate('Yes'), 0 => $this->view->translate('No')); $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 User"), "css" => "include")); }
/** * 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")); }
/** * List all Contacts */ public function indexAction() { $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Contacts"))); $this->view->url = $this->getFrontController()->getBaseUrl() . "/" . $this->getRequest()->getControllerName(); $db = Zend_Registry::get('db'); $select = $db->select()->from(array("n" => "contact"), array("n.id_contact as id", "n.ds_name as name", "n.ds_city as city", "n.ds_state as state", "n.ds_cep as cep", "n.ds_phone as phone", "n.ds_cell_phone as cellphone", "g.ds_name as group"))->join(array("g" => "contact_group"), 'n.id_contact_group = g.id_contact_group', array())->order('n.id_contact'); if ($this->_request->getPost('filtro')) { $field = pg_escape_string($this->_request->getPost('campo')); $query = pg_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->contacts = $paginator; $this->view->pages = $paginator->getPages(); $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/"; /*Opcoes do Filtro*/ $opcoes = array("n.ds_name" => $this->view->translate("Name"), "n.ds_city" => $this->view->translate("City"), "n.ds_state" => $this->view->translate("State"), "n.ds_cep" => $this->view->translate("ZIP Code"), "n.ds_phone" => $this->view->translate("Phone"), "n.ds_cell_phone" => $this->view->translate("Cellphone")); $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 Contact"), "css" => "include"), array("url" => "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/multi-remove/", "display" => $this->view->translate("Remove Multiple"), "css" => "exclude"), array("url" => "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/import/", "display" => $this->view->translate("Import CSV"), "css" => "import"), array("url" => "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/export/", "display" => $this->view->translate("Export CSV"), "css" => "export")); }
/** * Exibe a lista das guias geradas */ public function consultaEmissaoAction() { if ($this->getRequest()->isPost()) { parent::noTemplate(); $aRecord = array(); $iLimit = $this->_request->getParam('rows') ? $this->_request->getParam('rows') : 10; $iPage = $this->_request->getParam('page') ? $this->_request->getParam('page') : 0; $oContribuinte = $this->_session->contribuinte; $iIdContribuinte = $oContribuinte->getIdUsuarioContribuinte(); $aGuias = Contribuinte_Model_Guia::consultaGuiasDesif($iIdContribuinte); $aGuias = Contribuinte_Model_Guia::atualizaSituacaoGuias($aGuias); $oPaginatorAdapter = new DBSeller_Controller_PaginatorArray($aGuias); $aResultado = new Zend_Paginator($oPaginatorAdapter); $aResultado->setItemCountPerPage($iLimit); $aResultado->setCurrentPageNumber($iPage); $iTotal = $aResultado->getTotalItemCount(); $iTotalPages = $aResultado->getPages()->pageCount; foreach ($aResultado as $oResultado) { $sSituacaoLabel = null; switch ($oResultado->getSituacao()) { case 'a': $sSituacaoLabel = 'label label-warning'; break; case 'p': $sSituacaoLabel = 'label label-success'; break; case 'c': $sSituacaoLabel = 'label label-important'; break; case 'd': case 'x': default: $sSituacaoLabel = 'label'; } $oGuia = new StdClass(); $oGuia->id = $oResultado->getId(); $oGuia->competencia = $oResultado->getAnoComp() . $oResultado->getMesComp(); $oGuia->competencia_label = $oResultado->getAnoComp() . '/' . $oResultado->getMesComp(); $oGuia->data_vencimento = $oResultado->getVencimento()->format('d/m/Y'); $oGuia->valor_corrigido = DBSeller_Helper_Number_Format::toMoney($oResultado->getValorCorrigido(), 2, 'R$'); $oGuia->valor_historico = DBSeller_Helper_Number_Format::toMoney($oResultado->getValorHistorico(), 2, 'R$'); $oGuia->situacao = $oResultado->getSituacao(); $oGuia->situacao_label = "<span class='" . $sSituacaoLabel . "'>"; $oGuia->situacao_label .= Contribuinte_Model_Guia::$SITUACAO[$oResultado->getSituacao()] . "</span>"; $aRecord[] = $oGuia; } /** * Parametros de retorno do AJAX */ $aRetornoJson = array('total' => $iTotalPages, 'page' => $iPage, 'records' => $iTotal, 'rows' => $aRecord); echo $this->getHelper('json')->sendJson($aRetornoJson); } }
public function testGetsPagesForPageTwo() { $expected = new \stdClass(); $expected->pageCount = 11; $expected->itemCountPerPage = 10; $expected->first = 1; $expected->current = 2; $expected->last = 11; $expected->previous = 1; $expected->next = 3; $expected->pagesInRange = array_combine(range(1, 10), range(1, 10)); $expected->firstPageInRange = 1; $expected->lastPageInRange = 10; $expected->currentItemCount = 10; $expected->totalItemCount = 101; $expected->firstItemNumber = 11; $expected->lastItemNumber = 20; $this->_paginator->setCurrentPageNumber(2); $actual = $this->_paginator->getPages(); $this->assertEquals($expected, $actual); }
/** * Consulta os cancelamentos solicitados pelos contribuintes */ public function consultarAction() { if ($this->getRequest()->isPost()) { parent::noTemplate(); $aSolicitacoes = array(); $aParametros = $this->getAllParams(); $iLimit = $aParametros['rows']; $iPage = $aParametros['page']; $aFiltros = array('rejeitado' => NULL, 'autorizado' => NULL); $aOrdem = array('dt_solicitacao' => 'DESC'); $aSolicatacoesCancelamento = Contribuinte_Model_SolicitacaoCancelamento::getByAttributes($aFiltros, $aOrdem); $oPaginatorAdapter = new DBSeller_Controller_PaginatorArray($aSolicatacoesCancelamento); $aResultado = new Zend_Paginator($oPaginatorAdapter); $aResultado->setItemCountPerPage($iLimit); $aResultado->setCurrentPageNumber($iPage); $iTotal = $aResultado->getTotalItemCount(); $iTotalPages = $aResultado->getPages()->pageCount; foreach ($aResultado as $oSolicatacaoCancelamento) { $sMotivo = $this->getMotivoDescricaoCancelamento($oSolicatacaoCancelamento->getMotivo()); $sData = $oSolicatacaoCancelamento->getDtSolicitacao()->format("d/m/Y"); $sRazaoSocial = $oSolicatacaoCancelamento->getNota()->getP_razao_social(); $sCpfCnpj = DBSeller_Helper_Number_Format::maskCPF_CNPJ($oSolicatacaoCancelamento->getNota()->getP_cnpjcpf()); $iNota = $oSolicatacaoCancelamento->getNota()->getNota(); // Montado objeto que será retorna à grid $oSolicitacao = new StdClass(); $oSolicitacao->id = $oSolicatacaoCancelamento->getId(); $oSolicitacao->motivo_label = is_string($sMotivo) ? $sMotivo : "-"; $oSolicitacao->dt_solicitacao = $sData; $oSolicitacao->nome_contribuinte = $sRazaoSocial; $oSolicitacao->nota = $iNota; $oSolicitacao->cnpj = $sCpfCnpj; $aSolicitacoes[] = $oSolicitacao; } /** * Parametros de retorno do AJAX */ $aRetornoJson = array('total' => $iTotalPages, 'page' => $iPage, 'records' => $iTotal, 'rows' => $aSolicitacoes); echo $this->getHelper('json')->sendJson($aRetornoJson); } }
/** * List all sound files */ public function indexAction() { $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Configure"), $this->view->translate("Sound Files"))); $this->view->url = $this->getFrontController()->getBaseUrl() . "/" . $this->getRequest()->getControllerName(); $db = Zend_Registry::get('db'); $select = $db->select()->from("sounds")->where("tipo = 'AST'")->order('arquivo'); 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}%'"); } $objInspector = new Snep_Inspector('Permissions'); $inspect = $objInspector->getInspects(); $this->view->error = $inspect['Permissions']; $stmt = $db->query($select); $files = $stmt->fetchAll(); foreach ($files as $id => $file) { $info = Snep_SoundFiles_Manager::verifySoundFiles($file['arquivo']); $_files[] = array_merge($file, $info); } $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_Array($_files); $paginator = new Zend_Paginator($paginatorAdapter); $paginator->setCurrentPageNumber($this->view->page); $paginator->setItemCountPerPage(Zend_Registry::get('config')->ambiente->linelimit); $this->view->files = $paginator; $this->view->pages = $paginator->getPages(); $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/"; $opcoes = array("arquivo" => $this->view->translate("Filename"), "descricao" => $this->view->translate("Description")); $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 Sound File"), "css" => "include")); }
/** * List all Billing */ public function indexAction() { $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Carrier"), $this->view->translate("Billing"))); $this->view->url = $this->getFrontController()->getBaseUrl() . "/" . $this->getRequest()->getControllerName(); /*$select = $db->select() ->from("tarifas_valores", array('DATE_FORMAT(data,\'%d/%m/%Y %T\') as data', 'vcel', 'vfix')) ->from("billing") ->from("carrier", array('nome')) ->where("operadoras.codigo = tarifas.operadora") ->where("tarifas_valores.codigo = tarifas.codigo"); */ $billing = new Snep_Billing_Manager(); Zend_Debug::dump($billing->select()->from('billing')); exit(1); 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->billing = $paginator; $this->view->pages = $paginator->getPages(); $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/"; $opcoes = array("nome" => $this->view->translate("Carrier"), "pais" => $this->view->translate("Country"), "estado" => $this->view->translate("State"), "cidade" => $this->view->translate("City"), "prefixo" => $this->view->translate("Prefix"), "ddd" => $this->view->translate("City Code")); $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 Billing"), "css" => "include")); }
/** * List all Contact Groups */ public function indexAction() { $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Contact Group"))); $this->view->url = $this->getFrontController()->getBaseUrl() . "/" . $this->getRequest()->getControllerName(); $db = Zend_Registry::get('db'); $select = $db->select()->from("contact_group"); if ($this->_request->getPost('campo') == 'id_contact_group') { $field = pg_escape_string($this->_request->getPost('campo')); $query = pg_escape_string($this->_request->getPost('filtro')); if (preg_match('/^[0-9]+$/', $query)) { $select->where("{$field} = '{$query}'"); } } else { if ($this->_request->getPost('campo') == 'ds_name') { $field = pg_escape_string($this->_request->getPost('campo')); $query = pg_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 = pg_escape_string($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->contactgroups = $paginator; $this->view->pages = $paginator->getPages(); $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/"; $opcoes = array("id_contact_group" => $this->view->translate("Code"), "ds_name" => $this->view->translate("Name")); $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 Contact Group"), "css" => "include")); }
public function indexAction() { $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Extensions"))); $this->view->url = $this->getFrontController()->getBaseUrl() . '/' . $this->getRequest()->getControllerName(); $extension = new Snep_Extensions(); $extensions = array(); foreach ($extension->fetchAll() as $ext) { $peer = $ext->findParentRow('Snep_Peer_Manager'); $group = $ext->findParentRow('Snep_ExtensionsGroups_Manager'); array_push($extensions, array('id_extension' => $ext->id_extension, 'ds_channel' => $peer->ds_channel, 'ds_callerid' => $peer->ds_callerid, 'ds_group' => $group->ds_name)); } 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_Array($extensions); $paginator = new Zend_Paginator($paginatorAdapter); $paginator->setCurrentPageNumber($this->view->page); $paginator->setItemCountPerPage(Zend_Registry::get('config')->ambiente->linelimit); $this->view->extensions = $paginator; $this->view->pages = $paginator->getPages(); $this->view->PAGE_URL = "/snep/index.php/extensions/index/"; $options = array("name" => $this->view->translate("Extension"), "callerid" => $this->view->translate("Name"), "group" => $this->view->translate("Group")); $baseUrl = $this->getFrontController()->getBaseUrl(); // Formulário de filtro. $filter = new Snep_Form_Filter(); $filter->setAction($baseUrl . '/extensions/index'); $filter->setValue($this->_request->getPost('campo')); $filter->setFieldOptions($options); $filter->setFieldValue($this->_request->getParam('filtro')); $filter->setResetUrl("{$this->getFrontController()->getBaseUrl()}/" . "{$this->getRequest()->getControllerName()}/index/page/{$page}"); $this->view->form_filter = $filter; $this->view->filter = array(array("url" => $baseUrl . "/extensions/multiadd", "display" => $this->view->translate("Add Multiple Extensions"), "css" => "includes"), array("url" => $baseUrl . "/extensions/add", "display" => $this->view->translate("Add Extension"), "css" => "include")); }
/** * ナビゲータの生成 */ public function createNavigator($datas, $limit = 10) { // 現在のページ数を保存するためのセッション $module_name = $this->getRequest()->getModuleName(); $class_name = $this->getRequest()->getControllerName(); $list_path = '/' . $module_name . '/' . $class_name . '/list'; $session = new Zend_Session_Namespace($list_path); $paginator = null; if (get_class($datas) === 'Zend_Db_Table_Select') { $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($datas)); } elseif (get_class($datas) === 'Zend_Db_Select') { $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($datas)); } else { $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($datas)); } // リミットの設定 if ($this->getRequest()->getParam('limit')) { $limit = $this->getRequest()->getParam('limit'); } $session->limit = $limit; // ページング $paginator->setItemCountPerPage($limit); if ($paginator->count() && $this->getRequest()->getParam('page')) { $page = $this->getRequest()->getParam('page'); $session->page = $page; $paginator->setCurrentPageNumber($page); if ($page === '1') { $this->view->assign('first_page', true); } else { $this->view->assign('first_page', false); } } else { $session->page = 1; $this->view->assign('first_page', true); } $this->view->assign('pages', $paginator->getPages()); $this->view->assign('paginator', $paginator); }
/** * List all Cost Center's */ public function indexAction() { $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Cost Center"))); $this->view->url = $this->getFrontController()->getBaseUrl() . "/" . $this->getRequest()->getControllerName(); $db = Zend_Registry::get('db'); $select = $db->select()->from("cost_center", array("id_costcenter", "cd_code", "cd_type", "ds_name", "ds_description")); if ($this->_request->getPost('filtro')) { $field = mysql_escape_string($this->_request->getPost('campo')); $query = mysql_escape_string($this->_request->getPost('filtro')); if ($field == 'cd_type') { $types = array($this->view->translate('Incoming') => 'E', $this->view->translate('Outgoing') => 'S', $this->view->translate('Others') => 'O'); $query = $types[$query]; } $select->where("{$field} LIKE '%{$query}%'"); } $this->view->types = array('E' => $this->view->translate('Incoming'), 'S' => $this->view->translate('Outgoing'), 'O' => $this->view->translate('Others')); $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->costcenter = $paginator; $this->view->pages = $paginator->getPages(); $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/"; $opcoes = array("cd_code" => $this->view->translate("Code"), "ds_name" => $this->view->translate("Name"), "ds_description" => $this->view->translate("Description")); $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 Cost Center"), "css" => "include")); }
/** * Возвращает массив опций для построения постраничной навигации * Необходимо дергать сразу после выполнения SQL-запроса с SQL_CAL_FOUND_ROWS * * @param array $options - Массив опций * * @return object */ function getPaginator($options = array()) { $Paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Null($this->_db->fetchOne('SELECT FOUND_ROWS()'))); $Paginator->setItemCountPerPage(isset($options['perpage']) ? $options['perpage'] : $this->getPerPage()); if (isset($options['widgetid'])) { $Paginator->setCurrentPageNumber($this->getCurrentPage($options['widgetid'])); } else { $Paginator->setCurrentPageNumber($this->getCurrentPage()); } $out = $Paginator->getPages(); $pageidentity = $this->getPageIdentity(); // Кроме стандартных параметров Zend_Paginator::getPages() возвращаем доп. параметры // Полный путь без GET-запроса $UrlInfo = parse_url($this->_request->getRequestUri()); $out->ClearUrl = $UrlInfo['path']; // Обрабатываем GET-запрос $query = $this->_request->getQuery(); if (isset($query[$pageidentity])) { unset($query[$pageidentity]); } if (isset($query['widget'])) { unset($query['widget']); } // Строим строку выражения if (!empty($query)) { $out->Query = http_build_query($query); } // Фактически, ссылку на первую страницу (без page и widget) $out->FullUrl = isset($out->Query) ? $out->ClearUrl . '?' . $out->Query : $out->ClearUrl; // Добавляем к выражению Id виджета $widget = isset($options['widgetid']) ? 'widget=' . (int) $options['widgetid'] . '&' : ''; // Полную ссылку к которой в конце надо только добавить номер страницы $out->PageUrl = isset($out->Query) ? $out->FullUrl . '&' . $widget . $pageidentity . '=' : $out->FullUrl . '?' . $widget . $pageidentity . '='; return $out; }
public function indexAction() { $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Trunks"))); $this->view->url = $this->getFrontController()->getBaseUrl() . '/' . $this->getRequest()->getControllerName(); $db = Zend_Registry::get('db'); $select = "SELECT t.id, t.callerid, t.name, t.type, t.trunktype, t.time_chargeby, t.time_total,\n (\n SELECT th.used\n FROM time_history AS th\n WHERE th.owner = t.id AND th.owner_type='T'\n ORDER BY th.changed DESC limit 1\n ) as used,\n (\n SELECT th.changed\n FROM time_history AS th\n WHERE th.owner = t.id AND th.owner_type='T'\n ORDER BY th.changed DESC limit 1\n ) as changed\n FROM trunks as t "; 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'); $datasql = $db->query($select); $trunks = $datasql->fetchAll(); foreach ($trunks as $id => $val) { $trunks[$id]['saldo'] = null; if (!is_null($val['time_total'])) { $ligacao = $val['changed']; $anoLigacao = substr($ligacao, 6, 4); $mesLigacao = substr($ligacao, 3, 2); $diaLigacao = substr($ligacao, 0, 2); switch ($val['time_chargeby']) { case 'Y': if ($anoLigacao == date('Y')) { $saldo = $val['time_total'] - $val['used']; if ($val['used'] >= $val['time_total']) { $saldo = 0; } } else { $saldo = $val['time_total']; } break; case 'M': if ($anoLigacao == date('Y') && $mesLigacao == date('m')) { $saldo = $val['time_total'] - $val['used']; if ($val['used'] >= $val['time_total']) { $saldo = 0; } } else { $saldo = $val['time_total']; } break; case 'D': if ($anoLigacao == date('Y') && $mesLigacao == date('m') && $diaLigacao == date('d')) { $saldo = $val['time_total'] - $val['used']; } else { $saldo = $val['time_total']; } break; } $trunks[$id]['saldo'] = $saldo; } } $paginatorAdapter = new Zend_Paginator_Adapter_Array($trunks); $paginator = new Zend_Paginator($paginatorAdapter); $paginator->setCurrentPageNumber($this->view->page); $paginator->setItemCountPerPage(Zend_Registry::get('config')->ambiente->linelimit); $this->view->trunks = $paginator; $this->view->pages = $paginator->getPages(); $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/"; $opcoes = array("name" => $this->view->translate("Code"), "callerid" => $this->view->translate("Name")); // Formulário de filtro. $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 Trunk"), "css" => "include")); }
/** * Set view paginator * * @param int $count * @param int $perPage * @return void */ private function setViewPaginator($count, $perPage) { $adapter = new Zend_Paginator_Adapter_Null($count); $paginator = new Zend_Paginator($adapter); Zend_Paginator::setDefaultScrollingStyle('Sliding'); $paginator->setItemCountPerPage($perPage); $paginator->setCurrentPageNumber($this->page); $this->view->paginator = $paginator->getPages(); }
function fun_paginator($ArrData) { $pager = new Zend_Paginator(new Zend_Paginator_Adapter_Array($ArrData)); $currentPage = isset($_GET['p']) ? (int) htmlentities($_GET['p']) : 1; $pager->setCurrentPageNumber($currentPage); $itemsPerPage = 12; $pager->setItemCountPerPage($itemsPerPage); $pager->setPageRange(10); $pages = $pager->getPages(); $pageLinks = array(); $separator = ' | '; //$this->view->separator=$separator; if ($pages->pageCount > 1) { if ($pages->current == $pages->first) { $pageLinks[] = "<li >First</li>"; $pageLinks[] = "<li >Privious</li>"; } else { $previous = $pages->current - 1; $first = $pages->first; $pageLinks[] = "<li ><a href=\"?p={$first}\">First</a></li>"; $pageLinks[] = "<li><a href=\"?p={$previous}\">Privious</a></li>"; } for ($x = $pages->firstPageInRange; $x <= $pages->lastPageInRange; $x++) { if ($x == $pages->current) { $pageLinks[] = "<li>" . $x . "</li>"; } else { $q = http_build_query(array('p' => $x)); $pageLinks[] = "<li><a href=\"?{$q}\">{$x}</a></li>"; } } if ($pages->current == $pages->last) { $pageLinks[] = "<li>Next</li>"; $pageLinks[] = "<li>Last</li>"; } else { $last = $pages->last; $next = $pages->current + 1; $pageLinks[] = "<li><a href=\"?p={$next}\">Next</a></li>"; $pageLinks[] = "<li><a href=\"?p={$last}\">Last</a></li>"; } } $pagedata['pageLinks'] = $pageLinks; $pagedata['pagingdata'] = $pager->getCurrentItems(); return $pagedata; }
/** * Carrega as importações DES-IF na grid */ public function listarImportacaoDesifAction() { parent::noLayout(); $aParametro = $this->_request->getParam('form'); $oForm = new Contribuinte_Form_ConsultaImportacaoDesif(); $iCompetenciaInicial = null; if (!empty($aParametro['competencia_inicial'])) { $aCompetenciaInicial = explode('/', $aParametro['competencia_inicial']); $iCompetenciaInicial = $aCompetenciaInicial[1] . $aCompetenciaInicial[0]; } $iCompetenciaFinal = null; if (!empty($aParametro['competencia_final'])) { $aCompetenciaFinal = explode('/', $aParametro['competencia_final']); $iCompetenciaFinal = $aCompetenciaFinal[1] . $aCompetenciaFinal[0]; } $aRecord = array(); $iLimit = $this->_request->getParam('rows') ? $this->_request->getParam('rows') : 10; $iPage = $this->_request->getParam('page') ? $this->_request->getParam('page') : 0; $oContribuinte = $this->_session->contribuinte; $aIdContribuinte = $oContribuinte->getContribuintes(); $aImportacao = Contribuinte_Model_ImportacaoDesif::getImportacaoPorCompetencia($aIdContribuinte, $iCompetenciaInicial, $iCompetenciaFinal); $oPaginatorAdapter = new DBSeller_Controller_PaginatorArray($aImportacao); /** * Monta a paginação do GridPanel */ $oResultado = new Zend_Paginator($oPaginatorAdapter); $oResultado->setItemCountPerPage($iLimit); $oResultado->setCurrentPageNumber($iPage); $iTotal = $oResultado->getTotalItemCount(); $iTotalPages = $oResultado->getPages()->pageCount; $aRecord = array(); foreach ($oResultado as $oImportacaoDesif) { $sCompInicial = substr($oImportacaoDesif->getCompetenciaInicial(), 4, 2) . "/"; $sCompInicial .= substr($oImportacaoDesif->getCompetenciaInicial(), 0, 4); $sCompFinal = substr($oImportacaoDesif->getCompetenciaFinal(), 4, 2) . "/"; $sCompFinal .= substr($oImportacaoDesif->getCompetenciaFinal(), 0, 4); $oImportacaoRetorno = new StdClass(); $oImportacaoRetorno->id = $oImportacaoDesif->getId(); $oImportacaoRetorno->competencia_inicial = $sCompInicial; $oImportacaoRetorno->competencia_final = $sCompFinal; $oImportacaoRetorno->data_hora = $oImportacaoDesif->getDataImportacao()->format('d/m/Y H:i:s'); $aRecord[] = $oImportacaoRetorno; } /** * Parametros de retorno do AJAX */ $aRetornoJson = array('total' => $iTotalPages, 'page' => $iPage, 'records' => $iTotal, 'rows' => $aRecord); echo $this->getHelper('json')->sendJson($aRetornoJson); }
public function viewAction() { if ($this->_request->getPost()) { $formData = $this->_request->getParams(); $reportData = $this->getQuery($formData); $_SESSION['formDataSRC'] = $formData; } else { $formData = $_SESSION['formDataSRC']; $page = $this->_request->getParam(page); $reportData = $this->getQuery($formData); } if ($reportData) { $this->view->breadcrumb = $this->view->translate("Reports » Services Use <br/> Period: {$formData["period"]["init_day"]} to {$formData["period"]["till_day"]} "); $paginatorAdapter = new Zend_Paginator_Adapter_Array($reportData); $paginator = new Zend_Paginator($paginatorAdapter); if (!isset($page)) { $paginator->setCurrentPageNumber($this->view->page); } else { $paginator->setCurrentPageNumber($page); } $paginator->setItemCountPerPage(Zend_Registry::get('config')->ambiente->linelimit); $this->view->report = $paginator; $this->view->pages = $paginator->getPages(); $this->view->PAGE_URL = "/snep/index.php/{$this->getRequest()->getControllerName()}/view/"; $this->_helper->viewRenderer('view'); } else { $this->view->error = $this->view->translate("No records found."); $this->view->back = $this->view->translate("Back"); $this->_helper->viewRenderer('error'); } }
public function reportAction() { $db = Zend_Registry::get('db'); $config = Zend_Registry::get('config'); $format = new Formata(); // View labels $this->view->seq = $this->view->translate("SEQ"); $this->view->calldate = $this->view->translate("Call's date"); $this->view->origin = $this->view->translate("Source"); $this->view->destination = $this->view->translate("Destination"); $this->view->callstatus = $this->view->translate("Status"); $this->view->duration = $this->view->translate("Duration"); $this->view->conversation = $this->view->translate("Conversation"); $this->view->cost_center = $this->view->translate("Cost Center"); $this->view->city = $this->view->translate("City"); $this->view->state = $this->view->translate("State"); $this->view->filter = $this->view->translate("Filter"); $this->view->calls = $this->view->translate("Calls"); $this->view->totals_sub = $this->view->translate("Totals"); $this->view->times = $this->view->translate("Times"); $this->view->tot_tariffed = $this->view->translate("Total tariffed"); $this->view->answered = $this->view->translate("Answered"); $this->view->nanswered = $this->view->translate("Not Answered"); $this->view->busy = $this->view->translate("Busy"); $this->view->failure = $this->view->translate("Failed"); $this->view->other = $this->view->translate("Other"); $this->view->tarrifation = $this->view->translate("Charging"); $this->view->wait = $this->view->translate("Waiting"); $this->view->sub_total = $this->view->translate("Subtotal"); $this->view->gravation = $this->view->translate("Records"); $this->view->back = $this->view->translate("Back"); $defaultNS = new Zend_Session_Namespace('call_sql'); $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Reports"), $this->view->translate("Calls"), $defaultNS->sub_title)); $this->view->totals = $defaultNS->totais; $this->view->tariffed = $defaultNS->view_tarif; $this->view->files = $defaultNS->view_files; $this->view->status = $defaultNS->status; $this->view->compress_files = $this->view->translate("Compress selected files"); $this->view->duration_call = $format->fmt_segundos(array("a" => $defaultNS->totais['duration'], "b" => 'hms')); $this->view->bill_sec = $format->fmt_segundos(array("a" => $defaultNS->totais['billsec'], "b" => 'hms')); $this->view->wait_call = $format->fmt_segundos(array("a" => $defaultNS->totais['espera'], "b" => 'hms')); $row = $defaultNS->row; if ($defaultNS->report_type == 'synth') { // Cost center treatment $cc = $defaultNS->contas; if ($cc != '') { $valores = ''; $sqlcc = "select nome from ccustos where codigo IN (" . $cc . ")"; $ccs = $db->query($sqlcc)->fetchAll(PDO::FETCH_ASSOC); $ccusto_sintetic = ''; foreach ($ccs as $id => $value) { $ccusto_sintetic .= $ccs[$id]['nome'] . ", "; } } else { $ccusto_sintetic = $this->view->translate("Any"); } $this->view->cost_center_res = $ccusto_sintetic; // Groups treatment $sint_destino = $defaultNS->dst; $sint_groupdst = $defaultNS->groupdst; if ($sint_destino != '' && $sint_groupdst == '') { $sint_dest = $sint_destino; } if ($sint_groupdst != '' && $sint_destino == '') { $sqldst = "select name from peers where peers.group = '{$sint_groupdst}' "; $sint_dst = $db->query($sqldst)->fetchAll(PDO::FETCH_ASSOC); $sint_dest = ''; foreach ($sint_dst as $id => $value) { $sint_dest .= $sint_dst[$id]['name'] . ", "; } } if (!empty($sint_dest)) { $this->view->sinteticdst = $sint_dest; } $sint_origem = $defaultNS->src; $sint_groupsrc = $defaultNS->groupsrc; if ($sint_origem != '' && $sint_groupsrc == '') { $src_sintetic = trim($sint_origem); } if ($sint_groupsrc != '' && $sint_origem == '') { $sqlsrc = "select name from peers where peers.group = '{$sint_groupsrc}' "; $sint_src = $db->query($sqlsrc)->fetchAll(PDO::FETCH_ASSOC); $src_sintetic = ''; foreach ($sint_src as $id => $value) { $src_sintetic .= $sint_src[$id]['name'] . ", "; } } if (!empty($sint_dest)) { $this->view->sinteticsrc = $src_sintetic; } $this->renderScript('calls-report/synthetic-report.phtml'); } else { // Analytical Report $paginatorAdapter = new Zend_Paginator_Adapter_Array($row); $paginator = new Zend_Paginator($paginatorAdapter); $paginator->setCurrentPageNumber($this->_request->page); $paginator->setItemCountPerPage(Zend_Registry::get('config')->ambiente->linelimit); $items = $paginator->getCurrentItems(); $this->view->pages = $paginator->getPages(); $this->view->PAGE_URL = "/snep/index.php/calls-report/report/"; $listItems = array(); foreach ($items as $item) { // Status switch ($item['disposition']) { case 'ANSWERED': $item['disposition'] = $this->view->translate('Answered'); break; case 'NO ANSWER': $item['disposition'] = $this->view->translate('Not Answered'); break; case 'FAILED': $item['disposition'] = $this->view->translate('Failed'); break; case 'BUSY': $item['disposition'] = $this->view->translate('Busy'); break; case 'OTHER': $item['disposition'] = $this->view->translate('Others'); break; } // Search for a city or format the telephone type if (strlen($item['src']) > 7 && strlen($item['dst']) < 5) { $item['city'] = $this->telType($item['src']); } else { $item['city'] = $this->telType($item['dst']); } $item['nome'] = $item['tipo'] . " : " . $item['codigo'] . " - " . $item['nome']; if ($defaultNS->view_tarif) { $item['rate'] = $format->fmt_tarifa(array("a" => $item['dst'], "b" => $item['billsec'], "c" => $item['accountcode'], "d" => $item['calldate'], "e" => $item['tipo'])); } $item['src'] = $format->fmt_telefone(array("a" => $item['src'])); $item['dst'] = $format->fmt_telefone(array("a" => $item['dst'])); // Tarrifation $item['billsec'] = $format->fmt_segundos(array("a" => $item['billsec'], "b" => 'hms')); $item['duration'] = $format->fmt_segundos(array("a" => $item['duration'], "b" => 'hms')); if ($defaultNS->view_files) { $filePath = Snep_Manutencao::arquivoExiste($item['calldate'], $item['userfield']); $item['file_name'] = $item['userfield'] . ".wav"; if ($filePath) { $item['file_path'] = $filePath; } else { $item['file_path'] = 'N.D.'; } } array_push($listItems, $item); } $this->view->call_list = $listItems; $this->view->compact_success = $this->view->translate("The files were compressed successfully! Wait for the download start."); $this->renderScript('calls-report/analytical-report.phtml'); } return; }
public function testGetNextAndPreviousPageForLastPage() { $this->_paginator->setCurrentPageNumber(21); $pages = $this->_paginator->getPages('Elastic'); $this->assertEquals(20, $pages->previous); }
public function testGetsNextAndPreviousPageForLastPage() { $this->_paginator->setCurrentPageNumber(11); $pages = $this->_paginator->getPages('Jumping'); $this->assertEquals(10, $pages->previous); }
/** * Render the provided pages. If no scrolling style or partial * are specified, the defaults will be used (if set). * * @param Zend_Paginator $paginator * @param string $scrollingStyle (Optional) Scrolling style * @param string $partial (Optional) View partial * @param array|string $params (Optional) params to pass to the partial * @return string * @throws Zend_View_Exception */ public function paginationControl(Zend_Paginator $paginator, $scrollingStyle = null, $partial = null, $params = null) { if (empty($partial)) { if (empty(self::$_defaultViewPartial)) { /** * @see Zend_View_Exception */ require_once 'Zend/View/Exception.php'; throw new Zend_View_Exception('No view partial provided and no default view partial set'); } $partial = self::$_defaultViewPartial; } $pages = get_object_vars($paginator->getPages($scrollingStyle)); if ($params != null) { $pages = array_merge($pages, (array) $params); } return $this->view->partial($partial, $pages); }
public function testAcceptsPageRangeLargerThanPageCount() { $this->_paginator->setPageRange(100); $pages = $this->_paginator->getPages(); $this->assertEquals(11, $pages->last); }
/** * Returns the page collection. * * @param string $scrollingStyle Scrolling style * @return array */ public function getPages($scrollingStyle = null) { if (null === $scrollingStyle) { $scrollingStyle = $this->_scrollingStyle; } if (!$this->_pages || $scrollingStyle != $this->_scrollingStyle) { $this->_pages = $this->_paginator->getPages($scrollingStyle); $this->_scrollingStyle = $scrollingStyle; } return $this->_pages; }