Example #1
0
<?php

$p = \ebi\Paginator::dynamic_contents(2, 'C');
$p->add('A');
$p->add('B');
$p->add('C');
$p->add('D');
$p->add('E');
$p->add('F');
$p->add('G');
eq('A', $p->prev());
eq('E', $p->next());
eq('page=A', $p->query_prev());
eq(array('C', 'D'), $p->contents());
eq(null, $p->first());
eq(null, $p->last());
Example #2
0
foreach (test\db\Paginator::find($paginator, \ebi\Q::order('id')) as $o) {
    $i++;
}
eq(20, $i);
$i = 0;
$paginator = new \ebi\Paginator(20, 4);
foreach (test\db\Paginator::find($paginator, \ebi\Q::order('id')) as $o) {
    $i++;
}
eq(20, $i);
$i = 0;
$paginator = new \ebi\Paginator(20, 5);
foreach (test\db\Paginator::find($paginator, \ebi\Q::order('id')) as $o) {
    $i++;
}
eq(18, $i);
$i = 0;
$paginator = new \ebi\Paginator(20, 6);
foreach (test\db\Paginator::find($paginator, \ebi\Q::order('id')) as $o) {
    $i++;
}
eq(0, $i);
$i = 0;
$req = new \ebi\Request();
$req->vars('paginate_by', 30);
// 30を指定してもmax25なので25まで
$paginator = \ebi\Paginator::request($req, 20, 25);
foreach (test\db\Paginator::find($paginator, \ebi\Q::order('id')) as $o) {
    $i++;
}
eq(25, $i);
Example #3
0
File: Dt.php Project: tokushima/ebi
 /**
  * @automap
  */
 public function mail_blackhole()
 {
     $req = new \ebi\Request();
     $paginator = \ebi\Paginator::request($req);
     $list = \ebi\SmtpBlackholeDao::find_all(Q::eq('tcode', $req->in_vars('tcode')), $paginator, Q::order('-id'));
     return $req->ar_vars(['paginator' => $paginator, 'object_list' => $list]);
 }