source: temp/trunk/html/admin/mail/preview.php @ 1328

Revision 1328, 2.8 KB checked in by naka, 20 years ago (diff)

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2
3require_once("../require.php");
4
5class LC_Page {
6    var $arrSession;
7    var $body;
8    var $list_data;
9
10    function LC_Page() {
11        $this->tpl_mainpage = 'mail/preview.tpl';
12    }
13}
14
15//---- ¥Ú¡¼¥¸½é´üÀßÄê
16$conn = new SC_DBConn();
17$objPage = new LC_Page();
18$objView = new SC_AdminView();
19$objSess = new SC_Session();
20$objDate = new SC_Date();
21
22// ǧ¾Ú²ÄÈݤÎȽÄê
23sfIsSuccess($objSess);
24
25
26if ( $_POST['body'] ){
27    $objPage->body = $_POST['body'];
28
29// HTML¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¤Î¥×¥ì¥Ó¥å¡¼
30} elseif ($_REQUEST["method"] == "template" && sfCheckNumLength($_REQUEST['id'])) {
31
32    $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ?";
33    $result = $conn->getAll($sql, array($_REQUEST["id"]));
34    $objPage->list_data = $result[0];
35   
36    //¥á¡¼¥ëôÅö¼Ì¿¿¤Îɽ¼¨
37    $objUpFile = new SC_UploadFile(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
38    $objUpFile->addFile("¥á¡¼¥ëôÅö¼Ì¿¿", 'charge_image', array('jpg'), IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
39    $objUpFile->setDBFileList($objPage->list_data);
40    // FormÍÑÇÛÎó¤òÅϤ¹¡£
41    $objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
42   
43    // ¥á¥¤¥ó¾¦ÉʤξðÊó¼èÆÀ
44    $sql = "SELECT name, main_image, point_rate, deliv_fee, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
45    $main = $conn->getAll($sql, array($objPage->list_data["main_product_id"]));
46    $objPage->list_data["main"] = $main[0];
47
48    // ¥µ¥Ö¾¦ÉʤξðÊó¼èÆÀ
49    $sql = "SELECT product_id, name, main_list_image, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
50    $k = 0;
51    $l = 0;
52    for ($i = 1; $i <= 12; $i ++) {
53        if ($l == 4) {
54            $l = 0;
55            $k ++;
56        }
57        $result = "";
58        $j = sprintf("%02d", $i);
59        if ($i > 0 && $i < 5 ) $k = 0;
60        if ($i > 4 && $i < 9 ) $k = 1;
61        if ($i > 8 && $i < 13 ) $k = 2;
62       
63        if (is_numeric($objPage->list_data["sub_product_id" .$j])) {
64            $result = $conn->getAll($sql, array($objPage->list_data["sub_product_id" .$j]));
65            $objPage->list_data["sub"][$k][$l] = $result[0];
66            $objPage->list_data["sub"][$k]["data_exists"] = "OK";   //Åö³ºÃʤ˥ǡ¼¥¿¤¬£±¤Ä°Ê¾å¸ºß¤¹¤ë¥Õ¥é¥°
67        }
68        $l ++;
69    }
70    $objPage->tpl_mainpage = 'mail/html_template.tpl';
71
72} elseif ( sfCheckNumLength($_GET['send_id']) || sfCheckNumLength($_GET['id'])){
73    if (is_numeric($_GET["send_id"])) {
74        $id = $_GET["send_id"];
75        $sql = "SELECT body, mail_method FROM dtb_send_history WHERE send_id = ?";
76    } else {
77        $sql = "SELECT body, mail_method FROM dtb_mailmaga_template WHERE template_id = ?";
78        $id = $_GET['id'];
79    }
80    $result = $conn->getAll($sql, array($id));
81   
82   
83    if ( $result ){
84        if ( $result[0]["mail_method"] == 2 ){
85            // ¥Æ¥­¥¹¥È·Á¼°¤Î»þ¤Ï¥¿¥°Ê¸»ú¤ò¥¨¥¹¥±¡¼¥×
86            $objPage->escape_flag = 1;
87        }
88        $objPage->body = $result[0]["body"];
89    }
90
91}
92   
93$objView->assignobj($objPage);
94$objView->display($objPage->tpl_mainpage);
95
96?>
Note: See TracBrowser for help on using the repository browser.