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

Revision 20345, 4.7 KB checked in by shutta, 13 years ago (diff)

LC_Page_Adminクラスのclass_extends対応。

  • 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_EX_REALDIR . "page_extends/admin/LC_Page_Admin_Ex.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_Ex {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_mainpage = 'basis/control.tpl';
47        $this->tpl_subnavi = 'basis/subnavi.tpl';
48        $this->tpl_mainno = 'basis';
49        $this->tpl_subno = 'control';
50        $this->tpl_subtitle = 'サイト管理設定';
51    }
52
53    /**
54     * Page のプロセス.
55     *
56     * @return void
57     */
58    function process() {
59        $this->action();
60        $this->sendResponse();
61    }
62
63    /**
64     * Page のアクション.
65     *
66     * @return void
67     */
68    function action() {
69
70        $objFormParam = new SC_FormParam();
71        $this->lfInitParam($objFormParam);
72        $objFormParam->setParam($_POST);
73
74        switch($this->getMode()) {
75            case 'edit':
76                // 入力値の変換
77                $objFormParam->convParam();
78
79                // エラーチェック
80                $this->arrErr = $objFormParam->checkError();
81                if(count($this->arrErr) == 0) {
82                    $this->lfSiteControlData($objFormParam->getHashArray());
83                    // javascript実行
84                    $this->tpl_onload = "alert('更新が完了しました。');";
85                }
86
87                break;
88            default:
89                break;
90        }
91
92        $this->arrControlList = $arrSiteControlList;
93    }
94
95    function lfGetControlList() {
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_AFFILIATE:
105                    $arrSiteControlList[$i]["control_area"]
106                            = $masterData->getMasterData("mtb_site_control_affiliate");
107                    break;
108                default:
109                    break;
110            }
111        }
112        return $arrSiteControlList;
113    }
114
115    /**
116     * デストラクタ.
117     *
118     * @return void
119     */
120    function destroy() {
121        parent::destroy();
122    }
123
124    // サイト管理情報の取得
125    function lfGetControlList() {
126        $objQuery =& SC_Query::getSingletonInstance();
127        // サイト管理情報の取得
128        $sql = "SELECT * FROM dtb_site_control ";
129        $sql .= "WHERE del_flg = 0";
130        $arrRet = $objQuery->getAll($sql);
131        return $arrRet;
132    }
133
134    /* パラメータ情報の初期化 */
135    function lfInitParam(&$objFormParam) {
136        $objFormParam->addParam("設定状況", "control_flg", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
137        $objFormParam->addParam('コントロールID', 'control_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
138    }
139
140    /* DBへデータを登録する */
141    function lfSiteControlData($post) {
142        $objQuery =& SC_Query::getSingletonInstance();
143        $sqlval = $post;
144        $sqlval['update_date'] = 'Now()';
145
146        // 新規登録
147        if($post['control_id'] == "") {
148            // INSERTの実行
149            $sqlval['create_date'] = 'Now()';
150            $objQuery->nextVal("dtb_site_control_control_id");
151            $objQuery->insert("dtb_site_control", $sqlval);
152        // 既存編集
153        } else {
154            $where = "control_id = ?";
155            $objQuery->update("dtb_site_control", $sqlval, $where, array($post['control_id']));
156        }
157    }
158}
159?>
Note: See TracBrowser for help on using the repository browser.