source: branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php @ 18820

Revision 18820, 4.5 KB checked in by nanasess, 14 years ago (diff)

#781(規格のデータベースを木構造に)

  • 規格の無い商品が品切れになってしまう不具合修正
  • 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_Basis_Point extends LC_Page {
35
36    // {{{ properties
37
38    /** フォームパラメータの配列 */
39    var $objFormParam;
40
41    // }}}
42    // {{{ functions
43
44    /**
45     * Page を初期化する.
46     *
47     * @return void
48     */
49    function init() {
50        parent::init();
51        $this->tpl_mainpage = 'basis/point.tpl';
52        $this->tpl_subnavi = 'basis/subnavi.tpl';
53        $this->tpl_subno = 'point';
54        $this->tpl_mainno = 'basis';
55        $this->tpl_subtitle = 'ポイント設定';
56    }
57
58    /**
59     * Page のプロセス.
60     *
61     * @return void
62     */
63    function process() {
64        $objView = new SC_AdminView();
65        $objSess = new SC_Session();
66        $objQuery = new SC_Query();
67
68        // 認証可否の判定
69        SC_Utils_Ex::sfIsSuccess($objSess);
70
71        // パラメータ管理クラス
72        $this->objFormParam = new SC_FormParam();
73        // パラメータ情報の初期化
74        $this->lfInitParam();
75        // POST値の取得
76        $this->objFormParam->setParam($_POST);
77
78        $cnt = $objQuery->count("dtb_baseinfo");
79
80        if ($cnt > 0) {
81            $this->tpl_mode = "update";
82        } else {
83            $this->tpl_mode = "insert";
84        }
85
86        if(isset($_POST['mode']) && !empty($_POST['mode'])) {
87            // 入力値の変換
88            $this->objFormParam->convParam();
89            $this->arrErr = $this->objFormParam->checkError();
90
91            if(count($this->arrErr) == 0) {
92                switch($_POST['mode']) {
93                case 'update':
94                    $this->lfUpdateData(); // 既存編集
95                    break;
96                case 'insert':
97                    $this->lfInsertData(); // 新規作成
98                    break;
99                default:
100                    break;
101                }
102                // 再表示
103                //sfReload();
104                $this->tpl_onload = "window.alert('ポイント設定が完了しました。');";
105            }
106        } else {
107            $arrCol = $this->objFormParam->getKeyList(); // キー名一覧を取得
108            $col    = SC_Utils_Ex::sfGetCommaList($arrCol);
109            $arrRet = $objQuery->select($col, "dtb_baseinfo");
110            // POST値の取得
111            $this->objFormParam->setParam($arrRet[0]);
112        }
113
114        $this->arrForm = $this->objFormParam->getFormParamList();
115        $objView->assignobj($this);
116        $objView->display(MAIN_FRAME);
117    }
118
119    /**
120     * デストラクタ.
121     *
122     * @return void
123     */
124    function destroy() {
125        parent::destroy();
126    }
127
128    /* パラメータ情報の初期化 */
129    function lfInitParam() {
130        $this->objFormParam->addParam("ポイント付与率", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
131        $this->objFormParam->addParam("会員登録時付与ポイント", "welcome_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
132    }
133
134    function lfUpdateData() {
135        // 入力データを渡す。
136        $sqlval = $this->objFormParam->getHashArray();
137        $sqlval['update_date'] = 'Now()';
138        $objQuery = new SC_Query();
139        // UPDATEの実行
140        $ret = $objQuery->update("dtb_baseinfo", $sqlval);
141    }
142
143    function lfInsertData() {
144        // 入力データを渡す。
145        $sqlval = $this->objFormParam->getHashArray();
146        $sqlval['update_date'] = 'Now()';
147        $objQuery = new SC_Query();
148        // INSERTの実行
149        $ret = $objQuery->insert("dtb_baseinfo", $sqlval);
150    }
151}
152?>
Note: See TracBrowser for help on using the repository browser.