source: branches/dev/html/admin/order/mail.php @ 14150

Revision 14150, 4.9 KB checked in by nakanishi, 19 years ago (diff)
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");
8
9class LC_Page {
10    var $list_data;
11    var $mailTemp;
12    var $arrMAILTEMPLATE;
13    function LC_Page() {
14        $this->tpl_mainpage = 'order/mail.tpl';
15        $this->tpl_subnavi = 'order/subnavi.tpl';
16        $this->tpl_mainno = 'order';       
17        $this->tpl_subno = 'index';
18        $this->tpl_subtitle = '¼õÃí´ÉÍý';
19       
20       
21    }
22}
23
24$objPage = new LC_Page();
25$objView = new SC_AdminView();
26$objSess = new SC_Session();
27
28// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
29$objFormParam = new SC_FormParam();
30// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
31lfInitParam();
32
33// ǧ¾Ú²ÄÈݤÎȽÄê
34sfIsSuccess($objSess);
35
36// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
37foreach ($_POST as $key => $val) {
38    if (ereg("^search_", $key)) {
39        $objPage->arrSearchHidden[$key] = $val;
40    }
41}
42
43$objPage->tpl_order_id = $_POST['order_id'];
44print($_POST['order_id']);exit;
45// DB¤«¤é¼õÃí¾ðÊó¤òÆÉ¤ß¹þ¤à
46lfGetOrderData($_POST['order_id']);
47
48// --¥Æ¥ó¥×¥ì¡¼¥È¡¿¥×¥ë¥À¥¦¥ó¥á¥Ë¥å¡¼¤ÎºîÀ®
49$conn = new SC_DbConn();
50$sql = "SELECT * FROM dtb_mailtemplate WHERE del_flg=0 ORDER BY template_id ASC";
51
52$Temp = $conn->getAll($sql);//$Temp¤Ë¼èÆÀ¤·¤¿¥Ç¡¼¥¿¤ò°ì»þŪ¤Ë³ÊǼ
53//¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Ë½ÐÎϤ¹¤ë¤¿¤á¤ËÆó¼¡¸µÇÛÎó¤ËÂåÆþ¤¹¤ë
54for($i = 0;$i < count($Temp);$i++){
55    $arrTemplate[0][$i] = $Temp[$i]['template_id'];
56    $arrTemplate[1][$i] = $Temp[$i]['template_name'];
57}
58
59//¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Ø¥Ç¡¼¥¿¤òÂåÆþ
60$objPage->mailTemp = $arrTemplate;
61$objPage->arrMAILTEMPLATE = $arrTemplate[1];
62
63switch($_POST['mode']) {
64case 'pre_edit':
65    break;
66case 'return':
67    // POSTÃͤμèÆÀ
68    $objFormParam->setParam($_POST);
69    break;
70case 'send':
71    // POSTÃͤμèÆÀ
72    $objFormParam->setParam($_POST);
73    // ÆþÎÏÃͤÎÊÑ´¹
74    $objFormParam->convParam();
75    $objPage->arrErr = $objFormParam->checkerror();
76    // ¥á¡¼¥ë¤ÎÁ÷¿®
77    if (count($objPage->arrErr) == 0) {
78        // Ãíʸ¼õÉե᡼¥ë
79        sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['body']);
80    }
81    header("Location: " . URL_SEARCH_ORDER);
82    exit;
83    break; 
84case 'confirm':
85    // POSTÃͤμèÆÀ
86    $objFormParam->setParam($_POST);
87    // ÆþÎÏÃͤÎÊÑ´¹
88    $objFormParam->convParam();
89    // ÆþÎÏÃͤΰú¤­·Ñ¤®
90    $objPage->arrHidden = $objFormParam->getHashArray();
91    $objPage->arrErr = $objFormParam->checkerror();
92    // ¥á¡¼¥ë¤ÎÁ÷¿®
93    if (count($objPage->arrErr) == 0) {
94        // Ãíʸ¼õÉե᡼¥ë(Á÷¿®¤Ê¤·)
95        $objSendMail = sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['body'], false);
96        // ³Îǧ¥Ú¡¼¥¸¤Îɽ¼¨
97        $objPage->tpl_subject = $objSendMail->subject;
98        $objPage->tpl_body = mb_convert_encoding( $objSendMail->body, "EUC-JP", "auto" );       
99        $objPage->tpl_to = $objSendMail->tpl_to;
100        $objPage->tpl_mainpage = 'order/mail_confirm.tpl';
101       
102        $objView->assignobj($objPage);
103        $objView->display(MAIN_FRAME);
104       
105        exit;   
106    }
107    break;
108case 'change':
109    // POSTÃͤμèÆÀ
110   
111    $objFormParam->setValue('template_id', $_POST['template_id']);
112   
113    //¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ÇÁªÂò¤µ¤ì¤¿¥Æ¥ó¥×¥ì¡¼¥È̾¤ò¥Æ¥ó¥×¥ì¡¼¥ÈID¤È´ØÏ¢ÉÕ¤±¤ë
114    $_POST['template_id'] = $arrTemplate[0][$_POST['template_id']];
115    if(sfIsInt($_POST['template_id'])) {
116        $objQuery = new SC_Query();
117        $where = "template_id = ?";
118        $arrRet = $objQuery->select("subject, body", "dtb_mailtemplate", $where, array($_POST['template_id']));
119        $objFormParam->setParam($arrRet[0]);
120    }
121    break;
122}
123
124$objQuery = new SC_Query();
125$col = "send_date, subject, template_id, send_id";
126$where = "order_id = ?";
127$objQuery->setorder("send_date DESC");
128
129if(sfIsInt($_POST['order_id'])) {
130    $objPage->arrMailHistory = $objQuery->select($col, "dtb_mail_history", $where, array($_POST['order_id']));
131}
132
133$objPage->arrForm = $objFormParam->getFormParamList();
134$objView->assignobj($objPage);
135$objView->display(MAIN_FRAME);
136//-----------------------------------------------------------------------------------------------------------------------------------
137/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
138function lfInitParam() {
139    global $objFormParam;
140    $objFormParam->addParam("¥Æ¥ó¥×¥ì¡¼¥È", "template_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
141    $objFormParam->addParam("¥á¡¼¥ë¥¿¥¤¥È¥ë", "subject", STEXT_LEN, "KVa",  array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
142    $objFormParam->addParam("¥Ø¥Ã¥À¡¼", "body", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
143    //$objFormParam->addParam("¥Õ¥Ã¥¿¡¼", "footer", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
144}
145
146function lfGetOrderData($order_id) {
147    global $objFormParam;
148    global $objPage;
149    if(sfIsInt($order_id)) {
150        // DB¤«¤é¼õÃí¾ðÊó¤òÆÉ¤ß¹þ¤à
151        $objQuery = new SC_Query();
152        $where = "order_id = ?";
153        $arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id));
154        $objFormParam->setParam($arrRet[0]);
155        list($point, $total_point) = sfGetCustomerPoint($order_id, $arrRet[0]['use_point'], $arrRet[0]['add_point']);
156        $objFormParam->setValue('total_point', $total_point);
157        $objFormParam->setValue('point', $point);
158        $objPage->arrDisp = $arrRet[0];
159    }
160}
Note: See TracBrowser for help on using the repository browser.