source: branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php @ 20618

Revision 20618, 4.0 KB checked in by kotani, 13 years ago (diff)

#920 (デザイン管理でプレビューを押すとシステムエラー)

  • PC以外のデバイスではプレビューできないようにした
  • レイアウト設定以外ではプレビューできないようにした
  • 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_Design_Header 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 = 'design/header.tpl';
47        $this->tpl_subnavi  = 'design/subnavi.tpl';
48        $this->header_row = 13;
49        $this->footer_row = 13;
50        $this->tpl_subno = 'header';
51        $this->tpl_mainno = 'design';
52        $this->tpl_subtitle = 'ヘッダー/フッター設定';
53        $masterData = new SC_DB_MasterData_Ex();
54        $this->arrDeviceType = $masterData->getMasterData('mtb_device_type');
55    }
56
57    /**
58     * Page のプロセス.
59     *
60     * @return void
61     */
62    function process() {
63        $this->action();
64        $this->sendResponse();
65    }
66
67    /**
68     * Page のアクション.
69     *
70     * FIXME テンプレートの取得方法を要修正
71     *
72     * @return void
73     */
74    function action() {
75        // 端末種別IDを取得
76        if (isset($_REQUEST['device_type_id'])
77            && is_numeric($_REQUEST['device_type_id'])) {
78            $device_type_id = $_REQUEST['device_type_id'];
79        } else {
80            $device_type_id = DEVICE_TYPE_PC;
81        }
82        $this->device_type_id = $device_type_id;
83
84        //サブタイトルの追加
85        $this->tpl_subtitle .= ' - ' . $this->arrDeviceType[$device_type_id];
86
87        // テンプレートのパス
88        $template_path = $this->lfGetTemplatePath($device_type_id);
89
90        // データ更新処理
91        if (isset($_POST['division']) && $_POST['division'] != '') {
92            $division = $_POST['division'];
93            $content = $_POST[$division]; // TODO no checked?
94
95            switch ($this->getMode()) {
96            case 'regist':
97                // 正規のテンプレートに書き込む
98                $template = $template_path . '/' . $division . '.tpl';
99                $this->lfUpdateTemplate($template, $content);
100                $this->tpl_onload="alert('登録が完了しました。');";
101                break;
102            default:
103                // なにもしない
104                break;
105            }
106        }
107
108        // テキストエリアに表示
109        $this->header_data = file_get_contents($template_path . '/header.tpl');
110        $this->footer_data = file_get_contents($template_path . '/footer.tpl');
111
112        // ブラウザタイプ
113        $this->browser_type = isset($_POST['browser_type']) ? $_POST['browser_type'] : "";
114    }
115
116    protected function lfUpdateTemplate($template, $content) {
117        $fp = fopen($template,'w');
118        fwrite($fp, $content);
119        fclose($fp);
120    }
121
122    protected function lfGetTemplatePath($device_type_id) {
123        $objLayout = new SC_Helper_PageLayout_Ex();
124        return $objLayout->getTemplatePath($device_type_id);
125    }
126
127    /**
128     * デストラクタ.
129     *
130     * @return void
131     */
132    function destroy() {
133        parent::destroy();
134    }
135}
Note: See TracBrowser for help on using the repository browser.