/**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     if (!isset($_GET['mode'])) {
         $_GET['mode'] = "";
     }
     if (!isset($_GET['id'])) {
         $_GET['id'] = "";
     }
     if ($_GET['mode'] == "delete" && SC_Utils_Ex::sfCheckNumLength($_GET['id']) === true) {
         // メール担当の画像があれば削除しておく
         $sql = "SELECT charge_image FROM dtb_mailmaga_template WHERE template_id = ?";
         $result = $conn->getOne($sql, array($_GET["id"]));
         if (strlen($result) > 0) {
             @unlink(IMAGE_SAVE_DIR . $result);
         }
         // 登録削除
         $sql = "UPDATE dtb_mailmaga_template SET del_flg = 1 WHERE template_id = ?";
         $conn->query($sql, array($_GET['id']));
         $this->reload(null, true);
     }
     $sql = "SELECT *, create_date as disp_date FROM dtb_mailmaga_template WHERE del_flg = 0 ORDER BY create_date DESC";
     $this->list_data = $conn->getAll($sql);
     $this->list_data['disp_date'] = substr($this->list_data['disp_date'], 0, 19);
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     //---- ページ初期設定
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $objDate = new SC_Date();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     if (!isset($_GET['send_id'])) {
         $_GET['send_id'] = "";
     }
     if (!isset($_GET['mode'])) {
         $_GET['mode'] = "";
     }
     if (!isset($_POST['search_pageno'])) {
         $_POST['search_pageno'] = "";
     }
     // 削除時
     if (SC_Utils_Ex::sfCheckNumLength($_GET['send_id']) && $_GET['mode'] == 'delete') {
         $sql = "UPDATE dtb_send_history SET del_flg = 1 WHERE send_id = ?";
         $conn->query($sql, array($_GET['send_id']));
         $_SERVER['QUERY_STRING'] = "";
         $this->reload();
     }
     $col = "*";
     $from = "dtb_send_history";
     $where = " del_flg = ?";
     $arrval[] = "0";
     $objQuery = new SC_Query();
     // 行数の取得
     $linemax = $objQuery->count($from, $where, $arrval);
     $this->tpl_linemax = $linemax;
     // 何件が該当しました。表示用
     // ページ送りの取得
     $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, SEARCH_PMAX, "fnNaviSearchPage", NAVI_PMAX);
     $this->tpl_strnavi = $objNavi->strnavi;
     // 表示文字列
     $startno = $objNavi->start_row;
     // 取得範囲の指定(開始行番号、行数のセット)
     $objQuery->setlimitoffset(SEARCH_PMAX, $startno);
     // 表示順序
     $order = "start_date DESC, send_id DESC";
     $objQuery->setorder($order);
     // 検索結果の取得
     $this->arrDataList = $objQuery->select($col, $from, $where, $arrval);
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     $this->mode = "regist";
     // idが指定されているときは「編集」表示
     if (!isset($_REQUEST['template_id'])) {
         $_REQUEST['template_id'] = "";
     }
     if ($_REQUEST['template_id']) {
         $this->title = "編集";
     } else {
         $this->title = "新規登録";
     }
     if (!isset($_GET['mode'])) {
         $_GET['mode'] = "";
     }
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     // モードによる処理分岐
     if ($_GET['mode'] == 'edit' && SC_Utils_Ex::sfCheckNumLength($_GET['template_id']) === true) {
         // 編集
         $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? AND del_flg = 0";
         $result = $conn->getAll($sql, array($_GET['template_id']));
         $this->arrForm = $result[0];
     } elseif ($_POST['mode'] == 'regist') {
         // 新規登録
         $this->arrForm = $this->lfConvData($_POST);
         $this->arrErr = $this->lfErrorCheck($this->arrForm);
         if (!$this->arrErr) {
             // エラーが無いときは登録・編集
             $this->lfRegistData($this->arrForm, $_POST['template_id']);
             // 自分を再読込して、完了画面へ遷移
             $this->reload(array("mode" => "complete"));
         }
     } elseif ($_GET['mode'] == 'complete') {
         // 完了画面表示
         $this->tpl_mainpage = 'mail/template_complete.tpl';
     }
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $masterData = new SC_DB_MasterData_Ex();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     $this->arrMailTEMPLATE = $masterData->getMasterData("mtb_mail_template");
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     if ($_POST['mode'] == 'id_set') {
         // テンプレートプルダウン変更時
         if (SC_Utils_Ex::sfCheckNumLength($_POST['template_id'])) {
             $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?";
             $result = $conn->getAll($sql, array($_POST['template_id']));
             if ($result) {
                 $this->arrForm = $result[0];
             } else {
                 $this->arrForm['template_id'] = $_POST['template_id'];
             }
         }
     } elseif ($_POST['mode'] == 'regist' && SC_Utils_Ex::sfCheckNumLength($_POST['template_id'])) {
         // POSTデータの引き継ぎ
         $this->arrForm = $this->lfConvertParam($_POST);
         $this->arrErr = $this->fnErrorCheck($this->arrForm);
         if ($this->arrErr) {
             // エラーメッセージ
             $this->tpl_msg = "エラーが発生しました";
         } else {
             // 正常
             $this->lfRegist($conn, $this->arrForm);
             // 完了メッセージ
             $this->tpl_onload = "window.alert('メール設定が完了しました。テンプレートを選択して内容をご確認ください。');";
             unset($this->arrForm);
         }
     }
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
    /**
     * Page のプロセス.
     *
     * @return void
     */
    function process()
    {
        $objQuery = new SC_Query();
        $objView = new SC_AdminView();
        $objSess = new SC_Session();
        // 認証可否の判定
        SC_Utils_Ex::sfIsSuccess($objSess);
        $arrActive = array("0" => "稼働", "1" => "非稼働");
        $arrQuestion = array("0" => "使用しない", "1" => "テキストエリア", "2" => "テキストボックス", "3" => "チェックボックス", "4" => "ラジオボタン");
        $result = $objQuery->select('*, cast(create_date as date) as disp_date', 'dtb_question', 'del_flg = 0 ORDER BY question_id');
        $this->list_data = $result;
        if (!isset($_GET['mode'])) {
            $_GET['mode'] = "";
        }
        // アンケートを作成ボタン押下時
        if ($_GET['mode'] == 'regist') {
            for ($i = 0; $i < count($_POST["question"]); $i++) {
                $_POST['question'][$i]['name'] = mb_convert_kana(trim($_POST['question'][$i]['name']), "K");
                for ($j = 0; $j < count($_POST['question'][$i]['option']); $j++) {
                    $_POST['question'][$i]['option'][$j] = mb_convert_kana(trim($_POST['question'][$i]['option'][$j]));
                }
            }
            $error = $this->lfErrCheck();
            if (!$error) {
                // 新規登録
                if (!is_numeric($_POST['question_id'])) {
                    //登録
                    $value = serialize($_POST);
                    if (DB_TYPE == "pgsql") {
                        $question_id = $objQuery->nextval('dtb_question', 'question_id');
                    }
                    $sql_val = array('question' => $value, 'question_name' => $_POST['title'], 'question_id' => $question_id, 'create_date' => 'now()');
                    $objQuery->insert('dtb_question', $sql_val);
                    $this->MESSAGE = "登録が完了しました";
                    if (DB_TYPE == "mysql") {
                        $question_id = $objQuery->nextval('dtb_question', 'question_id');
                    }
                    $this->QUESTION_ID = $question_id;
                    $this->reload(null, true);
                    // 編集
                } else {
                    //編集
                    $value = serialize($_POST);
                    $sql_val = array('question' => $value, 'question_name' => $_POST['title']);
                    $objQuery->update('dtb_question', $sql_val, 'question_id = ?', array($_POST['question_id']));
                    $this->MESSAGE = "編集が完了しました";
                    $this->QUESTION_ID = $_POST['question_id'];
                    $this->reload(null, true);
                }
            } else {
                //エラー表示
                $this->ERROR = $error;
                $this->QUESTION_ID = $_REQUEST['question_id'];
                $this->ERROR_COLOR = $this->lfGetErrColor($error, ERR_COLOR);
            }
            // 削除ボタン押下時
        } elseif ($_GET['mode'] == 'delete' && SC_Utils_Ex::sfCheckNumLength($_GET['question_id'])) {
            $sqlval = array('del_flg' => 1);
            $objQuery->update('dtb_question', $sqlval, 'question_id = ?', array($_GET['question_id']));
            $this->reload(null, true);
            // CSVダウンロードボタン押下時
        } elseif ($_GET['mode'] == 'csv' && SC_Utils_Ex::sfCheckNumLength($_GET['question_id'])) {
            require_once CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php";
            $objCSV = new SC_Helper_CSV_Ex();
            $head = SC_Utils_Ex::sfGetCSVList($this->arrCVSTITLE);
            $sql = <<<__EOS__
                    SELECT
                         dtb_question_result.result_id
                        ,dtb_question_result.question_id
                        ,dtb_question_result.create_date
                        ,dtb_question.question_name
                        ,dtb_question_result.name01
                        ,dtb_question_result.name02
                        ,dtb_question_result.kana01
                        ,dtb_question_result.kana02
                        ,dtb_question_result.zip01
                        ,dtb_question_result.zip02
                        ,dtb_question_result.pref
                        ,dtb_question_result.addr01
                        ,dtb_question_result.addr02
                        ,dtb_question_result.tel01
                        ,dtb_question_result.tel02
                        ,dtb_question_result.tel03
                        ,dtb_question_result.mail01
                        ,dtb_question_result.question01
                        ,dtb_question_result.question02
                        ,dtb_question_result.question03
                        ,dtb_question_result.question04
                        ,dtb_question_result.question05
                        ,dtb_question_result.question06
                    FROM dtb_question_result
                        LEFT JOIN dtb_question
                            ON dtb_question_result.question_id = dtb_question.question_id
                    WHERE 0=0
                        AND dtb_question_result.del_flg = 0
                        AND dtb_question_result.question_id = ?
                    ORDER BY dtb_question_result.result_id ASC
__EOS__;
            $list_data = $objQuery->getAll($sql, array($_GET['question_id']));
            $data = "";
            for ($i = 0; $i < count($list_data); $i++) {
                // 各項目をCSV出力用に変換する。
                $data .= $objCSV->lfMakeCSV($list_data[$i]);
            }
            // CSVを送信する
            SC_Utils_Ex::sfCSVDownload($head . $data);
            exit;
            // 初回表示 or 編集ボタン押下時
        } else {
            if (!isset($_GET['question_id'])) {
                $_GET['question_id'] = "";
            }
            if (is_numeric($_GET['question_id'])) {
                $sql = "SELECT question FROM dtb_question WHERE question_id = ?";
                $result = $objQuery->getOne($sql, array($_GET['question_id']));
                if ($result) {
                    $_POST = unserialize($result);
                    $this->QUESTION_ID = $_GET['question_id'];
                }
            }
        }
        //各ページ共通
        $this->cnt_question = 6;
        $this->arrActive = $arrActive;
        $this->arrQuestion = $arrQuestion;
        //---- ページ表示
        $objView->assignobj($this);
        $objView->display(MAIN_FRAME);
    }
