Пример #1
0
    $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 (Permission::sufficient('staff')) {