/**
  * Page のプロセス(モバイル).
  *
  * @return void
  */
 function mobileProcess()
 {
     $objDb = new SC_Helper_DB_Ex();
     $CONF = $objDb->sf_getBasisData();
     // 店舗基本情報
     $objConn = new SC_DbConn();
     $objView = new SC_MobileView();
     $this->objDate = new SC_Date(START_BIRTH_YEAR, date("Y", strtotime("now")));
     $this->arrYear = $this->objDate->getYear();
     $this->arrMonth = $this->objDate->getMonth();
     $this->arrDay = $this->objDate->getDay();
     $this->objQuery = new SC_Query();
     $this->objCustomer = new SC_Customer();
     //メールアドレス種別
     $arrMailType = array("email" => true, "email_mobile" => true);
     //---- 登録用カラム配列
     $arrRegistColumn = array(array("column" => "name01", "convert" => "aKV"), array("column" => "name02", "convert" => "aKV"), array("column" => "kana01", "convert" => "CKV"), array("column" => "kana02", "convert" => "CKV"), array("column" => "zip01", "convert" => "n"), array("column" => "zip02", "convert" => "n"), array("column" => "pref", "convert" => "n"), array("column" => "addr01", "convert" => "aKV"), array("column" => "addr02", "convert" => "aKV"), array("column" => "email", "convert" => "a"), array("column" => "email_mobile", "convert" => "a"), array("column" => "tel01", "convert" => "n"), array("column" => "tel02", "convert" => "n"), array("column" => "tel03", "convert" => "n"), array("column" => "fax01", "convert" => "n"), array("column" => "fax02", "convert" => "n"), array("column" => "fax03", "convert" => "n"), array("column" => "sex", "convert" => "n"), array("column" => "job", "convert" => "n"), array("column" => "birth", "convert" => "n"), array("column" => "reminder", "convert" => "n"), array("column" => "reminder_answer", "convert" => "aKV"), array("column" => "password", "convert" => "a"), array("column" => "mailmaga_flg", "convert" => "n"));
     //---- 登録除外用カラム配列
     $arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02", "password02");
     $this->arrForm = $this->lfGetCustomerData();
     $this->arrForm['password'] = DEFAULT_PASSWORD;
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         //-- POSTデータの引き継ぎ
         $this->arrForm = array_merge($this->arrForm, $_POST);
         if (!isset($this->arrForm['year'])) {
             $this->arrForm['year'] = "";
         }
         if ($this->arrForm['year'] == '----') {
             $this->arrForm['year'] = '';
         }
         //-- 入力データの変換
         $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn);
         // 戻るボタン用処理
         if (!empty($_POST["return"])) {
             switch ($_POST["mode"]) {
                 case "complete":
                     $_POST["mode"] = "set3";
                     break;
                 case "confirm":
                     $_POST["mode"] = "set2";
                     break;
                 default:
                     $_POST["mode"] = "set1";
                     break;
             }
         }
         //-- 入力エラーチェック
         if ($_POST["mode"] == "set1") {
             $this->arrErr = $this->lfErrorCheck1($this->arrForm);
             $this->tpl_mainpage = 'mypage/change.tpl';
             $this->tpl_title = '登録変更(1/3)';
         } elseif ($_POST["mode"] == "set2") {
             $this->arrErr = $this->lfErrorCheck2($this->arrForm);
             $this->tpl_mainpage = 'mypage/set1.tpl';
             $this->tpl_title = '登録変更(2/3)';
         } else {
             $this->arrErr = $this->lfErrorCheck3($this->arrForm);
             $this->tpl_mainpage = 'mypage/set2.tpl';
             $this->tpl_title = '登録変更(3/3)';
         }
         if ($this->arrErr || !empty($_POST["return"])) {
             // 入力エラーのチェック
             //-- データの設定
             if ($_POST["mode"] == "set1") {
                 $checkVal = array("email", "email_mobile", "password", "reminder", "reminder_answer", "name01", "name02", "kana01", "kana02");
             } elseif ($_POST["mode"] == "set2") {
                 $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
             } else {
                 $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mailmaga_flg");
             }
             foreach ($this->arrForm as $key => $val) {
                 if ($key != "return" && $key != "mode" && $key != "confirm" && $key != session_name() && !in_array($key, $checkVal)) {
                     $this->list_data[$key] = $val;
                 }
             }
         } else {
             //-- テンプレート設定
             if ($_POST["mode"] == "set1") {
                 $this->tpl_mainpage = 'mypage/set1.tpl';
                 $this->tpl_title = '登録変更(2/3)';
             } elseif ($_POST["mode"] == "set2") {
                 $this->tpl_mainpage = 'mypage/set2.tpl';
                 $this->tpl_title = '登録変更(3/3)';
             } elseif ($_POST["mode"] == "confirm") {
                 //パスワード表示
                 $passlen = strlen($this->arrForm['password']);
                 $this->passlen = $this->lfPassLen($passlen);
                 // メール受け取り
                 if (!isset($_POST['mailmaga_flg'])) {
                     $_POST['mailmaga_flg'] = "";
                 }
                 if (strtolower($_POST['mailmaga_flg']) == "on") {
                     $this->arrForm['mailmaga_flg'] = "2";
                 } else {
                     $this->arrForm['mailmaga_flg'] = "3";
                 }
                 $this->tpl_mainpage = 'mypage/change_confirm.tpl';
                 $this->tpl_title = '登録変更(確認ページ)';
             }
             //-- データ設定
             unset($this->list_data);
             if ($_POST["mode"] == "set1") {
                 $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
             } elseif ($_POST["mode"] == "set2") {
                 $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mailmaga_flg");
             } else {
                 $checkVal = array();
             }
             foreach ($this->arrForm as $key => $val) {
                 if ($key != "return" && $key != "mode" && $key != "confirm" && $key != session_name() && !in_array($key, $checkVal)) {
                     $this->list_data[$key] = $val;
                 }
             }
             //-- 仮登録と完了画面
             if ($_POST["mode"] == "complete") {
                 //エラーなしでかつメールアドレスが重複していない場合
                 if ($this->checkErrorTotal($arrRegistColumn, $arrMailType, true)) {
                     $this->arrForm['customer_id'] = $this->objCustomer->getValue('customer_id');
                     //-- 編集登録
                     $objDb->sfEditCustomerData($this->arrForm, $arrRegistColumn);
                     //セッション情報を最新の状態に更新する
                     $this->objCustomer->updateSession();
                     //完了ページへ
                     $this->sendRedirect($this->getLocation("./change_complete.php"), true);
                     exit;
                 } else {
                     SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
                 }
             }
         }
     }
     $arrPrivateVariables = array('secret_key', 'first_buy_date', 'last_buy_date', 'buy_times', 'buy_total', 'point', 'note', 'status', 'create_date', 'update_date', 'del_flg', 'cell01', 'cell02', 'cell03', 'mobile_phone_id');
     foreach ($arrPrivateVariables as $key) {
         unset($this->list_data[$key]);
     }
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display(SITE_FRAME);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     // 認証可否の判定
     $objSess = new SC_Session();
     SC_Utils_Ex::sfIsSuccess($objSess);
     $this->objQuery = new SC_Query();
     $this->objConn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objDb = new SC_Helper_DB_Ex();
     $objDate = new SC_Date(1901);
     $this->arrYear = $objDate->getYear();
     // 日付プルダウン設定
     $this->arrMonth = $objDate->getMonth();
     $this->arrDay = $objDate->getDay();
     //---- 登録用カラム配列
     $arrRegistColumn = array(array("column" => "name01", "convert" => "aKV"), array("column" => "name02", "convert" => "aKV"), array("column" => "kana01", "convert" => "CKV"), array("column" => "kana02", "convert" => "CKV"), array("column" => "zip01", "convert" => "n"), array("column" => "zip02", "convert" => "n"), array("column" => "pref", "convert" => "n"), array("column" => "addr01", "convert" => "aKV"), array("column" => "addr02", "convert" => "aKV"), array("column" => "email", "convert" => "a"), array("column" => "email_mobile", "convert" => "a"), array("column" => "tel01", "convert" => "n"), array("column" => "tel02", "convert" => "n"), array("column" => "tel03", "convert" => "n"), array("column" => "fax01", "convert" => "n"), array("column" => "fax02", "convert" => "n"), array("column" => "fax03", "convert" => "n"), array("column" => "sex", "convert" => "n"), array("column" => "job", "convert" => "n"), array("column" => "birth", "convert" => "n"), array("column" => "password", "convert" => "a"), array("column" => "reminder", "convert" => "n"), array("column" => "reminder_answer", "convert" => "aKV"), array("column" => "mailmaga_flg", "convert" => "n"), array("column" => "note", "convert" => "aKV"), array("column" => "point", "convert" => "n"), array("column" => "status", "convert" => "n"));
     //---- 登録除外用カラム配列
     $arrRejectRegistColumn = array("year", "month", "day");
     // 検索条件を保持
     if ($_POST['mode'] == "edit_search") {
         $arrSearch = $_POST;
     } else {
         $arrSearch = $_POST['search_data'];
     }
     if (is_array($arrSearch)) {
         foreach ($arrSearch as $key => $val) {
             $arrSearchData[$key] = $val;
         }
     }
     $this->arrSearchData = $arrSearchData;
     //---- 顧客編集情報取得
     if (($_POST["mode"] == "edit" || $_POST["mode"] == "edit_search") && is_numeric($_POST["edit_customer_id"])) {
         //-- 顧客データ取得
         $sql = "SELECT * FROM dtb_customer WHERE del_flg = 0 AND customer_id = ?";
         $result = $this->objConn->getAll($sql, array($_POST["edit_customer_id"]));
         $this->list_data = $result[0];
         $birth = split(" ", $this->list_data["birth"]);
         $birth = split("-", $birth[0]);
         $this->list_data["year"] = $birth[0];
         $this->list_data["month"] = isset($birth[1]) ? $birth[1] : "";
         $this->list_data["day"] = isset($birth[2]) ? $birth[2] : "";
         $this->list_data["password"] = DEFAULT_PASSWORD;
         //DB登録のメールアドレスを渡す
         $this->tpl_edit_email = $result[0]['email'];
         //購入履歴情報の取得
         $this->arrPurchaseHistory = $this->lfPurchaseHistory($_POST['edit_customer_id']);
         // 支払い方法の取得
         $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
     }
     //---- 顧客情報編集
     if ($_POST["mode"] != "edit" && $_POST["mode"] != "edit_search" && is_numeric($_POST["customer_id"])) {
         //-- POSTデータの引き継ぎ
         $this->arrForm = $_POST;
         $this->arrForm['email'] = strtolower($this->arrForm['email']);
         // emailはすべて小文字で処理
         //-- 入力データの変換
         $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn);
         //-- 入力チェック
         $this->arrErr = $this->lfErrorCheck($this->arrForm);
         //-- 入力エラー発生 or リターン時
         if ($this->arrErr || $_POST["mode"] == "return") {
             foreach ($this->arrForm as $key => $val) {
                 $this->list_data[$key] = $val;
             }
             //購入履歴情報の取得
             $this->arrPurchaseHistory = $this->lfPurchaseHistory($_POST['customer_id']);
             // 支払い方法の取得
             $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
         } else {
             //-- 確認
             if ($_POST["mode"] == "confirm") {
                 $this->tpl_mainpage = 'customer/edit_confirm.tpl';
                 $passlen = strlen($this->arrForm['password']);
                 $this->passlen = $this->lfPassLen($passlen);
             }
             //-- 編集
             if ($_POST["mode"] == "complete") {
                 $this->tpl_mainpage = 'customer/edit_complete.tpl';
                 // 現在の会員情報を取得する
                 $arrCusSts = $this->objQuery->getOne("SELECT status FROM dtb_customer WHERE customer_id = ?", array($_POST["customer_id"]));
                 // 会員情報が変更されている場合にはシークレット№も更新する。
                 if ($arrCusSts != $_POST['status']) {
                     $secret = SC_Utils_Ex::sfGetUniqRandomId("r");
                     $this->arrForm['secret_key'] = $secret;
                     array_push($arrRegistColumn, array('column' => 'secret_key', 'convert' => 'n'));
                 }
                 //-- 編集登録
                 $objDb->sfEditCustomerData($this->arrForm, $arrRegistColumn);
             }
         }
     }
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }