本文整理汇总了PHP中FOFModel::getPagination方法的典型用法代码示例。如果您正苦于以下问题:PHP FOFModel::getPagination方法的具体用法?PHP FOFModel::getPagination怎么用?PHP FOFModel::getPagination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FOFModel
的用法示例。
在下文中一共展示了FOFModel::getPagination方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFormBrowse
//.........这里部分代码省略.........
array_unshift($options, $emptyOption);
$attribs = array('onchange' => 'document.adminForm.submit();');
$filter = JHtml::_('select.genericlist', $options, $headerField->name, $attribs, 'value', 'text', $headerField->value, false, true);
$filter_html .= "\t\t\t\t\t\t{$filter}" . PHP_EOL;
}
$filter_html .= "\t\t\t\t\t</td>" . PHP_EOL;
}
}
}
// Start the form
$filter_order = $form->getView()->getLists()->order;
$filter_order_Dir = $form->getView()->getLists()->order_Dir;
$html .= '<form action="index.php" method="post" name="adminForm" id="adminForm">' . PHP_EOL;
if (FOFPlatform::getInstance()->checkVersion(JVERSION, '3.0', 'ge')) {
// Joomla! 3.0+
// Get and output the sidebar, if present
$sidebar = JHtmlSidebar::render();
if ($show_filters && !empty($sidebar)) {
$html .= '<div id="j-sidebar-container" class="span2">' . "\n";
$html .= "\t{$sidebar}\n";
$html .= "</div>\n";
$html .= '<div id="j-main-container" class="span10">' . "\n";
} else {
$html .= '<div id="j-main-container">' . "\n";
}
// Render header search fields, if the header is enabled
if ($show_header) {
$html .= "\t" . '<div id="filter-bar" class="btn-toolbar">' . "\n";
$html .= "{$filter_html}\n";
if ($show_pagination) {
// Render the pagination rows per page selection box, if the pagination is enabled
$html .= "\t" . '<div class="btn-group pull-right hidden-phone">' . "\n";
$html .= "\t\t" . '<label for="limit" class="element-invisible">' . JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC') . '</label>' . "\n";
$html .= "\t\t" . $model->getPagination()->getLimitBox() . "\n";
$html .= "\t" . '</div>' . "\n";
}
if (!empty($sortFields)) {
// Display the field sort order
$asc_sel = $view->getLists()->order_Dir == 'asc' ? 'selected="selected"' : '';
$desc_sel = $view->getLists()->order_Dir == 'desc' ? 'selected="selected"' : '';
$html .= "\t" . '<div class="btn-group pull-right hidden-phone">' . "\n";
$html .= "\t\t" . '<label for="directionTable" class="element-invisible">' . JText::_('JFIELD_ORDERING_DESC') . '</label>' . "\n";
$html .= "\t\t" . '<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">' . "\n";
$html .= "\t\t\t" . '<option value="">' . JText::_('JFIELD_ORDERING_DESC') . '</option>' . "\n";
$html .= "\t\t\t" . '<option value="asc" ' . $asc_sel . '>' . JText::_('JGLOBAL_ORDER_ASCENDING') . '</option>' . "\n";
$html .= "\t\t\t" . '<option value="desc" ' . $desc_sel . '>' . JText::_('JGLOBAL_ORDER_DESCENDING') . '</option>' . "\n";
$html .= "\t\t" . '</select>' . "\n";
$html .= "\t" . '</div>' . "\n\n";
// Display the sort fields
$html .= "\t" . '<div class="btn-group pull-right">' . "\n";
$html .= "\t\t" . '<label for="sortTable" class="element-invisible">' . JText::_('JGLOBAL_SORT_BY') . '</label>' . "\n";
$html .= "\t\t" . '<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">' . "\n";
$html .= "\t\t\t" . '<option value="">' . JText::_('JGLOBAL_SORT_BY') . '</option>' . "\n";
$html .= "\t\t\t" . JHtml::_('select.options', $sortFields, 'value', 'text', $view->getLists()->order) . "\n";
$html .= "\t\t" . '</select>' . "\n";
$html .= "\t" . '</div>' . "\n";
}
$html .= "\t</div>\n\n";
$html .= "\t" . '<div class="clearfix"> </div>' . "\n\n";
}
}
// Start the table output
$html .= "\t\t" . '<table class="table table-striped" id="itemsList">' . PHP_EOL;
// Open the table header region if required
if ($show_header || $show_filters && FOFPlatform::getInstance()->checkVersion(JVERSION, '3.0', 'lt')) {
$html .= "\t\t\t<thead>" . PHP_EOL;
示例2: _createDocumentWithHypermedia
/**
* Creates a FOFHalDocument using the provided data
*
* @param array $data The data to put in the document
* @param FOFModel $model The model of this view
*
* @return FOFHalDocument A HAL-enabled document
*/
protected function _createDocumentWithHypermedia($data, $model = null)
{
// Create a new HAL document
if (is_array($data)) {
$count = count($data);
} else {
$count = null;
}
if ($count == 1) {
reset($data);
$document = new FOFHalDocument(end($data));
} else {
$document = new FOFHalDocument($data);
}
// Create a self link
$uri = (string) JUri::getInstance();
$uri = $this->_removeURIBase($uri);
$uri = JRoute::_($uri);
$document->addLink('self', new FOFHalLink($uri));
// Create relative links in a record list context
if (is_array($data) && $model instanceof FOFModel) {
$pagination = $model->getPagination();
if ($pagination->get('pages.total') > 1) {
// Try to guess URL parameters and create a prototype URL
// NOTE: You are better off specialising this method
$protoUri = $this->_getPrototypeURIForPagination();
// The "first" link
$uri = clone $protoUri;
$uri->setVar('limitstart', 0);
$uri = JRoute::_((string) $uri);
$document->addLink('first', new FOFHalLink($uri));
// Do we need a "prev" link?
if ($pagination->get('pages.current') > 1) {
$prevPage = $pagination->get('pages.current') - 1;
$limitstart = ($prevPage - 1) * $pagination->limit;
$uri = clone $protoUri;
$uri->setVar('limitstart', $limitstart);
$uri = JRoute::_((string) $uri);
$document->addLink('prev', new FOFHalLink($uri));
}
// Do we need a "next" link?
if ($pagination->get('pages.current') < $pagination->get('pages.total')) {
$nextPage = $pagination->get('pages.current') + 1;
$limitstart = ($nextPage - 1) * $pagination->limit;
$uri = clone $protoUri;
$uri->setVar('limitstart', $limitstart);
$uri = JRoute::_((string) $uri);
$document->addLink('next', new FOFHalLink($uri));
}
// The "last" link?
$lastPage = $pagination->get('pages.total');
$limitstart = ($lastPage - 1) * $pagination->limit;
$uri = clone $protoUri;
$uri->setVar('limitstart', $limitstart);
$uri = JRoute::_((string) $uri);
$document->addLink('last', new FOFHalLink($uri));
}
}
return $document;
}