source: branches/feature-module-update/data/class/pages/admin/mail/LC_Page_Admin_Mail_Preview.php @ 15654

Revision 15654, 4.3 KB checked in by nanasess, 17 years ago (diff)

クラス化に伴う修正

  • Property svn:keywords set to "Id Revision Date"
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_Mail_Preview 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 = 'mail/preview.tpl';
31    }
32
33    /**
34     * Page のプロセス.
35     *
36     * @return void
37     */
38    function process() {
39        $conn = new SC_DBConn();
40        $objView = new SC_AdminView();
41        $objSess = new SC_Session();
42        $objDate = new SC_Date();
43
44        // 認証可否の判定
45        SC_Utils_Ex::sfIsSuccess($objSess);
46
47        if (!isset($_POST['body'])) $_POST['body'] = "";
48        if ( $_POST['body'] ){
49            $this->body = $_POST['body'];
50
51            // HTMLメールテンプレートのプレビュー
52        } elseif ($_REQUEST["method"] == "template"
53                  && SC_Utils_Ex::sfCheckNumLength($_REQUEST['id'])) {
54
55            $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ?";
56            $result = $conn->getAll($sql, array($_REQUEST["id"]));
57            $this->list_data = $result[0];
58
59            //メール担当写真の表示
60            $objUpFile = new SC_UploadFile(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
61            $objUpFile->addFile("メール担当写真", 'charge_image', array('jpg'), IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
62            $objUpFile->setDBFileList($this->list_data);
63            // Form用配列を渡す。
64            $this->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
65
66            // メイン商品の情報取得
67            $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 = ?";
68            $main = $conn->getAll($sql, array($this->list_data["main_product_id"]));
69            $this->list_data["main"] = $main[0];
70
71            // サブ商品の情報取得
72            $sql = "SELECT product_id, name, main_list_image, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
73            $k = 0;
74            $l = 0;
75            for ($i = 1; $i <= 12; $i ++) {
76                if ($l == 4) {
77                    $l = 0;
78                    $k ++;
79                }
80                $result = "";
81                $j = sprintf("%02d", $i);
82                if ($i > 0 && $i < 5 ) $k = 0;
83                if ($i > 4 && $i < 9 ) $k = 1;
84                if ($i > 8 && $i < 13 ) $k = 2;
85
86                if (is_numeric($this->list_data["sub_product_id" .$j])) {
87                    $result = $conn->getAll($sql, array($this->list_data["sub_product_id" .$j]));
88                    $this->list_data["sub"][$k][$l] = $result[0];
89                    $this->list_data["sub"][$k]["data_exists"] = "OK";  //当該段にデータが1つ以上存在するフラグ
90                }
91                $l ++;
92            }
93            $this->tpl_mainpage = 'mail/html_template.tpl';
94
95        } elseif (SC_Utils_Ex::sfCheckNumLength($_GET['send_id'])
96                   || SC_Utils_Ex::sfCheckNumLength($_GET['id'])){
97            if (is_numeric($_GET["send_id"])) {
98                $id = $_GET["send_id"];
99                $sql = "SELECT body, mail_method FROM dtb_send_history WHERE send_id = ?";
100            } else {
101                $sql = "SELECT body, mail_method FROM dtb_mailmaga_template WHERE template_id = ?";
102                $id = $_GET['id'];
103            }
104            $result = $conn->getAll($sql, array($id));
105
106            $this->p($result);
107            if ( $result ){
108                if ( $result[0]["mail_method"] == 2 ){
109                    // テキスト形式の時はタグ文字をエスケープ
110                    $this->escape_flag = 1;
111                }
112                $this->body = $result[0]["body"];
113            }
114        }
115
116        $objView->assignobj($this);
117        $objView->display($this->tpl_mainpage);
118    }
119
120    /**
121     * デストラクタ.
122     *
123     * @return void
124     */
125    function destroy() {
126        parent::destroy();
127    }
128}
129?>
Note: See TracBrowser for help on using the repository browser.