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

Revision 19661, 5.2 KB checked in by nanasess, 13 years ago (diff)

source:branches/camp/camp-2_5-E のマージ

  • スマートフォン対応(#787)
  • プラグイン機能(#494)
  • 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/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_Design_Header extends LC_Page_Admin {
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    }
54
55    /**
56     * Page のプロセス.
57     *
58     * @return void
59     */
60    function process() {
61        $this->action();
62        $this->sendResponse();
63    }
64
65    /**
66     * Page のアクション.
67     *
68     * @return void
69     */
70    function action() {
71        // 認証可否の判定
72        $objSess = new SC_Session();
73        SC_Utils_Ex::sfIsSuccess($objSess);
74
75        $division = isset($_POST['division']) ? $_POST['division'] : "";
76        $pre_DIR = USER_INC_PATH . 'preview/';
77
78        // データ更新処理
79        if ($division != ''){
80            // プレビュー用テンプレートに書き込み
81            $fp = fopen($pre_DIR.$division.'.tpl',"w"); // TODO
82            fwrite($fp, $_POST[$division]);
83            fclose($fp);
84
85            // 登録時はプレビュー用テンプレートをコピーする
86            if ($_POST['mode'] == 'confirm'){
87                copy($pre_DIR.$division.".tpl", USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . $division . ".tpl");
88                // 完了メッセージ(プレビュー時は表示しない)
89                $this->tpl_onload="alert('登録が完了しました。');";
90
91                // テキストエリアの幅を元に戻す(処理の統一のため)
92                $_POST['header_row'] = "";
93                $_POST['footer_row'] = "";
94            }else if ($_POST['mode'] == 'preview'){
95                if ($division == "header") $this->header_prev = "on";
96                if ($division == "footer") $this->footer_prev = "on";
97            }
98
99            // ヘッダーファイルの読み込み(プレビューデータ)
100            $header_data = file_get_contents($pre_DIR . "header.tpl");
101
102            // フッターファイルの読み込み(プレビューデータ)
103            $footer_data = file_get_contents($pre_DIR . "footer.tpl");
104        }else{
105            // postでデータが渡されなければ新規読み込みと判断をし、プレビュー用データを正規のデータで上書きする
106            if (!is_dir($pre_DIR)) {
107                mkdir($pre_DIR);
108            }
109
110            // ユーザーパスにテンプレートが存在しなければ,
111            // 指定テンプレートから読み込む
112            $header_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "header.tpl";
113            if (!is_file($header_tpl)) {
114                $header_tpl = TEMPLATE_DIR . "header.tpl";
115            }
116            $footer_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "footer.tpl";
117            if (!is_file($footer_tpl)) {
118                $footer_tpl = TEMPLATE_DIR . "footer.tpl";
119            }
120
121            copy($header_tpl, $pre_DIR . "header.tpl");
122            copy($footer_tpl, $pre_DIR . "footer.tpl");
123
124            // ヘッダーファイルの読み込み
125            $header_data = file_get_contents($header_tpl);
126            // フッターファイルの読み込み
127            $footer_data = file_get_contents($footer_tpl);
128        }
129
130        // テキストエリアに表示
131        $this->header_data = $header_data;
132        $this->footer_data = $footer_data;
133
134        if (isset($_POST['header_row']) && $_POST['header_row'] != ''){
135            $this->header_row = $_POST['header_row'];
136        }
137
138        if (isset($_POST['footer_row']) && $_POST['footer_row'] != ''){
139            $this->footer_row = $_POST['footer_row'];
140        }
141
142        // ブラウザタイプ
143        $this->browser_type =
144            isset($_POST['browser_type']) ? $_POST['browser_type'] : "";
145    }
146
147    /**
148     * デストラクタ.
149     *
150     * @return void
151     */
152    function destroy() {
153        parent::destroy();
154    }
155}
156?>
Note: See TracBrowser for help on using the repository browser.