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

Revision 19661, 4.6 KB checked in by nanasess, 13 years ago (diff)

source:branches/camp/camp-2_5-E のマージ

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