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

Revision 18820, 5.3 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_Control extends LC_Page {
35
36    /** フォームパラメータの配列 */
37    var $objFormParam;
38
39    // }}}
40    // {{{ functions
41
42    /**
43     * Page を初期化する.
44     *
45     * @return void
46     */
47    function init() {
48        parent::init();
49        $this->tpl_mainpage = 'basis/control.tpl';
50        $this->tpl_subnavi = 'basis/subnavi.tpl';
51        $this->tpl_mainno = 'basis';
52        $this->tpl_subno = 'control';
53        $this->tpl_subtitle = 'サイト管理設定';
54    }
55
56    /**
57     * Page のプロセス.
58     *
59     * @return void
60     */
61    function process() {
62        $objView = new SC_AdminView();
63        $objSess = new SC_Session();
64
65        // 認証可否の判定
66        SC_Utils_Ex::sfIsSuccess($objSess);
67
68        // パラメータ管理クラス
69        $this->objFormParam = new SC_FormParam();
70        // パラメータ情報の初期化
71        $this->lfInitParam();
72        // POST値の取得
73        $this->objFormParam->setParam($_POST);
74
75        if (!isset($_POST['mode'])) $_POST['mode'] = "";
76
77        switch($_POST['mode']) {
78            case 'edit':
79                // 入力値の変換
80                $this->objFormParam->convParam();
81
82                // エラーチェック
83                $this->arrErr = $this->lfCheckError();
84                if(count($this->arrErr) == 0) {
85                    $this->lfSiteControlData($_POST['control_id']);
86                    // javascript実行
87                    $this->tpl_onload = "alert('更新が完了しました。');";
88                }
89
90                break;
91            default:
92                break;
93        }
94
95        // サイト管理情報の取得
96        $arrSiteControlList = $this->lfGetControlList();
97        $masterData = new SC_DB_MasterData_Ex();
98
99        // プルダウンの作成
100        for ($i = 0; $i < count($arrSiteControlList); $i++) {
101            switch ($arrSiteControlList[$i]["control_id"]) {
102                // トラックバック
103                case SITE_CONTROL_TRACKBACK:
104                    $arrSiteControlList[$i]["control_area"]
105                            = $masterData->getMasterData("mtb_site_control_track_back");
106                    break;
107                // アフィリエイト
108                case SITE_CONTROL_AFFILIATE:
109                    $arrSiteControlList[$i]["control_area"]
110                            = $masterData->getMasterData("mtb_site_control_affiliate");
111                    break;
112                default:
113                    break;
114            }
115        }
116
117        $this->arrControlList = $arrSiteControlList;
118        $objView->assignobj($this);
119        $objView->display(MAIN_FRAME);
120    }
121
122    /**
123     * デストラクタ.
124     *
125     * @return void
126     */
127    function destroy() {
128        parent::destroy();
129    }
130
131    // サイト管理情報の取得
132    function lfGetControlList() {
133        $objQuery = new SC_Query();
134        // サイト管理情報の取得
135        $sql = "SELECT * FROM dtb_site_control ";
136        $sql .= "WHERE del_flg = 0";
137        $arrRet = $objQuery->getAll($sql);
138        return $arrRet;
139    }
140
141    /* パラメータ情報の初期化 */
142    function lfInitParam() {
143        $this->objFormParam->addParam("設定状況", "control_flg", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
144    }
145
146    /* 入力内容のチェック */
147    function lfCheckError() {
148        // 入力データを渡す。
149        $arrRet =  $this->objFormParam->getHashArray();
150        $objErr = new SC_CheckError($arrRet);
151        $objErr->arrErr = $this->objFormParam->checkError();
152
153        return $objErr->arrErr;
154    }
155
156    /* DBへデータを登録する */
157    function lfSiteControlData($control_id = "") {
158        $objQuery = new SC_Query();
159        $sqlval = $this->objFormParam->getHashArray();
160        $sqlval['update_date'] = 'Now()';
161
162        // 新規登録
163        if($control_id == "") {
164            // INSERTの実行
165            //$sqlval['creator_id'] = $_SESSION['member_id'];
166            $sqlval['create_date'] = 'Now()';
167            $objQuery->nextVal("dtb_site_control_control_id");
168            $objQuery->insert("dtb_site_control", $sqlval);
169        // 既存編集
170        } else {
171            $where = "control_id = ?";
172            $objQuery->update("dtb_site_control", $sqlval, $where, array($control_id));
173        }
174    }
175}
176?>
Note: See TracBrowser for help on using the repository browser.