[16357] | 1 | <?php |
---|
| 2 | /* |
---|
[16582] | 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
[16357] | 5 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
---|
| 6 | * |
---|
| 7 | * http://www.lockon.co.jp/ |
---|
[16582] | 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. |
---|
[16357] | 22 | */ |
---|
| 23 | |
---|
| 24 | // {{{ requires |
---|
| 25 | require_once(CLASS_PATH . "pages/LC_Page.php"); |
---|
| 26 | |
---|
| 27 | /** |
---|
| 28 | * 受注メール管理 のページクラス. |
---|
| 29 | * |
---|
| 30 | * @package Page |
---|
| 31 | * @author LOCKON CO.,LTD. |
---|
| 32 | * @version $Id$ |
---|
| 33 | */ |
---|
| 34 | class LC_Page_Admin_Order_Mail extends LC_Page { |
---|
| 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 | |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | /** |
---|
| 58 | * Page のプロセス. |
---|
| 59 | * |
---|
| 60 | * @return void |
---|
| 61 | */ |
---|
| 62 | function process() { |
---|
| 63 | |
---|
| 64 | $objView = new SC_AdminView(); |
---|
| 65 | $objSess = new SC_Session(); |
---|
| 66 | SC_Utils_Ex::sfIsSuccess($objSess); |
---|
| 67 | |
---|
| 68 | // 検索パラメータの引き継ぎ |
---|
| 69 | foreach ($_POST as $key => $val) { |
---|
| 70 | if (ereg("^search_", $key)) { |
---|
| 71 | $this->arrSearchHidden[$key] = $val; |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | $this->tpl_order_id = $_POST['order_id']; |
---|
| 76 | |
---|
| 77 | // パラメータ管理クラス |
---|
| 78 | $objFormParam = new SC_FormParam(); |
---|
| 79 | // パラメータ情報の初期化 |
---|
| 80 | $this->lfInitParam($objFormParam); |
---|
| 81 | |
---|
| 82 | $objMail = new SC_Helper_Mail_Ex(); |
---|
| 83 | |
---|
| 84 | switch($_POST['mode']) { |
---|
| 85 | case 'pre_edit': |
---|
| 86 | break; |
---|
| 87 | case 'return': |
---|
| 88 | // POST値の取得 |
---|
| 89 | $objFormParam->setParam($_POST); |
---|
| 90 | break; |
---|
| 91 | case 'send': |
---|
| 92 | // POST値の取得 |
---|
| 93 | $objFormParam->setParam($_POST); |
---|
| 94 | // 入力値の変換 |
---|
| 95 | $objFormParam->convParam(); |
---|
| 96 | $this->arrErr = $objFormParam->checkerror(); |
---|
| 97 | // メールの送信 |
---|
| 98 | if (count($this->arrErr) == 0) { |
---|
| 99 | // 注文受付メール |
---|
| 100 | $objMail->sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer']); |
---|
| 101 | } |
---|
| 102 | $this->sendRedirect($this->getLocation(URL_SEARCH_ORDER)); |
---|
| 103 | exit; |
---|
| 104 | break; |
---|
| 105 | case 'confirm': |
---|
| 106 | // POST値の取得 |
---|
| 107 | $objFormParam->setParam($_POST); |
---|
| 108 | // 入力値の変換 |
---|
| 109 | $objFormParam->convParam(); |
---|
| 110 | // 入力値の引き継ぎ |
---|
| 111 | $this->arrHidden = $objFormParam->getHashArray(); |
---|
| 112 | $this->arrErr = $objFormParam->checkerror(); |
---|
| 113 | // メールの送信 |
---|
| 114 | if (count($this->arrErr) == 0) { |
---|
| 115 | // 注文受付メール(送信なし) |
---|
| 116 | $objSendMail = $objMail->sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer'], false); |
---|
| 117 | // 確認ページの表示 |
---|
| 118 | $this->tpl_subject = $_POST['subject']; |
---|
| 119 | $this->tpl_body = mb_convert_encoding( $objSendMail->body, CHAR_CODE, "auto" ); |
---|
| 120 | $this->tpl_to = $objSendMail->tpl_to; |
---|
| 121 | $this->tpl_mainpage = 'order/mail_confirm.tpl'; |
---|
| 122 | |
---|
| 123 | $objView->assignobj($this); |
---|
| 124 | $objView->display(MAIN_FRAME); |
---|
| 125 | |
---|
| 126 | exit; |
---|
| 127 | } |
---|
| 128 | break; |
---|
| 129 | case 'change': |
---|
| 130 | // POST値の取得 |
---|
| 131 | $objFormParam->setValue('template_id', $_POST['template_id']); |
---|
| 132 | if(SC_Utils_Ex::sfIsInt($_POST['template_id'])) { |
---|
| 133 | $objQuery = new SC_Query(); |
---|
| 134 | $where = "template_id = ?"; |
---|
| 135 | $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($_POST['template_id'])); |
---|
| 136 | $objFormParam->setParam($arrRet[0]); |
---|
| 137 | } |
---|
| 138 | break; |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | $objQuery = new SC_Query(); |
---|
| 142 | $col = "send_date, subject, template_id, send_id"; |
---|
| 143 | $where = "order_id = ?"; |
---|
| 144 | $objQuery->setorder("send_date DESC"); |
---|
| 145 | |
---|
| 146 | if(SC_Utils_Ex::sfIsInt($_POST['order_id'])) { |
---|
| 147 | $this->arrMailHistory = $objQuery->select($col, "dtb_mail_history", $where, array($_POST['order_id'])); |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | $this->arrForm = $objFormParam->getFormParamList(); |
---|
| 151 | $objView->assignobj($this); |
---|
| 152 | $objView->display(MAIN_FRAME); |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | /** |
---|
| 156 | * デストラクタ. |
---|
| 157 | * |
---|
| 158 | * @return void |
---|
| 159 | */ |
---|
| 160 | function destroy() { |
---|
| 161 | parent::destroy(); |
---|
| 162 | } |
---|
| 163 | |
---|
| 164 | |
---|
| 165 | /* パラメータ情報の初期化 */ |
---|
| 166 | function lfInitParam(&$objFormParam) { |
---|
| 167 | |
---|
| 168 | $objFormParam->addParam("テンプレート", "template_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
| 169 | $objFormParam->addParam("メールタイトル", "subject", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK")); |
---|
[18158] | 170 | $objFormParam->addParam("ヘッダー", "header", LTEXT_LEN, "KVa", array("MAX_LENGTH_CHECK", "SPTAB_CHECK")); |
---|
| 171 | $objFormParam->addParam("フッター", "footer", LTEXT_LEN, "KVa", array("MAX_LENGTH_CHECK", "SPTAB_CHECK")); |
---|
[16357] | 172 | } |
---|
| 173 | } |
---|
| 174 | ?> |
---|