source: branches/version-2_5-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php @ 19833

Revision 19833, 5.9 KB checked in by Seasoft, 13 years ago (diff)

#834(パラメータの定数名に「URL」を含むにもかかわらず、パスのみのものがある)

  • 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; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24// {{{ requires
25require_once(CLASS_REALDIR . "pages/admin/LC_Page_Admin.php");
26
27/**
28 * 受注メール管理 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Admin_Order_Mail extends LC_Page_Admin {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_mainpage = 'order/mail.tpl';
47        $this->tpl_subnavi = 'order/subnavi.tpl';
48        $this->tpl_mainno = 'order';
49        $this->tpl_subno = 'index';
50        $this->tpl_subtitle = '受注管理';
51
52        $masterData = new SC_DB_MasterData_Ex();
53        $this->arrMAILTEMPLATE = $masterData->getMasterData("mtb_mail_template");
54        $this->httpCacheControl('nocache');
55    }
56
57    /**
58     * Page のプロセス.
59     *
60     * @return void
61     */
62    function process() {
63        $this->action();
64        $this->sendResponse();
65    }
66
67    /**
68     * Page のアクション.
69     *
70     * @return void
71     */
72    function action() {
73        $objSess = new SC_Session();
74        SC_Utils_Ex::sfIsSuccess($objSess);
75
76        // 検索パラメータの引き継ぎ
77        foreach ($_POST as $key => $val) {
78            if (ereg("^search_", $key)) {
79                $this->arrSearchHidden[$key] = $val;
80            }
81        }
82
83        $this->tpl_order_id = $_POST['order_id'];
84
85        // パラメータ管理クラス
86        $objFormParam = new SC_FormParam();
87        // パラメータ情報の初期化
88        $this->lfInitParam($objFormParam);
89
90        $objMail = new SC_Helper_Mail_Ex();
91
92        switch($_POST['mode']) {
93        case 'pre_edit':
94            break;
95        case 'return':
96            // POST値の取得
97            $objFormParam->setParam($_POST);
98            break;
99        case 'send':
100            // POST値の取得
101            $objFormParam->setParam($_POST);
102            // 入力値の変換
103            $objFormParam->convParam();
104            $this->arrErr = $objFormParam->checkerror();
105            // メールの送信
106            if (count($this->arrErr) == 0) {
107                // 注文受付メール
108                $objMail->sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer']);
109            }
110            $this->objDisplay->redirect($this->getLocation(ADMIN_ORDER_URL_PATH));
111            exit;
112            break;
113        case 'confirm':
114            // POST値の取得
115            $objFormParam->setParam($_POST);
116            // 入力値の変換
117            $objFormParam->convParam();
118            // 入力値の引き継ぎ
119            $this->arrHidden = $objFormParam->getHashArray();
120            $this->arrErr = $objFormParam->checkerror();
121            // メールの送信
122            if (count($this->arrErr) == 0) {
123                // 注文受付メール(送信なし)
124                $objSendMail = $objMail->sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer'], false);
125                // 確認ページの表示
126                $this->tpl_subject = $_POST['subject'];
127                $this->tpl_body = mb_convert_encoding( $objSendMail->body, CHAR_CODE, "auto" );
128                $this->tpl_to = $objSendMail->tpl_to;
129                $this->tpl_mainpage = 'order/mail_confirm.tpl';
130                return;
131            }
132            break;
133        case 'change':
134            // POST値の取得
135            $objFormParam->setValue('template_id', $_POST['template_id']);
136            if(SC_Utils_Ex::sfIsInt($_POST['template_id'])) {
137                $objQuery = new SC_Query();
138                $where = "template_id = ?";
139                $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($_POST['template_id']));
140                $objFormParam->setParam($arrRet[0]);
141            }
142            break;
143        }
144
145        $objQuery = new SC_Query();
146        $col = "send_date, subject, template_id, send_id";
147        $where = "order_id = ?";
148        $objQuery->setOrder("send_date DESC");
149
150        if(SC_Utils_Ex::sfIsInt($_POST['order_id'])) {
151            $this->arrMailHistory = $objQuery->select($col, "dtb_mail_history", $where, array($_POST['order_id']));
152        }
153
154        $this->arrForm = $objFormParam->getFormParamList();
155    }
156
157    /**
158     * デストラクタ.
159     *
160     * @return void
161     */
162    function destroy() {
163        parent::destroy();
164    }
165
166
167    /* パラメータ情報の初期化 */
168    function lfInitParam(&$objFormParam) {
169
170        $objFormParam->addParam("テンプレート", "template_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
171        $objFormParam->addParam("メールタイトル", "subject", STEXT_LEN, "KVa",  array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
172        $objFormParam->addParam("ヘッダー", "header", LTEXT_LEN, "KVa", array("MAX_LENGTH_CHECK", "SPTAB_CHECK"));
173        $objFormParam->addParam("フッター", "footer", LTEXT_LEN, "KVa", array("MAX_LENGTH_CHECK", "SPTAB_CHECK"));
174    }
175}
176?>
Note: See TracBrowser for help on using the repository browser.