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


PHP Paginator::set_total方法代码示例

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


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

示例1: index

 public function index()
 {
     $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/sidebar_search.js');
     $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/common.js');
     // alapbeállítások lekérdezése
     $this->view->settings = $this->munkak_model->get_settings();
     // 3 legfrissebb munka
     $this->view->latest_jobs = $this->munkak_model->jobs_query(3);
     $this->view->title = 'Munka diákoknak | Multijob Iskolaszövetkezet.';
     $this->view->description = 'Munka diákoknak a Multijob Iskolaszövetkezetnél. Diákmunka az ország több területén.';
     $this->view->keywords = 'diákmunka, alkalmi munka, multijob';
     // paginator
     include LIBS . '/pagine_class.php';
     // paginátor objektum létrehozása (paraméter neve, limit)
     $pagine = new Paginator('oldal', 9);
     // adatok lekérdezése limittel
     $this->view->jobs_data = $this->munkak_model->jobs_filter_query($pagine->get_limit(), $pagine->get_offset());
     // szűrési feltételeknek megfelelő összes rekord száma
     $filter_count = $this->munkak_model->jobs_filter_count_query();
     $pagine->set_total($filter_count);
     // lapozó linkek
     $this->view->pagine_links = $pagine->page_links($this->registry->uri_path);
     //$this->view->debug(true);
     $this->view->render('munkak/tpl_munkak');
 }
开发者ID:hillmediakft,项目名称:multijob,代码行数:25,代码来源:munkak.php

示例2: cat

 public function cat($slug)
 {
     $pages = new Paginator('10', 'page');
     $pages->set_total(count($this->_model->getcatposttotal($slug)));
     $data['posts'] = $this->_model->getcatposts($slug, $pages->get_limit());
     $data['page_links'] = $pages->page_links();
     $data['cats'] = $this->_model->getcats();
     $data['title'] = $data['posts'][0]->catTitle;
     View::rendertemplate('header', $data);
     View::render('blog/cats', $data);
     View::rendertemplate('footer', $data);
 }
开发者ID:fabioassuncao,项目名称:build-a-blog,代码行数:12,代码来源:blog.php

示例3: reduceData

 /**
  * Reduce the $data array, so that only values from one page are showing.
  *
  * @param array $data
  * @param int   $perPage
  * @param int   $page
  *
  * @return array
  */
 public static function reduceData(array $data, $perPage = 10, $page = 1)
 {
     // get pagination
     $paginator = new Paginator($perPage, 'page');
     $paginator->set_total(count($data))->set_pageIdentifierFromGet($page);
     $minMaxArray = $paginator->get_limit_raw();
     --$minMaxArray[1];
     // get limit via pagination
     $dataFiltered = array();
     $tmpCounterMin = 0;
     $tmpCounterMax = 0;
     foreach ($data as $dataKey => $dataValue) {
         if ($tmpCounterMin >= $minMaxArray[0] || $minMaxArray[0] == 0) {
             $tmpCounterMax++;
             $dataFiltered[$dataKey] = $dataValue;
             if ($tmpCounterMax >= $minMaxArray[1] + 1) {
                 break;
             }
         }
         $tmpCounterMin++;
     }
     return $dataFiltered;
 }
开发者ID:voku,项目名称:pagination,代码行数:32,代码来源:PaginatorHelper.php

示例4: Paginator

        <table>
        <tr>
		<th>ID</th>
                <th>Pseudo</th>
		<th>PID</th>
                <th>Email</th>
		<th style="text-align: center;">Inscription</th>
                <th style="text-align: center;">Action</th>
        </tr>
        <?php 
