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

Revision 20116, 5.3 KB checked in by nanasess, 13 years ago (diff)
  • svn properties を再設定
  • 再設定用のスクリプト追加
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • 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        switch($this->getMode()) {
85            case 'edit':
86                // 入力値の変換
87                $this->objFormParam->convParam();
88
89                // エラーチェック
90                $this->arrErr = $this->lfCheckError();
91                if(count($this->arrErr) == 0) {
92                    $this->lfSiteControlData($_POST['control_id']);
93                    // javascript実行
94                    $this->tpl_onload = "alert('更新が完了しました。');";
95                }
96
97                break;
98            default:
99                break;
100        }
101
102        // サイト管理情報の取得
103        $arrSiteControlList = $this->lfGetControlList();
104        $masterData = new SC_DB_MasterData_Ex();
105
106        // プルダウンの作成
107        for ($i = 0; $i < count($arrSiteControlList); $i++) {
108            switch ($arrSiteControlList[$i]["control_id"]) {
109                // トラックバック
110                case SITE_CONTROL_TRACKBACK:
111                    $arrSiteControlList[$i]["control_area"]
112                            = $masterData->getMasterData("mtb_site_control_track_back");
113                    break;
114                // アフィリエイト
115                case SITE_CONTROL_AFFILIATE:
116                    $arrSiteControlList[$i]["control_area"]
117                            = $masterData->getMasterData("mtb_site_control_affiliate");
118                    break;
119                default:
120                    break;
121            }
122        }
123
124        $this->arrControlList = $arrSiteControlList;
125    }
126
127    /**
128     * デストラクタ.
129     *
130     * @return void
131     */
132    function destroy() {
133        parent::destroy();
134    }
135
136    // サイト管理情報の取得
137    function lfGetControlList() {
138        $objQuery = new SC_Query();
139        // サイト管理情報の取得
140        $sql = "SELECT * FROM dtb_site_control ";
141        $sql .= "WHERE del_flg = 0";
142        $arrRet = $objQuery->getAll($sql);
143        return $arrRet;
144    }
145
146    /* パラメータ情報の初期化 */
147    function lfInitParam() {
148        $this->objFormParam->addParam("設定状況", "control_flg", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
149    }
150
151    /* 入力内容のチェック */
152    function lfCheckError() {
153        // 入力データを渡す。
154        $arrRet =  $this->objFormParam->getHashArray();
155        $objErr = new SC_CheckError($arrRet);
156        $objErr->arrErr = $this->objFormParam->checkError();
157
158        return $objErr->arrErr;
159    }
160
161    /* DBへデータを登録する */
162    function lfSiteControlData($control_id = "") {
163        $objQuery = new SC_Query();
164        $sqlval = $this->objFormParam->getHashArray();
165        $sqlval['update_date'] = 'Now()';
166
167        // 新規登録
168        if($control_id == "") {
169            // INSERTの実行
170            //$sqlval['creator_id'] = $_SESSION['member_id'];
171            $sqlval['create_date'] = 'Now()';
172            $objQuery->nextVal("dtb_site_control_control_id");
173            $objQuery->insert("dtb_site_control", $sqlval);
174        // 既存編集
175        } else {
176            $where = "control_id = ?";
177            $objQuery->update("dtb_site_control", $sqlval, $where, array($control_id));
178        }
179    }
180}
181?>
Note: See TracBrowser for help on using the repository browser.