Пример #6
0
 function getTemplateData($conn, $id)
 {
     if (SC_Utils_Ex::sfCheckNumLength($id)) {
         $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? ORDER BY template_id DESC";
         $result = $conn->getAll($sql, array($id));
         if (is_array($result)) {
             $return = $result[0];
         }
     }
     return $return;
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $objDate = new SC_Date();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     if (!isset($_POST['body'])) {
         $_POST['body'] = "";
     }
     if (!isset($_REQUEST['method'])) {
         $_REQUEST['method'] = "";
     }
     if (!isset($_REQUEST['id'])) {
         $_REQUEST['id'] = "";
     }
     if (!isset($_GET['send_id'])) {
         $_GET['send_id'] = "";
     }
     if ($_POST['body']) {
         $this->body = $_POST['body'];
         // HTMLメールテンプレートのプレビュー
     } elseif ($_REQUEST["method"] == "template" && SC_Utils_Ex::sfCheckNumLength($_REQUEST['id'])) {
         $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ?";
         $result = $conn->getAll($sql, array($_REQUEST["id"]));
         $this->list_data = $result[0];
         //メール担当写真の表示
         $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($this->list_data);
         // Form用配列を渡す。
         $this->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
         // メイン商品の情報取得
         $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 = ?";
         $main = $conn->getAll($sql, array($this->list_data["main_product_id"]));
         $this->list_data["main"] = $main[0];
         // サブ商品の情報取得
         $sql = "SELECT product_id, name, main_list_image, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
         $k = 0;
         $l = 0;
         for ($i = 1; $i <= 12; $i++) {
             if ($l == 4) {
                 $l = 0;
                 $k++;
             }
             $result = "";
             $j = sprintf("%02d", $i);
             if ($i > 0 && $i < 5) {
                 $k = 0;
             }
             if ($i > 4 && $i < 9) {
                 $k = 1;
             }
             if ($i > 8 && $i < 13) {
                 $k = 2;
             }
             if (is_numeric($this->list_data["sub_product_id" . $j])) {
                 $result = $conn->getAll($sql, array($this->list_data["sub_product_id" . $j]));
                 $this->list_data["sub"][$k][$l] = $result[0];
                 $this->list_data["sub"][$k]["data_exists"] = "OK";
                 //当該段にデータが1つ以上存在するフラグ
             }
             $l++;
         }
         $this->tpl_mainpage = 'mail/html_template.tpl';
     } elseif (SC_Utils_Ex::sfCheckNumLength($_GET['send_id']) || SC_Utils_Ex::sfCheckNumLength($_GET['id'])) {
         if (is_numeric($_GET["send_id"])) {
             $id = $_GET["send_id"];
             $sql = "SELECT body, mail_method FROM dtb_send_history WHERE send_id = ?";
         } else {
             $sql = "SELECT body, mail_method FROM dtb_mailmaga_template WHERE template_id = ?";
             $id = $_GET['id'];
         }
         $result = $conn->getAll($sql, array($id));
         if ($result) {
             if ($result[0]["mail_method"] == 2) {
                 // テキスト形式の時はタグ文字をエスケープ
                 $this->escape_flag = 1;
             }
             $this->body = $result[0]["body"];
         }
     }
     $objView->assignobj($this);
     $objView->display($this->tpl_mainpage);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $arrRegistColumn = array(array("column" => "product_id", "convert" => "n"), array("column" => "category_id", "convert" => "n"), array("column" => "rank", "convert" => "n"), array("column" => "title", "convert" => "aKV"), array("column" => "comment", "convert" => "aKV"));
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     //最大登録数の表示
     $this->tpl_disp_max = RECOMMEND_NUM;
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     if (!isset($_POST['category_id'])) {
         $_POST['category_id'] = "";
     }
     // 登録時
     if ($_POST['mode'] == 'regist') {
         // 入力文字の強制変換
         $this->arrForm = $_POST;
         $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn);
         // エラーチェック
         $this->arrErr[$this->arrForm['rank']] = $this->lfErrorCheck();
         if (!$this->arrErr[$this->arrForm['rank']]) {
             // 古いのを消す
             $sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?";
             $conn->query($sql, array($this->arrForm['category_id'], $this->arrForm['rank']));
             // DB登録
             $this->arrForm['creator_id'] = $_SESSION['member_id'];
             $this->arrForm['update_date'] = "NOW()";
             $this->arrForm['create_date'] = "NOW()";
             $objQuery = new SC_Query();
             $objQuery->insert("dtb_best_products", $this->arrForm);
             //		$conn->autoExecute("dtb_best_products", $this->arrForm );
         }
     } elseif ($_POST['mode'] == 'delete') {
         // 削除時
         $sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?";
         $conn->query($sql, array($_POST['category_id'], $_POST['rank']));
     }
     // カテゴリID取得 無いときはトップページ
     if (SC_Utils_Ex::sfCheckNumLength($_POST['category_id'])) {
         $this->category_id = $_POST['category_id'];
     } else {
         $this->category_id = 0;
     }
     // 既に登録されている内容を取得する
     $sql = "SELECT B.name, B.main_list_image, A.* FROM dtb_best_products as A INNER JOIN dtb_products as B USING (product_id)\n\t\t WHERE A.del_flg = 0 ORDER BY rank";
     $arrItems = $conn->getAll($sql);
     foreach ($arrItems as $data) {
         $this->arrItems[$data['rank']] = $data;
     }
     // 商品変更時は、選択された商品に一時的に置き換える
     if ($_POST['mode'] == 'set_item') {
         $sql = "SELECT product_id, name, main_list_image FROM dtb_products WHERE product_id = ? AND del_flg = 0";
         $result = $conn->getAll($sql, array($_POST['product_id']));
         if ($result) {
             $data = $result[0];
             foreach ($data as $key => $val) {
                 $this->arrItems[$_POST['rank']][$key] = $val;
             }
             $this->arrItems[$_POST['rank']]['rank'] = $_POST['rank'];
         }
         $this->checkRank = $_POST['rank'];
     }
     //各ページ共通
     $this->cnt_question = 6;
     $this->arrActive = isset($arrActive) ? $arrActive : "";
     $this->arrQuestion = isset($arrQuestion) ? $arrQuestion : "";
     // カテゴリ取得
     $objDb = new SC_Helper_DB_Ex();
     $this->arrCatList = $objDb->sfGetCategoryList("level = 1");
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }