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); }