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); }
public function getLimitBox() { $app = JFactory::getApplication(); $limits = array(); $limitArray = JUDirectoryFrontHelper::customLimitBox(); $keyAllLimit = array_search(0, $limitArray); if ($keyAllLimit) { $limitAll = true; unset($limitArray[$keyAllLimit]); } else { $limitAll = false; } $limitArray = array_values($limitArray); sort($limitArray); if (empty($limitArray)) { return parent::getLimitBox(); } foreach ($limitArray as $limitValue) { $limits[] = JHtml::_('select.option', "{$limitValue}"); } if ($limitAll) { $limits[] = JHtml::_('select.option', '0', JText::_('JALL')); } $jversion_arr = explode(".", JVERSION); $priVersion = $jversion_arr[0]; if ($priVersion == 2) { $selected = $this->_viewall ? 0 : $this->limit; } elseif ($priVersion == 3) { $selected = $this->viewall ? 0 : $this->limit; } if ($app->isAdmin()) { $html = JHtml::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="inputbox" size="1" onchange="Joomla.submitform();"', 'value', 'text', $selected); } else { $html = JHtml::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected); } return $html; }
</tr> <?php } ?> <tr> <td colspan = "6" class = "<?php echo $boardclass; ?> profile-bottomnav fbm " align="center"> <?php // TODO: fxstein - Need to perform SEO cleanup echo $pageNav->getPagesLinks("index.php?option=com_kunena&func=fbprofile&task=showprf&userid={$userid}" . KUNENA_COMPONENT_ITEMID_SUFFIX); echo $pageNav->getLimitBox("index.php?option=com_kunena&func=fbprofile&task=showprf&userid={$userid}" . KUNENA_COMPONENT_ITEMID_SUFFIX); ?> <br/> <?php echo $pageNav->getPagesCounter(); ?> </td> </tr> </tbody> </table> </div> </div> </div> </div> </div>
/** * This method tests the getLimitBox function. * * @param integer $total The total number of items. * @param integer $limitstart The offset of the item to start at. * @param integer $limit The number of items to display per page. * @param boolean $admin Are we in the administrator area * @param string $expected The expected results for the JPagination object * * @return void * * @covers JPagination::getLimitBox * @dataProvider dataTestGetLimitBox * @since 3.1 */ public function testGetLimitBox($total, $limitstart, $limit, $admin, $expected) { // Set whether we are in the admin area or not $app = $this->app; $app->expects($this->any())->method('isAdmin')->willReturn($admin); $pagination = new JPagination($total, $limitstart, $limit, '', $app); $this->assertEquals($pagination->getLimitBox(), $expected, 'The limit box results are not as expected'); unset($pagination); }
</tr> <?php $enum++; } } ?> <tr> <td colspan = "5" class = "fb_profile-bottomnav" style = "text-align:right"> <?php echo _KUNENA_USRL_DISPLAY_NR; ?> <?php echo $pageNav->getLimitBox("index.php?option=com_kunena&func=myprofile&do=showsub" . KUNENA_COMPONENT_ITEMID_SUFFIX); ?> <input type = "submit" class = "button" value = "<?php echo _GEN_DELETE; ?> "/> </td> </tr> <?php } else { echo '<tr class="' . $boardclass . '' . $tabclass[$k] . '"><td class="td-1" colspan = "5" >' . _USER_NOSUBSCRIPTIONS . '</td></tr>'; } ?>
/** function that will create pagination for views * @param object $setLimit * total - total number of rows * start - number or index to start e.g 0 ( will start from 0 - limit ) * value - ending number or limit e.g 20 ( will only show 20 rows ) * @return $display */ private static function _pagination($setLimit, $onlyBox = false, $showTotal = false) { jimport('joomla.html.pagination'); $total = $setLimit->total; $start = $setLimit->start; $value = $setLimit->end; $pagination = new JPagination($total, $start, $value); //alex pagination $pagination->setAdditionalUrlParam('limit', JRequest::getVar('limit')); if (version_compare(JVERSION, '3.0.0', '<')) { if ($onlyBox) { $display = "<div class=\"list-footer\">\n"; $display .= "\n<div class=\"limit\" style=\"float:left; height:22px; line-height:22px; margin:0 10px;\">" . JText::_('Display Num') . ' ' . $pagination->getLimitBox() . "</div>"; $display .= "\n<div class=\"counter\" style=\"float:left; height:22px; line-height:22px; margin:0 10px;\">" . ' ' . $pagination->getPagesCounter() . "</div>"; if ($showTotal) { $display .= "\n<div class=\"outof\" style=\"float:left; height:22px; line-height:22px; margin:0 10px;\">" . ' ' . JText::_('Total Result:') . ' <span style="font-weight: bold; text-decoration: underlined;">' . $total . "</span></div>"; } $display .= "\n</div>"; } else { $display = $pagination->getListFooter(); } } else { $display = '<div style="display:inline; font-size:14px;">'; $display .= '<div class="jnews_pagination_one" style="float:right; margin-left:15px;">'; $display .= $pagination->getLimitBox(); $display .= '</div>'; $pagi = $pagination->getListFooter(); if (!empty($pagi)) { $display .= '<div class="jnews_pagination" style="float:right; margin-left:15px;">'; $display .= $pagi; $display .= '</div>'; } $pagi = $pagination->getPagesCounter(); if (!empty($pagi)) { $display .= '<div style="float:right;padding-top: 4px;">'; $display .= $pagi; $display .= '</div>'; } $display .= '</div>'; } return $display; }
/** * This method tests the getLimitBox function. * * @param integer $total The total number of items. * @param integer $limitstart The offset of the item to start at. * @param integer $limit The number of items to display per page. * @param string $expected The expected results for the JPagination object * * @return void * * @covers JPagination::getLimitBox * @dataProvider dataTestGetLimitBox * @since 3.1 */ public function testGetLimitBox($total, $limitstart, $limit, $expected) { $pagination = new JPagination($total, $limitstart, $limit); $this->assertEquals($pagination->getLimitBox(), $expected, 'The limit box results are not as expected'); unset($pagination); }
function display($tpl = null) { $app = JFactory::getApplication(); $option = JRequest::getCmd('option'); if (empty($layout)) { // degrade to default $layout = 'list'; } // Initialise some variables $user =& JFactory::getUser(); $pathway =& $app->getPathway(); $document =& JFactory::getDocument(); // Get the page/component configuration $params =& $app->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); $menus =& JSite::getMenu(); $menu = $menus->getActive(); // because the application sets a default page title, we need to get it // right from the menu item itself if (is_object($menu)) { $menu_params = new JParameter($menu->params); if (!$menu_params->get('page_title')) { $params->set('page_title', JText::_('Archives')); } } else { $params->set('page_title', JText::_('Archives')); } $document->setTitle($params->get('page_title')); $form = new stdClass(); // Month Field $months = array('' => JText::_('Month'), '01' => JText::_('JANUARY_SHORT'), '02' => JText::_('FEBRUARY_SHORT'), '03' => JText::_('MARCH_SHORT'), '04' => JText::_('APRIL_SHORT'), '05' => JText::_('MAY_SHORT'), '06' => JText::_('JUNE_SHORT'), '07' => JText::_('JULY_SHORT'), '08' => JText::_('AUGUST_SHORT'), '09' => JText::_('SEPTEMBER_SHORT'), '10' => JText::_('OCTOBER_SHORT'), '11' => JText::_('NOVEMBER_SHORT'), '12' => JText::_('DECEMBER_SHORT')); $form->monthField = JHtml::_('select.genericlist', $months, 'month', array('list.attr' => 'size="1" class="inputbox"', 'list.select' => $month, 'option.key' => null)); // 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', array('list.attr' => 'size="1" class="inputbox"', 'list.select' => $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); }