本文整理汇总了PHP中Zend_Paginator类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Paginator类的具体用法?PHP Zend_Paginator怎么用?PHP Zend_Paginator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Paginator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:63,代码来源:ExportacaoArquivoController.php
示例2: 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;
}
开发者ID:nandorodpires2,项目名称:intranet,代码行数:28,代码来源:PropostaController.php
示例3: indexAction
public function indexAction()
{
$galerias = Galeria::findGaleriasActive()->getData();
$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($galerias));
$paginator->setItemCountPerPage(20)->setPageRange(5)->setCurrentPageNumber($this->_request->getParam('page', 1));
$this->view->galerias = $paginator;
}
开发者ID:Neozeratul,项目名称:Intermodels,代码行数:7,代码来源:IndexController.php
示例4: indexAction
public function indexAction()
{
$modelos = Modelo::findModelos()->getData();
$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($modelos));
$paginator->setItemCountPerPage(20)->setPageRange(5)->setCurrentPageNumber($this->_request->getParam('page', 1));
$this->view->modelos = $paginator;
}
开发者ID:Neozeratul,项目名称:Intermodels,代码行数:7,代码来源:ModelosController.php
示例5: 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
示例6: 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;
}
}
开发者ID:noginn,项目名称:Noginn_Service_Bing,代码行数:28,代码来源:SearchController.php
示例7: modelList
/**
* @param string $modelName
* @param array $options
* @param Doctrine_Query_Abstract $query
* @return string
*/
public function modelList($modelName, array $options = array(), Doctrine_Query_Abstract $query = null)
{
$options = array_merge(self::$_defaultOptions, $options);
if (!$options['paginationScript']) {
$options['paginationScript'] = 'partials/pagination.phtml';
}
$table = Doctrine_Core::getTable($modelName);
if (!$query) {
$query = $table->createQuery();
}
$adapter = new FansubCMS_Paginator_Adapter_Doctrine($query);
$paginator = new Zend_Paginator($adapter);
$front = Zend_Controller_Front::getInstance();
$request = $front->getRequest();
$currentPage = $request->getParam('page', 1);
$paginator->setCurrentPageNumber($currentPage);
$paginator->setItemCountPerPage($options['itemsPerPage']);
if (!isset($options['listScript'])) {
$options['listScript'] = 'partials/table.phtml';
}
if (!isset($options['showFieldNames'])) {
$fieldNames = $this->getAutoFieldNames($table);
} else {
$fieldNames = $options['showFieldNames'];
}
return $this->view->partial($options['listScript'], array('modelName' => $modelName, 'paginator' => $paginator, 'currentPage' => $currentPage, 'options' => $options, 'fieldNames' => $fieldNames));
}
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:33,代码来源:ModelList.php
示例8: adminimagereportAction
function adminimagereportAction()
{
$this->view->title = 'Reports';
$this->view->activeTab = 'Reports';
$this->_helper->layout->setLayout("layout_admin");
$this->view->campaign_id = $this->_request->getParam('id');
$curPage = 1;
$rowsPerPage = 50;
if ($this->_request->getParam('page')) {
$curPage = $this->_request->getParam('page');
}
$db = Zend_Registry::get('db');
$select = $db->select();
$select->from('image_report', array('id', 'image', 'state', 'create_date', 'consumer_id', 'thumb_width', 'thumb_height'))->join('consumer', 'consumer.id = image_report.consumer_id', array('email', 'name', 'recipients_name', 'language_pref'))->joinLeft('image_report_reply', 'image_report_reply.image_report_id = image_report.id', 'content')->joinLeft('reward_point_transaction_record', 'reward_point_transaction_record.id = image_report.reward_point_transaction_record_id', 'point_amount')->where('campaign_id = ?', $this->view->campaign_id)->where('consumer.pest is null')->order('create_date desc');
$this->view->imageReports = $db->fetchAll($select);
//paging
$this->view->controller = $this->_request->getControllerName();
$this->view->action = $this->_request->getActionName();
$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($this->view->imageReports));
$paginator->setCurrentPageNumber($curPage)->setItemCountPerPage($rowsPerPage);
$this->view->paginator = $paginator;
// Zend_Debug::dump($this->view->duplicatedUrlArray);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination/pagelist.phtml');
$this->view->NoInitValue = ($curPage - 1) * $rowsPerPage + 1;
}
开发者ID:omusico,项目名称:wildfire_php,代码行数:25,代码来源:ImageController.php
示例9: indexAction
/**
* Display a list of all users in the system.
*
*/
public function indexAction()
{
$filterStatus = $this->_getParam('status', 'any');
$filterTrigger = $this->_getParam('trigger', 'any');
$filterSort = $this->_getParam('sort', 'queueDt');
$filterDirection = $this->_getParam('direction', 'asc');
$form = new Ot_Form_EmailqueueSearch();
$form->populate($_GET);
$eq = new Ot_Model_DbTable_EmailQueue();
$select = new Zend_Db_Table_Select($eq);
if ($filterStatus != '' && $filterStatus != 'any') {
$select->where('status = ?', $filterStatus);
}
if ($filterTrigger != '' && $filterTrigger != 'any') {
$select->where('attributeName = ?', 'triggerActionId');
$select->where('attributeId = ?', $filterTrigger);
}
$select->order($filterSort . ' ' . $filterDirection);
$adapter = new Zend_Paginator_Adapter_DbSelect($select);
$paginator = new Zend_Paginator($adapter);
$paginator->setCurrentPageNumber($this->_getParam('page', 1));
$ta = new Ot_Model_DbTable_TriggerAction();
$actions = $ta->fetchAll();
$triggers = array();
foreach ($actions as $a) {
$triggers[$a->triggerActionId] = $a;
}
$this->_helper->pageTitle('ot-emailqueue-index:title');
$this->view->assign(array('paginator' => $paginator, 'form' => $form, 'interface' => true, 'sort' => $filterSort, 'direction' => $filterDirection, 'triggers' => $triggers));
}
开发者ID:ncsuwebdev,项目名称:otframework,代码行数:34,代码来源:EmailqueueController.php
示例10: getProductByCategory
/**
* gets a listing of products based on category
*
* (main method used in product listings)
*
* @param $categoryId category ID (can be more than one)
* @param null $paged current page (null, no pagination; not null contains the current page)
* @param null $order order clause
* @return Zend_Db_Table_Rowset_Abstract|Zend_Paginator
*/
public function getProductByCategory($categoryId, $paged = null, $order = null)
{
// creating the select statement
// using the IN clause is suitable as $categoryId is an array of categories
$select = $this->select()->from('product')->where('categoryId IN (?)', $categoryId);
// ordering according to order clause
// (e.g., array('name ASC', 'price DESC')
if (is_array($order) === true) {
$select->order($order);
}
// paginating the result
if ($paged !== null) {
// adapter to configure the paginator instance
$adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
// select statement that calculates the total amount of rows returned by the main statement
$count = clone $select;
// reseting the cloned statement
$count->reset(Zend_Db_Select::COLUMNS);
$count->reset(Zend_Db_Select::FROM);
// creating the count expression with Zend_Db_Expr
$count->from('product', new Zend_Db_Expr('COUNT(*) as `zend_paginator_row_count`'));
// setting the count statement in the adapter
$adapter->setRowCount($count);
// creating the zend paginator instance using the adapter
$paginator = new Zend_Paginator($adapter);
$paginator->setItemCountPerPage(5)->setCurrentPageNumber((int) $paged);
return $paginator;
}
return $this->fetchAll($select);
}
开发者ID:jingjangjung,项目名称:Storefront,代码行数:40,代码来源:Product.php
示例11: listAction
public function listAction()
{
// create search form
$searchForm = new Admin_Form_RouteSearch();
$searchForm->setAction('/admin/route/list')->setMethod('post');
$this->view->searchForm = $searchForm;
// get params from request
$sorter = $this->_request->getParam('sorter', null);
$filter = $this->_request->getParam('filter', null);
$filterText = $this->_request->getParam('filterText', null);
// populate them to form
$searchForm->getElement('sorter')->setValue($sorter);
$searchForm->getElement('filter')->setValue($filter);
$searchForm->getElement('filterText')->setValue($filterText);
// list route
$routeModel = new Admin_Model_Route();
$routeAdapter = $routeModel->getRoutePaginatorAdapter($filter, $filterText, $sorter);
if ($routeAdapter) {
$paginator = new Zend_Paginator($routeAdapter);
$page = $this->_request->getParam('page', 1);
$paginator->setItemCountPerPage(5);
$paginator->setCurrentPageNumber($page);
$paginator->setPageRange(8);
$this->view->paginator = $paginator;
}
}
开发者ID:rizkioa,项目名称:etak6,代码行数:26,代码来源:RouteController.php
示例12: indexAction
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"));
}
开发者ID:rootzig,项目名称:SNEP,代码行数:32,代码来源:PickupGroupsController.php
示例13: indexAction
/**
* 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"));
}
开发者ID:rootzig,项目名称:SNEP,代码行数:35,代码来源:ContactsController.php
示例14: 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
示例15: getAll
public function getAll($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('a' => 'Sheets'), array('*'))->join(array('t' => 'SheetsTsl'), 'a.id = t.s_id', array('lng', 'name', 't_desc', 't_file'))->join(array('ty' => 'SheetsSubtype'), 'a.subtype = ty.subtype_id', array())->join(array('tyt' => 'SheetsSubtypeTsl'), 'ty.subtype_id = tyt.subtype_id', array('name as subtypename'))->join(array('st' => 'SheetsType'), 'a.type = st.type_id', array())->join(array('stt' => 'SheetsTypeTsl'), 'st.type_id = stt.type_id', array('name as typename'))->where('t.lng = ?', $_SESSION['System']['lng'])->where('tyt.lng = ?', $_SESSION['System']['lng'])->where('stt.lng = ?', $_SESSION['System']['lng'])->order('st.position ASC')->order('ty.position ASC')->order('a.place ASC');
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;
}
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:27,代码来源:Proxy.php
示例16: 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
示例17: getAll
public function getAll($paginator = true, $pindex = 1, $perpage = 25, $cache = true)
{
if ($cache == true) {
$cacheId = 'SxModule_Pageform_Subscription_Meta_getAll_' . sha1(var_export($paginator, true) . '_' . var_export($pindex, true) . '_' . var_export($perpage, true));
$cache = Zend_Registry::get('cache');
if (true == ($result = $cache->load($cacheId))) {
return $result;
}
}
$db = Zend_Registry::get('db');
$select = $db->select()->from(array('i' => $this->_tablename()), array('*'));
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 = array('SxModule_Pageform_Subscription_Meta', 'SxModule_Pageform_Subscription_Meta_getAll', 'SxModule_Pageform_Subscription', 'SxModule_Pageform');
$cache->save($data, $cacheId, $cacheTags);
}
return $data;
}
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:27,代码来源:Proxy.php
示例18: indexAction
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"));
}
开发者ID:rootzig,项目名称:SNEP,代码行数:33,代码来源:UsersController.php
示例19: 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;
*/
}
开发者ID:rjon76,项目名称:netspotapp,代码行数:27,代码来源:log.php
示例20: getPages
/**
* Returns an array of "local" pages given a page number and range.
*
* @param Zend_Paginator $paginator
* @param integer $pageRange (Optional) Page range
* @return array
*/
public function getPages(Zend_Paginator $paginator, $pageRange = null)
{
if ($pageRange === null) {
$pageRange = $paginator->getPageRange();
}
$pageNumber = $paginator->getCurrentPageNumber();
$pageCount = count($paginator);
if ($pageRange > $pageCount) {
$pageRange = $pageCount;
}
$delta = ceil($pageRange / 2);
if ($pageNumber - $delta > $pageCount - $pageRange) {
$lowerBound = $pageCount - $pageRange + 1;
$upperBound = $pageCount;
} else {
if ($pageNumber - $delta < 0) {
$delta = $pageNumber;
}
$offset = $pageNumber - $delta;
$lowerBound = $offset + 1;
$upperBound = $offset + $pageRange;
}
return $paginator->getPagesInRange($lowerBound, $upperBound);
}
开发者ID:padraic,项目名称:framework-benchs,代码行数:37,代码来源:Sliding.php
注:本文中的Zend_Paginator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论