source: branches/comu/html/admin/order/mail.php @ 12197

Revision 12197, 3.6 KB checked in by adati, 17 years ago (diff)

1.3.0正式版のマージ

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