source: branches/beta/html/admin/order/mail.php @ 14676

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