$search->addQuery($boolquery); $search->setSource(false); $search = $search->toArray(); $search = CGUtils::searchElastic($search, $Pagination); $Pagination->calcMaxPages($search['hits']['total']); if (!empty($search['hits']['hits'])) { $ids = []; foreach ($search['hits']['hits'] as $hit) { $ids[] = $hit['_id']; } $Ponies = $CGDb->where('id IN (' . implode(',', $ids) . ')')->orderBy('order', 'ASC')->get('appearances'); } } if (!$elasticAvail) { $_EntryCount = $CGDb->where('ishuman', $EQG)->where('id != 0')->count('appearances'); $Pagination = new Pagination('cg', $AppearancesPerPage, $_EntryCount); $Ponies = Appearances::get($EQG, $Pagination->getLimit()); } if (isset($_REQUEST['GOFAST'])) { if (empty($Ponies[0]['id'])) { Response::fail('The search returned no results.'); } Response::done(array('goto' => "{$CGPath}/v/{$Ponies[0]['id']}-" . Appearances::getSafeLabel($Ponies[0]))); } CoreUtils::fixPath("{$CGPath}/{$Pagination->page}" . (!empty($Restrictions) ? "?q={$SearchQuery}" : '')); $heading = ($EQG ? 'EQG ' : '') . "{$Color} Guide"; $title .= "Page {$Pagination->page} - {$heading}"; if (isset($_GET['js'])) { $Pagination->respond(Appearances::getHTML($Ponies, NOWRAP), '#list'); } $settings = array('title' => $title, 'heading' => $heading, 'css' => array($do), 'js' => array('jquery.qtip', 'jquery.ctxmenu', $do, 'paginate'));
if (isset($q) && isset($by)) { $q[] = "by={$by}"; $title .= (!isset($type) ? 'Entries ' : '') . "by {$by} "; } } else { if (isset($q)) { $q[] = 'by=' . CoreUtils::FIXPATH_EMPTY; } } } $q = array(); if (isset($_GET['js'])) { $q[] = 'js=' . $_GET['js']; } process_filter($q); $Pagination = new Pagination('admin/logs', 20, $Database->count('log')); $heading = 'Global logs'; if (!empty($title)) { $title .= '- '; } $title .= "Page {$Pagination->page} - {$heading}"; CoreUtils::fixPath("/admin/logs/{$Pagination->page}" . (!empty($q) ? '?' . implode('&', $q) : '')); process_filter(); $LogItems = $Database->orderBy('timestamp')->orderBy('entryid')->get('log', $Pagination->getLimit()); if (isset($_GET['js'])) { $Pagination->respond(Logs::getTbody($LogItems), '#logs tbody'); } CoreUtils::loadPage(array('title' => $title, 'view' => "{$do}-logs", 'css' => "{$do}-logs", 'js' => array("{$do}-logs", 'paginate'))); break; default: CoreUtils::notFound();
<?php use App\CoreUtils; use App\Episodes; use App\Pagination; use App\Permission; /** @var $do string */ $Pagination = new Pagination('episodes', 10, $Database->where('season != 0')->count('episodes')); CoreUtils::fixPath("/episodes/{$Pagination->page}"); $heading = "Episodes"; $title = "Page {$Pagination->page} - {$heading}"; $Episodes = Episodes::get($Pagination->getLimit()); if (isset($_GET['js'])) { $Pagination->respond(Episodes::getTableTbody($Episodes), '#episodes tbody'); } $settings = array('title' => $title, 'do-css', 'js' => array('paginate', $do)); if (Permission::sufficient('staff')) { $settings['js'] = array_merge($settings['js'], array('moment-timezone', "{$do}-manage")); } CoreUtils::loadPage($settings);