source: branches/beta/html/admin/contents/campaign_design.php @ 14676

Revision 14676, 4.2 KB checked in by adati, 17 years ago (diff)

1.4.0a-betaのマージ

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    // ¥×¥ì¥Ó¥å¡¼¤ò½ñ¤­½Ð¤·ÊÌÁë¤Ç³«¤¯
82    $preview  = $arrForm['header']."\n";
83    $preview .= '<script type="text/javascript" src="<!--{$smarty.const.URL_DIR}-->js/site.js"></script>'."\n";
84    $preview .= '<script type="text/javascript" src="<!--{$smarty.const.URL_DIR}-->js/navi.js"></script>'."\n";
85    $preview .= $arrForm['contents'] . "\n";
86    $preview .= $arrForm['footer']."\n";
87    sfWriteFile($preview, $campaign_dir."preview.tpl", "w");
88   
89    $objPage->tpl_onload = "win02('./campaign_preview.php?status=". $arrForm['status'] ."&campaign_id=". $arrForm['campaign_id'] ."', 'preview', '600', '400');";
90    $objPage->header_data = $arrForm['header'];
91    $objPage->contents_data = $arrForm['contents'];
92    $objPage->footer_data = $arrForm['footer'];
93    break;
94case 'return':
95    // ÅÐÏ¿¥Ú¡¼¥¸¤ØÌá¤ë
96    header("location: ".URL_CAMPAIGN_TOP);
97    break;
98default:   
99    break;
100}
101
102if ($arrForm['header_row'] != ''){
103    $objPage->header_row = $arrForm['header_row'];
104}
105if ($arrForm['contents_row'] != ''){
106    $objPage->contents_row = $arrForm['contents_row'];
107}
108if ($arrForm['footer_row'] != ''){
109    $objPage->footer_row = $arrForm['footer_row'];
110}
111
112if($_POST['mode'] != 'preview') {
113    // ¥Ø¥Ã¥À¡¼¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß
114    $objPage->header_data = file_get_contents($campaign_dir . "header.tpl");   
115    // ¥³¥ó¥Æ¥ó¥Ä¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß
116    $objPage->contents_data = file_get_contents($campaign_dir . "contents.tpl");   
117    // ¥Õ¥Ã¥¿¡¼¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß
118    $objPage->footer_data = file_get_contents($campaign_dir . "footer.tpl");
119}
120
121// ¥Õ¥©¡¼¥à¤ÎÃͤò³ÊǼ
122$objPage->arrForm = $arrForm;
123
124// ²èÌ̤Îɽ¼¨
125$objView->assignobj($objPage);
126$objView->display(MAIN_FRAME);
127
128//---------------------------------------------------------------------------------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.