source: branches/feature-module-update/html/admin/contents/campaign_design.php @ 15532

Revision 15532, 4.1 KB checked in by nanasess, 17 years ago (diff)

svn:mime-type 修正

  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once("../../require.php");
8require_once(DATA_PATH . "include/file_manager.inc");
9
10class LC_Page {
11
12    function LC_Page() {
13        $this->tpl_mainpage = 'contents/campaign_design.tpl';
14        $this->tpl_subnavi = 'contents/subnavi.tpl';
15        $this->tpl_subno = "campaign";
16        $this->tpl_mainno = 'contents';
17        $this->header_row = 13;
18        $this->contents_row = 13;
19        $this->footer_row = 13;     
20        $this->tpl_subtitle = 'キャンペーンデザイン編集';
21    }
22}
23
24$objPage = new LC_Page();
25$objView = new SC_AdminView();
26$objQuery = new SC_Query();
27
28// 認証可否の判定
29$objSess = new SC_Session();
30sfIsSuccess($objSess);
31
32// キャンペーンデータを引き継ぎ
33if($_POST['mode'] != "") {
34    $arrForm = $_POST;
35} else {
36    $arrForm = $_GET;
37}
38
39// 正しく値が取得できない場合はキャンペーンTOPへ
40if($arrForm['campaign_id'] == "" || $arrForm['status'] == "") {
41    header("location: ".URL_CAMPAIGN_TOP);
42}
43
44switch($arrForm['status']) {
45    case 'active':
46        $status = CAMPAIGN_TEMPLATE_ACTIVE;
47        $objPage->tpl_campaign_title = "キャンペーン中デザイン編集";
48        break;
49    case 'end':
50        $status = CAMPAIGN_TEMPLATE_END;
51        $objPage->tpl_campaign_title = "キャンペーン終了デザイン編集";
52        break;
53    default:
54        break;
55}
56
57// ディレクトリ名を取得名     
58$directory_name = $objQuery->get("dtb_campaign", "directory_name", "campaign_id = ?", array($arrForm['campaign_id']));
59// キャンペーンテンプレート格納ディレクトリ
60$campaign_dir = CAMPAIGN_TEMPLATE_PATH . $directory_name . "/" .$status;
61
62switch($_POST['mode']) {
63case 'regist':
64    // ファイルを更新
65    sfWriteFile($arrForm['header'], $campaign_dir."header.tpl", "w");
66    sfWriteFile($arrForm['contents'], $campaign_dir."contents.tpl", "w");
67    sfWriteFile($arrForm['footer'], $campaign_dir."footer.tpl", "w");
68    // サイトフレーム作成
69    $site_frame  = $arrForm['header']."\n";
70    $site_frame .= '<script type="text/javascript" src="<!--{$smarty.const.URL_DIR}-->js/site.js"></script>'."\n";
71    $site_frame .= '<script type="text/javascript" src="<!--{$smarty.const.URL_DIR}-->js/navi.js"></script>'."\n";
72    $site_frame .= '<!--{include file=$tpl_mainpage}-->'."\n";
73    $site_frame .= $arrForm['footer']."\n";
74    sfWriteFile($site_frame, $campaign_dir."site_frame.tpl", "w");
75   
76    // 完了メッセージ(プレビュー時は表示しない)
77    $objPage->tpl_onload="alert('登録が完了しました。');";
78    break;
79case 'preview':
80    // プレビューを書き出し別窓で開く
81    sfWriteFile($arrForm['header'] . $arrForm['contents'] . $arrForm['footer'], $campaign_dir."preview.tpl", "w");
82    $objPage->tpl_onload = "win02('./campaign_preview.php?status=". $arrForm['status'] ."&campaign_id=". $arrForm['campaign_id'] ."', 'preview', '600', '400');";
83    $objPage->header_data = $arrForm['header'];
84    $objPage->contents_data = $arrForm['contents'];
85    $objPage->footer_data = $arrForm['footer'];
86    break;
87case 'return':
88    // 登録ページへ戻る
89    header("location: ".URL_CAMPAIGN_TOP);
90    break;
91default:   
92    break;
93}
94
95if ($arrForm['header_row'] != ''){
96    $objPage->header_row = $arrForm['header_row'];
97}
98if ($arrForm['contents_row'] != ''){
99    $objPage->contents_row = $arrForm['contents_row'];
100}
101if ($arrForm['footer_row'] != ''){
102    $objPage->footer_row = $arrForm['footer_row'];
103}
104
105if($_POST['mode'] != 'preview') {
106    // ヘッダーファイルの読み込み
107    $objPage->header_data = file_get_contents($campaign_dir . "header.tpl");   
108    // コンテンツファイルの読み込み
109    $objPage->contents_data = file_get_contents($campaign_dir . "contents.tpl");   
110    // フッターファイルの読み込み
111    $objPage->footer_data = file_get_contents($campaign_dir . "footer.tpl");
112}
113
114// フォームの値を格納
115$objPage->arrForm = $arrForm;
116
117// 画面の表示
118$objView->assignobj($objPage);
119$objView->display(MAIN_FRAME);
120
121//---------------------------------------------------------------------------------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.