当前位置: 首页>>代码示例>>PHP>>正文


PHP Pagination::getCurPage方法代码示例

本文整理汇总了PHP中Pagination::getCurPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::getCurPage方法的具体用法?PHP Pagination::getCurPage怎么用?PHP Pagination::getCurPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pagination的用法示例。


在下文中一共展示了Pagination::getCurPage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     $type = MailBox::$IN;
     if (isset($this->params['type'])) {
         $type = $this->params['type'];
     }
     try {
         $mailBox = new MailBox(User::getInstance(), $type);
     } catch (MailBoxNullException $e) {
         $this->error(ECode::$MAIL_NOBOX);
     }
     $this->notice = '邮件-' . $mailBox->desc;
     $p = isset($this->params['url']['p']) ? $this->params['url']['p'] : 1;
     App::import('vendor', "inc/pagination");
     try {
         $pagination = new Pagination($mailBox, 10);
         $mails = $pagination->getPage($p);
     } catch (MailDataNullException $e) {
         $this->error(ECode::$MAIL_NOMAIL);
     }
     $info = false;
     if ($mailBox->getTotalNum() > 0) {
         App::import('Sanitize');
         foreach ($mails as $v) {
             $info[] = array("read" => $v->isRead(), "num" => $v->num, "sender" => $v->OWNER, "title" => Sanitize::html($v->TITLE), "time" => date("Y-m-d H:i:s", $v->POSTTIME), "size" => $v->EFFSIZE);
         }
     }
     $this->set("type", $type);
     $this->set("info", $info);
     $this->set("totalNum", $mailBox->getTotalNum());
     $this->set("curPage", $pagination->getCurPage());
     $this->set("totalPage", $pagination->getTotalPage());
 }
开发者ID:tilitala,项目名称:nForum,代码行数:33,代码来源:mail_controller.php

示例2: index

 public function index()
 {
     $u = User::getInstance();
     try {
         App::import('Sanitize');
         $p = isset($this->params['url']['p']) ? $this->params['url']['p'] : 1;
         $this->notice = "°æÃæ-{$this->_board->DESC}({$this->_board->NAME})";
         $page = new Pagination($this->_board, Configure::read("pagination.threads"));
         $threads = $page->getPage($p);
         $info = false;
         $curTime = strtotime(date("Y-m-d", time()));
         $pageArticle = Configure::read("pagination.article");
         if ($this->_board->getMode() === Board::$THREAD) {
             foreach ($threads as $v) {
                 $pages = ceil($v->articleNum / $pageArticle);
                 $last = $v->LAST;
                 $postTime = $curTime > $v->POSTTIME ? date("Y-m-d", $v->POSTTIME) : date("H:i:s", $v->POSTTIME);
                 $replyTime = $curTime > $last->POSTTIME ? date("Y-m-d", $last->POSTTIME) : date("H:i:s", $last->POSTTIME);
                 $info[] = array("tag" => $v->isTop() ? "top" : ($v->isM() || $v->isG() ? "m" : false), "title" => Sanitize::html($v->TITLE), "poster" => $v->isSubject() ? $v->OWNER : "Ô­ÌûÒÑɾ³ý", "postTime" => $postTime, "gid" => $v->ID, "last" => $last->OWNER, "replyTime" => $replyTime, "num" => $v->articleNum - 1, "page" => $pages);
             }
             $threads = true;
         } else {
             foreach ($threads as $v) {
                 $postTime = $curTime > $v->POSTTIME ? date("Y-m-d", $v->POSTTIME) : date("H:i:s", $v->POSTTIME);
                 $info[] = array("tag" => $v->isTop() ? "top" : ($v->isM() || $v->isG() ? "m" : false), "title" => Sanitize::html($v->TITLE), "poster" => $v->OWNER, "postTime" => $postTime, "gid" => $v->ID, "subject" => $v->isSubject(), "top" => $v->isTop(), "m" => $v->isM(), "pos" => $v->getPos());
             }
             $threads = false;
         }
         $this->set("threads", $threads);
         $this->set("info", $info);
         $this->set("totalPage", $page->getTotalPage());
         $this->set("curPage", $page->getCurPage());
         $this->set("bName", $this->_board->NAME);
         $this->set("canPost", $this->_board->hasPostPerm($u) ? 1 : 0);
         $this->set("mode", $this->_board->getMode());
         $this->set("sort", $this->_board->isSortMode());
         $this->set("isBM", $u->isBM($this->_board));
         $this->set("isAdmin", $u->isAdmin());
     } catch (BoardNullException $e) {
         $this->error(Board::$BOARD_NONE);
     }
 }
