本文整理汇总了PHP中JPagination类的典型用法代码示例。如果您正苦于以下问题:PHP JPagination类的具体用法?PHP JPagination怎么用?PHP JPagination使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JPagination类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPhotos
/**
* TuiyoModelPhotos::getPhotos()
* An array of all photos belonging to userID
* @param mixed $userID
* @param mixed $albumID
* @param mixed $limit
* @param mixed $published
* @param bool $newFirst
* @return
*/
public function getPhotos($userID, $albumID = NULL, $published = NULL, $newFirst = TRUE, $uselimit = TRUE, $overiteLimit = NULL)
{
$limit = $uselimit ? $this->getState('limit') : NULL;
$limit = !is_null($overiteLimit) ? (int) $overiteLimit : $limit;
$limitstart = $this->getState('limitstart');
//1. Get all Photos
$photosTable = TuiyoLoader::table("photos", true);
$photos = $photosTable->getAllPhotos($userID, $albumID, $limitstart, $published, $newFirst, $limit);
//print_R( $photos );
//1b. Paginate?
jimport('joomla.html.pagination');
$dbo = $photosTable->_db;
$this->_total = $dbo->loadResult();
$pageNav = new JPagination($this->_total, $limitstart, $limit);
$root = JURI::root();
$this->pageNav = $pageNav->getPagesLinks();
//Set the total count
$this->setState('total', $this->_total);
$this->setState('pagination', $this->pageNav);
//2. Check the existence of each photo!
foreach ($photos as $photo) {
$photo->date_added = TuiyoTimer::diff(strtotime($photo->date_added));
$photo->last_modified = TuiyoTimer::diff(strtotime($photo->last_modified));
$photo->src_original = $root . substr($photo->src_original, 1);
$photo->src_thumb = $root . substr($photo->src_thumb, 1);
}
return (array) $photos;
}
示例2: appFullView
/**
* Application full view
**/
function appFullView()
{
$document =& JFactory::getDocument();
$this->showSubmenu();
$applicationName = JString::strtolower(JRequest::getVar('app', '', 'GET'));
if (empty($applicationName)) {
JError::raiseError(500, 'CC APP ID REQUIRED');
}
if (!$this->accessAllowed('registered')) {
return;
}
$output = '';
//@todo: Since group walls doesn't use application yet, we process it manually now.
if ($applicationName == 'walls') {
CFactory::load('libraries', 'wall');
$jConfig = JFactory::getConfig();
$limit = $jConfig->get('list_limit');
$limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
$eventId = JRequest::getVar('eventid', '', 'GET');
$my = CFactory::getUser();
$config = CFactory::getConfig();
$eventsModel = CFactory::getModel('Events');
$event =& JTable::getInstance('Event', 'CTable');
$event->load($eventId);
$config = CFactory::getConfig();
$document->setTitle(JText::sprintf('CC EVENTS WALL TITLE', $event->title));
CFactory::load('helpers', 'owner');
$guest = $event->isMember($my->id);
$waitingApproval = $event->isPendingApproval($my->id);
$status = $event->getUserStatus($my->id);
$responded = $status == COMMUNITY_EVENT_STATUS_ATTEND || $status == COMMUNITY_EVENT_STATUS_WONTATTEND || $status == COMMUNITY_EVENT_STATUS_MAYBE;
if (!$config->get('lockeventwalls') || $config->get('lockeventwalls') && $guest && !$waitingApproval && $responded || COwnerHelper::isCommunityAdmin()) {
$output .= CWallLibrary::getWallInputForm($event->id, 'events,ajaxSaveWall', 'events,ajaxRemoveWall');
// Get the walls content
$output .= '<div id="wallContent">';
$output .= CWallLibrary::getWallContents('events', $event->id, $event->isAdmin($my->id), 0, $limitstart, 'wall.content', 'events,events');
$output .= '</div>';
jimport('joomla.html.pagination');
$wallModel = CFactory::getModel('wall');
$pagination = new JPagination($wallModel->getCount($event->id, 'events'), $limitstart, $limit);
$output .= '<div class="pagination-container">' . $pagination->getPagesLinks() . '</div>';
}
} else {
CFactory::load('libraries', 'apps');
$model = CFactory::getModel('apps');
$applications =& CAppPlugins::getInstance();
$applicationId = $model->getUserApplicationId($applicationName);
$application = $applications->get($applicationName, $applicationId);
if (!$application) {
JError::raiseError(500, 'CC APPLICATION NOT FOUND');
}
// Get the parameters
$manifest = JPATH_PLUGINS . DS . 'community' . DS . $applicationName . DS . $applicationName . '.xml';
$params = new JParameter($model->getUserAppParams($applicationId), $manifest);
$application->params =& $params;
$application->id = $applicationId;
$output = $application->onAppDisplay($params);
}
echo $output;
}
示例3: pagination
/**
* Creates a pagination using the passed in values
*
* @param array $config Configuration Options
* total => list total, limit => list limit, offset => list start offset
*
* @return string
*/
public function pagination(array $config)
{
$config = new KConfig($config);
jimport('joomla.html.pagination');
$pagination = new JPagination($config->total, $config->offset, $config->limit);
return $pagination->getListFooter();
}
示例4: _displaylist
function _displaylist($tpl = null)
{
$document = JFactory::getDocument();
$this->assignRef('rules', $this->rules);
$pagination = new JPagination($this->total, $this->limitstart, $this->limit);
$document->setTitle($document->getTitle() . ' - ' . $pagination->getPagesCounter());
$this->assignRef('pagination', $pagination);
$this->assignRef('params', $this->params);
parent::display($tpl);
}
示例5: DefaultPaginationSearchForm
function DefaultPaginationSearchForm($total, $limitstart, $limit)
{
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
?>
<div class="jev_pagination">
<?php
echo $pageNav->getListFooter();
?>
</div>
<?php
}
示例6: display
function display($tpl = null)
{
global $mainframe, $option;
if (empty($layout)) {
// degrade to default
$layout = 'list';
}
// Initialize some variables
$user =& JFactory::getUser();
$pathway =& $mainframe->getPathway();
// Get the page/component configuration
$params =& $mainframe->getParams('com_content');
// Request variables
$task = JRequest::getCmd('task');
$limit = JRequest::getVar('limit', $params->get('display_num', 20), '', 'int');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
$month = JRequest::getInt('month');
$year = JRequest::getInt('year');
$filter = JRequest::getString('filter');
// Get some data from the model
$state =& $this->get('state');
$items =& $this->get('data');
$total =& $this->get('total');
// Add item to pathway
$pathway->addItem(JText::_('Archive'), '');
$params->def('filter', 1);
$params->def('filter_type', 'title');
jimport('joomla.html.pagination');
$pagination = new JPagination($total, $limitstart, $limit);
$form = new stdClass();
// Month Field
$months = array(JHTML::_('select.option', null, JText::_('Month')), JHTML::_('select.option', '01', JText::_('JANUARY_SHORT')), JHTML::_('select.option', '02', JText::_('FEBRUARY_SHORT')), JHTML::_('select.option', '03', JText::_('MARCH_SHORT')), JHTML::_('select.option', '04', JText::_('APRIL_SHORT')), JHTML::_('select.option', '05', JText::_('MAY_SHORT')), JHTML::_('select.option', '06', JText::_('JUNE_SHORT')), JHTML::_('select.option', '07', JText::_('JULY_SHORT')), JHTML::_('select.option', '08', JText::_('AUGUST_SHORT')), JHTML::_('select.option', '09', JText::_('SEPTEMBER_SHORT')), JHTML::_('select.option', '10', JText::_('OCTOBER_SHORT')), JHTML::_('select.option', '11', JText::_('NOVEMBER_SHORT')), JHTML::_('select.option', '12', JText::_('DECEMBER_SHORT')));
$form->monthField = JHTML::_('select.genericlist', $months, 'month', 'size="1" class="inputbox"', 'value', 'text', $month);
// Year Field
$years = array();
$years[] = JHTML::_('select.option', null, JText::_('Year'));
for ($i = 2000; $i <= 2010; $i++) {
$years[] = JHTML::_('select.option', $i, $i);
}
$form->yearField = JHTML::_('select.genericlist', $years, 'year', 'size="1" class="inputbox"', 'value', 'text', $year);
$form->limitField = $pagination->getLimitBox();
$this->assign('filter', $filter);
$this->assign('year', $year);
$this->assign('month', $month);
$this->assignRef('form', $form);
$this->assignRef('items', $items);
$this->assignRef('params', $params);
$this->assignRef('user', $user);
$this->assignRef('pagination', $pagination);
parent::display($tpl);
}
示例7: _displaydetailrank
function _displaydetailrank($tpl = null)
{
$document = JFactory::getDocument();
$this->assignRef('detailrank', $this->detailrank);
$pagination = new JPagination($this->total, $this->limitstart, $this->limit);
// insert the page counter in the title of the window page
$document->setTitle($document->getTitle() . ' - ' . $pagination->getPagesCounter());
$this->assignRef('pagination', $pagination);
$this->assignRef('params', $this->params);
$this->assignRef('useAvatarFrom', $this->useAvatarFrom);
$this->assignRef('linkToProfile', $this->linkToProfile);
$this->assignRef('allowGuestUserViewProfil', $this->allowGuestUserViewProfil);
parent::display("listing");
}
示例8: getAllNotifications
/**
* TuiyoModelNotifications::getAllNotifications()
* Add function documentation
* @param mixed $userID
* @param mixed $status
* @return void
*/
public function getAllNotifications($userID, $status = NULL)
{
$nTable = TuiyoLoader::table("notifications", true);
$limit = $this->getState('limit');
$limitstart = $this->getState('limitstart');
$notices = $nTable->getUserNotifications((int) $userID, $limitstart, $limit);
//1b. Paginate?
jimport('joomla.html.pagination');
$dbo = $nTable->_db;
$this->_total = $dbo->loadResult();
$pageNav = new JPagination($this->_total, $limitstart, $limit);
$this->pageNav = $pageNav->getPagesLinks();
//Set the total count
$this->setState('total', $this->_total);
$this->setState('pagination', $this->pageNav);
return $notices;
}
示例9: DefaultPaginationForm
function DefaultPaginationForm($total, $limitstart, $limit)
{
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
$Itemid = JRequest::getInt("Itemid");
$task = JRequest::getVar("jevtask");
$link = JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&Itemid={$Itemid}&task={$task}");
?>
<div class="jev_pagination">
<form action="<?php
echo $link;
?>
" method="post">
<?php
// TODO add in catids so that changing it doesn't look the data
echo $pageNav->getListFooter();
?>
</form>
</div>
<?php
}
示例10: _display
function _display($tpl = null)
{
$document = JFactory::getDocument();
$uri = JFactory::getURI();
$uri2string = $uri->toString();
$document->addScript(JURI::base(true) . '/media/system/js/core.js');
$pagination = new JPagination($this->total, $this->limitstart, $this->limit);
// insert the page counter in the title of the window page
$titlesuite = $this->limitstart ? ' - ' . $pagination->getPagesCounter() : '';
$document->setTitle($document->getTitle() . $titlesuite);
$this->assignRef('params', $this->params);
$this->assignRef('allowGuestUserViewProfil', $this->allowGuestUserViewProfil);
$this->assignRef('rows', $this->rows);
$this->assignRef('lists', $this->lists);
$this->assignRef('limit', $this->limit);
$this->assignRef('pagination', $pagination);
$this->assignRef('action', $uri2string);
$this->assignRef('useAvatarFrom', $this->useAvatarFrom);
$this->assignRef('linkToProfile', $this->linkToProfile);
parent::display($tpl);
}
示例11: testConstructor
/**
* This method tests the.
*
* This is a basic data driven test. It takes the data passed, runs the constructor
* and make sure the appropriate values get setup.
*
* @return void
*
* @since 11.1
* @dataProvider dataTestConstructor
* @covers JPagination::__construct
*/
public function testConstructor($total, $limitstart, $limit, $expected)
{
$pagination = new JPagination($total, $limitstart, $limit);
$this->assertEquals($expected['total'], $pagination->total, 'Wrong Total');
$this->assertEquals($expected['limitstart'], $pagination->limitstart, 'Wrong Limitstart');
$this->assertEquals($expected['limit'], $pagination->limit, 'Wrong Limit');
$this->assertEquals($expected['pages.total'], $pagination->get('pages.total'), 'Wrong Total Pages');
$this->assertEquals($expected['pages.current'], $pagination->get('pages.current'), 'Wrong Current Page');
$this->assertEquals($expected['pages.start'], $pagination->get('pages.start'), 'Wrong Start Page');
$this->assertEquals($expected['pages.stop'], $pagination->get('pages.stop'), 'Wrong Stop Page');
unset($pagination);
}
示例12: onContentPrepare
/**
* Plugin that adds a pagebreak into the text and truncates text at that point
*
* @param string $context The context of the content being passed to the plugin.
* @param object &$row The article object. Note $article->text is also available
* @param mixed &$params The article params
* @param integer $page The 'page' number
*
* @return mixed Always returns void or true
*
* @since 1.6
*/
public function onContentPrepare($context, &$row, &$params, $page = 0)
{
$canProceed = $context == 'com_content.article';
if (!$canProceed) {
return;
}
$style = $this->params->get('style', 'pages');
// Expression to search for.
$regex = '#<hr(.*)class="system-pagebreak"(.*)\\/>#iU';
$input = JFactory::getApplication()->input;
$print = $input->getBool('print');
$showall = $input->getBool('showall');
if (!$this->params->get('enabled', 1)) {
$print = true;
}
if ($print) {
$row->text = preg_replace($regex, '<br />', $row->text);
return true;
}
// Simple performance check to determine whether bot should process further.
if (JString::strpos($row->text, 'class="system-pagebreak') === false) {
return true;
}
$view = $input->getString('view');
$full = $input->getBool('fullview');
if (!$page) {
$page = 0;
}
if ($params->get('intro_only') || $params->get('popup') || $full || $view != 'article') {
$row->text = preg_replace($regex, '', $row->text);
return;
}
// Find all instances of plugin and put in $matches.
$matches = array();
preg_match_all($regex, $row->text, $matches, PREG_SET_ORDER);
if ($showall && $this->params->get('showall', 1)) {
$hasToc = $this->params->get('multipage_toc', 1);
if ($hasToc) {
// Display TOC.
$page = 1;
$this->_createToc($row, $matches, $page);
} else {
$row->toc = '';
}
$row->text = preg_replace($regex, '<br />', $row->text);
return true;
}
// Split the text around the plugin.
$text = preg_split($regex, $row->text);
// Count the number of pages.
$n = count($text);
// We have found at least one plugin, therefore at least 2 pages.
if ($n > 1) {
$title = $this->params->get('title', 1);
$hasToc = $this->params->get('multipage_toc', 1);
// Adds heading or title to <site> Title.
if ($title) {
if ($page) {
if ($page && @$matches[$page - 1][2]) {
$attrs = JUtility::parseAttributes($matches[$page - 1][1]);
if (@$attrs['title']) {
$row->page_title = $attrs['title'];
}
}
}
}
// Reset the text, we already hold it in the $text array.
$row->text = '';
if ($style == 'pages') {
// Display TOC.
if ($hasToc) {
$this->_createToc($row, $matches, $page);
} else {
$row->toc = '';
}
// Traditional mos page navigation
$pageNav = new JPagination($n, $page, 1);
// Page counter.
$row->text .= '<div class="pagenavcounter">';
$row->text .= $pageNav->getPagesCounter();
$row->text .= '</div>';
// Page text.
$text[$page] = str_replace('<hr id="system-readmore" />', '', $text[$page]);
$row->text .= $text[$page];
// $row->text .= '<br />';
$row->text .= '<div class="pager">';
// Adds navigation between pages to bottom of text.
if ($hasToc) {
//.........这里部分代码省略.........
示例13:
function __construct(XiptModel &$model)
{
$limit = null;
$limitstart = null;
$this->initDefaultStates($model, $limit, $limitstart);
return parent::__construct($model->getTotal(), $limitstart, $limit);
}
示例14:
function __construct($total, $limitstart, $limit)
{
global $mainframe;
if ($limit == "") {
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
}
parent::__construct($total, $limitstart, $limit);
}
示例15: intval
function __construct($total, $limitstart, $limit, $prefix = '') {
// If out of range, use last page
if ($total < (int) $limitstart)
$limitstart = intval($total / $limit) * $limit;
parent::__construct($total, $limitstart, $limit, $prefix);
$this->setDisplay();
if ($limitstart === false) $this->set('pages.current', -1);
$this->template = KunenaFactory::getTemplate();
}