source: branches/feature-module-update/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php @ 16357

Revision 16357, 5.1 KB checked in by nanasess, 17 years ago (diff)

クラス化対応

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • Property svn:mime-type set to text/x-httpd-php
Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7
8// {{{ requires
9require_once(CLASS_PATH . "pages/LC_Page.php");
10
11/**
12 * 受注メール管理 のページクラス.
13 *
14 * @package Page
15 * @author LOCKON CO.,LTD.
16 * @version $Id$
17 */
18class LC_Page_Admin_Order_Mail extends LC_Page {
19
20    // }}}
21    // {{{ functions
22
23    /**
24     * Page を初期化する.
25     *
26     * @return void
27     */
28    function init() {
29        parent::init();
30        $this->tpl_mainpage = 'order/mail.tpl';
31        $this->tpl_subnavi = 'order/subnavi.tpl';
32        $this->tpl_mainno = 'order';
33        $this->tpl_subno = 'index';
34        $this->tpl_subtitle = '受注管理';
35
36        $masterData = new SC_DB_MasterData_Ex();
37        $this->arrMAILTEMPLATE = $masterData->getMasterData("mtb_mail_template");
38
39    }
40
41    /**
42     * Page のプロセス.
43     *
44     * @return void
45     */
46    function process() {
47
48        $objView = new SC_AdminView();
49        $objSess = new SC_Session();
50        SC_Utils_Ex::sfIsSuccess($objSess);
51
52        // 検索パラメータの引き継ぎ
53        foreach ($_POST as $key => $val) {
54            if (ereg("^search_", $key)) {
55                $this->arrSearchHidden[$key] = $val;
56            }
57        }
58
59        $this->tpl_order_id = $_POST['order_id'];
60
61        // パラメータ管理クラス
62        $objFormParam = new SC_FormParam();
63        // パラメータ情報の初期化
64        $this->lfInitParam($objFormParam);
65
66        $objMail = new SC_Helper_Mail_Ex();
67
68        switch($_POST['mode']) {
69        case 'pre_edit':
70            break;
71        case 'return':
72            // POST値の取得
73            $objFormParam->setParam($_POST);
74            break;
75        case 'send':
76            // POST値の取得
77            $objFormParam->setParam($_POST);
78            // 入力値の変換
79            $objFormParam->convParam();
80            $this->arrErr = $objFormParam->checkerror();
81            // メールの送信
82            if (count($this->arrErr) == 0) {
83                // 注文受付メール
84                $objMail->sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer']);
85            }
86            $this->sendRedirect($this->getLocation(URL_SEARCH_ORDER));
87            exit;
88            break;
89        case 'confirm':
90            // POST値の取得
91            $objFormParam->setParam($_POST);
92            // 入力値の変換
93            $objFormParam->convParam();
94            // 入力値の引き継ぎ
95            $this->arrHidden = $objFormParam->getHashArray();
96            $this->arrErr = $objFormParam->checkerror();
97            // メールの送信
98            if (count($this->arrErr) == 0) {
99                // 注文受付メール(送信なし)
100                $objSendMail = $objMail->sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer'], false);
101                // 確認ページの表示
102                $this->tpl_subject = $_POST['subject'];
103                $this->tpl_body = mb_convert_encoding( $objSendMail->body, CHAR_CODE, "auto" );
104                $this->tpl_to = $objSendMail->tpl_to;
105                $this->tpl_mainpage = 'order/mail_confirm.tpl';
106
107                $objView->assignobj($this);
108                $objView->display(MAIN_FRAME);
109
110                exit;
111            }
112            break;
113        case 'change':
114            // POST値の取得
115            $objFormParam->setValue('template_id', $_POST['template_id']);
116            if(SC_Utils_Ex::sfIsInt($_POST['template_id'])) {
117                $objQuery = new SC_Query();
118                $where = "template_id = ?";
119                $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($_POST['template_id']));
120                $objFormParam->setParam($arrRet[0]);
121            }
122            break;
123        }
124
125        $objQuery = new SC_Query();
126        $col = "send_date, subject, template_id, send_id";
127        $where = "order_id = ?";
128        $objQuery->setorder("send_date DESC");
129
130        if(SC_Utils_Ex::sfIsInt($_POST['order_id'])) {
131            $this->arrMailHistory = $objQuery->select($col, "dtb_mail_history", $where, array($_POST['order_id']));
132        }
133
134        $this->arrForm = $objFormParam->getFormParamList();
135        $objView->assignobj($this);
136        $objView->display(MAIN_FRAME);
137    }
138
139    /**
140     * デストラクタ.
141     *
142     * @return void
143     */
144    function destroy() {
145        parent::destroy();
146    }
147
148
149    /* パラメータ情報の初期化 */
150    function lfInitParam(&$objFormParam) {
151
152        $objFormParam->addParam("テンプレート", "template_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
153        $objFormParam->addParam("メールタイトル", "subject", STEXT_LEN, "KVa",  array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
154        $objFormParam->addParam("ヘッダー", "header", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
155        $objFormParam->addParam("フッター", "footer", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
156    }
157}
158?>
Note: See TracBrowser for help on using the repository browser.