本文整理汇总了PHP中Zend_Paginator::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Paginator::factory方法的具体用法?PHP Zend_Paginator::factory怎么用?PHP Zend_Paginator::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Paginator
的用法示例。
在下文中一共展示了Zend_Paginator::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction() {
// Don't render this if not authorized
$viewer = Engine_Api::_()->user()->getViewer();
if (!Engine_Api::_()->core()->hasSubject()) {
return $this->setNoRender();
}
// Get subject and check auth
$subject = Engine_Api::_()->core()->getSubject();
if (!$subject->authorization()->isAllowed($viewer, 'view')) {
return $this->setNoRender();
}
// Get paginator
$profile_owner_id = $subject->getIdentity();
$playlistTable = Engine_Api::_()->getItemTable('ynvideo_playlist');
$select = $playlistTable->select();
$select->where('user_id = ?', $profile_owner_id);
$select->where('search = 1');
$this->view->paginator = $paginator = Zend_Paginator::factory($select);
// Set item count per page and current page number
$paginator->setItemCountPerPage($this->_getParam('itemCountPerPage', 10));
$paginator->setCurrentPageNumber($this->_getParam('page', 1));
// Do not render if nothing to show
if ($paginator->getTotalItemCount() <= 0) {
return $this->setNoRender();
} else {
$this->_childCount = $paginator->getTotalItemCount();
}
}
示例2: indexAction
/**
* The default action - show the home page
*/
public function indexAction()
{
$loai = $this->_getParam('loai', 'dhsg');
$table = Khcn_Api::_()->getDbTable('he_cao_hoc', 'default');
$this->view->he_cao_hoc = $he_cao_hoc = $table->fetchRow($table->select()->where('name = ?', $loai));
if (!$he_cao_hoc) {
$this->_redirect('index');
}
// TODO Auto-generated {0}::indexAction() default action
$params = array('trang_thai' => true, 'limit' => 20, 'he_cao_hoc' => $he_cao_hoc->getIdentity());
$danhSach = Khcn_Api::_()->getDbTable('lich_hoc', 'default')->getPaginator($params);
$paginator = Zend_Paginator::factory($danhSach);
$currentPage = 1;
//Check if the user is not on page 1
$page = $this->_getParam('page');
if (!empty($page)) {
//Where page is the current page
$currentPage = $this->_getParam('page');
}
//Set the properties for the pagination
$paginator->setItemCountPerPage(15);
$paginator->setPageRange(10);
$paginator->setCurrentPageNumber($currentPage);
Zend_Paginator::setDefaultScrollingStyle('Sliding');
Zend_View_Helper_PaginationControl::setDefaultViewPartial('includes/pagination.phtml');
$paginator->setView($this->view);
$this->view->paginator = $paginator;
}
示例3: listAction
public function listAction()
{
$elementSetName = $this->_getParam('elset');
$elementName = $this->_getParam('elname');
$curPage = $this->_getParam('page');
$elementTextTable = $this->getDb()->getTable('ElementText');
$el = $this->getDb()->getTable('Element')->findByElementSetNameAndElementName($this->_unslugify($elementSetName), $this->_unslugify($elementName));
//$elTexts = $this->getDb()->getTable('ElementText')->findByElement($el->id);
$select = $elementTextTable->getSelect()->where('element_id = ?', $el->id)->order('text')->group('text');
$elTexts = $elementTextTable->fetchObjects($select);
//$sortedTexts = $elTexts->getSelect()->findByElement($el->id)->order('text');
$totalCategories = count($elTexts);
release_object($el);
// set-up pagination routine
$paginationUrl = $this->getRequest()->getBaseUrl() . '/categories/list/' . $elementSetName . '/' . $elementName . "/";
/*
$pageAdapter = new Zend_Paginator_Adapter_DbSelect($elementTextTable->getSelect()->where('element_id = ?', $el->id)->order('text')->group('text'));
*/
$paginator = Zend_Paginator::factory($select);
$paginator->setItemCountPerPage(20);
//$totalCategories = count($paginator);
$paginator->setCurrentPageNumber($curPage);
$this->view->paginator = $paginator;
//Serve up the pagination
// add other pagination items
$pagination = array('page' => $curPage, 'per_page' => 20, 'total_results' => $totalCategories, 'link' => $paginationUrl);
Zend_Registry::set('pagination', $pagination);
//$this->view->assign(array('texts'=>$elTexts, 'elset'=>$elementSetName, 'elname'=>$elementName, 'total_results'=>$totalCategories));
$this->view->assign(array('elset' => $elementSetName, 'elname' => $elementName, 'total_results' => $totalCategories));
}
示例4: indexAction
public function indexAction()
{
// Don't render this if not authorized
$viewer = Engine_Api::_()->user()->getViewer();
if (!Engine_Api::_()->core()->hasSubject()) {
return $this->setNoRender();
}
// Get subject and check auth
$subject = Engine_Api::_()->core()->getSubject('group');
if (!$subject->authorization()->isAllowed($viewer, 'view')) {
return $this->setNoRender();
}
// Get paginator
$table = Engine_Api::_()->getItemTable('advgroup_topic');
$select = $table->select()->where('group_id = ?', Engine_Api::_()->core()->getSubject()->getIdentity())->order('post_count DESC');
$this->view->paginator = $paginator = Zend_Paginator::factory($select);
// Set item count per page and current page number
$paginator->setItemCountPerPage($this->_getParam('itemCountPerPage', 5));
$paginator->setCurrentPageNumber($this->_getParam('page', 1));
// Do not render if nothing to show and not viewer
if ($paginator->getTotalItemCount() <= 0 && !$viewer->getIdentity()) {
return $this->setNoRender();
}
$this->view->canPost = Engine_Api::_()->authorization()->isAllowed($subject, $viewer, 'comment');
// Add count to title if configured
// if( $this->_getParam('titleCount', false) && $paginator->getTotalItemCount() > 0 ) {
// $this->_childCount = $paginator->getTotalItemCount();
// }
}
示例5: indexAction
public function indexAction()
{
$this->view->Title = "Group User Manager";
$this->view->headTitle($this->view->Title, true);
$tbl_group = new Manager_Model_group();
if ($this->_request->getPost('keyword') != NULL) {
$keyword = $this->_request->getParam('keyword');
$this->view->keyword = $keyword;
$listArticles = $tbl_group->searchkq($keyword);
$currentPage = 1;
$i = $this->_getParam('page', 1);
if (!empty($i)) {
$currentPage = $i;
}
$paginator = Zend_Paginator::factory($listArticles);
$paginator->setItemCountPerPage(45)->setPageRange(5)->setCurrentPageNumber($currentPage);
$this->view->paginator = $paginator;
} else {
$listArticles = $tbl_group->get_info();
$currentPage = 1;
$i = $this->_getParam('page', 1);
if (!empty($i)) {
$currentPage = $i;
}
$paginator = Zend_Paginator::factory($listArticles);
$paginator->setItemCountPerPage(45)->setPageRange(45)->setCurrentPageNumber($currentPage);
$this->view->paginator = $paginator;
}
}
示例6: fetchAllJoin
public function fetchAllJoin($key,$condition)
{
$select = $this->select()
->setIntegrityCheck(false)
->from(array('v' => 've_verecords'))
->join(array('e'=>'em_contacts'),'e.contactId = v.contactId',array('contactName'))
->join(array('h'=>'ve_vehicles'),'h.veId = v.veId');
if($condition[1] != null)
{
if($condition[1] == 'plateNo')
{
$select->where('h.plateNo like ?','%'.$key.'%');
}
elseif($condition[1] == 'date')
{
$select->where('startDate <= ?',$key)
->where('endDate >= ?',$key);
}
elseif($condition[1] == 'contactName')
{
$select->where('e.contactName like ?','%'.$key.'%');
}
}
if($condition[0] != null)
{
$select->where('v.projectId = ?', $condition[0]);
}
else
{
$select->where('v.prjFlag = 0');
}
$paginator = Zend_Paginator::factory($select);
return $paginator;
}
示例7: indexAction
public function indexAction()
{
// Should we consider creation or modified recent?
$recentType = $this->_getParam('recentType', 'creation');
if (!in_array($recentType, array('creation', 'modified'))) {
$recentType = 'creation';
}
$this->view->recentType = $recentType;
$this->view->recentCol = $recentCol = $recentType . '_date';
// Get paginator
$table = Engine_Api::_()->getItemTable('video');
$select = $table->select()->where('search = ?', 1)->where('status = ?', 1);
if ($recentType == 'creation') {
// using primary should be much faster, so use that for creation
$select->order('video_id DESC');
} else {
$select->order($recentCol . ' DESC');
}
$this->view->paginator = $paginator = Zend_Paginator::factory($select);
// Set item count per page and current page number
$paginator->setItemCountPerPage($this->_getParam('itemCountPerPage', 4));
$paginator->setCurrentPageNumber($this->_getParam('page', 1));
// Hide if nothing to show
if ($paginator->getTotalItemCount() <= 0) {
return $this->setNoRender();
}
}
示例8: indexAction
public function indexAction()
{
// $this->view->headMeta()->appendName('description', '');
// $this->view->headLink()->prependStylesheet($this->view->baseUrl('/modules/default/css/file.css'));
// $this->view->headScript()->prependFile($this->view->baseUrl('/js/file.js'));
$this->view->breadcrumb = array($this->title => 'gestao/contato');
if ($this->getRequest()->isPost()) {
$this->view->date = $date = $this->getRequest()->getPost('date');
$this->view->dateEnd = $dateEnd = $this->getRequest()->getPost('dateEnd');
if (!empty($date)) {
$dateArray = explode('-', $date);
$date = $dateArray[2] . '-' . $dateArray[1] . '-' . $dateArray[0];
} else {
$date = null;
}
if (!empty($dateEnd)) {
$dateArray = explode('-', $dateEnd);
$dateEnd = $dateArray[2] . '-' . $dateArray[1] . '-' . $dateArray[0];
} else {
$dateEnd = null;
}
$rs = $this->_service->getAll($date, $dateEnd);
} else {
$rs = $this->_service->getAll();
}
$rs = $rs ? $rs : array();
$page = $this->_getParam('page', 1);
$paginator = Zend_Paginator::factory($rs);
$paginator->setItemCountPerPage(20);
$paginator->setCurrentPageNumber($page);
$this->view->rs = $paginator;
}
示例9: indexAction
public function indexAction()
{
// Should we consider views or comments popular?
$popularType = $this->_getParam('popularType', 'comment');
if (!in_array($popularType, array('comment', 'view'))) {
$popularType = 'comment';
}
$this->view->popularType = $popularType;
$this->view->popularCol = $popularCol = $popularType . '_count';
// Get paginator
$parentTable = Engine_Api::_()->getItemTable('album');
$parentTableName = $parentTable->info('name');
$table = Engine_Api::_()->getItemTable('album_photo');
$tableName = $table->info('name');
$select = $table->select()->from($tableName)->joinLeft($parentTableName, $parentTableName . '.album_id=' . $tableName . '.album_id', null)->where($parentTableName . '.search = ?', true)->order($popularCol . ' DESC');
// Create new array filtering out private albums
$viewer = Engine_Api::_()->user()->getViewer();
$photo_select = $select;
$new_select = array();
$i = 0;
foreach ($photo_select->getTable()->fetchAll($photo_select) as $photo) {
if (Engine_Api::_()->authorization()->isAllowed($photo, $viewer, 'view')) {
$new_select[$i++] = $photo;
}
}
$this->view->paginator = $paginator = Zend_Paginator::factory($new_select);
// Set item count per page and current page number
$paginator->setItemCountPerPage($this->_getParam('itemCountPerPage', 4));
$paginator->setCurrentPageNumber($this->_getParam('page', 1));
// Do not render if nothing to show
if ($paginator->getTotalItemCount() <= 0) {
return $this->setNoRender();
}
}
示例10: indexAction
public function indexAction()
{
$entries = new Entry();
// test memcached
if (extension_loaded('memcache')) {
$mem = new Memcache();
$mem->addServer('localhost', 11211);
$result = $mem->get('indexContent');
if (!$result) {
$result = $entries->fetchLatest(100);
$mem->set('indexContent', $result, 0, 4);
}
} else {
$result = $entries->fetchLatest(100);
}
if ($result) {
$this->view->entries = $result;
// Zend_Paginator
$page = $this->_request->getParam('page', 1);
$paginator = Zend_Paginator::factory($result);
$paginator->setItemCountPerPage(4);
$paginator->setCurrentPageNumber($page);
$this->view->paginator = $paginator;
}
}
示例11: direct
/**
* @param $data data in to be shown on view
*/
public function direct($currentPage, $data)
{
$paginator = Zend_Paginator::factory($data);
$paginator->setItemCountPerPage(10);
$paginator->setCurrentPageNumber($currentPage);
return $paginator;
}
示例12: setUp
/**
* Prepares the environment before running a test.
*/
protected function setUp()
{
parent::setUp();
$this->_scrollingStyle = new Zend_Paginator_ScrollingStyle_All();
$this->_paginator = Zend_Paginator::factory(range(1, 101));
$this->_paginator->setItemCountPerPage(10);
}
示例13: doSearchAction
public function doSearchAction()
{
$keyword = $this->_getParam("keyword");
if ($keyword) {
$perPage = 20;
$curPage = (int) $this->_getParam('page');
$start = 0;
if ($curPage > 0) {
$start = ($curPage - 1) * $perPage;
}
$searchObj = new VC_Business_Search();
$result = $searchObj->searchProcess($this->userId, $keyword, array('count' => $perPage, 'offset' => $start));
//var_dump($result);die;
$result['numFound'] = (int) $result['numFound'];
if ($result['numFound'] > $perPage) {
$paginator = Zend_Paginator::factory($result['numFound']);
$paginator->setItemCountPerPage($perPage);
$paginator->setCurrentPageNumber($curPage);
$this->view->paginator = $paginator;
}
$this->view->listArticle = $result['list'];
$this->view->keyword = $keyword;
} else {
return $this->render("index");
}
}
示例14: indexAction
public function indexAction()
{
// Don't render this if not authorized
$this->view->viewer = $viewer = Engine_Api::_()->user()->getViewer();
if (!Engine_Api::_()->core()->hasSubject()) {
return $this->setNoRender();
}
// Get subject and check auth
$subject = Engine_Api::_()->core()->getSubject();
if (!$subject->authorization()->isAllowed($viewer, 'view')) {
return $this->setNoRender();
}
// Get paginator
$table = Engine_Api::_()->getDbtable('links', 'core');
$select = $table->select()->where('parent_type = ?', $subject->getType())->where('parent_id = ?', $subject->getIdentity())->where('search = ?', 1)->order('creation_date DESC');
$this->view->paginator = $paginator = Zend_Paginator::factory($select);
$paginator->setCurrentPageNumber($this->_getParam('page'));
// Do not render if nothing to show
if ($paginator->getTotalItemCount() <= 0) {
return $this->setNoRender();
}
// Add count to title if configured
if ($this->_getParam('titleCount', false) && $paginator->getTotalItemCount() > 0) {
$this->_childCount = $paginator->getTotalItemCount();
}
}
示例15: indexAction
public function indexAction()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
if ($request->isPost()) {
$this->getElement()->clearDecorators();
}
$numberOfBooks = $this->_getParam('itemCountPerPage', 12);
$bookTable = new Book_Model_DbTable_Books();
$bookSelect = $bookTable->getSelect();
$bookSelect->limit($numberOfBooks);
$bookSelect->order('RAND()');
$this->view->paginator = $paginator = Zend_Paginator::factory($bookSelect);
if ($paginator->getTotalItemCount() == 0) {
return $this->setNoRender();
}
if ($paginator->getTotalItemCount() == 0) {
return $this->setNoRender();
}
$itemCountPerPage = $this->_getParam('itemCountPerPage', 12);
if (empty($itemCountPerPage)) {
$itemCountPerPage = 12;
}
$paginator->setItemCountPerPage($itemCountPerPage);
$paginator->setCurrentPageNumber($this->_getParam('page', 1));
}