/** * Page のプロセス. * * @return void */ function process() { //---- ページ初期設定 $conn = new SC_DBConn(); $objView = new SC_AdminView(); $objDate = new SC_Date(); $objQuery = new SC_Query(); $objDb = new SC_Helper_DB_Ex(); $this->objDate = $objDate; $this->arrTemplate = $this->getTemplateList($conn); $objSess = new SC_Session(); // 認証可否の判定 SC_Utils_Ex::sfIsSuccess($objSess); /* query:配信履歴「確認」 */ if ($_GET["mode"] == "query" && SC_Utils_Ex::sfCheckNumLength($_GET["send_id"])) { // 送信履歴より、送信条件確認画面 $sql = "SELECT search_data FROM dtb_send_history WHERE send_id = ?"; $result = $conn->getOne($sql, array($_GET["send_id"])); $tpl_path = "mail/query.tpl"; $list_data = unserialize($result); // 都道府県を変換 $list_data['pref_disp'] = $this->arrPref[$list_data['pref']]; // 配信形式 $list_data['htmlmail_disp'] = $this->arrHtmlmail[$list_data['htmlmail']]; // 性別の変換 if (count($list_data['sex']) > 0) { foreach ($list_data['sex'] as $key => $val) { $list_data['sex'][$key] = $this->arrSex[$val]; $sex_disp .= $list_data['sex'][$key] . " "; } $list_data['sex_disp'] = $sex_disp; } // 職業の変換 if (count($list_data['job']) > 0) { foreach ($list_data['job'] as $key => $val) { $list_data['job'][$key] = $this->arrJob[$val]; $job_disp .= $list_data['job'][$key] . " "; } $list_data['job_disp'] = $job_disp; } // カテゴリ変換 $arrCatList = $objDb->sfGetCategoryList(); $list_data['category_name'] = $arrCatList[$list_data['category_id']]; $this->list_data = $list_data; $this->arrCampaignList = $this->lfGetCampaignList($objQuery); $objView->assignobj($this); $objView->display($tpl_path); exit; } if ($_POST['mode'] == 'delete') { } switch ($_POST['mode']) { /* search:「検索」ボタン back:検索結果画面「戻る」ボタン */ case 'delete': case 'search': case 'back': //-- 入力値コンバート $this->list_data = $this->lfConvertParam($_POST, $this->arrSearchColumn); //-- 入力エラーのチェック $this->arrErr = $this->lfErrorCheck($this->list_data); //-- 検索開始 if (!is_array($this->arrErr)) { $this->list_data['name'] = isset($this->list_data['name']) ? SC_Utils_Ex::sfManualEscape($this->list_data['name']) : ""; // hidden要素作成 $this->arrHidden = $this->lfGetHidden($this->list_data); //-- 検索データ取得 $objSelect = new SC_CustomerList($this->list_data, "magazine"); // 生成されたWHERE文を取得する list($where, $arrval) = $objSelect->getWhere(); // 「WHERE」部分を削除する。 $where = ereg_replace("^WHERE", "", $where); // 検索結果の取得 $from = "dtb_customer"; // 行数の取得 $linemax = $objQuery->count($from, $where, $arrval); $this->tpl_linemax = $linemax; // 何件が該当しました。表示用 // ページ送りの取得 $objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, SEARCH_PMAX, "fnResultPageNavi", NAVI_PMAX); $this->arrPagenavi = $objNavi->arrPagenavi; $startno = $objNavi->start_row; // 取得範囲の指定(開始行番号、行数のセット) $objQuery->setlimitoffset(SEARCH_PMAX, $startno); // 表示順序 $objQuery->setorder("customer_id DESC"); // 検索結果の取得 $col = $objSelect->getMailMagazineColumn($this->lfGetIsMobile($_POST['mail_type'])); $this->arrResults = $objQuery->select($col, $from, $where, $arrval); //現在時刻の取得 $this->arrNowDate = $this->lfGetNowDate(); } break; /* input:検索結果画面「htmlmail内容設定」ボタン */ /* input:検索結果画面「htmlmail内容設定」ボタン */ case 'input': //-- 入力値コンバート $this->list_data = $this->lfConvertParam($_POST, $this->arrSearchColumn); //-- 入力エラーのチェック $this->arrErr = $this->lfErrorCheck($this->list_data); //-- エラーなし if (!is_array($this->arrErr)) { //-- 現在時刻の取得 $this->arrNowDate = $this->lfGetNowDate(); $this->arrHidden = $this->lfGetHidden($this->list_data); // hidden要素作成 $this->tpl_mainpage = 'mail/input.tpl'; } break; /* template:テンプレート選択 */ /* template:テンプレート選択 */ case 'template': //-- 入力値コンバート $this->list_data = $this->lfConvertParam($_POST, $this->arrSearchColumn); //-- 時刻設定の取得 $this->arrNowDate['year'] = isset($_POST['send_year']) ? $_POST['send_year'] : ""; $this->arrNowDate['month'] = isset($_POST['send_month']) ? $_POST['send_month'] : ""; $this->arrNowDate['day'] = isset($_POST['send_day']) ? $_POST['send_day'] : ""; $this->arrNowDate['hour'] = isset($_POST['send_hour']) ? $_POST['send_hour'] : ""; $this->arrNowDate['minutes'] = isset($_POST['send_minutes']) ? $_POST['send_minutes'] : ""; //-- 入力エラーのチェック $this->arrErr = $this->lfErrorCheck($this->list_data); //-- 検索開始 if (!is_array($this->arrErr)) { $this->list_data['name'] = isset($this->list_data['name']) ? SC_Utils_Ex::sfManualEscape($this->list_data['name']) : ""; $this->arrHidden = $this->lfGetHidden($this->list_data); // hidden要素作成 $this->tpl_mainpage = 'mail/input.tpl'; $template_data = $this->getTemplateData($conn, $_POST['template_id']); if ($template_data) { foreach ($template_data as $key => $val) { $this->list_data[$key] = $val; } } //-- HTMLテンプレートを使用する場合は、HTMLソースを生成してBODYへ挿入 if ($this->list_data["mail_method"] == 3) { $objTemplate = new LC_HTMLtemplate(); $objTemplate->list_data = lfGetHtmlTemplateData($_POST['template_id']); $objSiteInfo = new SC_SiteInfo(); $objTemplate->arrInfo = $objSiteInfo->data; //メール担当写真の表示 $objUpFile = new SC_UploadFile(IMAGE_TEMP_URL, IMAGE_SAVE_URL); $objUpFile->addFile("メール担当写真", 'charge_image', array('jpg'), IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); $objUpFile->setDBFileList($objTemplate->list_data); $objTemplate->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL); $objMakeTemplate = new SC_AdminView(); $objMakeTemplate->assignobj($objTemplate); $this->list_data["body"] = $objMakeTemplate->fetch("mail/html_template.tpl"); } } break; /* regist_confirm:「入力内容を確認」 regist_back:「テンプレート設定画面へ戻る」 regist_complete:「登録」 */ /* regist_confirm:「入力内容を確認」 regist_back:「テンプレート設定画面へ戻る」 regist_complete:「登録」 */ case 'regist_confirm': case 'regist_back': case 'regist_complete': //-- 入力値コンバート $this->arrCheckColumn = array_merge($this->arrSearchColumn, $this->arrRegistColumn); $this->list_data = $this->lfConvertParam($_POST, $this->arrCheckColumn); //現在時刻の取得 $this->arrNowDate = $this->lfGetNowDate(); //-- 入力エラーのチェック $this->arrErr = $this->lfErrorCheck($this->list_data, 1); $this->tpl_mainpage = 'mail/input.tpl'; $this->arrHidden = $this->lfGetHidden($this->list_data); // hidden要素作成 //-- 検索開始 if (!is_array($this->arrErr)) { $this->list_data['name'] = isset($this->list_data['name']) ? SC_Utils_Ex::sfManualEscape($this->list_data['name']) : ""; if ($_POST['mode'] == 'regist_confirm') { $this->tpl_mainpage = 'mail/input_confirm.tpl'; } else { if ($_POST['mode'] == 'regist_complete') { $this->lfRegistData($conn, $this->list_data); if (MELMAGA_SEND == true) { if (MELMAGA_BATCH_MODE) { $this->sendRedirect($this->getLocation(URL_DIR . "admin/mail/history.php")); } else { $this->sendRedirect($this->getLocation(URL_DIR . "admin/mail/sendmail.php", array("mode" => "now"))); } exit; } else { SC_Utils_Ex::sfErrorHeader(">> 本サイトではメルマガ配信は行えません。"); } } } } break; default: $this->list_data['mail_type'] = 1; break; } // 配信時間の年を、「現在年~現在年+1」の範囲に設定 for ($year = date("Y"); $year <= date("Y") + 1; $year++) { $arrYear[$year] = $year; } $this->arrYear = $arrYear; $this->arrCustomerOrderId = $this->lfGetCustomerOrderId($_POST['buy_product_code']); $this->arrCatList = $objDb->sfGetCategoryList(); $this->arrCampaignList = $this->lfGetCampaignList($objQuery); //---- ページ表示 $objView->assignobj($this); $objView->display(MAIN_FRAME); }