source: branches/version-2_5-dev/data/class/pages/admin/mail/LC_Page_Admin_Mail_Preview.php @ 19805

Revision 19805, 5.4 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_Mail_Preview 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 = 'mail/preview.tpl';
47    }
48
49    /**
50     * Page のプロセス.
51     *
52     * @return void
53     */
54    function process() {
55        $this->action();
56        $this->sendResponse();
57    }
58
59    /**
60     * Page のアクション.
61     *
62     * @return void
63     */
64    function action() {
65        $objQuery = new SC_Query();
66        $objSess = new SC_Session();
67        $objDate = new SC_Date();
68
69        // 認証可否の判定
70        SC_Utils_Ex::sfIsSuccess($objSess);
71
72        if (!isset($_POST['body'])) $_POST['body'] = "";
73        if (!isset($_REQUEST['method'])) $_REQUEST['method'] = "";
74        if (!isset($_REQUEST['id'])) $_REQUEST['id'] = "";
75        if (!isset($_GET['send_id'])) $_GET['send_id'] = "";
76
77        if ( $_POST['body'] ){
78            $this->body = $_POST['body'];
79
80            // HTMLメールテンプレートのプレビュー
81        } elseif ($_REQUEST["method"] == "template"
82                  && SC_Utils_Ex::sfCheckNumLength($_REQUEST['id'])) {
83
84            $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ?";
85            $result = $objQuery->getAll($sql, array($_REQUEST["id"]));
86            $this->list_data = $result[0];
87
88            //メール担当写真の表示
89            $objUpFile = new SC_UploadFile(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
90            $objUpFile->addFile("メール担当写真", 'charge_image', array('jpg'), IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
91            $objUpFile->setDBFileList($this->list_data);
92            // Form用配列を渡す。
93            $this->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
94
95            // メイン商品の情報取得
96            // FIXME SC_Product クラスを使用した実装
97            $sql = "SELECT name, main_image, point_rate, deliv_fee, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass AS allcls WHERE product_id = ?";
98            $main = $objQuery->getAll($sql, array($this->list_data["main_product_id"]));
99            $this->list_data["main"] = $main[0];
100
101            // サブ商品の情報取得
102            // FIXME SC_Product クラスを使用した実装
103            $sql = "SELECT product_id, name, main_list_image, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
104            $k = 0;
105            $l = 0;
106            for ($i = 1; $i <= 12; $i ++) {
107                if ($l == 4) {
108                    $l = 0;
109                    $k ++;
110                }
111                $result = "";
112                $j = sprintf("%02d", $i);
113                if ($i > 0 && $i < 5 ) $k = 0;
114                if ($i > 4 && $i < 9 ) $k = 1;
115                if ($i > 8 && $i < 13 ) $k = 2;
116
117                if (is_numeric($this->list_data["sub_product_id" .$j])) {
118                    $result = $objQuery->getAll($sql, array($this->list_data["sub_product_id" .$j]));
119                    $this->list_data["sub"][$k][$l] = $result[0];
120                    $this->list_data["sub"][$k]["data_exists"] = "OK";  //当該段にデータが1つ以上存在するフラグ
121                }
122                $l ++;
123            }
124            $this->tpl_mainpage = 'mail/html_template.tpl';
125
126        } elseif (SC_Utils_Ex::sfCheckNumLength($_GET['send_id'])
127                   || SC_Utils_Ex::sfCheckNumLength($_GET['id'])){
128            if (is_numeric($_GET["send_id"])) {
129                $id = $_GET["send_id"];
130                $sql = "SELECT body, mail_method FROM dtb_send_history WHERE send_id = ?";
131            } else {
132                $sql = "SELECT body, mail_method FROM dtb_mailmaga_template WHERE template_id = ?";
133                $id = $_GET['id'];
134            }
135            $result = $objQuery->getAll($sql, array($id));
136
137            if ( $result ){
138                if ( $result[0]["mail_method"] == 2 ){
139                    // テキスト形式の時はタグ文字をエスケープ
140                    $this->escape_flag = 1;
141                }
142                $this->body = $result[0]["body"];
143            }
144        }
145    }
146
147    /**
148     * デストラクタ.
149     *
150     * @return void
151     */
152    function destroy() {
153        parent::destroy();
154    }
155}
156?>
Note: See TracBrowser for help on using the repository browser.