source: trunk/data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php @ 18758

Revision 18758, 4.6 KB checked in by kajiwara, 14 years ago (diff)

EC-CUBE Ver2.4.4 分コミット。詳細はこちら( http://www.ec-cube.net/release/detail.php?release_id=223

  • 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        $conn = new SC_DBConn();
65        $objView = new SC_AdminView();
66        $objSess = new SC_Session();
67        $objQuery = new SC_Query();
68
69        // 認証可否の判定
70        SC_Utils_Ex::sfIsSuccess($objSess);
71
72        // パラメータ管理クラス
73        $this->objFormParam = new SC_FormParam();
74        // パラメータ情報の初期化
75        $this->lfInitParam();
76        // POST値の取得
77        $this->objFormParam->setParam($_POST);
78
79        $cnt = $objQuery->count("dtb_baseinfo");
80
81        if ($cnt > 0) {
82            $this->tpl_mode = "update";
83        } else {
84            $this->tpl_mode = "insert";
85        }
86
87        if(isset($_POST['mode']) && !empty($_POST['mode'])) {
88            // 入力値の変換
89            $this->objFormParam->convParam();
90            $this->arrErr = $this->objFormParam->checkError();
91
92            if(count($this->arrErr) == 0) {
93                switch($_POST['mode']) {
94                case 'update':
95                    $this->lfUpdateData(); // 既存編集
96                    break;
97                case 'insert':
98                    $this->lfInsertData(); // 新規作成
99                    break;
100                default:
101                    break;
102                }
103                // 再表示
104                //sfReload();
105                $this->tpl_onload = "window.alert('ポイント設定が完了しました。');";
106            }
107        } else {
108            $arrCol = $this->objFormParam->getKeyList(); // キー名一覧を取得
109            $col    = SC_Utils_Ex::sfGetCommaList($arrCol);
110            $arrRet = $objQuery->select($col, "dtb_baseinfo");
111            // POST値の取得
112            $this->objFormParam->setParam($arrRet[0]);
113        }
114
115        $this->arrForm = $this->objFormParam->getFormParamList();
116        $objView->assignobj($this);
117        $objView->display(MAIN_FRAME);
118    }
119
120    /**
121     * デストラクタ.
122     *
123     * @return void
124     */
125    function destroy() {
126        parent::destroy();
127    }
128
129    /* パラメータ情報の初期化 */
130    function lfInitParam() {
131        $this->objFormParam->addParam("ポイント付与率", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
132        $this->objFormParam->addParam("会員登録時付与ポイント", "welcome_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
133    }
134
135    function lfUpdateData() {
136        // 入力データを渡す。
137        $sqlval = $this->objFormParam->getHashArray();
138        $sqlval['update_date'] = 'Now()';
139        $objQuery = new SC_Query();
140        // UPDATEの実行
141        $ret = $objQuery->update("dtb_baseinfo", $sqlval);
142    }
143
144    function lfInsertData() {
145        // 入力データを渡す。
146        $sqlval = $this->objFormParam->getHashArray();
147        $sqlval['update_date'] = 'Now()';
148        $objQuery = new SC_Query();
149        // INSERTの実行
150        $ret = $objQuery->insert("dtb_baseinfo", $sqlval);
151    }
152}
153?>
Note: See TracBrowser for help on using the repository browser.