本文整理汇总了PHP中Pagination::setTotal方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::setTotal方法的具体用法?PHP Pagination::setTotal怎么用?PHP Pagination::setTotal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagination
的用法示例。
在下文中一共展示了Pagination::setTotal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$this->getView()->addStylesheetURL('assets/stylesheets/sorting.css');
$customer_id = \Yoda\Request::getInt('customer_id');
$did_number = \Yoda\Request::getString('did_number');
$from_date = \Yoda\Request::getString('from_date');
$to_date = \Yoda\Request::getString('to_date');
$order = \Yoda\Request::getString('order', 'duration');
$direction = \Yoda\Request::getString('direction', 'ASC');
$pagination = new Pagination();
$pagination->setLimit(10);
$pagination->setPage(\Yoda\Request::getInt('page', 1));
$pagination->setLink('index.php?controller=call_history&did_number=' . $did_number . '&customer_id=' . $customer_id . '&from_date=' . $from_date . '&to_date=' . $to_date);
$cdr = new Didww\API2\CDRCollection();
$cdr->setCustomerId($customer_id);
$cdr->setDidNumber($did_number);
$cdr->setFromDate($from_date);
$cdr->setToDate($to_date);
$cdr->setOrderBy($order);
$cdr->setOrderDir(strtoupper($direction));
$cdr->setLimit($pagination->getLimit());
$cdr->setOffset($pagination->getOffset());
$cdrs = $cdr->getList();
$total = $cdr->getTotal();
$pagination->setTotal($total);
$this->getView()->setProperties(['view' => $this->getView(), 'cdrs' => $cdrs, 'customer_id' => $customer_id, 'did_number' => $did_number, 'from_date' => $from_date, 'to_date' => $to_date, 'pagination' => $pagination, 'order' => $order, 'direction' => $direction, 'total' => $total])->display();
}
示例2: index
function index()
{
$this->getView()->addStylesheetURL('assets/stylesheets/sorting.css');
$customer_id = \Yoda\Request::getInt('customer_id');
$destination = \Yoda\Request::getString('destination');
$source = \Yoda\Request::getString('source');
$success = \Yoda\Request::getString('success', '');
$from_date = \Yoda\Request::getString('from_date');
$to_date = \Yoda\Request::getString('to_date');
$order = \Yoda\Request::getString('order', 'destination');
$direction = \Yoda\Request::getString('direction', 'ASC');
$pagination = new Pagination();
$pagination->setLimit(10);
$pagination->setPage(\Yoda\Request::getInt('page', 1));
$pagination->setLink('index.php?controller=sms&customer_id=' . $customer_id . '&destination=' . $destination . '&source=' . $source . '&success=' . $success . '&from_date=' . $from_date . '&to_date=' . $to_date);
$sms = new Didww\API2\SMSCollection();
$sms->setCustomerId($customer_id);
$sms->setDestination($destination);
$sms->setSource($source);
if ($success !== '') {
$sms->setSuccess($success);
}
$sms->setFromDate($from_date);
$sms->setToDate($to_date);
$sms->setOrderBy($order);
$sms->setOrderDir(strtoupper($direction));
$sms->setLimit($pagination->getLimit());
$sms->setOffset($pagination->getOffset());
$sms_log = $sms->getList();
$total = $sms->getTotal();
$pagination->setTotal($total);
$this->getView()->setProperties(['view' => $this->getView(), 'sms_log' => $sms_log, 'customer_id' => $customer_id, 'destination' => $destination, 'source' => $source, 'success' => $success, 'from_date' => $from_date, 'to_date' => $to_date, 'pagination' => $pagination, 'order' => $order, 'direction' => $direction, 'total' => $total])->display();
}
示例3: testPagination
public function testPagination()
{
$pagination = new Pagination();
$pagination->setCurrent(10);
$pagination->setTotal(95);
$pagination->setRPP(10);
$this->assertEquals(10, $pagination->getNumberOfPages());
$this->assertEquals(5, $pagination->countCurrentItems());
$this->assertEquals(91, $pagination->firstItem());
$this->assertEquals(95, $pagination->lastItem());
//change to another page
$pagination->setCurrent(5);
$this->assertEquals(10, $pagination->countCurrentItems());
$this->assertEquals(41, $pagination->firstItem());
$this->assertEquals(50, $pagination->lastItem());
}
示例4: index
/**
*
* @param string $tag Default is NULL
* @param int $page Default is NULL
* @return void
*/
public function index($tag = NULL, $page = NULL)
{
$getData = array('query' => $tag ? $tag : Input::get('query'), 'type' => Input::get('type'), 'country' => Input::get('country'), 'make' => Input::get('make'), 'model' => Input::get('model'), 'year_min' => Input::get('year_min'), 'year_max' => Input::get('year_max'), 'price_min' => Input::get('price_min'), 'price_max' => Input::get('price_max'), 'currency' => Input::get('currency'), 'condition' => Input::get('condition'), 'color' => Input::get('color'), 'mileage_min' => Input::get('mileage_min'), 'mileage_max' => Input::get('mileage_max'), 'vehicle' => Input::get('vehicle'), 'vin' => Input::get('vin'), 'state' => Input::get('state'), 'city' => Input::get('city'), 'location' => Input::get('location'), 'order' => Input::get('order'), 'page' => $page ? $page : Input::get('page'));
$getData = $this->mSearch->fixDashes($getData);
$getData = $this->mSearch->fixLower($getData);
$data = $this->mSearch->apiResults($getData);
$data['params'] = $getData;
$data['yearMin'] = $getData['year_min'] ? $getData['year_min'] : 1980;
$data['yearMax'] = $getData['year_max'] ? $getData['year_max'] : (int) date('Y');
$data['priceMin'] = $getData['price_min'] ? $getData['price_min'] : 0;
$data['priceMax'] = $getData['price_max'] ? $getData['price_max'] : 50000;
$data['mileageMin'] = $getData['mileage_min'] ? $getData['mileage_min'] : 0;
$data['mileageMax'] = $getData['mileage_max'] ? $getData['mileage_max'] : 200000;
$this->mSearch->saveTags($getData['query'], $data['total']);
$data['latestTags'] = $this->mSearch->getTags('latest');
$data['randomTags'] = $this->mSearch->getTags('random');
if ($tag !== NULL) {
Pagination::setQueryString(FALSE);
Pagination::setURL(tagLink($getData['query']));
$seoData = $this->mSearch->setSeo('tags', $getData, $data['total']);
Layout::title(getSeo($seoData, 'tagsTitle'));
Layout::desc(getSeo($seoData, 'tagsDesc'));
Layout::heading(getSeo($seoData, 'tagsHeading'));
} else {
Pagination::setQueryString(TRUE);
Pagination::setURL(searchLink($getData, FALSE));
$seoData = $this->mSearch->setSeo('search', $getData, $data['total']);
Layout::title(getSeo($seoData, 'searchTitle'));
Layout::desc(getSeo($seoData, 'searchDesc'));
Layout::heading(getSeo($seoData, 'searchHeading'));
}
Pagination::setTotal($data['total'], Config::get('searchResultsLimit', 'limit'), Config::get('searchPaginaLimit', 'limit'));
Pagination::setCurrent($getData['page']);
Pagination::setNumLinks(3);
Pagination::run();
$data['pagination'] = Pagination::getPagina();
Layout::view('vSearch', $data);
}
示例5: htmlspecialchars
$label = '<span class="label label-' . htmlspecialchars($label[0]->label) . '">' . htmlspecialchars($label[0]->name) . '</span>';
} else {
// no
$label = '';
}
// Add to array
$sticky_array[] = array('topic_title' => htmlspecialchars($sticky->topic_title), 'topic_id' => $sticky->id, 'topic_created_rough' => $timeago->inWords(date('d M Y, H:i', $sticky->topic_date), $time_language), 'topic_created' => date('d M Y, H:i', $sticky->topic_date), 'topic_created_username' => htmlspecialchars($user->IdToName($sticky->topic_last_user)), 'topic_created_mcname' => htmlspecialchars($user->IdToMCName($sticky->topic_last_user)), 'views' => $sticky->topic_views, 'locked' => $sticky->locked, 'posts' => $replies, 'last_reply_avatar' => $last_reply_avatar, 'last_reply_rough' => $timeago->inWords(date('d M Y, H:i', $sticky->topic_reply_date), $time_language), 'last_reply' => date('d M Y, H:i', $sticky->topic_reply_date), 'last_reply_username' => htmlspecialchars($user->IdToName($sticky->topic_last_user)), 'last_reply_mcname' => htmlspecialchars($user->IdToMCName($sticky->topic_last_user)), 'label' => $label);
}
// Clear out variables
$stickies = null;
$sticky = null;
// Latest discussions
// PAGINATION
// Set current page and number of records
$pagination->setCurrent($p);
$pagination->setTotal(count($topics));
$pagination->alwaysShowPagination();
// Get number of topics we should display on the page
$paginate = PaginateArray($p);
$n = $paginate[0];
$f = $paginate[1];
// Get the number we need to finish on ($d)
if (count($topics) > $f) {
$d = $p * 10;
} else {
$d = count($topics) - $n;
$d = $d + $n;
}
$template_array = array();
// Get a list of all topics from the forum, and paginate
while ($n < $d) {
示例6: View
include 'admin_header.php';
$view = new View();
$user = new User();
$pagination = new Pagination();
// get the actual pagenumber (for pagination)
if (isset($_GET['page'])) {
$page = intval($_GET['page']);
} else {
$page = 1;
}
// config pagination class
$pagination->setTable('users');
$pagination->setPageLink('users.php');
$pagination->setLimit(10);
$pagination->setPage($page);
$pagination->setTotal();
$pagination->setPages();
$pagination->setOffset();
// get the users data as array (for view)
$users = $pagination->getData();
?>
<!-- content wrapper -->
<div class="container-full">
<!-- page row -->
<div class="row">
<!-- sidebar -->
<div class="col-sm-2 sidebar-wrapper">
<ul class="sidebar-nav">
示例7: formatPagination
function formatPagination($current_page, $result_count)
{
global $search_results_per_page;
$pagination = new Pagination();
$pagination->setCurrent($current_page);
$pagination->setTotal($result_count);
$pagination->setRPP($search_results_per_page);
$pagination->setClasses(array("pagination", "pagination-right"));
return $pagination->parse();
}
示例8: array
if (!isset($result[1])) {
// Need to get corresponding topic
$result_topic = $queries->getWhere('topics', array('id', '=', $result[0]['topic_id']));
$merged_results[$result[0]['topic_id']][1] = array('topic_id' => $result_topic[0]->id, 'topic_title' => $result_topic[0]->topic_title, 'label' => $result_topic[0]->label);
$result_topic = null;
// clear out variable
}
}
}
// Reset array keys (for pagination)
$merged_results = array_values($merged_results);
//echo '<pre>', print_r($merged_results), '</pre>';
// Pagination
$pagination = new Pagination();
$pagination->setCurrent($p);
$pagination->setTotal(count($merged_results));
$pagination->alwaysShowPagination();
// Get number of users we should display on the page
$paginate = PaginateArray($p);
$n = $paginate[0];
$f = $paginate[1];
// Get the number we need to finish on ($d)
if (count($merged_results) > $f) {
$d = $p * 10;
} else {
$d = count($merged_results) - $n;
$d = $d + $n;
}
// Initialise HTMLPurifier
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
示例9: sprintf
<a href="<?php
echo $websiteUrl . 'movies/mv' . sprintf("%07s", $actormovie->movie_id) . '/';
?>
">Go To Movie</a>
</div>
</div>
<hr>
<?php
$num_rec_per_page = 10;
$page = isset($get['page']) ? $get['page'] : 1;
$start_from = ($page - 1) * $num_rec_per_page;
$query = "SELECT rt.*,mv.title,mv.release_date FROM " . $db_prefix . "ratings rt JOIN " . $db_prefix . "movies mv ON rt.movie_id=mv.movie_id WHERE rt.actor_id='{$actorid}' AND mv.movie_id='{$movieid}'";
$all = $db->sql_query($query);
$pagi = new Pagination();
$pagi->setCurrent($page);
$pagi->setTotal($all->num_rows);
$pagi->setRPP($num_rec_per_page);
$comments = $db->sql_query("{$query} ORDER BY rate_date DESC LIMIT {$start_from}, {$num_rec_per_page}");
?>
<section class="comment-list">
<h2>Ratings and Comments</h2>
<?php
if ($comments->num_rows > 0) {
while ($comment = $comments->fetch_object()) {
$user = fetchUserDetailsByID($comment->user_id);
?>
<article>
<div class="panel panel-default arrow left">
<div class="panel-body">
<header class="text-left">
<div class="comment-user">
示例10: switch
?>
"><?php
echo $infractions_language['view'];
?>
</a></td>
</tr>
<?php
$n++;
}
?>
</tbody>
</table>
</div>
<?php
$pagination->setCurrent($p);
$pagination->setTotal(count($all_infractions));
$pagination->alwaysShowPagination();
echo $pagination->parse();
} else {
// Viewing infraction
if (isset($_GET['type']) && $_GET["type"] !== "ban" && $_GET["type"] !== "kick" && $_GET["type"] !== "mute" && $_GET["type"] !== "temp_ban" && $_GET["type"] !== "warning" && $_GET['type'] !== 'temp_mute') {
Redirect::to('/infractions');
die;
}
if (!isset($_GET['id'])) {
Redirect::to('/infractions');
die;
}
// Get infraction type
switch ($_GET['type']) {
case 'ban':
示例11: confirm
} else {
$buttons .= $forum_language['lock_thread'];
}
$buttons .= '</a></li>
<li><a href="/forum/merge_thread/?tid=' . $tid . '">' . $forum_language['merge_thread'] . '</a></li>
<li><a href="/forum/delete_thread/?tid=' . $tid . '" onclick="return confirm(\'' . $forum_language['confirm_thread_deletion'] . '\')">' . $forum_language['delete_thread'] . '</a></li>
<li><a href="/forum/move_thread/?tid=' . $tid . '">' . $forum_language['move_thread'] . '</a></li>
<li><a href="/forum/sticky_thread/?tid=' . $tid . '">' . $forum_language['sticky_thread'] . '</a></li>
</ul>
</div>
</span>';
}
$smarty->assign('BUTTONS', $buttons);
// Pagination
$pagination->setCurrent($p);
$pagination->setTotal(count($posts));
$pagination->alwaysShowPagination();
// Get number of users we should display on the page
$paginate = PaginateArray($p);
$n = $paginate[0];
$f = $paginate[1];
// Get the number we need to finish on ($d)
if (count($posts) > $f) {
$d = $p * 10;
} else {
$d = count($posts) - $n;
$d = $d + $n;
}
$pagination = $pagination->parse();
// Print pagination
$smarty->assign('PAGINATION', $pagination);
示例12: PaginateArray
">
<input type="submit" style="float: right; margin-top: 10px;" class="btn btn-info btn-md" value="<?php
echo $general_language['submit'];
?>
">
</form>
</div>
<hr />
<?php
}
// Get all profile posts
$profile_posts = $queries->orderWhere('user_profile_wall_posts', 'user_id = ' . $profile_user[0]->id, 'time', 'DESC');
if (count($profile_posts)) {
// Pagination stuff
$pagination->setCurrent($p);
$pagination->setTotal(count($profile_posts));
$pagination->alwaysShowPagination();
// Get number of users we should display on the page
$paginate = PaginateArray($p);
$n = $paginate[0];
$f = $paginate[1];
// Get the number we need to finish on ($d)
if (count($profile_posts) > $f) {
$d = $p * 10;
} else {
$d = count($profile_posts) - $n;
$d = $d + $n;
}
while ($n < $d) {
// Get info about the user who's posted
$post_user = $queries->getWhere('users', array('id', '=', $profile_posts[$n]->author_id));
示例13: array
if ($_GET['p'] == 1) {
// Avoid bug in pagination class
echo '<script>window.location.replace("/admin/users/");</script>';
die;
}
$p = $_GET['p'];
}
} else {
$p = 1;
}
$users = $queries->orderAll("users", "USERNAME", "ASC");
$groups = $queries->getAll("groups", array("id", "<>", 0));
// instantiate; set current page; set number of records
$pagination = new Pagination();
$pagination->setCurrent($p);
$pagination->setTotal(count($users));
$pagination->alwaysShowPagination();
// Get number of users we should display on the page
$paginate = PaginateArray($p);
$n = $paginate[0];
$f = $paginate[1];
if (count($users) > $f) {
$d = $p * 10;
} else {
$d = count($users) - $n;
$d = $d + $n;
}
?>
<a href="/admin/users/?action=new" class="btn btn-default">New User</a>
<a href="/admin/donate_sync" class="btn btn-default">Synchronise with web store</a>
<span class="pull-right">
示例14: isset
$number = isset($_GET['number']) ? (int) $_GET['number'] : 0;
$number2 = isset($_GET['number2']) ? (int) $_GET['number2'] : 0;
if ($fundRaising != null) {
$startups = $Startup->searchByFundraisingDetails($fundRaising, $number, $number2, array('filter' => 'raising'));
} else {
$startups = $Startup->startupsWithRaising(array('query' => $query, 'type' => 'Startup', 'filter' => 'raising', 'page' => $page, 'per_page' => '3'));
}
} else {
$startups = $Startup->raising($page)['startups'];
}
$pagination_markup = "";
if ($raising['total'] > 3) {
require 'libs/Pagination.class';
$pagination = new Pagination();
$pagination->setCurrent($page);
$pagination->setTotal($raising['total']);
$pagination_markup = $pagination->parse();
}
if (isset($_GET['vd'])) {
vd($startups);
}
?>
<?php
include 'header.php';
?>
<div class="container">
<div class="row">
示例15: displayMerchant
//.........这里部分代码省略.........
if ($merchant_preorder) {
$tag_open = '<div class="uk-badge uk-badge-success">' . t("Pre-Order") . '</div>';
} else {
$tag_open = '<div class="uk-badge uk-badge-danger">' . t("Closed") . '</div>';
}
}
$rating = "<div class=\"rate-wrap\">\n\t\t\t<h6 class=\"rounded2\" data-uk-tooltip=\"{pos:'bottom-left'}\" title=\"{$rating_meanings}\" >" . number_format($ratings['ratings'], 1) . "</h6>\n\t\t\t<span>" . $ratings['votes'] . " " . Yii::t("default", "Votes") . "</span>\t\t\t\n\t\t\t</div>";
$merchant_id = $val['merchant_id'];
$lat = Yii::app()->functions->getOption("merchant_latitude", $merchant_id);
$long = Yii::app()->functions->getOption("merchant_longtitude", $merchant_id);
?>
<div class="links" data-id="<?php
echo $address;
?>
" >
<div class="uk-grid" id="restaurant-mini-list">
<div class="uk-width-3-10">
<a href="<?php
echo baseUrl() . "{$ccCon}/menu/merchant/" . $val['restaurant_slug'];
?>
">
<?php
if (!empty($val['merchant_logo'])) {
?>
<img class="uk-thumbnail uk-thumbnail-mini" src="<?php
echo Yii::app()->request->baseUrl . "/upload/" . $val['merchant_logo'];
?>
">
<?php
} else {
?>
<img class="uk-thumbnail uk-thumbnail-mini" src="<?php
echo Yii::app()->request->baseUrl . "/assets/images/thumbnail-medium.png";
?>
">
<?php
}
?>
</a>
</div>
<div class="uk-width-7-10">
<h5><a href="<?php
echo baseUrl() . "{$ccCon}/menu/merchant/" . $val['restaurant_slug'];
?>
">
<?php
echo $val['restaurant_name'];
?>
</a>
</h5>
<p class="uk-text-muted"><?php
echo $address;
?>
</p>
<a class="view-map" href="javascript:;" data-id="<?php
echo $address;
?>
" data-lat="<?php
echo $lat;
?>
" data-long="<?php
echo $long;
?>
" data-merchantname="<?php
echo ucwords($val['restaurant_name']);
?>
" >
<i class="fa fa-map-marker"></i>
<?php
echo Yii::t("default", "View Map");
?>
</a>
<?php
echo $tag_open;
?>
<?php
echo $rating;
?>
</div>
</div>
</div>
<?php
}
$path = Yii::getPathOfAlias('webroot') . "/protected/vendor";
require_once $path . "/Pagination/Pagination.class.php";
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$pagination = new Pagination();
$pagination->setCurrent($page);
$pagination->setRPP(10);
$pagination->setTotal($total_records);
echo $pagination->parse();
} else {
?>
<p class="uk-text-muted"><?php
echo Yii::t("default", "No data available");
?>
</p><?php
}
}