本文整理汇总了PHP中Pager::getOffset方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::getOffset方法的具体用法?PHP Pager::getOffset怎么用?PHP Pager::getOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pager
的用法示例。
在下文中一共展示了Pager::getOffset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDefault
public function renderDefault()
{
$files = $this->files->order($this->order . " " . $this->sort);
// vyhledavani
if ($this->q) {
$files->where("file.name LIKE ?", "%" . $this->q . "%");
$this['search']['q']->setDefaultValue($this->q);
$this->template->search = TRUE;
} else {
$this->template->search = FALSE;
}
$this->pagerFiles->itemCount = $files->count();
$this->template->files = $files->limit($this->pagerFiles->getLimit(), $this->pagerFiles->getOffset());
}
示例2: testUnavailablePage
public function testUnavailablePage()
{
$pager = new Pager(27);
$pager->setPageSize(4)->setCurrentPage(10);
$this->assertEquals(0, $pager->getOffset());
$this->assertEquals(1, $pager->getCurrentPage());
}
示例3: renderDefault
public function renderDefault()
{
// vyhledavani
if ($this->q) {
$this->places->where("subject.name LIKE ? OR user.email LIKE ?", "%" . $this->q . "%", "%" . $this->q . "%");
$this['search']['q']->setDefaultValue($this->q);
$this->template->search = TRUE;
} else {
$this->template->search = FALSE;
}
switch ($this->what) {
case self::UPDATED:
$this->places->group('subject.id')->having('DATEDIFF(NOW(), subject.changed) < ' . self::TIME_UPDATED);
$this->template->what = self::UPDATED;
break;
case self::RECENT:
$this->places->group('subject.id')->having('DATEDIFF(NOW(), subject.created) < ' . self::TIME_RECENT);
$this->template->what = self::RECENT;
break;
case self::TOREVIEW:
$this->places->group('subject.id')->having('subject.reviewed = 0 && subject.deleted = 0 ');
$this->template->what = self::TOREVIEW;
break;
case self::DELETED:
$this->template->what = self::DELETED;
$this->places->fetchDeleted();
break;
default:
$this->template->what = self::ALL;
}
if (!$this->what == self::DELETED) {
$this->places->fetchUnDeleted();
}
if ($this->orderBy == '' && $this->user->isInRole('administrator')) {
$this->orderBy = self::MODIFICATION;
}
switch ($this->orderBy) {
case self::MODIFICATION:
$this->places->order('changed DESC, created DESC');
$this->template->orderBy = self::MODIFICATION;
break;
case self::ALPHABET:
default:
$this->places->order('name');
$this->template->orderBy = self::ALPHABET;
break;
}
// strankovani
$this->pagerPlaces->itemCount = $this->places->count();
$this->places->limit($this->pagerPlaces->getLimit(), $this->pagerPlaces->getOffset());
// vypis
$this->template->places = $this->places;
}
示例4: WSErro
WSErro("O status da empresa foi atualizado para <b>inativo</b>. Empresa agora é um rascunho!", WS_ALERT);
break;
case 'delete':
$empUpdate->ExeDelete($empAction);
WSErro($empUpdate->getError()[0], $empUpdate->getError()[1]);
break;
default:
WSErro("Ação não foi identifica pelo sistema, favor utilize os botões!", WS_ALERT);
}
}
$empi = 0;
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager('painel.php?exe=empresas/index&page=');
$Pager->ExePager($getPage, 10);
$readEmp = new Controle();
$readEmp->FullRead("SELECT * FROM app_empresas ORDER BY empresa_status ASC, empresa_title ASC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if ($readEmp->getResult()) {
foreach ($readEmp->getResult() as $emp) {
$empi++;
extract((array) $emp);
$status = !$empresa_status ? 'style="background: #fffed8"' : '';
$stateObj = new Controle('app_estados');
$stateObj->Query("estado_id = :est", "est={$empresa_uf}");
$state = $stateObj->getResult() ? $stateObj->getResult()[0]->estado_uf : 'NULL';
$cityObj = new Controle('app_cidades');
$cityObj->Query("cidade_id = :city", "city={$empresa_cidade}");
$city = $cityObj->getResult() ? $cityObj->getResult()[0]->cidade_nome : 'NULL';
?>
<article<?php
if ($empi % 2 == 0) {
echo ' class="right"';
示例5: WSErro
WSErro("Erro ao deletar", WS_ERROR);
}
break;
default:
WSErro("Opss! opção invalida.", WS_ERROR);
break;
}
} else {
WSErro("A ação informada não pode ser encontrado!", WS_INFOR);
}
}
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager(FAST_INCLUDE . "admin/&exe=acoes/index&page=");
$Pager->ExePager($getPage, 15);
$FeAcoes = new FeAcoes();
$FeAcoes->Execute()->FullRead("SELECT * FROM fe_acoes ORDER BY acao_status LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$FeAcoes->Execute()->getResult()) {
$Pager->ReturnPage();
WSErro("Nenhum ação cadastrado!", WS_INFOR);
} else {
?>
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Descrição</th>
<th>Ação</th>
</tr>
</thead>
<tbody>
<?php
示例6: Pager
echo $Cat;
?>
</h2>
<p class="tagline">Conheça as empresas cadastradas no seu guia online. Encontre aqui empresas <?php
echo $Cat;
?>
</p>
</header>
<?php
$getPage = !empty($Link->getLocal()[2]) ? $Link->getLocal()[2] : 1;
$Pager = new Pager(HOME . '/empresas/' . $EmpLink . '/');
$Pager->ExePager($getPage, 5);
$readEmp = new Controle();
$readEmp->setTable('app_empresas');
$readEmp->Query("empresa_status = 1 AND empresa_categoria = :cat ORDER BY empresa_date DESC LIMIT :limit OFFSET :offset", "cat={$EmpLink}&limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$readEmp->getResult()) {
$Pager->ReturnPage();
WSErro("Desculpe, ainda não existem empresas cadastradas {$Cat}, favor volte depois", WS_INFOR);
} else {
$View = new View();
$tpl = $View->Load('empresa_list');
foreach ($readEmp->getResult() as $emp) {
//encontra cidade
$readEmp->setTable('app_cidades');
$readEmp->find("cidade_id={$emp->empresa_cidade}");
$cidade = $readEmp->getResult()->cidade_nome;
$emp->empresa_cidade = $cidade;
//encontra estado
$readEmp->setTable('app_estados');
$readEmp->find("estado_id={$emp->empresa_uf}");
示例7: WSErro
break;
case 'delete':
$postUpdate->ExeDelete($postAction);
WSErro('O membro ' . $postUpdate->getError()[0], $postUpdate->getError()[1]);
break;
default:
WSErro("Ação não foi identificada pelo sistema, favor utilize os botões", WS_ERROR);
break;
}
}
$posti = 0;
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager("painel.php?exe=membros/index&page=");
$Pager->ExePager($getPage, 5);
$Read = new Controle();
$Read->FullRead("SELECT * FROM ws_posts WHERE post_type = 'membros' ORDER by post_status ASC, post_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$Read->getResult()) {
$Pager->ReturnPage();
WSErro("Desculpa, ainda não temos membros cadastrados", WS_INFOR);
} else {
foreach ($Read->getResult() as $post) {
$posti++;
extract((array) $post);
$status = !$post_status ? 'style="background: #fffed8"' : '';
?>
<article<?php
if ($posti % 2 == 0) {
echo ' class="right" ';
}
?>
<?php
示例8: Pager
"</h2>
<p class="tagline">Sua pesquisa por <?php
echo $search;
?>
retornou <?php
echo $count;
?>
resultados:</p>
</header>
<?php
$getPage = (int) (!empty($Link->getLocal()[2]) ? $Link->getLocal()[2] : 1);
$Pager = new Pager(HOME . '/pesquisa/' . $search . '/');
$Pager->ExePager($getPage, 4);
$readArt = new WsPosts();
$readArt->Execute()->Query("post_status = 1 AND (post_title LIKE '%' :link '%' OR post_content LIKE '%' :link '%') ORDER BY post_date DESC LIMIT :limit OFFSET :offset", "link={$search}&limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$readArt->Execute()->getResult()) {
$Pager->ReturnPage();
WSErro("Desculpe, sua pesquisa não retornou resultados. Você pode resulmir sua pesquisa ou tentar outros termos!", WS_INFOR);
} else {
$cc = 0;
foreach ($readArt->Execute()->getResult() as $cat) {
$cc++;
$View = new View();
$tpl_cat = $View->Load('article_m');
$class = $cc % 3 == 0 ? ' class="right"' : null;
echo "<span{$class}>";
$cat->post_title = Check::Words($cat->post_title, 8);
$cat->post_content = Check::Words($cat->post_content, 20);
$cat->datetime = date('Y-m-d', strtotime($cat->post_date));
$cat->pubdate = date('d/m/Y H:i', strtotime($cat->post_date));
示例9: WSErro
break;
case 'delete':
$perfilUpdate->ExeDelete($perfilAction);
WSErro('O perfil ' . $perfilUpdate->getError()[0], $perfilUpdate->getError()[1]);
break;
default:
WSErro("Ação não foi identificada pelo sistema, favor utilize os botões", WS_ERROR);
break;
}
}
$posti = 0;
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager("painel.php?exe=perfil/index&page=");
$Pager->ExePager($getPage, 6);
$Read = new Controle();
$Read->FullRead("SELECT * FROM ws_perfil ORDER by perfil_status ASC, perfil_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$Read->getResult()) {
$Pager->ReturnPage();
WSErro("Desculpa, ainda não temos perfis cadastrados", WS_INFOR);
} else {
foreach ($Read->getResult() as $post) {
$posti++;
extract((array) $post);
$status = !$perfil_status ? 'style="background: #fffed8"' : '';
?>
<article<?php
if ($posti % 2 == 0) {
echo ' class="right" ';
}
?>
<?php
示例10: renderDefault
public function renderDefault()
{
$httpRequest = $this->context->getService('httpRequest');
$this->template->hash = $hash = $httpRequest->getUrl()->path;
$cache = new \Nette\Caching\Cache($this->context->getService('cacheStorage'));
$key = $hash . "count";
dump($key);
$count = $cache->load($key);
if ($count === NULL) {
$count = $this->context->createServiceTimes()->fetchPublic()->group('event_time.event_id')->count();
$cache->save($key, $count, array(\Nette\Caching\Cache::EXPIRE => '2 hours', \Nette\Caching\Cache::TAGS => array('events', 'event'), \Nette\Caching\Cache::SLIDING => TRUE));
}
$this->template->eventsCount = $count;
$this->template->events = $this->items;
$this->template->page = $this->page;
// omezeni na lokalitu
$this->template->locality = false;
if ($this->locality) {
$this->items->where('event_time.event.subject.locality.code', $this->locality);
$this->template->locality = true;
}
// omezeni na kraje
if ($this->shire) {
$this->items->where('(event_time.event.shire.code = "' . $this->shire . '") OR (event_time.event.shire_id = 99)');
}
// omezeni na kategorie
if ($this->category || count($this->categories) > 0) {
$this->items->where('event_time.event:event_x_category.category_id', array_keys($this->categories));
if (count($this->categories) == 1) {
$this->template->category = $this->context->createServiceCategories()->get(key($this->categories));
} else {
$this->template->categories = $this->context->createServiceCategories();
}
} else {
//$this['categories']['category']['all']->setValue(1);
}
// nastavi casovy ramec
if ($this->timeframe) {
$this->items->setTimeframe($this->timeframe);
$this->template->timeframe = $this->timeframe;
}
$this->template->dates = array();
for ($i = 2; $i < 13; $i++) {
$ts = time() + $i * 86400;
if (strftime("%u", $ts) == 6 || strftime("%u", $ts) == 7) {
$this->template->dates[date("Y-m-d", $ts)]['time'] = strftime("%a %e. %m.", $ts);
$this->template->dates[date("Y-m-d", $ts)]['day'] = 'weekend';
//$this->template->dates[date("Y-m-d", $ts)] = strftime("%A", $ts);
} else {
$this->template->dates[date("Y-m-d", $ts)]['time'] = strftime("%a %e. %m.", $ts);
$this->template->dates[date("Y-m-d", $ts)]['day'] = 'weekday';
}
}
// pocet polozek s omezenimi
$key = $hash . $this->timeframe . "/page-" . $this->pagerPlaces->getPage() . "/" . serialize($this->categories);
$this->template->pagingHash = $key;
dump($key);
$count = $cache->load($key);
if ($count === NULL) {
$count = $this->items->count();
$cache->save($key, $count, array(\Nette\Caching\Cache::EXPIRE => '2 hours', \Nette\Caching\Cache::TAGS => array('events', 'event'), \Nette\Caching\Cache::SLIDING => TRUE));
}
$this->template->count = $count;
if ($this->page * $this->limit > $count - $this->limit) {
//zkontroluje, zda se jedna o posledni stranku vypisu
$this->limit = 9999;
// nastavi limi na hodne velky cislo, aby se vypsalo vse zbyvajici
$this->template->limit = $this->limit;
} elseif (($this->page + 1) * $this->limit > $count - $this->limit) {
// zkontroluje, zda se jedna o predposledni stranku vypisu
$this->template->limit = 9998;
} else {
$this->template->limit = $this->limit;
}
//nastavi razeni
if ($this->order == "created DESC") {
$this->items->order($this->order);
} else {
// ostatni razeni se resi v modelu dle timeframe
}
// strankovani
$this->pagerPlaces->itemsPerPage = $this->limit;
$this->pagerPlaces->itemCount = $count;
if ($this->pagerPlaces->getOffset() == 9999 && $this->pagerPlaces->getPage() > 1) {
$this->redirect('this', array('pagingPlaces-page' => 1));
}
if ($this->isAjax()) {
$this->template->newEntry = $this->items->limit($this->pagerPlaces->getLimit(), $this->pagerPlaces->getOffset());
} else {
$this->template->events = $this->items->limit($this->pagerPlaces->getLimit(), $this->pagerPlaces->getOffset());
}
}
示例11: WSErro
break;
case 'delete':
$postUpdate->ExeDelete($postAction);
WSErro($postUpdate->getError()[0], $postUpdate->getError()[1]);
break;
default:
WSErro("Ação não foi identificada pelo sistema, favor utilize os botões", WS_ERROR);
break;
}
}
$posti = 0;
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager("painel.php?exe=posts/index&page=");
$Pager->ExePager($getPage, 5);
$Read = new Read("ws_posts");
$Read->Query("ORDER by post_status ASC, post_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}");
if ($Read->getResult()) {
foreach ($Read->getResult() as $post) {
$posti++;
extract((array) $post);
$status = !$post_status ? 'style="background: #fffed8"' : '';
?>
<article<?php
if ($posti % 2 == 0) {
echo ' class="right" ';
}
?>
<?php
echo $status;
?>
>
示例12: Pager
retornou <?php
echo $count;
?>
resultados:</p>
</header>
</section>
<?php
//
//POSTs
//
$getPage = (int) (!empty($Link->getLocal()[2]) ? $Link->getLocal()[2] : 1);
$Pager = new Pager(HOME . '/pesquisa/' . $search . '/');
$Pager->ExePager($getPage, 8);
$readArt = new WsPosts();
$readArt->Execute()->Query("post_status = 1 AND (post_title LIKE '%' :link '%' OR post_content LIKE '%' :link '%') ORDER BY post_date DESC LIMIT :limit OFFSET :offset", "link={$search}&limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$readArt->Execute()->getResult()) {
$Pager->ReturnPage();
WSErro("Desculpe, sua pesquisa não encontrou posts. Você pode resulmir sua pesquisa ou tentar outros termos!", WS_INFOR);
} else {
$cc = 0;
echo "<div class='row'>\n";
foreach ($readArt->Execute()->getResult() as $cat) {
$cat->post_title = Check::Words($cat->post_title, 8);
$cat->post_content = Check::Words($cat->post_content, 20);
$cat->datetime = date('Y-m-d', strtotime($cat->post_date));
$cat->pubdate = date('d/m/Y H:i', strtotime($cat->post_date));
echo $cc % 4 == 0 ? "<div class='row'>\n</div>\n" : "";
echo "<div class='col-md-3'>";
$View->Show((array) $cat, $tpl_cat);
echo "</div>\n";
示例13: Pager
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
require './_app/Config.inc.php';
$Atual = filter_input(INPUT_GET, 'atual', FILTER_VALIDATE_INT);
$Pager = new Pager('04-gestao-de-resultados.php?atual=', 'Primeira', 'Última');
$Pager->ExePager($Atual, 1);
$read = new Read();
$read->ExeRead('ws_categories', 'limit :limit offset :offset', "limit={$Pager->getLimite()}&offset={$Pager->getOffset()}");
$Pager->ExePaginator('ws_categories');
echo $Pager->getPaginator();
var_dump($Pager);
?>
</body>
</html>
示例14: WSErro
WSErro("Erro ao deletar", WS_ERROR);
}
break;
default:
WSErro("Opss! opção invalida.", WS_ERROR);
break;
}
} else {
WSErro("O posto informado não pode ser encontrado!", WS_INFOR);
}
}
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager(IMP_INCLUDE . "admin/&exe=postos/index&page=");
$Pager->ExePager($getPage, 15);
$Read = new ImpPostos();
$Read->Execute()->FullRead("SELECT * FROM imp_postos ORDER BY postos_ativo LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
?>
<article>
<?php
if (!$Read->Execute()->getResult()) {
$Pager->ReturnPage();
WSErro("Desculpa, ainda não temos postos cadastrados", WS_INFOR);
} else {
?>
<table class="table table-striped text-center">
<thead>
<tr>
<th class="text-center">#</th>
<th class="text-center">Nome</th>
<th class="text-center">Numero</th>
<th class="text-center">Impressoras</th>
示例15: Pager
<h1 class="title"><?php
echo $category_title;
?>
</h1>
<p><?php
echo $category_content;
?>
</p>
</header>
<?php
$getPage = (int) (!empty($Link->getLocal()[2]) ? $Link->getLocal()[2] : 1);
$Pager = new Pager(HOME . '/categoria/' . $category_name . '/');
$Pager->ExePager($getPage, 3);
$readCat = new WsPosts();
$readCat->Execute()->Query("post_status = 1 AND (post_category = :cat OR post_cat_parent = :cat) ORDER BY post_date DESC LIMIT :limit OFFSET :offset", "cat={$category_id}&limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$readCat->Execute()->getResult()) {
$Pager->ReturnPage();
WSErro("Desculpe, a categoria <b>{$category_title}</b> ainda não tem artigos publicados, favor volte mais tarde!", WS_INFOR);
} else {
$cc = 1;
$View = new View();
$tpl_m = $View->Load('article_m');
foreach ($readCat->Execute()->getResult() as $cat) {
echo "\n<div class='col-md-4'>\n";
$class = $cc % 3 == 0 ? ' class="right"' : null;
$cat->post_title = Check::Words($cat->post_title, 8);
$cat->post_content = Check::Words($cat->post_content, 20);
$cat->datetime = date('Y-m-d', strtotime($cat->post_date));
$cat->pubdate = date('d/m/Y H:i', strtotime($cat->post_date));
$View->Show((array) $cat, $tpl_m);