本文整理汇总了PHP中get_pagination函数的典型用法代码示例。如果您正苦于以下问题:PHP get_pagination函数的具体用法?PHP get_pagination怎么用?PHP get_pagination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_pagination函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _requestListGet
/**
* Метод, предназначенный для получения и вывода списка Запросов
*
* @param boolean $pagination признак формирования постраничного списка
*/
function _requestListGet($pagination = true)
{
global $AVE_DB, $AVE_Template;
$limit = '';
// Если используется постраничная навигация
if ($pagination) {
// Определяем лимит записей на страницу и начало диапазона выборки
$limit = $this->_limit;
$start = get_current_page() * $limit - $limit;
// Получаем общее количество запросов
$num = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_request")->GetCell();
// Если количество больше, чем установленный лимит, тогда формируем постраничную навигацию
if ($num > $limit) {
$page_nav = " <a class=\"pnav\" href=\"index.php?do=request&page={s}&cp=" . SESSION . "\">{t}</a> ";
$page_nav = get_pagination(ceil($num / $limit), 'page', $page_nav);
$AVE_Template->assign('page_nav', $page_nav);
}
$limit = $pagination ? "LIMIT " . $start . "," . $limit : '';
}
// Выполняем запрос к БД на получение списка запросов с учетом лимита вывода на страницу (если необходимо)
$items = array();
$sql = $AVE_DB->Query("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . PREFIX . "_request\r\n\t\t\tORDER BY Id ASC\r\n\t\t\t" . $limit . "\r\n\t\t");
// Формируем массив из полученных данных
while ($row = $sql->FetchRow()) {
$row->request_author = get_username_by_id($row->request_author_id);
array_push($items, $row);
}
// Возвращаем массив
return $items;
}
示例2: get_priest_preach_by_id
public function get_priest_preach_by_id()
{
$id = $this->input->get('id');
$limit = $this->get('limit');
$page = $this->get('page');
$limit = $limit ? $limit : self::DEFAULT_LIMIT;
if ($limit > self::MAX_LIMIT) {
$limit = self::DEFAULT_LIMIT;
}
$page = $page ? $page : 1;
if ($page == 0) {
$page = 1;
}
$count = $this->priest_preach_model->count_priest_preach_by_id($id);
$total = $count->count;
if ($total <= 0 || !$count) {
$this->response(array('status_code' => '400'));
return;
}
$this->load->helper('util_helper');
$pagination = get_pagination($total, $limit, $page);
$results = $this->priest_preach_model->get_priest_preach_by_id($id, $pagination['limit'], $pagination['offset']);
if (!$results) {
$this->response(array('status_code' => 400));
return;
}
$this->response(array('status_code' => 200, 'total' => $total, 'results' => $results));
}
示例3: get_user_followers
function get_user_followers($userid, $page, $username)
{
$text = "SELECT id, following_user_id AS username FROM follow WHERE follower_user_id='{$userid}' AND deleted_time=''";
$return['query'] = build_query($text, $page);
$return['pagination'] = get_pagination($text, $page);
return $return;
}
示例4: index
public function index()
{
$this->load->model('admin/soggetti_model');
$this->load->model('admin/luoghi_model');
// Setto il titolo della pagina
$data['titolo'] = "DiconArt - Gestione soggetti";
$data["cerca"] = isset($_GET["cerca"]) ? $_GET["cerca"] : "";
// Gestione della paginazione
$data["total_rows"] = $config["total_rows"] = $this->soggetti_model->count_soggetti($data["cerca"]);
$base_url = base_url() . "admin/soggetti/index/";
$pagination = get_pagination($base_url);
$this->pagination->initialize($config);
// Prende i dati dei soggetti
$data['lista_soggetti'] = $this->soggetti_model->lista_soggetti($data["cerca"], $pagination["per_page"], $pagination["offset"]);
foreach ($data['lista_soggetti'] as $k => $soggetto) {
$data['lista_soggetti'][$k]->luogo_nascita = $this->luoghi_model->dati_luogo($soggetto->id_luogo_nascita);
$data['lista_soggetti'][$k]->luogo_morte = $this->luoghi_model->dati_luogo($soggetto->id_luogo_morte);
}
$data["pagination"] = $this->pagination->create_links();
$data['javascript_files'] = array('plugins/jquery.tablesorter.min.js', 'admin/functions.js');
// Stampo la pagina di lista dei soggetti
$data["page"] = "lista_soggetti";
$content = array('admin/pages/soggetti/lista', 'admin/modals/cancella');
$this->render($content, $data);
}
示例5: onlineBibile
public function onlineBibile()
{
$search_keyword = $_REQUEST['search_keyword'];
$limit = $this->get('limit');
$page = $this->get('page');
$limit = $limit ? $limit : self::DEFAULT_LIMIT;
if ($limit > self::MAX_LIMIT) {
$limit = self::DEFAULT_LIMIT;
}
$page = $page ? $page : 1;
if ($page == 0) {
$page = 1;
}
if (!($total = $this->bibile_model->count_all($search_keyword))) {
$this->response(array('message' => '没有找到!你想要<b>【' . $search_keyword . '】</b>相关的经文!'));
return;
}
$this->load->helper('util_helper');
$pagination = get_pagination($total, $limit, $page);
if (!($bibile_seciton = $this->bibile_model->onlineBibile($search_keyword, $pagination['limit'], $pagination['offset']))) {
$this->response(array('message' => '没有找到,你想要相关的经文!'));
return;
}
$this->response(array('total' => $total, 'results' => $bibile_seciton));
}
示例6: get_tag
function get_tag($tag, $page)
{
$term = make_it_safe($tag);
$text = "SELECT DISTINCT id, time FROM quiz JOIN (SELECT quiz_id FROM tag WHERE tag='{$term}') AS hellyeah ON quiz.id=quiz_id";
$return['query'] = build_query($text, $page);
$return['pagination'] = get_pagination($text, $page);
return $return;
}
示例7: get_prints
function get_prints(&$dbh, $user, $args, $page)
{
list($count, $offset, $perpage, $page) = get_pagination($page);
$where_clauses = array('composed');
if ($user['id']) {
$where_clauses[] = sprintf('(private = 0 OR (private = 1 AND user_id = %s))', $dbh->quoteSmart($user['id']));
} else {
$where_clauses[] = 'private = 0';
}
if (isset($args['date']) && ($time = strtotime($args['date']))) {
$start = date('Y-m-d 00:00:00', $time);
$end = date('Y-m-d 23:59:59', $time);
$where_clauses[] = sprintf('(created BETWEEN "%s" AND "%s")', $start, $end);
}
if (isset($args['month']) && ($time = strtotime("{$args['month']}-01"))) {
$start = date('Y-m-d 00:00:00', $time);
$end = date('Y-m-d 23:59:59', $time + 86400 * intval(date('t', $time)));
$where_clauses[] = sprintf('(created BETWEEN "%s" AND "%s")', $start, $end);
}
if (isset($args['place'])) {
$woeid_clauses = array(sprintf('place_woeid = %d', $args['place']), sprintf('region_woeid = %d', $args['place']), sprintf('country_woeid = %d', $args['place']));
$where_clauses[] = '(' . join(' OR ', $woeid_clauses) . ')';
}
if (isset($args['user'])) {
$where_clauses[] = sprintf('(user_id = %s)', $dbh->quoteSmart($args['user']));
}
$q = sprintf("SELECT paper_size, orientation, provider, private,\n pdf_url, preview_url, geotiff_url,\n id, title, north, south, east, west, zoom,\n (north + south) / 2 AS latitude,\n (east + west) / 2 AS longitude,\n UNIX_TIMESTAMP(created) AS created,\n UNIX_TIMESTAMP(composed) AS composed,\n UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(created) AS age,\n country_name, country_woeid, region_name, region_woeid, place_name, place_woeid,\n user_id, progress\n FROM prints\n WHERE %s\n ORDER BY created DESC\n LIMIT %d OFFSET %d", join(' AND ', $where_clauses), $count, $offset);
$res = $dbh->query($q);
if (PEAR::isError($res)) {
die_with_code(500, "{$res->message}\n{$q}\n");
}
$rows = array();
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
// TODO: ditch special-case for provider
if (empty($row['provider'])) {
$row['provider'] = reset(reset(get_map_providers()));
}
// decode/compose.py writes the filename for pdf's
// I suppose this special case handles a time before the url's were being written to the DB
// TODO: ditch special-case for pdf_url
if (empty($row['pdf_url']) && S3_BUCKET_ID) {
$row['pdf_url'] = sprintf('http://%s.s3.amazonaws.com/prints/%s/walking-paper-%s.pdf', S3_BUCKET_ID, $row['id'], $row['id']);
}
// TODO: ditch special-case for preview_url
if (empty($row['preview_url']) && S3_BUCKET_ID) {
$row['preview_url'] = sprintf('http://%s.s3.amazonaws.com/prints/%s/preview.png', S3_BUCKET_ID, $row['id']);
}
$rows[] = $row;
}
$pagination_props = array('count' => $count, 'offset' => $offset, 'perpage' => $perpage, 'page' => $page);
return array($rows, $pagination_props, $where_clauses);
}
示例8: get_forms
function get_forms(&$dbh, $user_id, $page)
{
list($count, $offset, $perpage, $page) = get_pagination($page);
$where_user_clause = empty($user_id) ? '1' : sprintf('(user_id = %s)', $dbh->quoteSmart($user_id));
$q = sprintf("SELECT id, form_url, title, http_method, action_url,\n UNIX_TIMESTAMP(created) AS created,\n UNIX_TIMESTAMP(parsed) AS parsed,\n UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(created) AS age,\n user_id\n FROM forms\n WHERE parsed\n AND {$where_user_clause}\n ORDER BY created DESC\n LIMIT %d OFFSET %d", $count, $offset);
$res = $dbh->query($q);
if (PEAR::isError($res)) {
die_with_code(500, "{$res->message}\n{$q}\n");
}
$rows = array();
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
$rows[] = $row;
}
return $rows;
}
示例9: document_pagination
/**
* Постраничная навигация документа
*
* @param string $text текст многострочной части документа
* @return string
*/
function document_pagination($text)
{
global $AVE_Core;
// IE8 <div style="page-break-after: always"><span style="display: none"> </span></div>
// Chrome <div style="page-break-after: always; "><span style="DISPLAY:none"> </span></div>
// FF <div style="page-break-after: always;"><span style="display: none;"> </span></div>
$pages = preg_split('#<div style="page-break-after:[; ]*always[; ]*"><span style="display:[ ]*none[;]*"> </span></div>#i', $text);
$total_page = @sizeof($pages);
if ($total_page > 1) {
$text = @$pages[get_current_page('artpage') - 1];
$page_nav = ' <a class="pnav" href="index.php?id=' . $AVE_Core->curentdoc->Id . '&doc=' . (empty($AVE_Core->curentdoc->document_alias) ? prepare_url($AVE_Core->curentdoc->document_title) : $AVE_Core->curentdoc->document_alias) . '&artpage={s}' . '">{t}</a> ';
$page_nav = get_pagination($total_page, 'artpage', $page_nav, get_settings('navi_box'));
$text .= rewrite_link($page_nav);
}
return $text;
}
示例10: rubricList
/**
* Вывод списка рубрик
*
*/
function rubricList()
{
global $AVE_DB, $AVE_Template;
$rubrics = array();
$num = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_rubrics")->GetCell();
$page_limit = $this->_limit;
$seiten = ceil($num / $page_limit);
$set_start = get_current_page() * $page_limit - $page_limit;
if ($num > $page_limit) {
$page_nav = " <a class=\"pnav\" href=\"index.php?do=rubs&page={s}&cp=" . SESSION . "\">{t}</a> ";
$page_nav = get_pagination($seiten, 'page', $page_nav);
$AVE_Template->assign('page_nav', $page_nav);
}
$sql = $AVE_DB->Query("\r\n\t\t\tSELECT\r\n\t\t\t\trub.*,\r\n\t\t\t\tCOUNT(doc.Id) AS doc_count\r\n\t\t\tFROM\r\n\t\t\t\t" . PREFIX . "_rubrics AS rub\r\n\t\t\tLEFT JOIN\r\n\t\t\t\t" . PREFIX . "_documents AS doc\r\n\t\t\t\t\tON rubric_id = rub.Id\r\n\t\t\tGROUP BY rub.Id\r\n\t\t\tLIMIT " . $set_start . "," . $page_limit);
while ($row = $sql->FetchRow()) {
array_push($rubrics, $row);
}
$AVE_Template->assign('rubrics', $rubrics);
}
示例11: index
public function index()
{
$this->load->model('admin/tecniche_model');
// Setto il titolo della pagina
$data['titolo'] = "DiconArt - Gestione tecniche";
$data["cerca"] = isset($_GET["cerca"]) ? $_GET["cerca"] : "";
// Gestione della paginazione
$data["total_rows"] = $config["total_rows"] = $this->tecniche_model->count_tecniche($data["cerca"]);
$base_url = base_url() . "admin/tecniche/index/";
$pagination = get_pagination($base_url);
$this->pagination->initialize($config);
// Prende i dati delle tecniche
$data['lista_tecniche'] = $this->tecniche_model->lista_tecniche($data["cerca"], $pagination["per_page"], $pagination["offset"]);
$data["pagination"] = $this->pagination->create_links();
$data['javascript_files'] = array('plugins/jquery.tablesorter.min.js', 'admin/functions.js');
// Stampo la pagina di lista delle tecniche
$data["page"] = "lista_tecniche";
$content = array('admin/pages/tecniche/lista', 'admin/modals/cancella');
$this->render($content, $data);
}
示例12: newsletterList
/**
* Вывод списка рассылок
*
* @param string $tpl_dir путь к директории с шаблонами модуля
*/
function newsletterList($tpl_dir)
{
global $AVE_DB, $AVE_Template;
$db_extra = '';
$nav_string = '';
if (!empty($_REQUEST['q'])) {
$query = preg_replace('/[^ +_A-Za-zА-Яа-яЁёЇЄІїєі0-9-]/s', '', $_REQUEST['q']);
$db_extra = " WHERE newsletter_title LIKE '%{$query}%' OR newsletter_message LIKE '%{$query}%' ";
$nav_string = "&q={$query}";
}
$num = $AVE_DB->Query("\r\n\t\t\tSELECT COUNT(*)\r\n\t\t\tFROM " . PREFIX . "_modul_newsletter\r\n\t\t\t" . $db_extra . "\r\n\t\t\tORDER BY id DESC\r\n\t\t")->GetCell();
$limit = 20;
@($pages = @ceil($num / $limit));
$start = get_current_page() * $limit - $limit;
$items = array();
$sql = $AVE_DB->Query("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . PREFIX . "_modul_newsletter\r\n\t\t\t" . $db_extra . "\r\n\t\t\tORDER BY Id DESC\r\n\t\t\tLIMIT " . $start . "," . $limit);
while ($row = $sql->FetchRow()) {
$s = $AVE_DB->Query("\r\n\t\t\t\tSELECT user_group_name\r\n\t\t\t\tFROM " . PREFIX . "_user_groups\r\n\t\t\t\tWHERE user_group = " . implode(' OR user_group = ', explode(';', $row->newsletter_groups)));
$e = array();
while ($r = $s->FetchRow()) {
array_push($e, $r);
}
$row->newsletter_attach = explode(';', $row->newsletter_attach);
$row->newsletter_groups = $e;
array_push($items, $row);
}
if ($num > $limit) {
$page_nav = " <a class=\"pnav\" href=\"index.php?do=modules&action=modedit&mod=newsletter&moduleaction=1" . $nav_string . "&page={s}&cp=" . SESSION . "\">{t}</a> ";
$page_nav = get_pagination($pages, 'page', $page_nav);
$AVE_Template->assign('page_nav', $page_nav);
}
$AVE_Template->assign('items', $items);
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'start.tpl'));
}
示例13: nl2br
$post->group_ids = @explode(",", $post->GRUPPEN_IDS);
if (array_intersect($post->group_ids, $my_group_id)) {
// soll bbcode verwendet werden
if ($post->use_bbcode == 1) {
$post->message = $this->kcodes($post->message);
} else {
$post->message = nl2br($post->message);
}
} else {
$post->message = $mod['config_vars']['FORUMS_DENIED_TEXT'];
$post->flink = 'no';
}
$post->message = @$this->badwordreplace($post->message);
$post->message = $this->high($post->message);
$post->message = SMILIES == 1 && $post->use_smilies == 1 ? $this->replaceWithSmileys($post->message) : $post->message;
$matches[] = $post;
}
if ($num > $limit) {
$id = !is_numeric($_REQUEST['id']) ? 1 : $_REQUEST['id'];
$page_nav = " <a class=\"page_navigation\" href=\"index.php?module=forums&show=userpostings&user_id=" . $_GET['user_id'] . "&page={s}&pp=" . $limit . "\">{t}</a> ";
$page_nav = get_pagination($seiten, 'page', $page_nav);
$AVE_Template->assign('pages', $page_nav);
}
$AVE_Template->assign("matches", $matches);
$AVE_Template->assign("post_count", $num);
define("MODULE_CONTENT", $AVE_Template->fetch($mod['tpl_dir'] . 'showpost.tpl'));
define("MODULE_SITE", $mod['config_vars']['FORUMS_USER_POSTINGS']);
} else {
header("Location:index.php?module=forums");
exit;
}
示例14: get_template_part
<div class="post-row">
<div class="row-fluid">
<?php
// Use specific post-format template: aside, image, gallery, etc...
get_template_part('templates/post', get_post_format());
?>
</div>
</div><!-- .row-fluid -->
</article><!-- #post -->
<?php
}
// Pagination
$paging = isset($custom_query->query['paging']) && $custom_query->query['paging'] == 'false' ? false : true;
if ($paging) {
get_pagination($the_query);
}
// clean up
unset($the_query);
if (isset($custom_query)) {
unset($custom_query);
}
} else {
// No Posts Found
// ------------------------------------------------------------------
?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php
_e('Sorry, no blog posts were found.', 'framework');
?>
示例15: contactMessageShow
/**
* Метод, предназначенный для просмотра сообщений отправленных пользователями.
* Данный метод работает в двух режимах:
* 1) Просмотр входящих или исходящих сообщений списком
* 2) Полный просмотр любого сообщения
*
* @param string $tpl_dir путь к папке с шаблонами
* @param int $contact_form_id идентификатор формы
* @param string $newold сообщение без ответа new
*/
function contactMessageShow($tpl_dir, $contact_form_id, $newold = '')
{
global $AVE_DB, $AVE_Template;
// Определяем, пришел ли запрос на полный просмотр сообщения
switch ($_REQUEST['sub']) {
// Если нет, тогда
case '':
// Определяем условия просмотра (прочитанные или новые)
$n_o = $newold == 'new' ? 'AND contact_form_out_date < 1' : 'AND contact_form_out_date > 1';
$new_old = $newold == 'new' ? 'showmessages_new' : 'showmessages_old';
// Выполняем запрос к БД на получение списка сообщений согласно условиям
$num = $AVE_DB->Query("\r\n\t\t\t\t\tSELECT COUNT(*)\r\n\t\t\t\t\tFROM " . PREFIX . "_modul_contact_info\r\n\t\t\t\t\tWHERE contact_form_id = '" . $contact_form_id . "'\r\n\t\t\t\t\t" . $n_o . "\r\n\t\t\t\t")->GetCell();
// Формируем условия для выборки опредленного диапазона сообщений, в зависимости от
// номера страницы при постраницной навигации
$limit = $this->_adminlimit;
$seiten = ceil($num / $limit);
$start = get_current_page() * $limit - $limit;
// Выполняем запрос к БД на получение сообщений с учетом всех условий выборки
$items = array();
$sql = $AVE_DB->Query("\r\n\t\t\t\t\tSELECT *\r\n\t\t\t\t\tFROM " . PREFIX . "_modul_contact_info\r\n\t\t\t\t\tWHERE contact_form_id = '" . $contact_form_id . "'\r\n\t\t\t\t\t" . $n_o . "\r\n\t\t\t\t\tORDER BY contact_form_in_date DESC\r\n\t\t\t\t\tLIMIT " . $start . "," . $limit);
while ($row = $sql->FetchRow()) {
array_push($items, $row);
}
$sql->Close();
// Если количество сообщений превышает максимально-допустимый лимит на странице, тогла
// формируем постраничную навигацию.
if ($num > $limit) {
$page_nav = " <a class=\"pnav\" href=\"index.php?do=modules&action=modedit&mod=contact&moduleaction=" . $new_old . "&cp=" . SESSION . "&page={s}&id=" . intval($_REQUEST['id']) . "\">{t}</a> ";
$page_nav = get_pagination($seiten, 'page', $page_nav);
$AVE_Template->assign('page_nav', $page_nav);
}
// Передаем данные в шаблон и выводим
$AVE_Template->assign('items', $items);
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_messages.tpl'));
break;
// Если да
// Если да
case 'view':
// Выполняем запрос к БД и получаем полную информацию о просматриваемом сообщении
$row = $AVE_DB->Query("\r\n\t\t\t\t\tSELECT *\r\n\t\t\t\t\tFROM " . PREFIX . "_modul_contact_info\r\n\t\t\t\t\tWHERE Id = '" . $_REQUEST['id'] . "'\r\n\t\t\t\t")->FetchRow();
$attachments = '';
// Если сообщение имеет прикрепленные файлы, тогда получаем названия файлов
if ($row->contact_form_in_attachment != '') {
$attachments = array();
$attachments_arr = explode(';', $row->contact_form_in_attachment);
foreach ($attachments_arr as $attachment) {
$row_a->name = $attachment;
$row_a->size = round(filesize(BASE_DIR . '/attachments/' . $attachment) / 1024, 2);
array_push($attachments, $row_a);
$row_a = '';
}
}
// Приводим текст сообщения к правильному формату и передаем в шаблон полученные данные
$row->nl2brText = nl2br(stripslashes($row->contact_form_in_message));
$row->replytext = $row->contact_form_in_message;
$AVE_Template->assign('attachments', $attachments);
$AVE_Template->assign('row', $row);
// Отображаем данные
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_messageform.tpl'));
break;
}
}