source: trunk/data/class/pages/admin/basis/LC_Page_Admin_Basis_Control.php @ 18758

Revision 18758, 5.3 KB checked in by kajiwara, 14 years ago (diff)

EC-CUBE Ver2.4.4 分コミット。詳細はこちら( http://www.ec-cube.net/release/detail.php?release_id=223

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