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


PHP pagination类代码示例

本文整理汇总了PHP中pagination的典型用法代码示例。如果您正苦于以下问题:PHP pagination类的具体用法?PHP pagination怎么用?PHP pagination使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: show_user_overview

 private function show_user_overview()
 {
     if (($user_count = $this->model->count_users()) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     handle_table_sort("adminuser_order", array("id", "username", "fullname", "email", "status"), array("username", "id"));
     $paging = new pagination($this->output, "admin_users", $this->settings->admin_page_size, $user_count);
     $users = $this->model->get_users($_SESSION["adminuser_order"], $paging->offset, $paging->size);
     $roles = $this->model->get_roles();
     if ($users === false || $roles === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $status = array("Disabled", "Change password", "Active");
     $this->output->open_tag("overview");
     $this->output->open_tag("users");
     foreach ($users as $user) {
         $user["status"] = $status[$user["status"]];
         $this->output->open_tag("user", array("id" => $user["id"], "admin" => show_boolean($user["is_admin"])));
         $this->output->add_tag("username", $user["username"]);
         $this->output->add_tag("fullname", $user["fullname"]);
         $this->output->add_tag("email", $user["email"]);
         $this->output->add_tag("status", $user["status"]);
         $this->output->close_tag();
     }
     $this->output->close_tag();
     $paging->show_browse_links();
     $this->output->close_tag();
 }
开发者ID:shannara,项目名称:banshee,代码行数:30,代码来源:user.php

示例2: defaultAction

 function defaultAction()
 {
     $db = new sql();
     $db->connect();
     $chid = $this->chid;
     include "lib/pagination.class.php";
     include "lib/orderby.class.php";
     $adminConfig = admin::adminConfig();
     for ($i = 1; $i < 4; $i++) {
         $voteTR = "";
         $orderBy = new orderBy("?chid=" . $this->chid . "&", array("id" => "№", "time" => "Дата", "name" => "Заголовок", "company" => "Компания", "gsum" => "Средний бал", "gcount" => "Проголосовало"), array("gsum" => "desc"), $this->field[$i], $this->order[$i], array("field[{$i}]", "order[{$i}]"));
         $pagination = new pagination($orderBy->urlForPage(), $this->page, $adminConfig["recPerPage"], '', "projects", "id");
         $res = $db->query("select projects.id, name, company, category_name, date, sum(IF(grade is null,0, grade))/count(IF(grade is null,0, grade)) as gsum, count(grade) as gcount FROM (projects LEFT JOIN categories ON projects.category = categories.category_id) left join votes on projects.id=votes.id where category={$i} group by projects.id, name, company, category_name, date " . $orderBy->orderByQuery() . " " . $pagination->limit());
         $page = $this->page ? "&page=" . $this->page : "";
         while ($data = $db->fetch_array($res)) {
             $data["date"] = date("d.m.Y", $data["date"]);
             eval('$voteTR.="' . admin::template("voteTR") . '";');
         }
         $pageBar = $pagination->bar();
         $th = $orderBy->bar();
         eval('$content.="' . admin::template("voteMain") . '";');
         $content .= "<br>";
     }
     $this->elements["content"] = $content;
 }
开发者ID:BackupTheBerlios,项目名称:sitexs,代码行数:25,代码来源:vote.class.php

示例3: defaultAction

 function defaultAction()
 {
     $db = new sql();
     $db->connect();
     $chid = $this->chid;
     include "lib/pagination.class.php";
     include "lib/orderby.class.php";
     $adminConfig = admin::adminConfig();
     $orderBy = new orderBy("?chid=" . $this->chid . "&", array("library" => "№", "time" => "Дата", "name" => "Заголовок", "short_text" => "Подзаголовок", "author" => "Автор"), array("library" => "desc"), $this->field, $this->order);
     $pagination = new pagination($orderBy->urlForPage(), $this->page, $adminConfig["recPerPage"], '', "library", "id");
     $res = $db->query("select library.id as library, name, short_text, time, authors.lastname as author FROM (library LEFT JOIN library_authors ON library.id = library_authors.library) LEFT JOIN authors ON library_authors.author = authors.id GROUP BY library.id" . $orderBy->orderByQuery() . " " . $pagination->limit());
     $page = $this->page ? "&page=" . $this->page : "";
     while ($data = $db->fetch_array($res)) {
         $res1 = $db->query("select id, firstname, secondname, lastname from library_authors left join authors on library_authors.author = authors.id where library_authors.library=" . $data["library"] . " order by lastname, firstname, secondname");
         $typeAuthorsID = admin::getTypeID("authors");
         while ($data1 = $db->fetch_array($res1)) {
             $data["fio"] .= "<li><a href=\"?chid={$typeAuthorsID}&action=edit&id={$data1['id']}\">" . $data1["lastname"] . ($data1["firstname"] ? " " . $data1["firstname"] : "") . ($data1["secondname"] ? " " . $data1["secondname"] : "") . "</a></li>";
         }
         $data["date"] = $data["time"] ? @date("d.m.Y", $data["time"]) : "";
         $data["fio"] = $data["fio"] ? "<ul>" . $data["fio"] . "</ul>" : "";
         eval('$libraryTR.="' . admin::template("libraryTR") . '";');
     }
     $pageBar = $pagination->bar();
     $th = $orderBy->bar();
     eval('$content="' . admin::template("libraryMain") . '";');
     $this->elements["content"] = $content;
 }
开发者ID:BackupTheBerlios,项目名称:sitexs,代码行数:27,代码来源:library.class.php

示例4: show_forum

 private function show_forum($forum_id)
 {
     if (($count = $this->model->count_topics($forum_id)) === false) {
         $this->output->add_tag("result", "Database error while counting topics.");
         return;
     }
     $paging = new pagination($this->output, "forum_" . $forum_id, $this->settings->forum_page_size, $count);
     if (($forum = $this->model->get_forum($forum_id, $paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Forum not found.", $this->url);
         return;
     }
     $this->output->title = $forum["title"] . " - Forum";
     $this->output->open_tag("forum", array("id" => $forum["id"]));
     $this->output->add_tag("title", $forum["title"]);
     $this->output->open_tag("topics");
     foreach ($forum["topics"] as $topic) {
         if ($this->user->logged_in) {
             $topic["unread"] = show_boolean($this->model->last_topic_view($topic["id"]) < $topic["timestamp"]);
         }
         $topic["starter"] = isset($topic["visitor"]) ? $topic["visitor"] : $topic["user"];
         $topic["timestamp"] = date("j F Y, H:i", $topic["timestamp"]);
         $this->output->record($topic, "topic");
     }
     $this->output->close_tag();
     $paging->show_browse_links();
     $this->output->close_tag();
 }
开发者ID:shannara,项目名称:banshee,代码行数:27,代码来源:forum.php

示例5: execute

 public function execute()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         /* Delete message
          */
         if ($this->model->delete_message($_POST["id"])) {
             $this->user->log_action("guestbook entry %d deleted", $_POST["id"]);
         }
     }
     handle_table_sort("adminguestbook_order", array("author", "message", "timestamp", "ip_address"), array("timestamp", "author"));
     $paging = new pagination($this->output, "admin_guestbook", $this->settings->admin_page_size, $message_count);
     if (($guestbook = $this->model->get_messages($_SESSION["adminguestbook_order"], $paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $this->output->open_tag("guestbook");
     foreach ($guestbook as $item) {
         $item["message"] = truncate_text($item["message"], 45);
         if ($this->output->mobile) {
             $item["timestamp"] = date("Y-m-d", $item["timestamp"]);
         } else {
             $item["timestamp"] = date("j F Y, H:i", $item["timestamp"]);
         }
         $this->output->record($item, "item");
     }
     $paging->show_browse_links();
     $this->output->close_tag();
 }
开发者ID:shannara,项目名称:banshee,代码行数:28,代码来源:guestbook.php

示例6: show_album

 private function show_album($album_id)
 {
     if (($album = $this->model->get_album_info($album_id)) == false) {
         $this->output->add_tag("result", "Database error retrieving album title.");
         return;
     }
     if (($count = $this->model->count_photos_in_album($album_id)) === false) {
         $this->output->add_tag("result", "Database error counting albums");
         return;
     }
     $paging = new pagination($this->output, "photo_album_" . $album_id, $this->settings->photo_album_size, $count);
     if (($photos = $this->model->get_photo_info($album_id, $paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Database error retrieving photos.");
         return;
     } else {
         if (count($photos) == 0) {
             $this->output->add_tag("result", "Photo album is empty.");
             return;
         }
     }
     $this->title = $album["name"];
     $this->output->open_tag("photos", array("info" => $album["description"]));
     foreach ($photos as $photo) {
         $this->output->record($photo, "photo");
     }
     $paging->show_browse_links();
     $this->output->close_tag();
     $this->output->add_javascript("banshee/jquery.prettyphoto.js");
     $this->output->add_javascript("photo.js");
     $this->output->add_css("banshee/prettyphoto.css");
 }
开发者ID:shannara,项目名称:banshee,代码行数:31,代码来源:photo.php

示例7: show_message_overview

 private function show_message_overview()
 {
     if (($message_count = $this->model->count_messages()) === false) {
         $this->output->add_tag("result", "Database error.");
         return false;
     }
     $paging = new pagination($this->output, "admin_forum", $this->settings->admin_page_size, $message_count);
     if (($messages = $this->model->get_messages($paging->offset, $paging->size)) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $this->output->open_tag("overview");
     $this->output->open_tag("messages");
     foreach ($messages as $message) {
         $message["content"] = truncate_text($message["content"], 400);
         $message["timestamp"] = date("j F Y, H:i", $message["timestamp"]);
         if ($message["author"] == "") {
             $message["author"] = $message["username"];
         }
         $this->output->record($message, "message");
     }
     $this->output->close_tag();
     $paging->show_browse_links();
     $this->output->close_tag();
 }
开发者ID:shannara,项目名称:banshee,代码行数:25,代码来源:forum.php

示例8: actionIndex

 public function actionIndex($type = '')
 {
     $file = zotop::model('zotop.file');
     if (!empty($type)) {
         $where = array('type', '=', $type);
     }
     $files = $file->db()->where($where)->orderby('createtime', 'desc')->getPage();
     $pagination = new pagination();
     $pagination->page = $files['page'];
     $pagination->pagesize = $files['pagesize'];
     $pagination->total = $files['total'];
     $p = $pagination->render();
     $totalsize = $file->totalsize();
     $totalcount = $file->count();
     $page = new page();
     $page->set('title', zotop::t('文件管理'));
     $page->set('navbar', $this->navbar());
     $page->set('page', $files['page']);
     $page->set('pagesize', $files['pagesize']);
     $page->set('total', $files['total']);
     $page->set('files', $files['data']);
     $page->set('totalsize', $totalsize);
     $page->set('totalcount', $totalcount);
     $page->set('pagination', $p);
     $page->display();
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:26,代码来源:file.php

示例9: execute

 public function execute()
 {
     if (isset($_SERVER["hide_ss"]) == false) {
         $_SERVER["hide_ss"] = true;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["submit_button"] == "hidess") {
         $_SERVER["hide_ss"] = is_true($_POST["hide_ss"]);
     }
     $this->output->add_css("banshee/filter.css");
     $filter = new filter($this->db, $this->output, $this->user);
     $filter->to_output($this->model->table, false);
     if (($count = $this->model->count_events($filter->webserver, $_SERVER["hide_ss"])) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $paging = new pagination($this->output, "events", $this->settings->event_page_size, $count);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $paging->reset();
     }
     if (($events = $this->model->get_events($paging->offset, $paging->size, $filter->webserver, $_SERVER["hide_ss"])) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $this->output->open_tag("events", array("hide_ss" => show_boolean($_SERVER["hide_ss"])));
     foreach ($events as $event) {
         $event["timestamp"] = date("j F Y, H:i:s", $event["timestamp"]);
         $event["event"] = $this->output->secure_string($event["event"], "_");
         $this->output->record($event, "event");
     }
     $paging->show_browse_links();
     $this->output->close_tag();
 }
开发者ID:Wabuo,项目名称:monitor,代码行数:32,代码来源:events.php

示例10: actionIndex

 public function actionIndex($categoryid = 0, $status = null)
 {
     $where = array();
     if (!empty($categoryid)) {
         $where[] = 'AND';
         $where[] = array('categoryid', '=', $categoryid);
     }
     if (isset($status)) {
         $where[] = 'AND';
         $where[] = array('status', '=', $status);
     }
     $where = array_slice($where, 1);
     $blog = zotop::model('blog.blog');
     $blogs = $blog->db()->where($where)->orderby('order', 'desc')->orderby('updatetime', 'desc')->getPage();
     $blogstatus = $blog->status();
     $category = zotop::model('blog.category');
     $categorys = $category->getAll();
     $categorys = arr::hashmap($categorys, 'id');
     $pagination = new pagination();
     $pagination->page = $blogs['page'];
     $pagination->pagesize = $blogs['pagesize'];
     $pagination->total = $blogs['total'];
     $p = $pagination->render();
     $page = new page();
     $page->set('title', '日志管理');
     $page->set('navbar', $this->navbar($categoryid));
     $page->set('blogs', $blogs);
     $page->set('status', $status);
     $page->set('blogstatus', $blogstatus);
     $page->set('pagination', $p);
     $page->set('categoryid', $categoryid);
     $page->set('categorys', $categorys);
     $page->display();
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:34,代码来源:index.php

示例11: actionLibrary

 public function actionLibrary($globalid, $field, $image = '')
 {
     if (empty($image)) {
         //zotop::redirect('zotop/image/upload',array('globalid'=>$globalid, 'field'=>$field, 'image'=>url::encode($image)));
     }
     $file = zotop::model('zotop.image');
     $images = $file->db()->where('type', '=', 'image')->where('globalid', '=', $globalid)->orderby('createtime', 'desc')->getPage();
     $pagination = new pagination();
     $pagination->page = $images['page'];
     $pagination->pagesize = $images['pagesize'];
     $pagination->total = $images['total'];
     $p = $pagination->render();
     $page = new dialog();
     $page->set('title', '图片库');
     $page->set('globalid', $globalid);
     $page->set('field', $field);
     $page->set('navbar', $this->navbar($globalid, $field, $image));
     $page->set('image', $image);
     $page->set('page', $images['page']);
     $page->set('pagesize', $images['pagesize']);
     $page->set('total', $images['total']);
     $page->set('images', $images['data']);
     $page->set('pagination', $p);
     $page->display();
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:25,代码来源:image.php

示例12: execute

 public function execute()
 {
     $this->output->description = "News";
     $this->output->keywords = "news";
     $this->output->title = "News";
     $this->output->add_alternate("News", "application/rss+xml", "/news.xml");
     if ($this->page->type == "xml") {
         /* RSS feed
          */
         $rss = new RSS($this->output);
         if ($rss->fetch_from_cache("news_rss") == false) {
             $rss->title = $this->settings->head_title . " news";
             $rss->description = $this->settings->head_description;
             if (($news = $this->model->get_news(0, $this->settings->news_rss_page_size)) != false) {
                 foreach ($news as $item) {
                     $link = "/news/" . $item["id"];
                     $rss->add_item($item["title"], $item["content"], $link, $item["timestamp"]);
                 }
             }
             $rss->to_output();
         }
     } else {
         if (valid_input($this->page->pathinfo[1], VALIDATE_NUMBERS, VALIDATE_NONEMPTY)) {
             /* News item
              */
             if (($item = $this->model->get_news_item($this->page->pathinfo[1])) == false) {
                 $this->output->add_tag("result", "Unknown news item");
             } else {
                 $this->output->title = $item["title"] . " - News";
                 $item["timestamp"] = date("j F Y, H:i", strtotime($item["timestamp"]));
                 $this->output->record($item, "news");
             }
         } else {
             /* News overview
              */
             if (($count = $this->model->count_news()) === false) {
                 $this->output->add_tag("result", "Database error");
                 return;
             }
             $paging = new pagination($this->output, "news", $this->settings->news_page_size, $count);
             if (($news = $this->model->get_news($paging->offset, $paging->size)) === false) {
                 $this->output->add_tag("result", "Database error");
                 return;
             }
             foreach ($news as $item) {
                 $item["timestamp"] = date("j F Y, H:i", $item["timestamp"]);
                 $this->output->record($item, "news");
             }
             $paging->show_browse_links(7, 3);
         }
     }
 }
开发者ID:shannara,项目名称:banshee,代码行数:52,代码来源:news.php

示例13: output

 public static function output($total, $page = 0, $pagesize = 0, $url = '')
 {
     if (is_array($total)) {
         $page = $total['page'];
         $pagesize = $total['pagesize'];
         $url = $total['url'];
         $total = $total['total'];
     }
     $pagination = new pagination();
     $pagination->total = $total;
     $pagination->page = $page;
     $pagination->pagesize = $pagesize;
     $pagination->url = $url;
     $p = $pagination->render();
     return $p;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:16,代码来源:pagination.php

示例14: _make_user_table

function _make_user_table($n, &$data)
{
    $dbh = getdbh();
    //pagination
    $stmt = $dbh->query('SELECT count(*) "total" FROM "users"');
    $rs = $stmt->fetch(PDO::FETCH_ASSOC);
    $total = $rs['total'];
    $limit = $GLOBALS['pagination']['per_page'];
    $data['body'][] = '<p>Showing records ' . ($n + 1) . ' to ' . min($total, $n + $limit) . ' of ' . $total . '</p>';
    $data['body'][] = pagination::makePagination($n, $total, myUrl('users/manage'), $GLOBALS['pagination']);
    //table
    $stmt = $dbh->query("SELECT * FROM \"users\" LIMIT {$n},{$limit}");
    $tablearr[] = explode(',', 'uid,username,password,fullname,created_dt,Action');
    while ($rs = $stmt->fetch(PDO::FETCH_ASSOC)) {
        $uid = $rs['uid'];
        $row = null;
        foreach ($rs as $k => $v) {
            $row[$k] = htmlspecialchars($v);
        }
        $row[] = '<a href="' . myUrl("users/edit/{$uid}") . '">Edit</a> | <a href="javascript:jsconfirm(\'Really Delete User?\',\'' . myUrl("users/ops_delete/{$uid}") . '\')">Delete</a>';
        $tablearr[] = $row;
    }
    $data['body'][] = table::makeTable($tablearr);
    $data['head'][] = '<script type="text/javascript" src="' . myUrl('js/jsconfirm.js') . '"></script>';
}
开发者ID:469306621,项目名称:Languages,代码行数:25,代码来源:manage.php

示例15: _make_html_table

function _make_html_table($n, &$data)
{
    $dbh = getdbh();
    //pagination
    $stmt = $dbh->query('SELECT count(OID) total FROM t_user');
    $total = $stmt->fetchColumn();
    $limit = $GLOBALS['pagination']['per_page'];
    $data['body'][] = '<p>Showing records ' . ($n + 1) . ' to ' . min($total, $n + $limit) . ' of ' . $total . '</p>';
    $data['body'][] = pagination::makePagination($n, $total, myUrl('mgmt_user/manage'), $GLOBALS['pagination']);
    //table
    $stmt = $dbh->query("SELECT OID,CID,permissions,username,fullname FROM t_user LIMIT {$n},{$limit}");
    $tablearr[] = explode(',', 'username,roll,fullname');
    while ($rs = $stmt->fetch(PDO::FETCH_ASSOC)) {
        $OID = $rs['OID'];
        $CID = $rs['CID'];
        $row = null;
        $row['username'] = htmlspecialchars($rs['username']);
        $row['roll'] = htmlspecialchars(User::getPermissionsAsRollText($rs['permissions']));
        $row['fullname'] = htmlspecialchars($rs['fullname']);
        $row[] = '<a href="' . myUrl("mgmt_user/edit/{$OID}/{$CID}") . '">Edit</a> | <a href="javascript:jsconfirm(\'Really Delete User?\',\'' . myUrl("mgmt_user/ops_delete/{$OID}/{$CID}") . '\')">Delete</a>';
        $tablearr[] = $row;
    }
    $data['body'][] = table::makeTable($tablearr);
    $data['head'][] = '<script type="text/javascript" src="' . myUrl('js/jsconfirm.js') . '"></script>';
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:25,代码来源:manage.php


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