source: branches/feature-module-update/html/admin/order/mail.php @ 15079

Revision 15079, 3.7 KB checked in by nanasess, 17 years ago (diff)

svn:mime-type application/x-httpd-php; charset=UTF-8 設定

  • Property svn:mime-type set to application/x-httpd-php; charset=UTF-8
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.