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

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