开发者ID:tilitala,项目名称:nForum,代码行数:42,代码来源:board_controller.php

示例3: index

 public function index()
 {
     $this->js[] = "forum.adv.js";
     $this->css[] = "adv.css";
     $p = 1;
     if (isset($this->params['url']['p'])) {
         $p = $this->params['url']['p'];
     }
     $adv = new Adv();
     $adv->type = $this->_type;
     $search = array();
     if (isset($this->params['url']['remark']) && trim($this->params['url']['remark']) != '') {
         $search['remark'] = $adv->search = trim($this->params['url']['remark']);
     }
     if (isset($this->params['url']['sTime']) && trim($this->params['url']['sTime']) != '') {
         $search['sTime'] = $adv->search_start = trim($this->params['url']['sTime']);
     }
     if (isset($this->params['url']['eTime']) && trim($this->params['url']['eTime']) != '') {
         $search['eTime'] = $adv->search_end = trim($this->params['url']['eTime']);
     }
     App::import('vendor', "inc/pagination");
     $page = new Pagination($adv, 30);
     $res = $page->getPage($p);
     $ret['page'] = $page->getCurPage();
     $ret['total'] = $adv->getTotalNum();
     $ret['aPath'] = Configure::read("adv.path");
     foreach ($res as $v) {
         $ret['info'][] = $v;
     }
     $this->set($ret);
     $this->set($search);
     $this->set("dir", Configure::read('adv.path'));
     $this->set("type", $this->_type == 1 || $this->_type == 2 ? true : false);
     $this->set("advType", $this->_type);
     $this->set("hasPrivilege", isset($res[0]['privilege']) && '1' == $res[0]['privilege']);
     $query = '';
     foreach ($search as $k => $v) {
         $query .= '&' . $k . '=' . $v;
     }
     $this->set("pageBar", $page->getPageBar($p, "?p=%page%" . $query));
     $this->set("pagination", $page);
 }
开发者ID:tilitala,项目名称:nForum,代码行数:42,代码来源:adv_controller.php

示例4: index

 public function index()
 {
     $this->js[] = "forum.refer.js";
     $this->css[] = "mail.css";
     $type = Refer::$AT;
     $pageBar = "";
     if (isset($this->params['type'])) {
         $type = $this->params['type'];
     }
     try {
         $refer = new Refer(User::getInstance(), $type);
     } catch (ReferNullException $e) {
         $this->error(ECode::$REFER_NONE);
     }
     $this->notice = 'ндублАпя-' . $refer->getDesc();
     $p = isset($this->params['url']['p']) ? $this->params['url']['p'] : 1;
     App::import('vendor', "inc/pagination");
     try {
         $pagination = new Pagination($refer, Configure::read("pagination.mail"));
         $articles = $pagination->getPage($p);
     } catch (Exception $e) {
         $this->error(ECode::$REFER_NONE);
     }
     if ($refer->getTotalNum() > 0) {
         $info = array();
         App::import('Sanitize');
         foreach ($articles as $v) {
             $info[] = array("index" => $v['INDEX'], "id" => $v['ID'], "board" => $v['BOARD'], "user" => $v['USER'], "title" => Sanitize::html($v['TITLE']), "time" => date("Y-m-d H:i:s", $v['TIME']), "read" => $v['FLAG'] === Refer::$FLAG_READ);
         }
         $this->set("info", $info);
     }
     $this->set("type", $type);
     $this->set("totalNum", $pagination->getTotalNum());
     $this->set("curPage", $pagination->getCurPage());
     $this->set("totalPage", $pagination->getTotalPage());
 }
开发者ID:tilitala,项目名称:nForum,代码行数:36,代码来源:refer_controller.php

