Source for file LC_Page_Admin_Mail_Preview.php

Documentation is available at LC_Page_Admin_Mail_Preview.php

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

Documentation generated on Tue, 28 Apr 2009 18:11:17 +0900 by phpDocumentor 1.4.2