1 | <?php |
---|
2 | /* |
---|
3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
---|
4 | * |
---|
5 | * http://www.lockon.co.jp/ |
---|
6 | */ |
---|
7 | require_once("../require.php"); |
---|
8 | |
---|
9 | class LC_Page { |
---|
10 | function LC_Page() { |
---|
11 | $this->tpl_mainpage = 'products/product_rank.tpl'; |
---|
12 | $this->tpl_subnavi = 'products/subnavi.tpl'; |
---|
13 | $this->tpl_mainno = 'products'; |
---|
14 | $this->tpl_subno = 'product_rank'; |
---|
15 | $this->tpl_subtitle = '商品並び替え'; |
---|
16 | } |
---|
17 | } |
---|
18 | |
---|
19 | $conn = new SC_DBConn(); |
---|
20 | $objPage = new LC_Page(); |
---|
21 | $objView = new SC_AdminView(); |
---|
22 | $objSess = new SC_Session(); |
---|
23 | |
---|
24 | // 認証可否の判定 |
---|
25 | sfIsSuccess($objSess); |
---|
26 | |
---|
27 | $objPage->tpl_pageno = $_POST['pageno']; |
---|
28 | |
---|
29 | // 通常時は親カテゴリを0に設定する。 |
---|
30 | $objPage->arrForm['parent_category_id'] = $_POST['parent_category_id']; |
---|
31 | |
---|
32 | switch($_POST['mode']) { |
---|
33 | case 'up': |
---|
34 | $where = "category_id = " . addslashes($_POST['parent_category_id']); |
---|
35 | sfRankUp("dtb_products", "product_id", $_POST['product_id'], $where); |
---|
36 | break; |
---|
37 | case 'down': |
---|
38 | $where = "category_id = " . addslashes($_POST['parent_category_id']); |
---|
39 | sfRankDown("dtb_products", "product_id", $_POST['product_id'], $where); |
---|
40 | break; |
---|
41 | case 'move': |
---|
42 | $key = "pos-".$_POST['product_id']; |
---|
43 | $input_pos = mb_convert_kana($_POST[$key], "n"); |
---|
44 | if(sfIsInt($input_pos)) { |
---|
45 | $where = "category_id = " . addslashes($_POST['parent_category_id']); |
---|
46 | sfMoveRank("dtb_products", "product_id", $_POST['product_id'], $input_pos, $where); |
---|
47 | } |
---|
48 | break; |
---|
49 | case 'tree': |
---|
50 | // カテゴリの切替は、ページ番号をクリアする。 |
---|
51 | $objPage->tpl_pageno = ""; |
---|
52 | break; |
---|
53 | default: |
---|
54 | break; |
---|
55 | } |
---|
56 | |
---|
57 | $objPage->arrTree = sfGetCatTree($_POST['parent_category_id']); |
---|
58 | $objPage->arrProductsList = lfGetProduct($_POST['parent_category_id']); |
---|
59 | |
---|
60 | $objView->assignobj($objPage); |
---|
61 | $objView->display(MAIN_FRAME); |
---|
62 | |
---|
63 | //----------------------------------------------------------------------------------------------------------------------------------- |
---|
64 | /* 商品読み込み */ |
---|
65 | function lfGetProduct($category_id) { |
---|
66 | global $objPage; |
---|
67 | |
---|
68 | $objQuery = new SC_Query(); |
---|
69 | $col = "product_id, name, main_list_image, rank, product_code"; |
---|
70 | $table = "vw_products_nonclass AS noncls "; |
---|
71 | $where = "del_flg = 0 AND category_id = ?"; |
---|
72 | |
---|
73 | // 行数の取得 |
---|
74 | $linemax = $objQuery->count("dtb_products", $where, array($category_id)); |
---|
75 | // 順位、該当件数表示用 |
---|
76 | $objPage->tpl_linemax = $linemax; |
---|
77 | |
---|
78 | $objNavi = new SC_PageNavi($objPage->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX); |
---|
79 | $startno = $objNavi->start_row; |
---|
80 | $objPage->tpl_strnavi = $objNavi->strnavi; // Navi表示文字列 |
---|
81 | $objPage->tpl_pagemax = $objNavi->max_page; // ページ最大数(「上へ下へ」表示判定用) |
---|
82 | $objPage->tpl_disppage = $objNavi->now_page; // 表示ページ番号(「上へ下へ」表示判定用) |
---|
83 | |
---|
84 | // 取得範囲の指定(開始行番号、行数のセット) |
---|
85 | if(DB_TYPE != "mysql") $objQuery->setlimitoffset(SEARCH_PMAX, $startno); |
---|
86 | |
---|
87 | $objQuery->setorder("rank DESC"); |
---|
88 | |
---|
89 | // viewも絞込みをかける(mysql用) |
---|
90 | sfViewWhere("&&noncls_where&&", $where, array($category_id), $objQuery->order . " " . $objQuery->setlimitoffset(SEARCH_PMAX, $startno, true)); |
---|
91 | |
---|
92 | $arrRet = $objQuery->select($col, $table, $where, array($category_id)); |
---|
93 | return $arrRet; |
---|
94 | } |
---|
95 | |
---|
96 | ?> |
---|