本文整理汇总了PHP中Paginate::setCurPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Paginate::setCurPage方法的具体用法?PHP Paginate::setCurPage怎么用?PHP Paginate::setCurPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paginate
的用法示例。
在下文中一共展示了Paginate::setCurPage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Factory
$factory = new Factory($target);
$time_start = _get('time_start');
$time_end = _get('time_end');
$type = _get('type');
$sort = _get('sort');
$conds = compact('time_start', 'time_end', 'type', 'sort');
switch ($argument) {
case 'stone':
$types = $config['st_type'];
$account = $factory->stAccount();
break;
case 'account':
$types = $config['account_type'];
$account = $factory->account();
$orders = Order::listOrder(array('factory_id' => $factory->id));
break;
default:
throw new Exception("arg: {$argument}", 1);
break;
}
$per_page = 50;
$total = $account->countHistory($conds);
$paging = new Paginate($per_page, $total);
$paging->setCurPage(_get('p') ?: 1);
$history = $account->history(array_merge($conds, array('limit' => $per_page, 'offset' => $paging->offset())));
$matter = "{$view}.{$argument}";
} else {
$matter = $view . ($target ? ".{$target}" : '');
}
$view = 'board?master';
$page['scripts'][] = 'jquery.validate.min';
示例2: exit
!defined('IN_PTF') && exit('ILLEGAL EXECUTION');
/**
* @author ryan <cumt.xiaochi@gmail.com>
*/
switch ($target) {
case 'gold_price':
$time_start = _get('time_start');
$time_end = _get('time_end');
$type = _get('type');
$material_types = $config['material_type_map'];
$p = _get('p') ?: 1;
$per_page = 50;
$total = Price::total($type);
$paging = new Paginate($per_page, $total);
$paging->setCurPage($p);
$prices = Price::history(array('type' => $type, 'limit' => $per_page, 'offset' => $paging->offset()));
break;
case 'sale':
$divide = _get('divide') ?: 'day';
// day or month
$format_map = array('day' => 'Y年m月d日', 'month' => 'Y年m月');
$data = Statistics::saleRecord(compact('divide'));
$date = new DateTime();
$format = $format_map[$divide];
$date->sub(DateInterval::createFromDateString("1 {$divide}"));
$end = $date->format($format);
$date->sub(DateInterval::createFromDateString("59 {$divide}"));
$start = $date->format($format);
break;
default:
示例3: exit
<?php
!defined('IN_PTF') && exit('ILLEGAL EXECUTION');
/**
* @file index
* @author ryan <cumt.xiaochi@gmail.com>
* @created Jun 27, 2012 6:24:01 PM
*/
if ($user_type === 'Admin') {
redirect('order/all');
}
if ($user_type === 'SuperAdmin') {
redirect('admin');
}
list($name, $no, $stone_size, $type) = _get('name', 'no', 'stone_size', 'type');
$mode = _get('mode') ?: 'list';
$cur_page = _get('p') ?: 1;
$page_num_map = array('list' => 10, 'image' => 24);
$per_page = $page_num_map[$mode];
$conds = compact('name', 'no', 'stone_size', 'type');
$total = Product::count($conds);
$paging = new Paginate($per_page, $total);
$paging->setCurPage($cur_page);
$products = Product::read(array_merge($conds, array('limit' => $per_page, 'offset' => $paging->offset())));
$chosen_map = SesState::chosenProducts();
$types = Product::types();
$view .= '?master';
$page['scripts'][] = 'widget';