Пример #1
0
!defined('IN_PTF') && exit('ILLEGAL EXECUTION');
/**
 * @author  ryan <*****@*****.**>
 */
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:
        throw new Exception("unkown target: {$target}");
Пример #2
0
    $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';
Пример #3
0
<?php 
require_once "admin/includes/init.php";
$page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
$item_per_page = 2;
$item_total_count = Photo::count_all();
$paginate = new Paginate($page, $item_per_page, $item_total_count);
$sql = "SELECT * FROM photos LIMIT {$item_per_page} OFFSET {$paginate->offset()}";
$photos = Photo::find_by_query($sql);
//$photos=Photo::find_all();
?>

<?php 
include "includes/header.php";
?>


        <div class="row">

            <!-- Blog Entries Column -->
            <div class="col-md-8">

  <p style="color: red;"><?php 
echo $session->message();
?>
</p>

            </div>
        </div>

<!---->
Пример #4
0
<?php

include 'includes/header.php';
include 'admin/includes/init.php';
$current_page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
$items_per_page = 2;
$items_total_count = Photo::count_all();
$paginate = new Paginate($current_page, $items_per_page, $items_total_count);
$sql = "SELECT * FROM photos LIMIT " . $items_per_page . " OFFSET " . $paginate->offset();
$photos = Photo::find_this_query($sql);
?>


        <div class="row">

            <!-- Blog Entries Column -->
            <div class="col-md-12">
                <div class="thumbnails row">
                <?php 
foreach ($photos as $photo) {
    ?>

                    <div class="col-xs-6 col-md3">
                        <a class="thumbnail" href="photo.php?id=<?php 
    echo $photo->id;
    ?>
">
                            <img class="img-responsive home-page-photo" src="admin/<?php 
    echo $photo->picture_path();
    ?>
" alt="">
 /**
  * Get SQL OFFSET clause to find.
  * 
  * @return int
  */
 private static function offset()
 {
     return self::$offset = self::$page * self::limit() - self::limit();
 }
Пример #6
0
        // get some divs
        if ($by_ajax && is_numeric($target) && preg_match('/get_.+_div/', $action)) {
            include FrameFile::controller('order.get_div');
            exit;
        }
        // 对订单的操作,通过表单post过来的
        if ($action && $by_post && is_numeric($target)) {
            include FrameFile::controller('order.control');
            exit;
        }
        list($customer, $username, $factory) = _get('customer', 'username', 'factory');
        $conds = array_merge($conds, compact('username', 'factory'));
        $page['styles'][] = 'admin';
        break;
    default:
        throw new Exception("unkown user type: {$user_type}");
        break;
}
$conds['customer'] = $customer;
$per_page = 50;
$total = Order::count($conds);
$paging = new Paginate($per_page, $total);
$paging->setCurPage(_get('p') ?: 1);
$orders = Order::listOrder(array_merge(array('limit' => $per_page, 'offset' => $paging->offset()), $conds));
// we don't need these two lines
if (empty($orders)) {
    $orders = array();
}
$matter = $view;
$view = 'board?master';
$page['scripts'][] = 'jquery.validate.min';
Пример #7
0
<?php

!defined('IN_PTF') && exit('ILLEGAL EXECUTION');
/**
 * @file    index
 * @author  ryan <*****@*****.**>
 * @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';
Пример #8
0
        default:
            throw new Exception("unkown action: {$action}");
            break;
    }
}
$types = Product::types();
switch ($target) {
    case '':
        list($name, $no, $type, $sort1, $sort2) = _get('name', 'no', 'type', 'sort1', 'sort2');
        $sort = $sort1 ? $sort1 . ' ' . $sort2 : '';
        $p = _get('p') ?: 1;
        $per_page = 50;
        $total = Product::count(array('name' => $name, 'no' => $no, 'type' => $type));
        $paging = new Paginate($per_page, $total);
        $paging->setCurPage($p);
        $products = Product::listProduct(array('limit' => $per_page, 'offset' => $paging->offset(), 'name' => $name, 'no' => $no, 'type' => $type, 'sort' => $sort));
        break;
    case 'post':
        $types = Product::types();
        list($name, $no, $type, $material, $weight, $rabbet_start, $rabbet_end, $small_stone, $st_weight, $remark) = _post('name', 'no', 'type', 'material', 'weight', 'rabbet_start', 'rabbet_end', 'small_stone', 'st_weight', 'remark');
        $image1 = _post('image1');
        $image1_400 = _post('image1_400');
        $image1_thumb = _post('image1_thumb');
        $image2 = _post('image2');
        $image2_400 = _post('image2_400');
        $image2_thumb = _post('image2_thumb');
        $image3 = _post('image3');
        $image3_400 = _post('image3_400');
        $image3_thumb = _post('image3_thumb');
        $material = _post('material');
        if ($material) {