[15307] | 1 | <?php |
---|
| 2 | /* |
---|
[16582] | 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
[22206] | 5 | * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved. |
---|
[15307] | 6 | * |
---|
| 7 | * http://www.lockon.co.jp/ |
---|
[16582] | 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. |
---|
[15307] | 22 | */ |
---|
| 23 | |
---|
[20534] | 24 | require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php'; |
---|
[15307] | 25 | |
---|
| 26 | /** |
---|
| 27 | * ポイント設定 のページクラス. |
---|
| 28 | * |
---|
| 29 | * @package Page |
---|
| 30 | * @author LOCKON CO.,LTD. |
---|
| 31 | * @version $Id$ |
---|
| 32 | */ |
---|
[22856] | 33 | class LC_Page_Admin_Basis_Point extends LC_Page_Admin_Ex |
---|
[22567] | 34 | { |
---|
[15307] | 35 | /** |
---|
| 36 | * Page を初期化する. |
---|
| 37 | * |
---|
| 38 | * @return void |
---|
| 39 | */ |
---|
[22567] | 40 | function init() |
---|
| 41 | { |
---|
[15307] | 42 | parent::init(); |
---|
| 43 | $this->tpl_mainpage = 'basis/point.tpl'; |
---|
| 44 | $this->tpl_subno = 'point'; |
---|
| 45 | $this->tpl_mainno = 'basis'; |
---|
[20911] | 46 | $this->tpl_maintitle = '基本情報管理'; |
---|
[15307] | 47 | $this->tpl_subtitle = 'ポイント設定'; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | /** |
---|
| 51 | * Page のプロセス. |
---|
| 52 | * |
---|
| 53 | * @return void |
---|
| 54 | */ |
---|
[22567] | 55 | function process() |
---|
| 56 | { |
---|
[19661] | 57 | $this->action(); |
---|
| 58 | $this->sendResponse(); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | /** |
---|
| 62 | * Page のアクション. |
---|
| 63 | * |
---|
| 64 | * @return void |
---|
| 65 | */ |
---|
[22567] | 66 | function action() |
---|
| 67 | { |
---|
[20171] | 68 | $objDb = new SC_Helper_DB_Ex(); |
---|
[20970] | 69 | // パラメーター管理クラス |
---|
[20501] | 70 | $objFormParam = new SC_FormParam_Ex(); |
---|
[20970] | 71 | // パラメーター情報の初期化 |
---|
[20339] | 72 | $this->lfInitParam($objFormParam); |
---|
[15307] | 73 | // POST値の取得 |
---|
[20339] | 74 | $objFormParam->setParam($_POST); |
---|
[15307] | 75 | |
---|
[21376] | 76 | if ($objDb->sfGetBasisExists()) { |
---|
[20538] | 77 | $this->tpl_mode = 'update'; |
---|
[15307] | 78 | } else { |
---|
[20538] | 79 | $this->tpl_mode = 'insert'; |
---|
[15307] | 80 | } |
---|
[20166] | 81 | |
---|
[21441] | 82 | if (!empty($_POST)) { |
---|
[15307] | 83 | // 入力値の変換 |
---|
[20339] | 84 | $objFormParam->convParam(); |
---|
| 85 | $this->arrErr = $objFormParam->checkError(); |
---|
[15307] | 86 | |
---|
[21441] | 87 | if (count($this->arrErr) == 0) { |
---|
| 88 | switch ($this->getMode()) { |
---|
[21526] | 89 | case 'update': |
---|
| 90 | $this->lfUpdateData($objFormParam->getHashArray()); // 既存編集 |
---|
| 91 | break; |
---|
| 92 | case 'insert': |
---|
| 93 | $this->lfInsertData($objFormParam->getHashArray()); // 新規作成 |
---|
| 94 | break; |
---|
| 95 | default: |
---|
| 96 | break; |
---|
[15307] | 97 | } |
---|
| 98 | // 再表示 |
---|
| 99 | $this->tpl_onload = "window.alert('ポイント設定が完了しました。');"; |
---|
| 100 | } |
---|
| 101 | } else { |
---|
[22841] | 102 | $arrRet = $objDb->sfGetBasisData(); |
---|
[20339] | 103 | $objFormParam->setParam($arrRet); |
---|
[15307] | 104 | } |
---|
[20339] | 105 | $this->arrForm = $objFormParam->getFormParamList(); |
---|
[15307] | 106 | } |
---|
| 107 | |
---|
[20970] | 108 | /* パラメーター情報の初期化 */ |
---|
[22567] | 109 | function lfInitParam(&$objFormParam) |
---|
| 110 | { |
---|
[21514] | 111 | $objFormParam->addParam('ポイント付与率', 'point_rate', PERCENTAGE_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
| 112 | $objFormParam->addParam('会員登録時付与ポイント', 'welcome_point', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
[15307] | 113 | } |
---|
| 114 | |
---|
[22567] | 115 | function lfUpdateData($post) |
---|
| 116 | { |
---|
[15307] | 117 | // 入力データを渡す。 |
---|
[20297] | 118 | $sqlval = $post; |
---|
[21185] | 119 | $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; |
---|
[20507] | 120 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
[15307] | 121 | // UPDATEの実行 |
---|
[23091] | 122 | $objQuery->update('dtb_baseinfo', $sqlval); |
---|
[15307] | 123 | } |
---|
| 124 | |
---|
[22567] | 125 | function lfInsertData($post) |
---|
| 126 | { |
---|
[15307] | 127 | // 入力データを渡す。 |
---|
[20297] | 128 | $sqlval = $post; |
---|
[21810] | 129 | $sqlval['id'] = 1; |
---|
[21185] | 130 | $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; |
---|
[20507] | 131 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
[15307] | 132 | // INSERTの実行 |
---|
[23091] | 133 | $objQuery->insert('dtb_baseinfo', $sqlval); |
---|
[15307] | 134 | } |
---|
| 135 | } |
---|