try {
    $pages = new Paginator('10', 'p');
    $stmt = $db->query('SELECT memberID FROM blog_members');
    //pass number of records to
    $pages->set_total($stmt->rowCount());
    $stmt = $db->query('SELECT memberID,username,pid,email,memberDate FROM blog_members ORDER BY memberID DESC ' . $pages->get_limit());
    while ($row = $stmt->fetch()) {
        echo '<tr>';
        echo '<td>' . $row['memberID'] . '</td>';
        echo '<td style="width: 20%;">' . $row['username'] . '</td>';
        echo '<td style="font-size: 10px;">' . $row['pid'] . '</td>';
        echo '<td style="font-size: 11px;">' . $row['email'] . '</td>';
        sscanf($row['memberDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde);
        echo '<td style="font-size: 10px; text-align: center;">' . $jour . '-' . $mois . '-' . $annee . '</td>';
        ?>

                                <td style="text-align: center;">
                                        <a style="text-decoration: none;" href="edit-user.php?id=<?php 
        echo $row['memberID'];
        ?>
开发者ID:sybix,项目名称:freeostorrent,代码行数:30,代码来源:users.php

示例5: displayView

 function displayView($view, $id = 0)
 {
     $tpl_vars = array();
     switch ($view) {
         case 'about':
             break;
         case 'config':
             $dev_infos = $this->_getPocheVersion('dev');
             $dev = trim($dev_infos[0]);
             $check_time_dev = date('d-M-Y H:i', $dev_infos[1]);
             $prod_infos = $this->_getPocheVersion('prod');
             $prod = trim($prod_infos[0]);
             $check_time_prod = date('d-M-Y H:i', $prod_infos[1]);
             $compare_dev = version_compare(POCHE, $dev);
             $compare_prod = version_compare(POCHE, $prod);
             $themes = $this->tpl->getInstalledThemes();
             $languages = $this->language->getInstalledLanguages();
             $token = $this->user->getConfigValue('token');
             $http_auth = isset($_SERVER['PHP_AUTH_USER']) || isset($_SERVER['REMOTE_USER']) ? true : false;
             $only_user = $this->store->listUsers() > 1 ? false : true;
             $tpl_vars = array('themes' => $themes, 'languages' => $languages, 'dev' => $dev, 'prod' => $prod, 'check_time_dev' => $check_time_dev, 'check_time_prod' => $check_time_prod, 'compare_dev' => $compare_dev, 'compare_prod' => $compare_prod, 'token' => $token, 'user_id' => $this->user->getId(), 'http_auth' => $http_auth, 'only_user' => $only_user);
             Tools::logm('config view');
             break;
         case 'edit-tags':
             # tags
             $entry = $this->store->retrieveOneById($id, $this->user->getId());
             if (!$entry) {
                 $this->messages->add('e', _('Article not found!'));
                 Tools::logm('error : article not found');
                 Tools::redirect();
             }
             $tags = $this->store->retrieveTagsByEntry($id);
             $tpl_vars = array('entry_id' => $id, 'tags' => $tags, 'entry' => $entry);
             break;
         case 'tags':
             $token = $this->user->getConfigValue('token');
             //if term is set - search tags for this term
             $term = Tools::checkVar('term');
             $tags = $this->store->retrieveAllTags($this->user->getId(), $term);
             if (Tools::isAjaxRequest()) {
                 $result = array();
                 foreach ($tags as $tag) {
                     $result[] = $tag['value'];
                 }
                 echo json_encode($result);
                 exit;
             }
             $tpl_vars = array('token' => $token, 'user_id' => $this->user->getId(), 'tags' => $tags);
             break;
         case 'search':
             if (isset($_GET['search'])) {
                 $search = filter_var($_GET['search'], FILTER_SANITIZE_STRING);
                 $tpl_vars['entries'] = $this->store->search($search, $this->user->getId());
                 $count = count($tpl_vars['entries']);
                 $this->pagination->set_total($count);
                 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), $this->pagination->page_links('?view=' . $view . '?search=' . $search . '&sort=' . $_SESSION['sort'] . '&'));
                 $tpl_vars['page_links'] = $page_links;
                 $tpl_vars['nb_results'] = $count;
                 $tpl_vars['searchterm'] = $search;
             }
             break;
         case 'view':
             $entry = $this->store->retrieveOneById($id, $this->user->getId());
             if ($entry != NULL) {
                 Tools::logm('view link #' . $id);
                 $content = $entry['content'];
                 if (function_exists('tidy_parse_string')) {
                     $tidy = tidy_parse_string($content, array('indent' => true, 'show-body-only' => true), 'UTF8');
                     $tidy->cleanRepair();
                     $content = $tidy->value;
                 }
                 # flattr checking
                 $flattr = NULL;
                 if (FLATTR) {
                     $flattr = new FlattrItem();
                     $flattr->checkItem($entry['url'], $entry['id']);
                 }
                 # tags
                 $tags = $this->store->retrieveTagsByEntry($entry['id']);
                 $tpl_vars = array('entry' => $entry, 'content' => $content, 'flattr' => $flattr, 'tags' => $tags);
             } else {
                 Tools::logm('error in view call : entry is null');
             }
             break;
         default:
             # home, favorites, archive and tag views
             $tpl_vars = array('entries' => '', 'page_links' => '', 'nb_results' => '', 'listmode' => isset($_COOKIE['listmode']) ? true : false);
             //if id is given - we retrieve entries by tag: id is tag id
             if ($id) {
                 $tpl_vars['tag'] = $this->store->retrieveTag($id, $this->user->getId());
                 $tpl_vars['id'] = intval($id);
             }
             $count = $this->store->getEntriesByViewCount($view, $this->user->getId(), $id);
             if ($count > 0) {
                 $this->pagination->set_total($count);
                 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . ($id ? '&id=' . $id : '') . '&'));
                 $tpl_vars['entries'] = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit(), $id);
                 $tpl_vars['page_links'] = $page_links;
                 $tpl_vars['nb_results'] = $count;
             }
//.........这里部分代码省略.........
开发者ID:nsbasicus,项目名称:wallabag,代码行数:101,代码来源:Poche.class.php

示例6: displayView

 function displayView($view, $id = 0)
 {
     $tpl_vars = array();
     switch ($view) {
         case 'about':
             break;
         case 'config':
             $dev_infos = $this->_getPocheVersion('dev');
             $dev = trim($dev_infos[0]);
             $check_time_dev = date('d-M-Y H:i', $dev_infos[1]);
             $prod_infos = $this->_getPocheVersion('prod');
             $prod = trim($prod_infos[0]);
             $check_time_prod = date('d-M-Y H:i', $prod_infos[1]);
             $compare_dev = version_compare(POCHE, $dev);
             $compare_prod = version_compare(POCHE, $prod);
             $themes = $this->tpl->getInstalledThemes();
             $languages = $this->language->getInstalledLanguages();
             $token = $this->user->getConfigValue('token');
             $http_auth = isset($_SERVER['REMOTE_USER']);
             $only_user = $this->store->listUsers() > 1 ? false : true;
             $https = substr(Tools::getPocheUrl(), 0, 5) == 'https';
             $tpl_vars = array('themes' => $themes, 'languages' => $languages, 'dev' => $dev, 'prod' => $prod, 'check_time_dev' => $check_time_dev, 'check_time_prod' => $check_time_prod, 'compare_dev' => $compare_dev, 'compare_prod' => $compare_prod, 'token' => $token, 'user_id' => $this->user->getId(), 'http_auth' => $http_auth, 'only_user' => $only_user, 'https' => $https);
             Tools::logm('config view');
             break;
         case 'edit-tags':
             # tags
             $entry = $this->store->retrieveOneById($id, $this->user->getId());
             if (!$entry) {
                 $this->messages->add('e', _('Article not found!'));
                 Tools::logm('error : article not found');
                 Tools::redirect();
             }
             $tags = $this->store->retrieveTagsByEntry($id);
             $all_tags = $this->store->retrieveAllTags($this->user->getId());
             $maximus = 0;
             foreach ($all_tags as $eachtag) {
                 // search for the most times a tag is present
                 if ($eachtag["entriescount"] > $maximus) {
                     $maximus = $eachtag["entriescount"];
                 }
             }
             foreach ($all_tags as $key => $eachtag) {
                 // get the percentage of presence of each tag
                 $percent = floor($eachtag["entriescount"] / $maximus * 100);
                 if ($percent < 20) {
                     // assign a css class, depending on the number of entries count
                     $cssclass = 'smallesttag';
                 } elseif ($percent >= 20 and $percent < 40) {
                     $cssclass = 'smalltag';
                 } elseif ($percent >= 40 and $percent < 60) {
                     $cssclass = 'mediumtag';
                 } elseif ($percent >= 60 and $percent < 80) {
                     $cssclass = 'largetag';
                 } else {
                     $cssclass = 'largesttag';
                 }
                 $all_tags[$key]['cssclass'] = $cssclass;
             }
             $tpl_vars = array('entry_id' => $id, 'tags' => $tags, 'alltags' => $all_tags, 'entry' => $entry);
             break;
         case 'tags':
             $token = $this->user->getConfigValue('token');
             //if term is set - search tags for this term
             $term = Tools::checkVar('term');
             $tags = $this->store->retrieveAllTags($this->user->getId(), $term);
             if (Tools::isAjaxRequest()) {
                 $result = array();
                 foreach ($tags as $tag) {
                     $result[] = $tag['value'];
                 }
                 echo json_encode($result);
                 exit;
             }
             $tpl_vars = array('token' => $token, 'user_id' => $this->user->getId(), 'tags' => $tags);
             break;
         case 'search':
             if (isset($_GET['search'])) {
                 $search = filter_var($_GET['search'], FILTER_SANITIZE_STRING);
                 $tpl_vars['entries'] = $this->store->search($search, $this->user->getId());
                 $count = count($tpl_vars['entries']);
                 $this->pagination->set_total($count);
                 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), $this->pagination->page_links('?view=' . $view . '?search=' . $search . '&sort=' . $_SESSION['sort'] . '&'));
                 $tpl_vars['page_links'] = $page_links;
                 $tpl_vars['nb_results'] = $count;
                 $tpl_vars['searchterm'] = $search;
             }
             break;
         case 'view':
             $entry = $this->store->retrieveOneById($id, $this->user->getId());
             if ($entry != NULL) {
                 Tools::logm('view link #' . $id);
                 $content = $entry['content'];
                 if (function_exists('tidy_parse_string')) {
                     $tidy = tidy_parse_string($content, array('indent' => true, 'show-body-only' => true), 'UTF8');
                     $tidy->cleanRepair();
                     $content = $tidy->value;
                 }
                 # flattr checking
                 $flattr = NULL;
                 if (FLATTR) {
//.........这里部分代码省略.........
开发者ID:Kwadz,项目名称:wallabag,代码行数:101,代码来源:Poche.class.php


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