Source for file LC_Page_Admin_Mail.php
Documentation is available at LC_Page_Admin_Mail.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Admin_Mail.php 21217 2011-08-24 03:58:36Z Seasoft $
$this->tpl_mainpage = 'mail/index.tpl';
$this->tpl_mainno = 'mail';
$this->tpl_subno = 'index';
$this->tpl_pager = 'pager.tpl';
$this->tpl_maintitle = 'メルマガ管理';
$this->tpl_subtitle = '配信内容設定';
$masterData = new SC_DB_MasterData_Ex();
$this->arrPref = $masterData->getMasterData('mtb_pref');
$this->arrJob = $masterData->getMasterData("mtb_job");
$this->arrJob["不明"] = "不明";
$this->arrSex = $masterData->getMasterData("mtb_sex");
$this->arrPageRows = $masterData->getMasterData("mtb_page_max");
$this->arrHtmlmail = array( "" => "両方", 1 => 'HTML', 2 => 'TEXT' );
$this->arrMailType = $masterData->getMasterData("mtb_mail_type");
$objDate = new SC_Date_Ex(BIRTH_YEAR);
$this->arrBirthYear = $objDate->getYear();
$this->arrRegistYear = $objDate->getYear();
$this->arrMonth = $objDate->getMonth();
$this->arrDay = $objDate->getDay();
$this->objDate = $objDate;
$objDb = new SC_Helper_DB_Ex();
$this->arrCatList = $objDb->sfGetCategoryList();
$this->httpCacheControl('nocache');
$objFormParam = new SC_FormParam_Ex();
$objFormParam->setParam($_POST);
$this->arrHidden = $objFormParam->getSearchArray();
$this->arrErr = SC_Helper_Customer_Ex::sfCheckErrorSearchParam($objFormParam);
$this->arrForm = $objFormParam->getFormParamList();
if(!SC_Utils_Ex::isBlank($this->arrErr)) return;
switch ($this->getMode()) {
list ($this->tpl_linemax, $this->arrResults, $this->objNavi) = SC_Helper_Customer_Ex::sfGetSearchData($objFormParam->getHashArray());
$this->arrPagenavi = $this->objNavi->arrPagenavi;
// input:検索結果画面「配信内容を設定する」押下後
$this->tpl_mainpage = 'mail/input.tpl';
$this->tpl_mainpage = 'mail/input.tpl';
if (SC_Utils_Ex::sfIsInt($_POST['template_id']) === true) {
// regist_back時、subject,bodyにはテンプレートを読み込むのではなく、入力内容で上書き
if($this->getMode()== 'regist_back') $objFormParam->setParam($_POST);
$this->tpl_mainpage = 'mail/input.tpl';
$objFormParam->setParam($_POST);
$this->arrErr = $objFormParam->checkError();
if (SC_Utils_Ex::isBlank($this->arrErr)) $this->tpl_mainpage = 'mail/input_confirm.tpl';
$this->tpl_mainpage = 'mail/input.tpl';
$objFormParam->setParam($_POST);
$this->arrErr = $objFormParam->checkError();
if (SC_Utils_Ex::isBlank($this->arrErr)){
$this->tpl_mainpage = 'mail/index.tpl';
SC_Helper_Mail_Ex::sfSendMailmagazine($this->lfRegisterData($objFormParam)); // DB登録・送信
SC_Response_Ex::sendRedirect("./history.php");
if (SC_Utils_Ex::sfIsInt($_GET["send_id"])) {
$this->setTemplate('mail/query.tpl');
if (SC_Utils_Ex::sfIsInt($_GET["send_id"])) {
SC_Helper_Mail_Ex::sfSendMailmagazine($_GET['send_id']); // DB登録・送信
SC_Response_Ex::sendRedirect("./history.php");
$this->tpl_onload = "window.alert('メール送信IDが正しくありません');";
$this->arrForm = $objFormParam->getFormParamList();
* @param array $objFormParam フォームパラメータークラス
SC_Helper_Customer_Ex::sfSetSearchParam($objFormParam);
$objFormParam->addParam('配信形式', 'search_htmlmail', INT_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK"));
$objFormParam->addParam('配信メールアドレス種別', 'search_mail_type', INT_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK"));
* @param array $objFormParam フォームパラメータークラス
$objFormParam->addParam("メール形式", 'mail_method', INT_LEN, 'n', array("EXIST_CHECK","ALNUM_CHECK"));
$objFormParam->addParam('Subject', 'subject', STEXT_LEN, 'KVa', array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objFormParam->addParam("本文", 'body', LLTEXT_LEN, 'KVCa', array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objFormParam->addParam("テンプレートID", "template_id", INT_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"), "", false);
* @param array $arrTemplate SC_Helper_Mail_Ex::sfGetMailmagaTemplate()の戻り値
* @return array key:template_id value:サブジェクト【配信形式】
foreach( $arrTemplate as $line ){
$return[$line['template_id']] = "【" . $this->arrHtmlmail[$line['mail_method']] . "】" . $line['subject'];
* テンプレートIDから情報の取得して$objFormParamにset_paramする
* @param array $objFormParam フォームパラメータークラス
* @param array $template_id テンプレートID
$objQuery = & SC_Query_Ex::getSingletonInstance();
$objQuery->setOrder("template_id DESC");
$where = 'template_id = ?';
$arrResults = $objQuery->getRow('*', 'dtb_mailmaga_template', $where, array($template_id));
$objFormParam->setParam($arrResults);
* @return integer 登録した行の dtb_send_history.send_id の値
$objQuery = & SC_Query_Ex::getSingletonInstance();
list ($linemax, $arrSendCustomer, $objNavi) = SC_Helper_Customer_Ex::sfGetSearchData($objFormParam->getHashArray(), 'All');
$send_customer_cnt = count($arrSendCustomer);
$send_id = $objQuery->nextVal('dtb_send_history_send_id');
$dtb_send_history = array();
$dtb_send_history["mail_method"] = $objFormParam->getValue('mail_method');
$dtb_send_history['subject'] = $objFormParam->getValue('subject');
$dtb_send_history['body'] = $objFormParam->getValue('body');
$dtb_send_history["start_date"] = 'CURRENT_TIMESTAMP';
$dtb_send_history["creator_id"] = $_SESSION['member_id'];
$dtb_send_history["send_count"] = $send_customer_cnt;
$dtb_send_history["search_data"] = serialize($objFormParam->getSearchArray());
$dtb_send_history["update_date"] = 'CURRENT_TIMESTAMP';
$dtb_send_history["create_date"] = 'CURRENT_TIMESTAMP';
$dtb_send_history['send_id'] = $send_id;
$objQuery->insert("dtb_send_history", $dtb_send_history );
// 「配信メールアドレス種別」に携帯メールアドレスが指定されている場合は、携帯メールアドレスに配信
$searchmailtype = $objFormParam->getValue('search_mail_type');
if($searchmailtype== 2|| $searchmailtype== 4)$emailtype= "email_mobile";
foreach( $arrSendCustomer as $line ){
$dtb_send_customer = array();
$dtb_send_customer["customer_id"] = $line["customer_id"];
$dtb_send_customer["send_id"] = $send_id;
$dtb_send_customer['email'] = $line[$emailtype];
$dtb_send_customer['name'] = $line["name01"] . " " . $line["name02"];
$objQuery->insert("dtb_send_customer", $dtb_send_customer );
* @param integer $send_id 配信履歴番号
$objQuery = & SC_Query_Ex::getSingletonInstance();
$sql = "SELECT search_data FROM dtb_send_history WHERE send_id = ?";
$searchData = $objQuery->getOne($sql, array($_GET["send_id"]));
Documentation generated on Fri, 24 Feb 2012 14:01:21 +0900 by Seasoft
|