本文整理汇总了PHP中PageManager::showPages方法的典型用法代码示例。如果您正苦于以下问题:PHP PageManager::showPages方法的具体用法?PHP PageManager::showPages怎么用?PHP PageManager::showPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageManager
的用法示例。
在下文中一共展示了PageManager::showPages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showPages
function showPages()
{
global $mainframe, $option;
$db =& JFactory::getDBO();
$filter_order = $mainframe->getUserStateFromRequest("{$option}.filter_order_pages", 'filter_order', 'b.title', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest("{$option}.filter_order_Dir_pages", 'filter_order_Dir', '', 'word');
$filter_state = $mainframe->getUserStateFromRequest("{$option}.filter_state_pages", 'filter_state', '', 'word');
$filter_book = $mainframe->getUserStateFromRequest("{$option}.filter_book_pages", 'filter_book', '-1', 'string');
$search = $mainframe->getUserStateFromRequest("{$option}.search_pages", 'search', '', 'string');
$search = JString::strtolower($search);
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest($option . 'limitstart_page', 'limitstart', 0, 'int');
$where = array();
if ($filter_state) {
if ($filter_state == 'P') {
$where[] = 'm.published = 1';
} else {
if ($filter_state == 'U') {
$where[] = 'm.published = 0';
}
}
}
if ($filter_book > -1) {
$where[] = '(m.book_id = ' . $filter_book . ')';
}
if ($search) {
$where[] = '(LOWER(m.file) LIKE ' . $db->Quote('%' . $search . '%') . ' OR LOWER(m.link_url) LIKE ' . $db->Quote('%' . $search . '%') . ' OR LOWER(m.zoom_url) LIKE ' . $db->Quote('%' . $search . '%') . ')';
}
$where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
$orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir . ', m.ordering';
$query = 'SELECT COUNT(m.id)' . ' FROM #__flippingbook_pages AS m' . $where;
$db->setQuery($query);
$total = $db->loadResult();
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
$query = 'SELECT m.*, b.title' . ' FROM #__flippingbook_pages AS m LEFT JOIN #__flippingbook_books AS b ON (m.book_id=b.id)' . $where . $orderby;
$db->setQuery($query, $pageNav->limitstart, $pageNav->limit);
$rows = $db->loadObjectList();
if ($db->getErrorNum()) {
echo $db->stderr();
return false;
}
$lists['state'] = JHTML::_('grid.state', $filter_state);
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
$query = 'SELECT id, title FROM #__flippingbook_books ORDER BY title';
$db->setQuery($query);
$rows2 = $db->loadObjectList();
$book_filter[] = JHTML::_('select.option', -1, '- ' . JText::_('Select Book') . ' -');
foreach ($rows2 as $row) {
$book_filter[] = JHTML::_('select.option', $row->id, $row->title);
}
$lists['book'] = JHTML::_('select.genericlist', $book_filter, 'filter_book', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_book);
$lists['search'] = $search;
require_once JPATH_COMPONENT . DS . 'views' . DS . 'page_manager.php';
PageManager::showPages($rows, $pageNav, $option, $lists);
}