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

Revision 13806, 4.6 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// ɽ¼¨¥â¡¼¥ÉȽÄê
36if(sfIsInt($_GET['order_id'])) {
37    $objPage->disp_mode = true;
38    $order_id = $_GET['order_id'];
39} else {
40    $order_id = $_POST['order_id'];
41}
42$objPage->tpl_order_id = order_id;
43print_r($_POST);
44// DB¤«¤é¼õÃí¾ðÊó¤òÆÉ¤ß¹þ¤à
45lfGetOrderData($order_id);
46
47// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
48$objFormParam = new SC_FormParam();
49// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
50lfInitParam();
51
52switch($_POST['mode']) {
53case 'pre_edit':
54    break;
55case 'return':
56    // POSTÃͤμèÆÀ
57    $objFormParam->setParam($_POST);
58    break;
59case 'send':
60    // POSTÃͤμèÆÀ
61    $objFormParam->setParam($_POST);
62    // ÆþÎÏÃͤÎÊÑ´¹
63    $objFormParam->convParam();
64    $objPage->arrErr = $objFormParam->checkerror();
65    // ¥á¡¼¥ë¤ÎÁ÷¿®
66    if (count($objPage->arrErr) == 0) {
67        // Ãíʸ¼õÉե᡼¥ë
68        sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer']);
69    }
70    header("Location: " . URL_SEARCH_ORDER);
71    exit;
72    break; 
73case 'confirm':
74    // POSTÃͤμèÆÀ
75    $objFormParam->setParam($_POST);
76    // ÆþÎÏÃͤÎÊÑ´¹
77    $objFormParam->convParam();
78    // ÆþÎÏÃͤΰú¤­·Ñ¤®
79    $objPage->arrHidden = $objFormParam->getHashArray();
80    $objPage->arrErr = $objFormParam->checkerror();
81    // ¥á¡¼¥ë¤ÎÁ÷¿®
82    if (count($objPage->arrErr) == 0) {
83        // Ãíʸ¼õÉե᡼¥ë(Á÷¿®¤Ê¤·)
84        $objSendMail = sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer'], false);
85        // ³Îǧ¥Ú¡¼¥¸¤Îɽ¼¨
86        $objPage->tpl_subject = $objSendMail->subject;
87        $objPage->tpl_body = mb_convert_encoding( $objSendMail->body, "EUC-JP", "auto" );       
88        $objPage->tpl_to = $objSendMail->tpl_to;
89        $objPage->tpl_mainpage = 'order/mail_confirm.tpl';
90       
91        $objView->assignobj($objPage);
92        $objView->display(MAIN_FRAME);
93       
94        exit;   
95    }
96    break;
97case 'change':
98    // POSTÃͤμèÆÀ
99    $objFormParam->setValue('template_id', $_POST['template_id']);
100    if(sfIsInt($_POST['template_id'])) {
101        $objQuery = new SC_Query();
102        $where = "template_id = ?";
103        $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($_POST['template_id']));
104        $objFormParam->setParam($arrRet[0]);
105    }
106    break;
107}
108
109
110$objQuery = new SC_Query();
111$col = "send_date, subject, template_id, send_id";
112$where = "order_id = ?";
113$objQuery->setorder("send_date DESC");
114
115if(sfIsInt($_POST['order_id'])) {
116    $objPage->arrMailHistory = $objQuery->select($col, "dtb_mail_history", $where, array($_POST['order_id']));
117}
118
119$objPage->arrForm = $objFormParam->getFormParamList();
120$objView->assignobj($objPage);
121$objView->display(MAIN_FRAME);
122//-----------------------------------------------------------------------------------------------------------------------------------
123/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
124function lfInitParam() {
125    global $objFormParam;
126    $objFormParam->addParam("¥Æ¥ó¥×¥ì¡¼¥È", "template_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
127    $objFormParam->addParam("¥á¡¼¥ë¥¿¥¤¥È¥ë", "subject", STEXT_LEN, "KVa",  array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
128    $objFormParam->addParam("¥Ø¥Ã¥À¡¼", "header", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
129    $objFormParam->addParam("¥Õ¥Ã¥¿¡¼", "footer", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
130}
131
132function lfGetOrderData($order_id) {
133    global $objFormParam;
134    global $objPage;
135    if(sfIsInt($order_id)) {
136        // DB¤«¤é¼õÃí¾ðÊó¤òÆÉ¤ß¹þ¤à
137        $objQuery = new SC_Query();
138        $where = "order_id = ?";
139        $arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id));
140        //$objFormParam->setParam($arrRet[0]);
141        print_r($arrRet);
142        list($point, $total_point) = sfGetCustomerPoint($order_id, $arrRet[0]['use_point'], $arrRet[0]['add_point']);
143        $objFormParam->setValue('total_point', $total_point);
144        $objFormParam->setValue('point', $point);
145        $objPage->arrDisp = $arrRet[0];
146        // ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
147        $arrRet = lfGetOrderDetail($order_id);
148        $arrRet = sfSwapArray($arrRet);
149        $objPage->arrDisp = array_merge($objPage->arrDisp, $arrRet);
150        $objFormParam->setParam($arrRet);
151    }
152}
Note: See TracBrowser for help on using the repository browser.