本文整理汇总了PHP中Pager::getLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::getLimit方法的具体用法?PHP Pager::getLimit怎么用?PHP Pager::getLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pager
的用法示例。
在下文中一共展示了Pager::getLimit方法的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: testCalc
public function testCalc()
{
$pager = new Pager(27);
$pager->setPageSize(4)->setCurrentPage(7);
$this->assertEquals(4, $pager->getLimit());
$this->assertEquals(24, $pager->getOffset());
$this->assertEquals(7, $pager->getPageCount());
$pager->setCurrentPage(1);
$this->assertEquals(0, $pager->getOffset());
}
示例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: 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);
示例5: 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"';
示例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: renderDefault
public function renderDefault()
{
$this->template->subjects = $this->places->order('name')->where('subject.id != 1')->group('subject.id')->having('COUNT(:event.id) > 0');
$this->template->approvedPlacesCount = $this->approvedPlacesCount;
$this->template->subject_id = $this->subject_id;
if ($this->subject_id != 'all') {
$this->events->where('subject_id', $this->subject_id)->group('event.id')->having('COUNT(:event_time.id) = 0');
}
// vyhledavani
if ($this->q) {
$this->events->where("event.name LIKE ? OR subject.name LIKE ? OR user.email LIKE ?", "%" . $this->q . "%", "%" . $this->q . "%", "%" . $this->q . "%");
$this->places->where("subject.name LIKE ?", "%" . $this->q . "%");
$this['search']['q']->setDefaultValue($this->q);
$this->template->search = TRUE;
} else {
$this->template->search = FALSE;
}
if ($this->order == '' && $this->user->isInRole('administrator')) {
$this->order = 'updated DESC';
}
switch ($this->what) {
case self::ANONYMOUS:
$this->events->where('subject_id', '1');
$this->template->what = self::ANONYMOUS;
break;
case self::NOTERM:
$this->events->group('event.id')->having('COUNT(:event_time.id) = 0');
$this->template->what = self::NOTERM;
break;
case self::UPDATED:
$this->events->group('event.id')->having('DATEDIFF(NOW(), event.changed) < ' . self::TIME_UPDATED);
$this->template->what = self::UPDATED;
break;
case self::RECENT:
$this->events->group('event.id')->having('DATEDIFF(NOW(), event.created) < ' . self::TIME_RECENT);
$this->template->what = self::UPDATED;
break;
case self::TOREVIEW:
$this->events->group('event.id')->having('event.reviewed = 0');
$this->template->what = self::TOREVIEW;
break;
case self::NOTAPPROVED:
$this->events->group('event.id')->having('event.approved = 0');
$this->template->what = self::NOTAPPROVED;
break;
case self::PREFERED:
$this->events->group('event.id')->having('event.prefered = 1');
$this->template->what = self::PREFERED;
break;
default:
$this->template->what = self::ALL;
}
if ($this->orderBy == '' && $this->user->isInRole('administrator')) {
$this->orderBy = self::MODIFICATION;
}
switch ($this->orderBy) {
case self::MODIFICATION:
$this->events->order('changed DESC, created DESC');
$this->template->orderBy = self::MODIFICATION;
break;
case self::ALPHABET:
default:
$this->events->order('name');
$this->template->orderBy = self::ALPHABET;
break;
}
$this->pagerEvents->itemCount = $this->events->count();
$this->template->events = $this->events->limit($this->pagerEvents->getLimit(), $this->pagerEvents->getOffset());
if ($this->user->isInRole('administrator')) {
$this->template->nonaproved = $this->context->createServiceEvents()->where('approved', '0');
}
}
示例10: renderDefault
public function renderDefault()
{
$this->items->fetchVisible();
$this->template->page = $this->page;
$this->offset = $this->limit * ($this->page - 1);
// omezeni na lokalitu
$this->template->locality = false;
if ($this->locality) {
//$this->items->where('(locality.code = ? OR scope_all = 1)',$this->locality);
$this->items->where('(locality.code = ?)', $this->locality);
if ($this->shire === null) {
$this->template->locality = true;
}
}
// omezeni na kraje
if ($this->shire) {
$this->items->where('(locality.shire.code = ? OR locality.shire.id = 99 OR scope_all = 1)', $this->shire);
$this->template->shire = $this->context->createServiceShires()->where('code', $this->shire)->fetch();
}
//omezeni na kategorie
if ($this->category || count($this->categories) > 0) {
$this->items->where(':subject_x_category.category_id', array_keys($this->categories));
if (count($this->categories) == 1) {
$this->template->category = $this->context->createService('categories')->get(key($this->categories));
} else {
$this->template->categories = $this->context->createService('categories');
}
} else {
// $this['categories']['categories']['all']->setValue(1);
}
//omezeni na deti
if ($this->kids) {
$this->items->kids($this->kids);
}
// omezeni na kocarek
if ($this->stroller) {
$this->items->where('subject.stroller', $this->stroller);
}
// omezeni na kocarek
if ($this->nonsmoking) {
$this->items->where('subject.nonsmoking', $this->nonsmoking);
}
// omezeni na kocarek
if ($this->wheelchair_access) {
$this->items->where('subject.wheelchair_access', $this->wheelchair_access);
}
//nastavi razeni a pripadna dalsi omezeni
switch ($this->order) {
case 'likes':
$res = $this->context->database->table('subject_rating')->select('subject_id, sum(thumb_up) thumb_up, sum(thumb_down) thumb_down')->order('thumb_up DESC, thumb_down')->group('subject_id');
$ids = array();
foreach ($res as $key => $row) {
$ids[] = $row['subject_id'];
}
$this->items->where('subject.id', $ids);
$this->items->order('FIND_IN_SET(subject.id,"' . implode(",", $ids) . '")');
break;
case 'recommended':
$this->items->fetchAd(null, true)->order('created DESC');
break;
default:
$this->items->order($this->order);
break;
}
// pocet polozek s omezenimi
$items = clone $this->items;
$count = $items->count();
$this->template->count = $count;
// strankovani
$this->pagerPlaces->itemCount = $count;
if ($this->page * $this->limit > $count - $this->limit) {
//zkontroluje, zda se jedna o posledni stranku vypisu
$this->limit = 99;
// nastavi limit na hodne velky cislo, aby se vypsalo vse zbyvajici
} elseif (($this->page + 1) * $this->limit > $count - $this->limit) {
// zkontroluje, zda se jedna o predposledni stranku vypisu
$this->limit = 99;
}
$this->template->limit = $this->limit;
$this->pagerPlaces->itemsPerPage = $this->limit;
$this->template->page = $this->page;
if ($this->isAjax()) {
$this->template->newEntry = $this->items->limit($this->pagerPlaces->getLimit(), $this->pagerPlaces->getOffset());
$this->redrawControl('paging');
} else {
$this->template->subjects = $this->items->limit($this->pagerPlaces->getLimit(), $this->pagerPlaces->getOffset());
}
}
示例11: 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 Read('app_empresas');
$readEmp->Query("ORDER BY empresa_status ASC, empresa_title ASC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}");
if ($readEmp->getResult()) {
foreach ($readEmp->getResult() as $emp) {
$empi++;
extract((array) $emp);
$status = !$empresa_status ? 'style="background: #fffed8"' : '';
$stateObj = new Read('app_estados');
$stateObj->Query("WHERE estado_id = :est", "est={$empresa_uf}");
$state = $stateObj->getResult() ? $stateObj->getResult()[0]->estado_uf : 'NULL';
$cityObj = new Read('app_cidades');
$cityObj->Query("WHERE cidade_id = :city", "city={$empresa_cidade}");
$city = $cityObj->getResult() ? $cityObj->getResult()[0]->cidade_nome : 'NULL';
?>
<article<?php
if ($empi % 2 == 0) {
echo ' class="right"';
示例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: __toString
public function __toString()
{
$dbo =& $this->dbo;
$meta = $dbo->meta();
$table = $meta->getTable();
$key = $meta->getKey();
$sql = "{$this->type} ";
$meat = '';
if ($this->type == 'SELECT') {
if ($this->fields) {
$sql .= "{$this->fields} ";
} else {
$sql .= "`{$table}`.`{$key}`," . $meta->getColumnsSQL() . ' ';
}
} elseif ($this->fields) {
throw new InvalidArgumentException('field specification is incompatible with non-select queries');
} elseif ($this->pager) {
throw new InvalidArgumentException('pager is not compatible with non-select queries');
}
if ($this->pager && $this->limit) {
throw new InvalidArgumentException('pager is mutually exclusive with limit');
}
$meat = "FROM `{$table}` ";
foreach ($this->joins as $join) {
$meat .= "{$join} ";
}
for ($i = 0; $i < count($this->wheres); $i++) {
$where = $this->wheres[$i];
if (!$i) {
$where = "WHERE {$where}";
} else {
$where = "AND {$where} ";
}
$meat .= "{$where} ";
}
for ($i = 0; $i < count($this->groupBys); $i++) {
$group = $this->groupBys[$i];
if (!$i) {
$group = "GROUP BY {$group}";
} else {
$group = ",{$group}";
}
$meat .= "{$group} ";
}
if ($this->pager && null === $this->pager->results) {
$database = Site::getModule('Database');
$lsql = "SELECT COUNT(*) {$meat}";
$sth = $database->query($lsql);
$this->pager->setResults($sth->fetchColumn());
}
$sql .= $meat;
for ($i = 0; $i < count($this->orders); $i++) {
$order = $this->orders[$i];
if (!$i) {
$order = "ORDER BY {$order}";
} else {
$order = ",{$order}";
}
$sql .= "{$order} ";
}
if ($this->pager) {
$sql .= $this->pager->getLimit();
} elseif ($this->limit) {
$sql .= "LIMIT {$this->limit}";
}
return $sql;
}
示例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: WSErro
WSErro("Erro ao deletar", WS_ERROR);
}
break;
default:
WSErro("Opss! opção invalida.", WS_ERROR);
break;
}
} else {
WSErro("O material informada não pode ser encontrado!", WS_INFOR);
}
}
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager(FAST_INCLUDE . "admin/&exe=exames/index&page=");
$Pager->ExePager($getPage, 15);
$FeExames = new FeExames();
$FeExames->Execute()->FullRead("SELECT * FROM fe_exames WHERE ex_cancelado = 0 ORDER BY ex_status, ex_data_fechamento DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$FeExames->Execute()->getResult()) {
$Pager->ReturnPage();
WSErro("Nenhum solicitação de alteraçao de exame encontrado!", WS_INFOR);
} else {
?>
<table class="table table-striped text-center" id="form" style="font-size: 0.9em;">
<thead>
<tr>
<th class="text-center">Descrição</th>
<th class="text-center">Mnemônico</th>
<th class="text-center">Setor Exec.</th>
<th class="text-center">Ações</th>
<th class="text-center">Solicitado em.</th>
<th class="text-center">Concluido em.</th>
<th class="text-center">Setor Soli.</th>