source: branches/version-2/data/class/pages/admin/contents/LC_Page_Admin_Contents_CampaignDesign.php @ 17653

Revision 17653, 5.9 KB checked in by takegami, 15 years ago (diff)

#366修正

  • 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
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2007 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_Contents_CampaignDesign extends LC_Page {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_mainpage = 'contents/campaign_design.tpl';
47        $this->tpl_subnavi = 'contents/subnavi.tpl';
48        $this->tpl_subno = "campaign";
49        $this->tpl_mainno = 'contents';
50        $this->header_row = 13;
51        $this->contents_row = 13;
52        $this->footer_row = 13;
53        $this->tpl_subtitle = 'キャンペーンデザイン編集';
54    }
55
56    /**
57     * Page のプロセス.
58     *
59     * @return void
60     */
61    function process() {
62        $objView = new SC_AdminView();
63        $objQuery = new SC_Query();
64
65        // 認証可否の判定
66        $objSess = new SC_Session();
67        SC_Utils_Ex::sfIsSuccess($objSess);
68
69        // キャンペーンデータを引き継ぎ
70        if($_POST['mode'] != "") {
71            $arrForm = $_POST;
72        } else {
73            $arrForm = $_GET;
74        }
75
76        // 正しく値が取得できない場合はキャンペーンTOPへ
77        if($arrForm['campaign_id'] == "" || $arrForm['status'] == "") {
78            $this->sendRedirect($this->getLocation(URL_CAMPAIGN_TOP));
79            exit;
80        }
81
82        switch($arrForm['status']) {
83        case 'active':
84            $status = CAMPAIGN_TEMPLATE_ACTIVE;
85            $this->tpl_campaign_title = "キャンペーン中デザイン編集";
86            break;
87        case 'end':
88            $status = CAMPAIGN_TEMPLATE_END;
89            $this->tpl_campaign_title = "キャンペーン終了デザイン編集";
90            break;
91        default:
92            break;
93        }
94
95        // ディレクトリ名を取得名
96        $directory_name = $objQuery->get("dtb_campaign", "directory_name", "campaign_id = ?", array($arrForm['campaign_id']));
97        // キャンペーンテンプレート格納ディレクトリ
98        $campaign_dir = CAMPAIGN_TEMPLATE_PATH . $directory_name . "/" .$status;
99
100        switch($_POST['mode']) {
101        case 'regist':
102            // ファイルを更新
103            SC_Utils_Ex::sfWriteFile($arrForm['header'], $campaign_dir."header.tpl", "w");
104            SC_Utils_Ex::sfWriteFile($arrForm['contents'], $campaign_dir."contents.tpl", "w");
105            SC_Utils_Ex::sfWriteFile($arrForm['footer'], $campaign_dir."footer.tpl", "w");
106            // サイトフレーム作成
107            $site_frame  = $arrForm['header']."\n";
108            $site_frame .= '<script type="text/javascript" src="<!--{$TPL_DIR}-->js/site.js"></script>'."\n";
109            $site_frame .= '<script type="text/javascript" src="<!--{$TPL_DIR}-->js/navi.js"></script>'."\n";
110            $site_frame .= '<!--{include file=$tpl_mainpage}-->'."\n";
111            $site_frame .= $arrForm['footer']."\n";
112            SC_Utils_Ex::sfWriteFile($site_frame, $campaign_dir."site_frame.tpl", "w");
113
114            // 完了メッセージ(プレビュー時は表示しない)
115            $this->tpl_onload="alert('登録が完了しました。');";
116            break;
117        case 'preview':
118            // プレビューを書き出し別窓で開く
119            SC_Utils_Ex::sfWriteFile($arrForm['header'] . $arrForm['contents'] . $arrForm['footer'], $campaign_dir."preview.tpl", "w");
120            $this->tpl_onload = "win02('./campaign_preview.php?status=". $arrForm['status'] ."&campaign_id=". $arrForm['campaign_id'] ."', 'preview', '600', '400');";
121            $this->header_data = $arrForm['header'];
122            $this->contents_data = $arrForm['contents'];
123            $this->footer_data = $arrForm['footer'];
124            break;
125        case 'return':
126            // 登録ページへ戻る
127            $this->sendRedirect($this->getLocation(URL_CAMPAIGN_TOP));
128            exit;
129            break;
130        default:
131            break;
132        }
133
134        if ($arrForm['header_row'] != ''){
135            $this->header_row = $arrForm['header_row'];
136        }
137        if ($arrForm['contents_row'] != ''){
138            $this->contents_row = $arrForm['contents_row'];
139        }
140        if ($arrForm['footer_row'] != ''){
141            $this->footer_row = $arrForm['footer_row'];
142        }
143
144        if($_POST['mode'] != 'preview') {
145            // ヘッダーファイルの読み込み
146            $this->header_data = file_get_contents($campaign_dir . "header.tpl");
147            // コンテンツファイルの読み込み
148            $this->contents_data = file_get_contents($campaign_dir . "contents.tpl");
149            // フッターファイルの読み込み
150            $this->footer_data = file_get_contents($campaign_dir . "footer.tpl");
151        }
152
153        // フォームの値を格納
154        $this->arrForm = $arrForm;
155
156        // 画面の表示
157        $objView->assignobj($this);
158        $objView->display(MAIN_FRAME);
159    }
160
161    /**
162     * デストラクタ.
163     *
164     * @return void
165     */
166    function destroy() {
167        parent::destroy();
168    }
169}
170?>
Note: See TracBrowser for help on using the repository browser.