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


PHP Pagination::getRange方法代码示例

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


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

示例1: displayList

 /**
  *
  */
 function displayList($calendar = false, $time = false)
 {
     if ($time) {
         $time = explode('-', $time);
         $start = mktime(0, 0, 0, $time[1], 1, $time[0]);
         $end = mktime(0, 0, 0, $time[1] + 1, 1, $time[0]);
     } else {
         $start = $end = false;
     }
     $eventIDs = $this->getEventIDs($calendar, $start, $end);
     $total = count($eventIDs);
     $pageInfo = Pagination::getRange($this->itemsPerPage, $total);
     $start = $pageInfo['range']['start'];
     $stop = $pageInfo['range']['stop'];
     $r = '<h1>' . __('Calendar') . '</h1><div class="cols spacer"><div class="col eight first"><ul class="events">';
     $i = 0;
     foreach ($eventIDs as $eventID) {
         if ($start <= $i && $i <= $stop) {
             $event = $this->getEvent($eventID);
             $r .= '<li>' . $event->getShort(true) . '</li>';
         }
         $i++;
     }
     if ($total > $this->itemsPerPage) {
         $r .= '<li><div class="cols"><div class="col eight first bordered thinner">' . $pageInfo['links'] . '</div></div></li>';
     }
     $r .= '</ul></div>';
     $r .= $this->rightmenu();
     return $r;
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:33,代码来源:CalendarViewer.php

示例2: run

 function run()
 {
     global $Templates, $DB, $Controller;
     $_REQUEST->setType('item', 'numeric');
     $PERPAGE = 5;
     if ($_REQUEST['item']) {
         $obj = $Controller->{$_REQUEST['item']};
         $content = $obj->display(false, true, true, true);
     } else {
         $QUEUE = $this->ID;
         $COUNT = (int) $DB->flow->count(array('queue~' => $QUEUE), 'id');
         $pagination = Pagination::getRange($PERPAGE, $COUNT);
         $Objects = Flow::retrieve('News', $PERPAGE, false, false, false, $pagination['range']['start']);
         $content = '';
         $first = true;
         foreach ($Objects as $obj) {
             $content .= '<li' . ($first ? '' : ' class="cols"') . '>' . $obj->display(false, $first, true) . '</li>';
             $first = false;
         }
         $content = '<ul>' . $content . '</ul>' . $pagination['links'];
     }
     $r = '<h1>FlowView</h1>' . Design::row(array(Design::column('<div class="padded">' . $content . '</div>', 8, true, true, true), Design::column('Möjlighet att följa nyheterna via RSS kommer... ', 4, false, true, true)), true);
     $this->setContent('main', $r);
     $this->setContent('menu', $this->submenu());
     $Templates->yweb('empty')->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:26,代码来源:FlowQueue.php

示例3: viewSpine

 /**
  * Overview the spine database table and display the overview page
  * @return string
  */
 function viewSpine()
 {
     global $DB, $Controller;
     $r = '';
     $perpage = 250;
     $total = $DB->spine->count();
     $pager = Pagination::getRange($perpage, $total);
     $objects = $Controller->get($DB->spine->asList(null, 'id', $pager['range']['start'] . ',' . $perpage), EDIT_PRIVILEGES);
     $groups = array();
     foreach ($objects as $o) {
         $groups[$o->privilegeGroup][] = $o;
     }
     ksort($groups);
     $r .= '<ul class="list">';
     foreach ($groups as $group => $rows) {
         if ($group == 'hide' || $group == 'hidden') {
             continue;
         }
         $r .= '<li>' . ucwords(__($group)) . '<ul>';
         $i = 0;
         natcasesort($rows);
         foreach ($rows as $o) {
             $r .= '<li class="' . ($i % 2 ? 'even' : 'odd') . '"><span class="fixed-width">' . $o . '</span><div class="tools">' . icon('small/key', __('Edit permissions for') . ' &quot;' . strip_tags($o) . '&quot;', url(array("edit" => $o->ID), 'id')) . (is_a($o, 'User') || is_a($o, 'Group') ? icon('small/magnifier', __('Overview permissions for') . ' &quot;' . strip_tags($o) . '&quot;', url(array('view' => $o->ID), 'id')) : '') . (method_exists($o, 'run') ? icon('small/bullet_go', __('Go to') . ' &quot;' . strip_tags($o) . '&quot;', url(array('id' => $o->ID))) : '') . '</div></li>';
             $i++;
         }
         $r .= '</ul></li>';
     }
     $r .= '</ul>';
     return $r . ($total > $perpage ? $pager['links'] : '');
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:34,代码来源:PermissionEditor.php

示例4: userSearchResults

 /**
  * Display the results of a user search
  * @return string
  */
 function userSearchResults()
 {
     global $DB, $Controller, $USER;
     if ($_REQUEST['keyword']) {
         $results = array_unique(array_merge($DB->users->asList(array('username~' => '%' . $_REQUEST['keyword'] . '%'), 'id', false, false, 'username', 'id'), $DB->userinfo->asList(array('val~' => $_REQUEST['keyword']), 'id', false, false, false, 'id')));
         if (count($results) == 0) {
             return __('No results');
         } else {
             $r = '';
             $r .= '<h3>' . __('Search results') . '</h3>';
             $r .= '<ul class="list">';
             $i = 0;
             foreach ($results as $id) {
                 if ($id == NOBODY) {
                     continue;
                 }
                 $user = $Controller->{$id}('User', READ);
                 if ($user) {
                     $r .= '<li class="' . ($i % 2 ? 'odd' : 'even') . '"><span class="fixed-width">' . $user . '</span><div class="tools">' . ($id == $USER->ID || $user->memberOf(ADMIN_GROUP) || !$this->may($USER, DELETE) ? '' : icon('small/delete', __('Delete'), url(array('del' => $user->ID), array('id', 'edit')))) . ($this->may($USER, EDIT) ? icon('small/user_edit', __('Edit user'), url(array('edit' => $user->ID), array('id', 'edit'))) : '') . '</div></li>';
                     $i++;
                 }
             }
             $r .= '</ul>';
         }
     } else {
         $perpage = 100;
         $total = $DB->users->count(array('id!' => NOBODY));
         $pager = Pagination::getRange($perpage, $total);
         $users = $Controller->get($DB->users->asList(array('id!' => NOBODY), 'id', $pager['range']['start'] . ', ' . $perpage, false, 'username'));
         natcasesort($users);
         $r = '';
         if (count($users) > 0) {
             $r = '<ul class="limitheight flul">';
             $pre = false;
             $i = 0;
             foreach ($users as $user) {
                 $us = (string) $user;
                 if (strlen($us) == 0) {
                     $us = ' ';
                 }
                 if (strtoupper($us[0]) !== $pre) {
                     if ($pre !== false) {
                         $r .= '</ul>';
                     }
                     $pre = strtoupper($us[0]);
                     $r .= '<li class="fletter">' . $pre . '<ul>';
                     $i = 0;
                 }
                 $r .= '<li class="' . ($i % 2 ? 'odd' : 'even') . '"><span class="fixed-width">' . $us . '</span><div class="tools">' . ($user->memberOf(ADMIN_GROUP) ? '' : icon('small/delete', __('Delete'), url(array('del' => $user->ID), array('id', 'edit')))) . icon('small/user_edit', __('Edit user'), url(array('edit' => $user->ID), array('id', 'edit'))) . '</div></li>';
                 $i++;
             }
             $r .= '</ul></li></ul>';
             if ($total > $perpage) {
                 $r .= $pager['links'];
             }
         }
     }
     return $r;
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:63,代码来源:UserEditor.php

示例5: run

 function run()
 {
     global $DB, $Templates, $Controller, $CONFIG;
     $_REQUEST->setType('lfrom', '#\\d\\d-\\d\\d-\\d\\d#');
     $_REQUEST->setType('lto', '#\\d\\d-\\d\\d-\\d\\d#');
     $_REQUEST->setType('lrh', 'string');
     $_REQUEST->setType('luser', 'string');
     $_REQUEST->setType('lsource', 'string');
     $_REQUEST->setType('llevel', 'numeric');
     $ENTRIES = array();
     $from = false;
     $to = false;
     if ($_REQUEST['lfrom']) {
         $from = strtotime($_REQUEST['lfrom']);
     }
     if (!$from) {
         $from = mktime(0, 0, 0, date('m') - 1, date('d'), date('Y'));
     }
     if ($_REQUEST['lto']) {
         $to = strtotime($_REQUEST['lto']) + 86400;
     }
     if (!$to) {
         $to = time();
     }
     $ENTRIES = $DB->log->asArray(array('time>=' => date('Y-m-d H:i:s', $from), 'time<=' => date('Y-m-d H:i:s', $to)));
     if (file_exists(PRIV_PATH . '/log')) {
         $logfile = file(PRIV_PATH . '/log');
         foreach ($logfile as $row => $entryRow) {
             if (empty($entryRow) || $entryRow == "\n") {
                 continue;
             }
             $entry = array();
             list($entry['time'], $entry['remote_addr'], $entry['user'], $entry['source'], $entry['level'], $entry['message']) = explode("\t", $entryRow);
             $t = strtotime($entry['time']);
             if ($t >= $from && $t <= $to) {
                 $ENTRIES[] = $entry;
             }
         }
     }
     usort($ENTRIES, create_function('$a,$b', 'return -strcmp($a["time"], $b["time"]);'));
     $perpage = 250;
     $total = count($ENTRIES);
     $pager = Pagination::getRange($perpage, $total);
     $ENTRIES = array_slice($ENTRIES, $pager['range']['start'], $perpage);
     $TEXT = '';
     $i = 0;
     foreach ($ENTRIES as $entry) {
         if ($a = $Controller->{$entry['user']}('User')) {
             $entry['user'] = $a->link();
         }
         if ($entry['level'] < $_REQUEST['llevel'] || $_REQUEST['luser'] && stristr($entry['user'], $_REQUEST['luser']) === false || $_REQUEST['lrh'] && stristr($entry['remote_addr'], $_REQUEST['lrh']) === false || $_REQUEST['lsource'] && stristr($entry['source'], $_REQUEST['lsource']) === false) {
             continue;
         }
         $entry['message'] = preg_replace_callback('/id=([0-9]+)/', create_function('$matches', 'global $Controller; if ($obj = $Controller->retrieve($matches[1], ANYTHING, false, false)) return $obj->link(); return $matches[0];'), $entry['message']);
         $entry['source'] = preg_replace_callback('/([0-9]+)/', create_function('$matches', 'global $Controller; if ($obj = $Controller->retrieve($matches[1], ANYTHING, false, false)) return $obj->link(); return $matches[0];'), $entry['source']);
         $TEXT .= '<tr class="' . (++$i % 2 ? 'even' : 'odd') . '"><td>' . join("</td><td>", $entry) . '</td></tr>';
     }
     $this->setContent('header', __('View log'));
     JS::loadjQuery();
     Head::add('$(function(){$(".Datepicker").Datepicker({ dateFormat: "yy-mm-dd" });});', 'js-raw');
     Head::add($CONFIG->UI->jQuery_theme . '/jquery-ui-*', 'css-lib');
     $this->setContent('main', '<form action="' . url(null, 'id') . '" method="post"><input type="submit" value="' . __('Filter') . '" /><table class="log">' . '<tr><th>' . __('Time') . "</th><th>" . __('Remote address') . "</th><th>" . __('User') . "</th><th>" . __('Source') . "</th><th>" . __('Level') . "</th><th>" . __('Message') . '</th></tr>' . '<tr><td><input name="lfrom" class="small Datepicker" value="' . $_REQUEST['lfrom'] . '" />-<input name="lto" class="small Datepicker" value="' . $_REQUEST['lto'] . '" /></td><td><input name="lrh" class="small" value="' . $_REQUEST['lrh'] . '" /></td><td><input name="luser" class="small" value="' . $_REQUEST['luser'] . '" /></td><td><input name="lsource" class="small" value="' . $_REQUEST['lsource'] . '" /></td><td><input name="llevel" class="small" value="' . $_REQUEST['llevel'] . '" /></td><td></td></tr>' . $TEXT . '</table></form>' . ($total > $perpage ? $pager['links'] : ''));
     $Templates->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:64,代码来源:Logview.php

示例6: displayGallery

 /**
  * Main function for displaying the archive
  * @return string
  */
 function displayGallery()
 {
     global $Controller;
     $fileList = $this->getDirList($this->getPathLocal());
     $total = count($fileList);
     Head::add('var imgList = [ ' . $this->getLightboxStr($fileList) . ' ]; $(".gallery a.image").lightBox({ txtImage: "' . __('Image') . '", txtOf: "' . __('of') . '", imageArray: imgList });', 'js-raw');
     $pageInfo = Pagination::getRange($this->itemsAPage, $total);
     $start = $pageInfo['range']['start'];
     $stop = $pageInfo['range']['stop'];
     $r = $this->getTitle();
     if ($total > 0) {
         $r .= '<p>' . ($start + 1) . ' - ' . ($stop >= $total ? $total : $stop + 1) . ' ' . __('of') . ' ' . $total . ' ' . __('objects') . '</p>';
     }
     $r .= '<hr /><p class="gallery">';
     $i = 0;
     if ($total == 0) {
         $r .= '<p>' . __('Empty folder') . '</p>';
     } else {
         foreach ($fileList as $file) {
             if ($start <= $i && $i <= $stop) {
                 $fname = utf8(htmlentities($file[1]));
                 if ($file[0] == 'file') {
                     switch ($this->getMime($this->getPathLocal($file[1]))) {
                         case 'image':
                             $r .= '<a class="image" href="' . $this->galleryDirPublic . str_replace('%2F', '/', rawurlencode($this->ualbumName . ($this->ualbumName ? '/' : '') . $file[1])) . '" title="' . htmlentities($this->getEXIF($file[1])) . '">' . $this->getThumb($file[1]) . '</a>';
                             break;
                         case 'pdf':
                             $r .= '<a href="' . $this->galleryDirPublic . str_replace('%2F', '/', rawurlencode($this->albumName . ($this->ualbumName ? '/' : '') . $fname)) . '" title="' . $fname . '">' . icon('large/mail_new-64') . '<span class="text">' . $fname . '</span></a>';
                             break;
                         case 'audio':
                             $r .= '<a href="' . $this->galleryDirPublic . str_replace('%2F', '/', rawurlencode($this->albumName . ($this->albumName ? '/' : '') . $fname)) . '" title="' . $fname . '">' . icon('large/playsound-64') . '<span class="text">' . $fname . '</span></a>';
                             break;
                         case 'movie':
                             $r .= '<a href="' . $this->galleryDirPublic . str_replace('%2F', '/', rawurlencode($this->albumName . ($this->albumName ? '/' : '') . $fname)) . '" title="' . $fname . '">' . icon('large/camera-64') . '<span class="text">' . $fname . '</span></a>';
                             break;
                         default:
                             $r .= '<a href="' . $this->galleryDirPublic . str_replace('%2F', '/', rawurlencode($this->albumName . ($this->albumName ? '/' : '') . $fname)) . '" title="' . $fname . '">' . icon('large/attach-64') . '<span class="text">' . $fname . '</span></a>';
                     }
                 } elseif ($file[0] == 'dir') {
                     $r .= '<a href="' . $this->galleryDirPublic . $this->ualbumName . ($this->ualbumName ? '/' : '') . $fname . '" title="' . $fname . '">' . icon('large/folder-64') . '<span class="text">' . $fname . '</span></a>';
                 }
             }
             $i++;
         }
     }
     $r .= '</p><hr />';
     if ($total > $this->itemsAPage) {
         $r .= $pageInfo['links'];
     }
     return $r;
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:55,代码来源:Gallery.php

示例7: groupStatistics

 function groupStatistics()
 {
     $_REQUEST->setType('viewMembers', 'any');
     $r = '';
     $directMembers = $group->memberUsers(true, true);
     $allMembers = $group->memberUsers(false, true);
     $statsTable = new Table(new tablerow(__('Direct users') . ': ', count($directMembers)), new tablerow(__('All users') . ': ', $memcount = count($allMembers)));
     $r .= $statsTable;
     if ($_REQUEST['viewMembers']) {
         global $Controller;
         Base::preload(array_slice($allMembers, 0, 100), false);
         $pagination = Pagination::getRange(100, $memcount);
         $Count = 0;
         $activeMembers = array();
         foreach ($allMembers as $member_id) {
             if ($pagination['range']['start'] > $Count++) {
                 continue;
             }
             $u = $Controller->get($member_id, OVERRIDE, false, false);
             if ($u->isActive()) {
                 $activeMembers[] = $u;
             }
             if ($Count >= $pagination['range']['stop']) {
                 break;
             }
         }
         $r .= listify($activeMembers) . $pagination['links'];
     } else {
         $r .= '<a href="' . url(array('viewMembers' => '1'), array('edit', 'with', 'stats')) . '">' . __('View members') . '</a>';
     }
     return $r;
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:32,代码来源:GroupAdmin.php

示例8: mainView

 /**
  * @return string
  */
 private function mainView()
 {
     global $USER, $CONFIG, $DB, $Controller;
     $aList = array();
     $total = $DB->getCell("SELECT DISTINCT COUNT(*) FROM updates AS t1 \n            LEFT JOIN spine sp ON sp.id = t1.id\n            LEFT JOIN updates t2 ON t1.id = t2.id\n            AND t1.edited < t2.edited\n            WHERE t2.edited IS NULL\n            AND sp.class = 'Article'\n            ORDER BY t1.edited DESC");
     $perpage = 20;
     $pager = Pagination::getRange($perpage, $total);
     $r = $DB->query("SELECT DISTINCT sp.id FROM updates AS t1 \n            LEFT JOIN spine sp ON sp.id = t1.id\n            LEFT JOIN updates t2 ON t1.id = t2.id\n            AND t1.edited < t2.edited\n            WHERE t2.edited IS NULL\n            AND sp.class = 'Article'\n            ORDER BY t1.edited DESC\n            LIMIT " . $pager['range']['start'] . ", " . $perpage);
     while (false !== ($article = $DB->fetchAssoc($r))) {
         $article = $Controller->{$article['id']};
         $aList[] = '<li><span class="fixed-width">' . $article->Name . '</span><div class="tools">' . icon('small/eye', __('View'), url(array('id' => $article->ID))) . icon('small/pencil', __('Edit'), url(array('edit' => $article->ID), array('id'))) . icon('small/delete', __('Delete'), url(array('del' => $article->ID), 'id')) . '</div></li>';
     }
     $aList = listify($aList);
     if ($total > $perpage) {
         $aList .= $pager['links'];
     }
     $form = new Form('newArticle');
     $calendarSettings->params = 'collapsible:true,active:false';
     return new Tabber('events', __('Article manager'), $aList, __('New article'), $form->collection(new Hidden('asave', 1), new Hidden('edit', $_REQUEST['edit'] ? $_REQUEST['edit'] : 'new'), new Set(new Select(__('Language'), 'lang', google::languages($CONFIG->Site->languages), $USER->settings['language']), new Input(__('Title'), 'atitle'), new Li(new Datepicker(__('Publish'), 'apubd'), new Timepickr(false, 'apubt')), new htmlfield(__('Text'), 'atxt'), new htmlfield(__('Preamble'), 'apre'))));
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:23,代码来源:Articles.php


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