[15688] | 1 | <?php |
---|
| 2 | /* |
---|
[16582] | 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
[18701] | 5 | * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved. |
---|
[15688] | 6 | * |
---|
| 7 | * http://www.lockon.co.jp/ |
---|
[16582] | 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. |
---|
[15688] | 22 | */ |
---|
| 23 | |
---|
| 24 | // {{{ requires |
---|
[20534] | 25 | require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php'; |
---|
[15688] | 26 | |
---|
| 27 | /** |
---|
| 28 | * ヘッダ, フッタ編集 のページクラス. |
---|
| 29 | * |
---|
| 30 | * @package Page |
---|
| 31 | * @author LOCKON CO.,LTD. |
---|
| 32 | * @version $Id$ |
---|
| 33 | */ |
---|
[20345] | 34 | class LC_Page_Admin_Design_Header extends LC_Page_Admin_Ex { |
---|
[15688] | 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; |
---|
[20538] | 50 | $this->tpl_subno = 'header'; |
---|
| 51 | $this->tpl_mainno = 'design'; |
---|
[19715] | 52 | $this->tpl_subtitle = 'ヘッダー/フッター設定'; |
---|
[20560] | 53 | $masterData = new SC_DB_MasterData_Ex(); |
---|
| 54 | $this->arrDeviceType = $masterData->getMasterData('mtb_device_type'); |
---|
[15688] | 55 | } |
---|
| 56 | |
---|
| 57 | /** |
---|
| 58 | * Page のプロセス. |
---|
| 59 | * |
---|
| 60 | * @return void |
---|
| 61 | */ |
---|
| 62 | function process() { |
---|
[19661] | 63 | $this->action(); |
---|
| 64 | $this->sendResponse(); |
---|
| 65 | } |
---|
[15688] | 66 | |
---|
[19661] | 67 | /** |
---|
| 68 | * Page のアクション. |
---|
| 69 | * |
---|
[19713] | 70 | * FIXME テンプレートの取得方法を要修正 |
---|
| 71 | * |
---|
[19661] | 72 | * @return void |
---|
| 73 | */ |
---|
| 74 | function action() { |
---|
[19725] | 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 | } |
---|
[20275] | 82 | $this->device_type_id = $device_type_id; |
---|
[19725] | 83 | |
---|
[20560] | 84 | //サブタイトルの追加 |
---|
| 85 | $this->tpl_subtitle .= ' - ' . $this->arrDeviceType[$device_type_id]; |
---|
| 86 | |
---|
[20275] | 87 | // テンプレートのパス |
---|
| 88 | $template_path = $this->lfGetTemplatePath($device_type_id); |
---|
[15688] | 89 | |
---|
| 90 | // データ更新処理 |
---|
[20275] | 91 | if (isset($_POST['division']) && $_POST['division'] != '') { |
---|
| 92 | $division = $_POST['division']; |
---|
| 93 | $content = $_POST[$division]; // TODO no checked? |
---|
[15688] | 94 | |
---|
[20044] | 95 | switch ($this->getMode()) { |
---|
| 96 | case 'regist': |
---|
[20275] | 97 | // 正規のテンプレートに書き込む |
---|
| 98 | $template = $template_path . '/' . $division . '.tpl'; |
---|
| 99 | $this->lfUpdateTemplate($template, $content); |
---|
[15688] | 100 | $this->tpl_onload="alert('登録が完了しました。');"; |
---|
[20044] | 101 | break; |
---|
| 102 | default: |
---|
[20275] | 103 | // なにもしない |
---|
[20044] | 104 | break; |
---|
[15688] | 105 | } |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | // テキストエリアに表示 |
---|
[20618] | 109 | $this->header_data = file_get_contents($template_path . '/header.tpl'); |
---|
| 110 | $this->footer_data = file_get_contents($template_path . '/footer.tpl'); |
---|
[15688] | 111 | |
---|
[20275] | 112 | // ブラウザタイプ |
---|
| 113 | $this->browser_type = isset($_POST['browser_type']) ? $_POST['browser_type'] : ""; |
---|
| 114 | } |
---|
[15688] | 115 | |
---|
[20275] | 116 | protected function lfUpdateTemplate($template, $content) { |
---|
[20538] | 117 | $fp = fopen($template,'w'); |
---|
[20275] | 118 | fwrite($fp, $content); |
---|
| 119 | fclose($fp); |
---|
[15688] | 120 | } |
---|
| 121 | |
---|
[20275] | 122 | protected function lfGetTemplatePath($device_type_id) { |
---|
| 123 | $objLayout = new SC_Helper_PageLayout_Ex(); |
---|
| 124 | return $objLayout->getTemplatePath($device_type_id); |
---|
| 125 | } |
---|
| 126 | |
---|
[15688] | 127 | /** |
---|
| 128 | * デストラクタ. |
---|
| 129 | * |
---|
| 130 | * @return void |
---|
| 131 | */ |
---|
| 132 | function destroy() { |
---|
| 133 | parent::destroy(); |
---|
| 134 | } |
---|
| 135 | } |
---|