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


PHP Paginate::setCurPage方法代码示例

本文整理汇总了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';
开发者ID:name3,项目名称:cheng,代码行数:31,代码来源:factory.php

示例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:
开发者ID:name3,项目名称:cheng,代码行数:30,代码来源:statistics.php

示例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';
开发者ID:name3,项目名称:cheng,代码行数:28,代码来源:index.php


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