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

Revision 19805, 5.4 KB checked in by Seasoft, 13 years ago (diff)

#834(パラメータの定数名に「URL」を含むにもかかわらず、パスのみのものがある) 一部実装

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