source: tags/eccube-2.4.4/data/class/pages/admin/products/LC_Page_Admin_Products_ProductRank.php @ 18735

Revision 18735, 4.9 KB checked in by nanasess, 10 years ago (diff)

関数の命名規則の統一(#700)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to "Id Revision Date"
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24// {{{ requires
25require_once(CLASS_PATH . "pages/LC_Page.php");
26
27/**
28 * 商品並べ替え のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Admin_Products_ProductRank extends LC_Page {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_mainpage = 'products/product_rank.tpl';
47        $this->tpl_subnavi = 'products/subnavi.tpl';
48        $this->tpl_mainno = 'products';
49        $this->tpl_subno = 'product_rank';
50        $this->tpl_subtitle = '商品並び替え';
51    }
52
53    /**
54     * Page のプロセス.
55     *
56     * @return void
57     */
58    function process() {
59        $conn = new SC_DBConn();
60        $objView = new SC_AdminView();
61        $objSess = new SC_Session();
62        $objDb = new SC_Helper_DB_Ex();
63
64        // 認証可否の判定
65        SC_Utils_Ex::sfIsSuccess($objSess);
66
67        $this->tpl_pageno = isset($_POST['pageno']) ? $_POST['pageno'] : "";
68
69        // 通常時は親カテゴリを0に設定する。
70        $this->arrForm['parent_category_id'] =
71            isset($_POST['parent_category_id']) ? $_POST['parent_category_id'] : 0;
72
73        if (!isset($_POST['mode'])) $_POST['mode'] = "";
74        switch($_POST['mode']) {
75        case 'up':
76            $where = "category_id = " . SC_Utils_Ex::sfQuoteSmart($_POST['parent_category_id']);
77            $objDb->sfRankUp("dtb_product_categories", "product_id", $_POST['product_id'], $where);
78            break;
79        case 'down':
80            $where = "category_id = " . SC_Utils_Ex::sfQuoteSmart($_POST['parent_category_id']);
81            $objDb->sfRankDown("dtb_product_categories", "product_id", $_POST['product_id'], $where);
82            break;
83        case 'move':
84            $key = "pos-".$_POST['product_id'];
85            $input_pos = mb_convert_kana($_POST[$key], "n");
86            if(SC_Utils_Ex::sfIsInt($input_pos)) {
87                $where = "category_id = " . SC_Utils_Ex::sfQuoteSmart($_POST['parent_category_id']);
88                $objDb->sfMoveRank("dtb_product_categories", "product_id", $_POST['product_id'], $input_pos, $where);
89            }
90            break;
91        case 'tree':
92            // カテゴリの切替は、ページ番号をクリアする。
93            $this->tpl_pageno = "";
94            break;
95        default:
96            break;
97        }
98
99        $this->arrTree = $objDb->sfGetCatTree($this->arrForm['parent_category_id']);
100        $this->arrProductsList =
101            $this->lfGetProduct($this->arrForm['parent_category_id']);
102
103        $objView->assignobj($this);
104        $objView->display(MAIN_FRAME);
105    }
106
107    /**
108     * デストラクタ.
109     *
110     * @return void
111     */
112    function destroy() {
113        parent::destroy();
114    }
115
116    /* 商品読み込み */
117    function lfGetProduct($category_id) {
118        $objQuery = new SC_Query();
119        $col = "T2.product_id, name, main_list_image, T2.rank, product_code";
120        $table = "vw_products_nonclass AS noncls "
121            . " LEFT JOIN dtb_product_categories AS T2 USING (product_id)";
122        $where = "del_flg = 0 AND T2.category_id = ?";
123
124        // 行数の取得
125        $linemax = $objQuery->count($table, $where, array($category_id));
126        // 該当件数表示用
127        $this->tpl_linemax = $linemax;
128
129        $objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX);
130        $startno = $objNavi->start_row;
131        $this->tpl_start_row = $objNavi->start_row;
132        $this->tpl_strnavi = $objNavi->strnavi;     // Navi表示文字列
133        $this->tpl_pagemax = $objNavi->max_page;        // ページ最大数(「上へ下へ」表示判定用)
134        $this->tpl_disppage = $objNavi->now_page;   // 表示ページ番号(「上へ下へ」表示判定用)
135
136        // 取得範囲の指定(開始行番号、行数のセット)
137        if(DB_TYPE != "mysql") $objQuery->setLimitOffset(SEARCH_PMAX, $startno);
138
139        $objQuery->setOrder("rank DESC");
140
141        $arrRet = $objQuery->select($col, $table, $where, array($category_id));
142        return $arrRet;
143    }
144}
145?>
Note: See TracBrowser for help on using the repository browser.