示例5: index

 public function index()
 {
     $this->notice = "版面-{$this->_board->DESC}({$this->_board->NAME})";
     App::import('Sanitize');
     App::import('vendor', array("inc/pagination", "inc/astro"));
     try {
         $gid = $this->params['gid'];
         $threads = Threads::getInstance($gid, $this->_board);
     } catch (ThreadsNullException $e) {
         $this->error(ECode::$ARTICLE_NONE);
     }
     //article jump
     if (isset($this->params['url']['s'])) {
         $article = $threads->getArticleById(intval($this->params['url']['s']));
         if (null !== $article) {
             $pos = $article->getPos();
             $page = ceil(($pos + 1) / Configure::read("pagination.article"));
             $this->redirect("{$this->_mbase}/article/{$this->_board->NAME}/{$gid}?p={$page}#a{$pos}");
         }
         $this->redirect("{$this->_mbase}/article/{$this->_board->NAME}/{$gid}");
     }
     //filter author
     $auF = $au = false;
     if (isset($this->params['url']['au'])) {
         $tmp = $threads->getRecord(1, $threads->getTotalNum());
         $auF = array();
         $au = trim($this->params['url']['au']);
         foreach ($tmp as $v) {
             if ($v->OWNER == $au) {
                 $auF[] = $v;
             }
         }
         $auF = new ArrayPageableAdapter($auF);
     }
     $p = isset($this->params['url']['p']) ? $this->params['url']['p'] : 1;
     $pagination = new Pagination(false !== $au ? $auF : $threads, Configure::read("pagination.article"));
     $articles = $pagination->getPage($p);
     $u = User::getInstance();
     $bm = $u->isBM($this->_board) || $u->isAdmin();
     $info = array();
     foreach ($articles as $v) {
         $content = $v->getPlant();
         $content = preg_replace("/ /", " ", $content);
         $content = preg_replace("/  /", "  ", $content);
         preg_match("|※ 修改:·([\\S]+) .*?FROM:[\\s]*([0-9a-zA-Z.:*]+)|", $content, $m);
         preg_match("|※ 来源:.*FROM:[\\s]*([0-9a-zA-Z.:*]+)|", $content, $f);
         $m = empty($m) ? "" : "<br />修改:{$m[1]} FROM {$m[2]}";
         $f = empty($f) ? "" : "<br />FROM {$f[1]}";
         $s = ($pos = strpos($content, "<br/><br/>")) === false ? 0 : $pos + 10;
         $e = ($pos = strpos($content, "<br/>--<br/>")) === false ? strlen($content) : $pos + 7;
         $content = preg_replace(array("'^(<br/>)+'", "|(<br/>)+--\$|"), array("", "<br>--"), substr($content, $s, $e - $s)) . $m . $f;
         $content = $v->parseAtt($content, 'middle');
         if (Configure::read("ubb.parse")) {
             $content = XUBB::parse($content);
         }
         $info[] = array("id" => $v->ID, "op" => $v->OWNER == $u->userid || $bm ? 1 : 0, "time" => date("Y-m-d H:i:s", $v->POSTTIME), "pos" => $v->getPos(), "poster" => $v->OWNER, "content" => $content, "subject" => $v->isSubject());
     }
     $this->set("bName", $this->_board->NAME);
     $this->set("anony", $this->_board->isAnony());
     $this->set("canPost", $this->_board->hasPostPerm($u));
     $this->set("info", $info);
     $this->set("gid", $threads->GROUPID);
     $this->set("title", Sanitize::html($threads->TITLE));
     $this->set("curPage", $pagination->getCurPage());
     $this->set("totalPage", $pagination->getTotalPage());
     $this->set("au", $au);
     //for the quick reply, raw encode the space
     $this->set("reid", $threads->ID);
     if (!strncmp($threads->TITLE, "Re: ", 4)) {
         $reTitle = $threads->TITLE;
     } else {
         $reTitle = "Re: " . $threads->TITLE;
     }
     $this->set("reTitle", rawurlencode($reTitle));
 }
开发者ID:rainsun,项目名称:nForum,代码行数:75,代码来源:article_controller.php


注:本文中的Pagination::getCurPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。