/**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     $objCustomer = new SC_Customer_Ex();
     if (!SC_Utils_Ex::sfIsInt($_GET['send_id'])) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     $arrMailView = $this->lfGetMailView($_GET['send_id'], $objCustomer->getValue('customer_id'));
     if (empty($arrMailView)) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     $this->tpl_subject = $arrMailView[0]['subject'];
     $this->tpl_body = $arrMailView[0]['mail_body'];
     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_PC) {
         $this->setTemplate('mypage/mail_view.tpl');
     } else {
         $this->tpl_title = 'メール履歴詳細';
         $this->tpl_mainpage = 'mypage/mail_view.tpl';
     }
     switch ($this->getMode()) {
         case 'getDetail':
             echo SC_Utils_Ex::jsonEncode($arrMailView);
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 public function action()
 {
     $objCustomer = new SC_Customer_Ex();
     $customer_id = $objCustomer->getValue('customer_id');
     switch ($this->getMode()) {
         case 'delete_favorite':
             // お気に入り削除
             $this->lfDeleteFavoriteProduct($customer_id, intval($_POST['product_id']));
             break;
         case 'getList':
             // スマートフォン版のもっと見るボタン用
             // ページ送り用
             if (isset($_POST['pageno'])) {
                 $this->tpl_pageno = intval($_POST['pageno']);
             }
             $this->arrFavorite = $this->lfGetFavoriteProduct($customer_id, $this);
             SC_Product_Ex::setPriceTaxTo($this->arrFavorite);
             // 一覧メイン画像の指定が無い商品のための処理
             foreach ($this->arrFavorite as $key => $val) {
                 $this->arrFavorite[$key]['main_list_image'] = SC_Utils_Ex::sfNoImageMainList($val['main_list_image']);
             }
             echo SC_Utils_Ex::jsonEncode($this->arrFavorite);
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
     // ページ送り用
     if (isset($_POST['pageno'])) {
         $this->tpl_pageno = intval($_POST['pageno']);
     }
     $this->arrFavorite = $this->lfGetFavoriteProduct($customer_id, $this);
     // 1ページあたりの件数
     $this->dispNumber = SEARCH_PMAX;
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     $objProduct = new SC_Product_Ex();
     $objCustomer = new SC_Customer_Ex();
     $customer_id = $objCustomer->getValue('customer_id');
     switch ($this->getMode()) {
         case 'delete_favorite':
             // お気に入り削除
             $this->lfDeleteFavoriteProduct($customer_id, intval($_POST['product_id']));
             break;
         case 'getList':
             // スマートフォン版のもっと見るボタン用
             // ページ送り用
             if (isset($_POST['pageno'])) {
                 $this->tpl_pageno = intval($_POST['pageno']);
             }
             $this->arrFavorite = $this->lfGetFavoriteProduct($customer_id, $this);
             $this->arrFavorite = $objProduct->setPriceTaxTo($this->arrFavorite);
             echo SC_Utils_Ex::jsonEncode($this->arrFavorite);
             SC_Response_Ex::actionExit();
             break;
     }
     // ページ送り用
     if (isset($_POST['pageno'])) {
         $this->tpl_pageno = intval($_POST['pageno']);
     }
     $this->arrFavorite = $this->lfGetFavoriteProduct($customer_id, $this);
     // 1ページあたりの件数
     $this->dispNumber = SEARCH_PMAX;
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 public function action()
 {
     switch ($this->getMode()) {
         case 'confirm':
             // トークンを設定
             $this->refusal_transactionid = $this->getRefusalToken();
             $this->tpl_mainpage = 'mypage/refusal_confirm.tpl';
             $this->tpl_subtitle = '退会手続き(確認ページ)';
             break;
         case 'complete':
             // トークン入力チェック
             if (!$this->isValidRefusalToken()) {
                 // エラー画面へ遷移する
                 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true);
                 SC_Response_Ex::actionExit();
             }
             $objCustomer = new SC_Customer_Ex();
             $this->lfDeleteCustomer($objCustomer->getValue('customer_id'));
             $objCustomer->EndSession();
             SC_Response_Ex::sendRedirect('refusal_complete.php');
             break;
         default:
             if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
                 $this->refusal_transactionid = $this->getRefusalToken();
             }
             break;
     }
 }
Beispiel #5
0
 /**
  * Page のAction.
  *
  * @return void
  */
 public function action()
 {
     //決済処理中ステータスのロールバック
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);
     $objCustomer = new SC_Customer_Ex();
     $customer_id = $objCustomer->getValue('customer_id');
     //ページ送り用
     $this->objNavi = new SC_PageNavi_Ex($_REQUEST['pageno'], $this->lfGetOrderHistory($customer_id), SEARCH_PMAX, 'eccube.movePage', NAVI_PMAX, 'pageno=#page#', SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
     $this->arrOrder = $this->lfGetOrderHistory($customer_id, $this->objNavi->start_row);
     switch ($this->getMode()) {
         case 'getList':
             echo SC_Utils_Ex::jsonEncode($this->arrOrder);
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
     // 支払い方法の取得
     $this->arrPayment = SC_Helper_Payment_Ex::getIDValueList();
     // 1ページあたりの件数
     $this->dispNumber = SEARCH_PMAX;
     $this->json_payment = SC_Utils::jsonEncode($this->arrPayment);
     $this->json_customer_order_status = SC_Utils::jsonEncode($this->arrCustomerOrderStatus);
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $arrParam = $_REQUEST;
     list($response_outer, $arrResponse) = SC_Api_Operation::doApiAction($arrParam);
     SC_Api_Operation_Ex::sendApiResponse('xml', $response_outer, $arrResponse);
     SC_Response_Ex::actionExit();
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $arrParam = $_REQUEST;
     list($response_outer, $arrResponse) = SC_Api_Operation_Ex::doApiAction($arrParam);
     if (isset($arrParam["callback"])) {
         $arrResponse["callback"] = $arrParam["callback"];
     }
     SC_Api_Operation_Ex::sendApiResponse('json', $response_outer, $arrResponse);
     SC_Response_Ex::actionExit();
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objFormParam = new SC_FormParam_Ex();
     $this->initForm($objFormParam, $_GET);
     switch ($this->getMode()) {
         // PHP INFOを表示
         case 'info':
             phpinfo();
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
     $this->arrSystemInfo = $this->getSystemInfo();
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     $objCustomer = new SC_Customer_Ex();
     $customer_id = $objCustomer->getvalue('customer_id');
     //ページ送り用
     $this->objNavi = new SC_PageNavi_Ex($_REQUEST['pageno'], $this->lfGetOrderHistory($customer_id), SEARCH_PMAX, 'fnNaviPage', NAVI_PMAX, 'pageno=#page#', SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
     $this->arrOrder = $this->lfGetOrderHistory($customer_id, $this->objNavi->start_row);
     switch ($this->getMode()) {
         case 'getList':
             echo SC_Utils_Ex::jsonEncode($this->arrOrder);
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
     // 支払い方法の取得
     $this->arrPayment = SC_Helper_DB_Ex::sfGetIDValueList('dtb_payment', 'payment_id', 'payment_method');
     // 1ページあたりの件数
     $this->dispNumber = SEARCH_PMAX;
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     switch ($this->getMode()) {
         default:
             // フォーム操作クラス
             $objFormParam = new SC_FormParam_Ex();
             // パラメーター情報の初期化
             $this->lfInitParam($objFormParam);
             $objFormParam->setParam($_GET);
             $objFormParam->convParam();
             // 表示するファイルにエラーチェックを行う
             if ($this->checkErrorDispFile($objFormParam)) {
                 $this->execFileView($objFormParam);
             } else {
                 SC_Utils_Ex::sfDispError('');
             }
             SC_Response_Ex::actionExit();
             break;
     }
 }
 /**
  * 複数配送情報を一時保存する.
  *
  * 会員ログインしている場合は, その他のお届け先から住所情報を取得する.
  *
  * @param  integer            $uniqid       一時受注テーブルのユニークID
  * @param  SC_FormParam       $objFormParam SC_FormParam インスタンス
  * @param  SC_Customer        $objCustomer  SC_Customer インスタンス
  * @param  SC_Helper_Purchase $objPurchase  SC_Helper_Purchase インスタンス
  * @return void
  */
 public function saveMultipleShippings($uniqid, &$objFormParam, &$objCustomer, &$objPurchase, &$objAddress)
 {
     $arrParams = $objFormParam->getSwapArray();
     foreach ($arrParams as $arrParam) {
         $other_deliv_id = $arrParam['shipping'];
         if ($objCustomer->isLoginSuccess(true)) {
             if ($other_deliv_id != 0) {
                 $otherDeliv = $objAddress->getAddress($other_deliv_id, $objCustomer->getValue('customer_id'));
                 if (!$otherDeliv) {
                     SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', false, "入力値が不正です。<br />正しい値を入力してください。");
                     SC_Response_Ex::actionExit();
                 }
                 foreach ($otherDeliv as $key => $val) {
                     $arrValues[$other_deliv_id]['shipping_' . $key] = $val;
                 }
             } else {
                 $objPurchase->copyFromCustomer($arrValues[0], $objCustomer, 'shipping');
             }
         } else {
             $arrValues = $objPurchase->getShippingTemp();
         }
         $arrItemTemp[$other_deliv_id][$arrParam['product_class_id']] += $arrParam['quantity'];
     }
     $objPurchase->clearShipmentItemTemp();
     foreach ($arrValues as $shipping_id => $arrVal) {
         $objPurchase->saveShippingTemp($arrVal, $shipping_id);
     }
     foreach ($arrItemTemp as $other_deliv_id => $arrProductClassIds) {
         foreach ($arrProductClassIds as $product_class_id => $quantity) {
             if ($quantity == 0) {
                 continue;
             }
             $objPurchase->setShipmentItemTemp($other_deliv_id, $product_class_id, $quantity);
         }
     }
     //不必要な配送先を削除
     foreach ($_SESSION['shipping'] as $id => $arrShipping) {
         if (!isset($arrShipping['shipment_item'])) {
             $objPurchase->unsetOneShippingTemp($id);
         }
     }
     // $arrValues[0] には, 購入者の情報が格納されている
     $objPurchase->saveOrderTemp($uniqid, $arrValues[0], $objCustomer);
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     $objFormParam = new SC_FormParam_Ex();
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     switch ($this->getMode()) {
         case 'confirm':
             $this->arrErr = $this->lfCheckError($objFormParam);
             //エラーチェック
             if (empty($this->arrErr)) {
                 //重複タイトルでない
                 $this->tpl_mainpage = 'products/review_confirm.tpl';
             }
             break;
         case 'return':
             break;
         case 'complete':
             $this->arrErr = $this->lfCheckError($objFormParam);
             //エラーチェック
             if (empty($this->arrErr)) {
                 //登録実行
                 $this->lfRegistRecommendData($objFormParam);
                 //レビュー書き込み完了ページへ
                 SC_Response_Ex::sendRedirect('review_complete.php');
                 SC_Response_Ex::actionExit();
             }
             break;
         default:
             // 最初のproduct_idは、$_GETで渡ってくる。
             $objFormParam->setParam($_GET);
             break;
     }
     $this->arrForm = $objFormParam->getHashArray();
     //商品名の取得
     $this->arrForm['name'] = $this->lfGetProductName($this->arrForm['product_id']);
     if (empty($this->arrForm['name'])) {
         SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
     }
     $this->setTemplate($this->tpl_mainpage);
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objFormParam = new SC_FormParam_Ex();
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_REQUEST);
     $objFormParam->convParam();
     $this->arrErr = $objFormParam->checkError();
     $is_error = !SC_Utils_Ex::isBlank($this->arrErr);
     $this->bloc_id = $objFormParam->getValue('bloc_id');
     $this->device_type_id = $objFormParam->getValue('device_type_id', DEVICE_TYPE_PC);
     $objBloc = new SC_Helper_Bloc_Ex($this->device_type_id);
     switch ($this->getMode()) {
         // 登録/更新
         case 'confirm':
             if (!$is_error) {
                 $this->arrErr = $this->lfCheckError($objFormParam, $this->arrErr, $objBloc);
                 if (SC_Utils_Ex::isBlank($this->arrErr)) {
                     $result = $this->doRegister($objFormParam, $objBloc);
                     if ($result !== false) {
                         $arrPram = array('bloc_id' => $result, 'device_type_id' => $this->device_type_id, 'msg' => 'on');
                         SC_Response_Ex::reload($arrPram, true);
                         SC_Response_Ex::actionExit();
                     }
                 }
             }
             break;
             // 削除
         // 削除
         case 'delete':
             if (!$is_error) {
                 if ($this->doDelete($objFormParam, $objBloc)) {
                     $arrPram = array('device_type_id' => $this->device_type_id, 'msg' => 'on');
                     SC_Response_Ex::reload($arrPram, true);
                     SC_Response_Ex::actionExit();
                 }
             }
             break;
         default:
             if (isset($_GET['msg']) && $_GET['msg'] == 'on') {
                 // 完了メッセージ
                 $this->tpl_onload = "alert('登録が完了しました。');";
             }
             break;
     }
     if (!$is_error) {
         // ブロック一覧を取得
         $this->arrBlocList = $objBloc->getList();
         // bloc_id が指定されている場合にはブロックデータの取得
         if (!SC_Utils_Ex::isBlank($this->bloc_id)) {
             $arrBloc = $this->getBlocTemplate($this->bloc_id, $objBloc);
             $objFormParam->setParam($arrBloc);
         }
     } else {
         // 画面にエラー表示しないため, ログ出力
         GC_Utils_Ex::gfPrintLog('Error: ' . print_r($this->arrErr, true));
     }
     $this->tpl_subtitle = $this->arrDeviceType[$this->device_type_id] . '>' . $this->tpl_subtitle;
     $this->arrForm = $objFormParam->getFormParamList();
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objSiteSess = new SC_SiteSession_Ex();
     $objCartSess = new SC_CartSession_Ex();
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $this->is_multiple = $objPurchase->isMultiple();
     // カートの情報を取得
     $this->arrShipping = $objPurchase->getShippingTemp($this->is_multiple);
     $this->tpl_uniqid = $objSiteSess->getUniqId();
     $cart_key = $objCartSess->getKey();
     $this->cartKey = $cart_key;
     $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
     // 配送業者を取得
     $this->arrDeliv = $objPurchase->getDeliv($cart_key);
     $this->is_single_deliv = $this->isSingleDeliv($this->arrDeliv);
     // 会員情報の取得
     if ($objCustomer->isLoginSuccess(true)) {
         $this->tpl_login = '******';
         $this->tpl_user_point = $objCustomer->getValue('point');
         $this->name01 = $objCustomer->getValue('name01');
         $this->name02 = $objCustomer->getValue('name02');
     }
     // 戻り URL の設定
     // @deprecated 2.12.0 テンプレート直書きに戻した
     $this->tpl_back_url = '?mode=return';
     $arrOrderTemp = $objPurchase->getOrderTemp($this->tpl_uniqid);
     // 正常に受注情報が格納されていない場合はカート画面へ戻す
     if (SC_Utils_Ex::isBlank($arrOrderTemp)) {
         SC_Response_Ex::sendRedirect(CART_URLPATH);
         SC_Response_Ex::actionExit();
     }
     // カート内商品の妥当性チェック
     $this->tpl_message = $objCartSess->checkProducts($cart_key);
     if (strlen($this->tpl_message) >= 1) {
         SC_Response_Ex::sendRedirect(CART_URLPATH);
         SC_Response_Ex::actionExit();
     }
     /*
      * 購入金額の取得
      * ここでは送料を加算しない
      */
     $this->arrPrices = $objCartSess->calculate($cart_key, $objCustomer);
     // お届け日一覧の取得
     $this->arrDelivDate = $objPurchase->getDelivDate($objCartSess, $cart_key);
     switch ($this->getMode()) {
         /*
          * 配送業者選択時のアクション
          * モバイル端末以外の場合は, JSON 形式のデータを出力し, ajax で取得する.
          */
         case 'select_deliv':
             $this->setFormParams($objFormParam, $arrOrderTemp, true, $this->arrShipping);
             $objFormParam->setParam($_POST);
             $this->arrErr = $objFormParam->checkError();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 $deliv_id = $objFormParam->getValue('deliv_id');
                 $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id);
                 $arrSelectedDeliv['error'] = false;
             } else {
                 $arrSelectedDeliv = array('error' => true);
                 $this->tpl_mainpage = 'shopping/select_deliv.tpl';
                 // モバイル用
             }
             if (SC_Display_Ex::detectDevice() != DEVICE_TYPE_MOBILE) {
                 echo SC_Utils_Ex::jsonEncode($arrSelectedDeliv);
                 SC_Response_Ex::actionExit();
             } else {
                 $this->arrPayment = $arrSelectedDeliv['arrPayment'];
                 $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime'];
             }
             break;
             // 登録処理
         // 登録処理
         case 'confirm':
             // パラメーター情報の初期化
             $this->setFormParams($objFormParam, $_POST, false, $this->arrShipping);
             $deliv_id = $objFormParam->getValue('deliv_id');
             $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id);
             $this->arrPayment = $arrSelectedDeliv['arrPayment'];
             $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime'];
             $this->img_show = $arrSelectedDeliv['img_show'];
             $this->arrErr = $this->lfCheckError($objFormParam, $this->arrPrices['subtotal'], $this->tpl_user_point);
             if (empty($this->arrErr)) {
                 $this->saveShippings($objFormParam, $this->arrDelivTime);
                 $this->lfRegistData($this->tpl_uniqid, $objFormParam->getDbArray(), $objPurchase, $this->arrPayment);
                 // 正常に登録されたことを記録しておく
                 $objSiteSess->setRegistFlag();
                 // 確認ページへ移動
                 SC_Response_Ex::sendRedirect(SHOPPING_CONFIRM_URLPATH);
                 SC_Response_Ex::actionExit();
             }
             break;
             // 前のページに戻る
         // 前のページに戻る
         case 'return':
             // 正常な推移であることを記録しておく
             $objSiteSess->setRegistFlag();
             $url = null;
             if ($this->is_multiple) {
                 $url = MULTIPLE_URLPATH . '?from=multiple';
             } elseif ($objCustomer->isLoginSuccess(true)) {
                 if ($product_type_id == PRODUCT_TYPE_DOWNLOAD) {
                     $url = CART_URLPATH;
                 } else {
                     $url = DELIV_URLPATH;
                 }
             } else {
                 $url = SHOPPING_URL . '?from=nonmember';
             }
             SC_Response_Ex::sendRedirect($url);
             SC_Response_Ex::actionExit();
             break;
         default:
             // FIXME 前のページから戻ってきた場合は別パラメーター(mode)で処理分岐する必要があるのかもしれない
             $this->setFormParams($objFormParam, $arrOrderTemp, false, $this->arrShipping);
             if (!$this->is_single_deliv) {
                 $deliv_id = $objFormParam->getValue('deliv_id');
             } else {
                 $deliv_id = $this->arrDeliv[0]['deliv_id'];
             }
             if (!SC_Utils_Ex::isBlank($deliv_id)) {
                 $objFormParam->setValue('deliv_id', $deliv_id);
                 $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id);
                 $this->arrPayment = $arrSelectedDeliv['arrPayment'];
                 $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime'];
                 $this->img_show = $arrSelectedDeliv['img_show'];
             }
             break;
     }
     // モバイル用 ポストバック処理
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && SC_Utils_Ex::isBlank($this->arrErr)) {
         $this->tpl_mainpage = $this->getMobileMainpage($this->is_single_deliv, $this->getMode());
     }
     $this->arrForm = $objFormParam->getFormParamList();
 }
 /**
  * @param SC_Helper_Address_Ex $objAddress
  * @param SC_FormParam $objFormParam
  */
 public function lfRegistData($objAddress, $objFormParam, $customer_id)
 {
     $arrRet = $objFormParam->getHashArray();
     $sqlval = $objFormParam->getDbArray();
     $sqlval['other_deliv_id'] = $arrRet['other_deliv_id'];
     $sqlval['customer_id'] = $customer_id;
     if (!$objAddress->registAddress($sqlval)) {
         SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', false, '別のお届け先を登録できませんでした。');
         SC_Response_Ex::actionExit();
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objDb = new SC_Helper_DB_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $this->arrData = isset($_SESSION['customer']) ? $_SESSION['customer'] : '';
     switch ($this->getMode()) {
         case 'confirm':
             // エラーチェック
             $this->lfInitParam($objFormParam);
             $objFormParam->setParam($_POST);
             $objFormParam->convParam();
             $objFormParam->toLower('email');
             $objFormParam->toLower('email02');
             $this->arrErr = $this->lfCheckError($objFormParam);
             // 入力値の取得
             $this->arrForm = $objFormParam->getFormParamList();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 // エラー無しで完了画面
                 $this->tpl_mainpage = 'contact/confirm.tpl';
                 $this->tpl_title = 'お問い合わせ(確認ページ)';
             }
             break;
         case 'return':
             $this->lfInitParam($objFormParam);
             $objFormParam->setParam($_POST);
             $this->arrForm = $objFormParam->getFormParamList();
             break;
         case 'complete':
             $this->lfInitParam($objFormParam);
             $objFormParam->setParam($_POST);
             $this->arrErr = $objFormParam->checkError();
             $this->arrForm = $objFormParam->getFormParamList();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 $this->lfSendMail($this);
                 // 完了ページへ移動する
                 SC_Response_Ex::sendRedirect('complete.php');
                 SC_Response_Ex::actionExit();
             } else {
                 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
                 SC_Response_Ex::actionExit();
             }
             break;
         default:
             break;
     }
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     $objCustomer = new SC_Customer_Ex();
     $objAddress = new SC_Helper_Address_Ex();
     $ParentPage = MYPAGE_DELIVADDR_URLPATH;
     // GETでページを指定されている場合には指定ページに戻す
     if (isset($_GET['page'])) {
         $ParentPage = htmlspecialchars($_GET['page'], ENT_QUOTES);
     } else {
         if (isset($_POST['ParentPage'])) {
             $ParentPage = htmlspecialchars($_POST['ParentPage'], ENT_QUOTES);
         }
     }
     $this->ParentPage = $ParentPage;
     /*
      * ログイン判定 及び 退会判定
      * 未ログインでも, 複数配送設定ページからのアクセスの場合は表示する
      *
      * TODO 購入遷移とMyPageで別クラスにすべき
      */
     if (!$objCustomer->isLoginSuccess(true) && $ParentPage != MULTIPLE_URLPATH) {
         $this->tpl_onload = "fnUpdateParent('" . $this->getLocation($_POST['ParentPage']) . "'); window.close();";
     }
     // other_deliv_id のあるなしで追加か編集か判定しているらしい
     $_SESSION['other_deliv_id'] = $_REQUEST['other_deliv_id'];
     // パラメーター管理クラス,パラメーター情報の初期化
     $objFormParam = new SC_FormParam_Ex();
     $objAddress->setFormParam($objFormParam);
     $objFormParam->setParam($_POST);
     $this->arrForm = $objFormParam->getHashArray();
     switch ($this->getMode()) {
         // 入力は必ずedit
         case 'edit':
             $this->arrErr = $objAddress->errorCheck($objFormParam);
             // 入力エラーなし
             if (empty($this->arrErr)) {
                 // TODO ここでやるべきではない
                 if (in_array($_POST['ParentPage'], $this->validUrl)) {
                     $this->tpl_onload = "fnUpdateParent('" . $this->getLocation($_POST['ParentPage']) . "'); window.close();";
                 } else {
                     SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
                 }
                 if ($objCustomer->isLoginSuccess(true)) {
                     $this->lfRegistData($objAddress, $objFormParam, $objCustomer->getValue('customer_id'));
                 } else {
                     $this->lfRegistDataNonMember($objFormParam);
                 }
                 if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
                     // モバイルの場合、元のページに遷移
                     SC_Response_Ex::sendRedirect($this->getLocation($_POST['ParentPage']));
                     SC_Response_Ex::actionExit();
                 }
             }
             break;
         case 'multiple':
             // 複数配送先用
             break;
         default:
             if ($_GET['other_deliv_id'] != '') {
                 $arrOtherDeliv = $objAddress->getAddress($_SESSION['other_deliv_id']);
                 //不正アクセス判定
                 if (!$objCustomer->isLoginSuccess(true) || !$arrOtherDeliv) {
                     SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
                 }
                 //別のお届け先情報取得
                 $this->arrForm = $arrOtherDeliv;
             }
             break;
     }
     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
         $this->tpl_mainpage = 'mypage/delivery_addr.tpl';
     } else {
         $this->setTemplate('mypage/delivery_addr.tpl');
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objFormParam = new SC_FormParam_Ex();
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_REQUEST);
     $objFormParam->convParam();
     $this->device_type_id = $objFormParam->getValue('device_type_id', DEVICE_TYPE_PC);
     $this->tpl_select = $this->getTemplateName($this->device_type_id);
     $template_code = $objFormParam->getValue('template_code');
     switch ($this->getMode()) {
         // 登録ボタン押下時
         case 'register':
             $this->arrErr = $objFormParam->checkError();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 if ($this->doRegister($template_code, $this->device_type_id)) {
                     $this->tpl_select = $template_code;
                     $this->tpl_onload = "alert('登録が完了しました。');";
                 }
             }
             break;
             // 削除ボタン押下時
         // 削除ボタン押下時
         case 'delete':
             if ($objFormParam->checkError()) {
                 SC_Utils_Ex::sfDispError('');
             }
             $this->arrErr = $objFormParam->checkError();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 if ($this->doDelete($template_code, $this->device_type_id)) {
                     $this->tpl_onload = "alert('削除が完了しました。');";
                 }
             }
             break;
             // downloadボタン押下時
         // downloadボタン押下時
         case 'download':
             $this->arrErr = $objFormParam->checkError();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 if ($this->doDownload($template_code) !== false) {
                     // ブラウザに出力し, 終了する
                     SC_Response_Ex::actionExit();
                 }
             }
             break;
         default:
             break;
     }
     $this->templates = $this->getAllTemplates($this->device_type_id);
     $this->tpl_subtitle = $this->arrDeviceType[$this->device_type_id] . '>' . $this->tpl_subtitle;
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objCartSess = new SC_CartSession_Ex();
     $objSiteSess = new SC_SiteSession_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objHelperMail = new SC_Helper_Mail_Ex();
     $this->is_multiple = $objPurchase->isMultiple();
     // 前のページで正しく登録手続きが行われた記録があるか判定
     if (!$objSiteSess->isPrePage()) {
         SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, $objSiteSess);
     }
     // ユーザユニークIDの取得と購入状態の正当性をチェック
     $this->tpl_uniqid = $objSiteSess->getUniqId();
     $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
     $this->cartKey = $objCartSess->getKey();
     // カート内商品のチェック
     $this->tpl_message = $objCartSess->checkProducts($this->cartKey);
     if (!SC_Utils_Ex::isBlank($this->tpl_message)) {
         SC_Response_Ex::sendRedirect(CART_URLPATH);
         SC_Response_Ex::actionExit();
     }
     // カートの商品を取得
     $this->arrShipping = $objPurchase->getShippingTemp($this->is_multiple);
     $this->arrCartItems = $objCartSess->getCartList($this->cartKey);
     // 合計金額
     $this->tpl_total_inctax[$this->cartKey] = $objCartSess->getAllProductsTotal($this->cartKey);
     // 税額
     $this->tpl_total_tax[$this->cartKey] = $objCartSess->getAllProductsTax($this->cartKey);
     // ポイント合計
     $this->tpl_total_point[$this->cartKey] = $objCartSess->getAllProductsPoint($this->cartKey);
     // 一時受注テーブルの読込
     $arrOrderTemp = $objPurchase->getOrderTemp($this->tpl_uniqid);
     // カート集計を元に最終計算
     $arrCalcResults = $objCartSess->calculate($this->cartKey, $objCustomer, $arrOrderTemp['use_point'], $objPurchase->getShippingPref($this->is_multiple), $arrOrderTemp['charge'], $arrOrderTemp['discount'], $arrOrderTemp['deliv_id']);
     $this->arrForm = array_merge($arrOrderTemp, $arrCalcResults);
     // 会員ログインチェック
     if ($objCustomer->isLoginSuccess(true)) {
         $this->tpl_login = '******';
         $this->tpl_user_point = $objCustomer->getValue('point');
     }
     // 決済モジュールを使用するかどうか
     $this->use_module = SC_Helper_Payment_Ex::useModule($this->arrForm['payment_id']);
     switch ($this->getMode()) {
         // 前のページに戻る
         case 'return':
             // 正常な推移であることを記録しておく
             $objSiteSess->setRegistFlag();
             SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH);
             SC_Response_Ex::actionExit();
             break;
         case 'confirm':
             /*
              * 決済モジュールで必要なため, 受注番号を取得
              */
             $this->arrForm['order_id'] = $objPurchase->getNextOrderID();
             $_SESSION['order_id'] = $this->arrForm['order_id'];
             // 集計結果を受注一時テーブルに反映
             $objPurchase->saveOrderTemp($this->tpl_uniqid, $this->arrForm, $objCustomer);
             // 正常に登録されたことを記録しておく
             $objSiteSess->setRegistFlag();
             // 決済モジュールを使用する場合
             if ($this->use_module) {
                 $objPurchase->completeOrder(ORDER_PENDING);
                 SC_Response_Ex::sendRedirect(SHOPPING_MODULE_URLPATH);
             } else {
                 $objPurchase->completeOrder(ORDER_NEW);
                 $template_id = SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE ? 2 : 1;
                 $objHelperMail->sfSendOrderMail($this->arrForm['order_id'], $template_id);
                 SC_Response_Ex::sendRedirect(SHOPPING_COMPLETE_URLPATH);
             }
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
 }
 /**
  * モバイル端末以外ダウンロード処理
  *
  * @param string $realpath ダウンロードファイルパス
  * @param string $sdown_filename ダウンロード時の指定ファイル名
  */
 function lfDownload($realpath, $sdown_filename)
 {
     // 拡張子を取得
     $extension = pathinfo($realpath, PATHINFO_EXTENSION);
     $contentType = $this->defaultContentType;
     // 拡張ContentType判定(拡張子をキーに拡張ContentType対象か判断)
     if (isset($this->arrContentType[$extension])) {
         // 拡張ContentType対象の場合は、ContentTypeを変更
         $contentType = $this->arrContentType[$extension];
     }
     header('Content-Type: ' . $contentType);
     //ファイル名指定
     header('Content-Disposition: attachment; filename="' . $sdown_filename . '"');
     header('Content-Transfer-Encoding: binary');
     //キャッシュ無効化
     header('Expires: Mon, 26 Nov 1962 00:00:00 GMT');
     header('Last-Modified: ' . gmdate('D,d M Y H:i:s') . ' GMT');
     //IE6+SSL環境下は、キャッシュ無しでダウンロードできない
     header('Cache-Control: private');
     header('Pragma: private');
     //ファイルサイズ指定
     $zv_filesize = filesize($realpath);
     header('Content-Length: ' . $zv_filesize);
     //ファイル読み込み
     $handle = fopen($realpath, 'rb');
     if ($handle === false) {
         SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND, '', true);
         SC_Response_Ex::actionExit();
     }
     while (!feof($handle)) {
         echo fread($handle, DOWNLOAD_BLOCK * 1024);
         SC_Utils_Ex::sfFlush();
         SC_Utils_Ex::extendTimeOut();
     }
     fclose($handle);
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     // 会員クラス
     $objCustomer = new SC_Customer_Ex();
     // パラメーター管理クラス
     $this->objFormParam = new SC_FormParam_Ex();
     // パラメーター情報の初期化
     $this->arrForm = $this->lfInitParam($this->objFormParam);
     // ファイル管理クラス
     $this->objUpFile = new SC_UploadFile_Ex(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR);
     // ファイル情報の初期化
     $this->objUpFile = $this->lfInitFile($this->objUpFile);
     // プロダクトIDの正当性チェック
     $product_id = $this->lfCheckProductId($this->objFormParam->getValue('admin'), $this->objFormParam->getValue('product_id'));
     $this->mode = $this->getMode();
     $objProduct = new SC_Product_Ex();
     $objProduct->setProductsClassByProductIds(array($product_id));
     // 規格1クラス名
     $this->tpl_class_name1 = $objProduct->className1[$product_id];
     // 規格2クラス名
     $this->tpl_class_name2 = $objProduct->className2[$product_id];
     // 規格1
     $this->arrClassCat1 = $objProduct->classCats1[$product_id];
     // 規格1が設定されている
     $this->tpl_classcat_find1 = $objProduct->classCat1_find[$product_id];
     // 規格2が設定されている
     $this->tpl_classcat_find2 = $objProduct->classCat2_find[$product_id];
     $this->tpl_stock_find = $objProduct->stock_find[$product_id];
     $this->tpl_product_class_id = $objProduct->classCategories[$product_id]['__unselected']['__unselected']['product_class_id'];
     $this->tpl_product_type = $objProduct->classCategories[$product_id]['__unselected']['__unselected']['product_type'];
     // 在庫が無い場合は、OnLoadしない。(javascriptエラー防止)
     if ($this->tpl_stock_find) {
         // 規格選択セレクトボックスの作成
         $this->js_lnOnload .= $this->lfMakeSelect();
     }
     $this->tpl_javascript .= 'classCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories[$product_id]) . ';';
     $this->tpl_javascript .= 'function lnOnLoad(){' . $this->js_lnOnload . '}';
     $this->tpl_onload .= 'lnOnLoad();';
     // モバイル用 規格選択セレクトボックスの作成
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         $this->lfMakeSelectMobile($this, $product_id, $this->objFormParam->getValue('classcategory_id1'));
     }
     // 商品IDをFORM内に保持する
     $this->tpl_product_id = $product_id;
     switch ($this->mode) {
         case 'cart':
             $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
             if (count($this->arrErr) == 0) {
                 $objCartSess = new SC_CartSession_Ex();
                 $product_class_id = $this->objFormParam->getValue('product_class_id');
                 $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'));
                 SC_Response_Ex::sendRedirect(CART_URLPATH);
                 SC_Response_Ex::actionExit();
             }
             break;
         case 'add_favorite':
             // ログイン中のユーザが商品をお気に入りにいれる処理
             if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) {
                 $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam);
                 if (count($this->arrErr) == 0) {
                     if (!$this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'), $objCustomer->getValue('customer_id'))) {
                         $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
                         $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite', array($this));
                         SC_Response_Ex::actionExit();
                     }
                 }
             }
             break;
         case 'add_favorite_sphone':
             // ログイン中のユーザが商品をお気に入りにいれる処理(スマートフォン用)
             if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) {
                 $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam);
                 if (count($this->arrErr) == 0) {
                     if ($this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'), $objCustomer->getValue('customer_id'))) {
                         $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
                         $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite_sphone', array($this));
                         print 'true';
                         SC_Response_Ex::actionExit();
                     }
                 }
                 print 'error';
                 SC_Response_Ex::actionExit();
             }
             break;
         case 'select':
         case 'select2':
         case 'selectItem':
             /**
              * モバイルの数量指定・規格選択の際に、
              * $_SESSION['cart_referer_url'] を上書きさせないために、
              * 何もせずbreakする。
              */
             break;
         default:
             // カート「戻るボタン」用に保持
             $netURL = new Net_URL();
             $_SESSION['cart_referer_url'] = $netURL->getURL();
             break;
     }
     // モバイル用 ポストバック処理
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         switch ($this->mode) {
             case 'select':
                 // 規格1が設定されている場合
                 if ($this->tpl_classcat_find1) {
                     // templateの変更
                     $this->tpl_mainpage = 'products/select_find1.tpl';
                     break;
                 }
                 // 数量の入力を行う
                 $this->tpl_mainpage = 'products/select_item.tpl';
                 break;
             case 'select2':
                 $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
                 // 規格1が設定されていて、エラーを検出した場合
                 if ($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) {
                     // templateの変更
                     $this->tpl_mainpage = 'products/select_find1.tpl';
                     break;
                 }
                 // 規格2が設定されている場合
                 if ($this->tpl_classcat_find2) {
                     $this->arrErr = array();
                     $this->tpl_mainpage = 'products/select_find2.tpl';
                     break;
                 }
             case 'selectItem':
                 $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
                 // 規格2が設定されていて、エラーを検出した場合
                 if ($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) {
                     // templateの変更
                     $this->tpl_mainpage = 'products/select_find2.tpl';
                     break;
                 }
                 $value1 = $this->objFormParam->getValue('classcategory_id1');
                 // 規格2が設定されている場合.
                 if (SC_Utils_Ex::isBlank($this->objFormParam->getValue('classcategory_id2')) == false) {
                     $value2 = '#' . $this->objFormParam->getValue('classcategory_id2');
                 } else {
                     $value2 = '#0';
                 }
                 if (strlen($value1) === 0) {
                     $value1 = '__unselected';
                 }
                 $this->tpl_product_class_id = $objProduct->classCategories[$product_id][$value1][$value2]['product_class_id'];
                 // この段階では、数量の入力チェックエラーを出させない。
                 unset($this->arrErr['quantity']);
                 // 数量の入力を行う
                 $this->tpl_mainpage = 'products/select_item.tpl';
                 break;
             case 'cart':
                 // この段階でエラーが出る場合は、数量の入力エラーのはず
                 if (count($this->arrErr)) {
                     // 数量の入力を行う
                     $this->tpl_mainpage = 'products/select_item.tpl';
                 }
                 break;
             default:
                 $this->tpl_mainpage = 'products/detail.tpl';
                 break;
         }
     }
     // 商品詳細を取得
     $this->arrProduct = $objProduct->getDetail($product_id);
     // サブタイトルを取得
     $this->tpl_subtitle = $this->arrProduct['name'];
     // 関連カテゴリを取得
     $this->arrRelativeCat = SC_Helper_DB_Ex::sfGetMultiCatTree($product_id);
     // 商品ステータスを取得
     $this->productStatus = $objProduct->getProductStatus($product_id);
     // 画像ファイル指定がない場合の置換処理
     $this->arrProduct['main_image'] = SC_Utils_Ex::sfNoImageMain($this->arrProduct['main_image']);
     $this->subImageFlag = $this->lfSetFile($this->objUpFile, $this->arrProduct, $this->arrFile);
     //レビュー情報の取得
     $this->arrReview = $this->lfGetReviewData($product_id);
     //関連商品情報表示
     $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id);
     // ログイン判定
     if ($objCustomer->isLoginSuccess() === true) {
         //お気に入りボタン表示
         $this->tpl_login = true;
         $this->is_favorite = SC_Helper_DB_Ex::sfDataExists('dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($objCustomer->getValue('customer_id'), $product_id));
     }
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     $objCustomer = new SC_Customer_Ex();
     $customer_id = $objCustomer->getValue('customer_id');
     $objAddress = new SC_Helper_Address_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     switch ($this->getMode()) {
         // お届け先の削除
         case 'delete':
             if ($objFormParam->checkError()) {
                 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
                 SC_Response_Ex::actionExit();
             }
             $objAddress->deleteAddress($objFormParam->getValue('other_deliv_id'));
             break;
             // スマートフォン版のもっと見るボタン用
         // スマートフォン版のもっと見るボタン用
         case 'getList':
             $arrData = $objFormParam->getHashArray();
             //別のお届け先情報
             $arrOtherDeliv = $objAddress->getList($customer_id, ($arrData['pageno'] - 1) * SEARCH_PMAX);
             //県名をセット
             $arrOtherDeliv = $this->setPref($arrOtherDeliv, $this->arrPref);
             $arrOtherDeliv['delivCount'] = count($arrOtherDeliv);
             $this->arrOtherDeliv = $arrOtherDeliv;
             echo SC_Utils_Ex::jsonEncode($this->arrOtherDeliv);
             SC_Response_Ex::actionExit();
             break;
             // お届け先の表示
         // お届け先の表示
         default:
             break;
     }
     //別のお届け先情報
     $this->arrOtherDeliv = $objAddress->getList($customer_id);
     //お届け先登録数
     $this->tpl_linemax = count($this->arrOtherDeliv);
     // 1ページあたりの件数
     $this->dispNumber = SEARCH_PMAX;
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objDb = new SC_Helper_DB_Ex();
     $mode = $this->getMode();
     $objFormParam = new SC_FormParam_Ex();
     $this->lfInitParam($mode, $objFormParam);
     $objFormParam->setParam($_REQUEST);
     $objFormParam->convParam();
     $this->arrErr = $this->lfCheckError($mode, $objFormParam);
     $is_error = !SC_Utils_Ex::isBlank($this->arrErr);
     $this->kiyaku_id = $objFormParam->getValue('kiyaku_id');
     if ($is_error) {
         trigger_error('', E_USER_ERROR);
         return;
     }
     // 要求判定
     switch ($mode) {
         // 編集処理
         case 'confirm':
             // POST値の引き継ぎ
             $this->arrForm = $_POST;
             if (!$is_error) {
                 if ($this->kiyaku_id == '') {
                     $result = $this->lfInsertClass($this->arrForm, $_SESSION['member_id']);
                     // 新規作成
                 } else {
                     $result = $this->lfUpdateClass($this->arrForm, $this->kiyaku_id);
                     // 既存編集
                 }
                 if ($result !== FALSE) {
                     $arrPram = array('kiyaku_id' => $result, 'msg' => 'on');
                     SC_Response_Ex::reload($arrPram, true);
                     SC_Response_Ex::actionExit();
                 }
             }
             break;
             // 削除
         // 削除
         case 'delete':
             $objDb->sfDeleteRankRecord('dtb_kiyaku', 'kiyaku_id', $this->kiyaku_id, '', true);
             // 再表示
             $this->objDisplay->reload();
             break;
         case 'down':
             $objDb->sfRankDown('dtb_kiyaku', 'kiyaku_id', $this->kiyaku_id);
             // 再表示
             $this->objDisplay->reload();
             break;
         case 'up':
             $objDb->sfRankUp('dtb_kiyaku', 'kiyaku_id', $this->kiyaku_id);
             // 再表示
             $this->objDisplay->reload();
             break;
         default:
             if (isset($_GET['msg']) && $_GET['msg'] == 'on') {
                 // 完了メッセージ
                 $this->tpl_onload = "alert('登録が完了しました。');";
             }
             break;
     }
     $this->arrForm = $objFormParam->getFormParamList();
     if (!$is_error) {
         // 規約一覧を取得
         $this->arrKiyaku = $this->lfGetKiyakuList();
         // kiyaku_id が指定されている場合には規約データの取得
         if (!SC_Utils_Ex::isBlank($this->kiyaku_id)) {
             // 編集項目を取得する。
             $arrKiyakuData = $this->lfGetKiyakuDataByKiyakuID($this->kiyaku_id);
             // 入力項目にカテゴリ名を入力する。
             $this->arrForm['kiyaku_title'] = $arrKiyakuData[0]['kiyaku_title'];
             $this->arrForm['kiyaku_text'] = $arrKiyakuData[0]['kiyaku_text'];
             // POSTデータを引き継ぐ
             $this->tpl_kiyaku_id = $this->kiyaku_id;
         }
     } else {
         // 画面にエラー表示しないため, ログ出力
         GC_Utils_Ex::gfPrintLog('Error: ' . print_r($this->arrErr, true));
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objFormParam = new SC_FormParam_Ex();
     // パラメーターの初期化
     $this->initParam($objFormParam, $_POST);
     $arrErrTmp = array();
     $arrForm = array();
     $this->mode = $this->getMode();
     switch ($this->mode) {
         // バックアップを作成する
         case 'bkup':
             // データ型エラーチェック
             $arrErrTmp[1] = $objFormParam->checkError();
             // データ型に問題がない場合
             if (SC_Utils_Ex::isBlank($arrErrTmp[1])) {
                 // データ型以外のエラーチェック
                 $arrErrTmp[2] = $this->lfCheckError($objFormParam->getHashArray(), $this->mode);
             }
             // エラーがなければバックアップ処理を行う
             if (SC_Utils_Ex::isBlank($arrErrTmp[1]) && SC_Utils_Ex::isBlank($arrErrTmp[2])) {
                 $arrData = $objFormParam->getHashArray();
                 $work_dir = $this->bkup_dir . $arrData['bkup_name'] . '/';
                 // バックアップデータの事前削除
                 SC_Helper_FileManager_Ex::deleteFile($work_dir);
                 // バックアップファイル作成
                 $res = $this->lfCreateBkupData($arrData['bkup_name'], $work_dir);
                 // バックアップデータの事後削除
                 SC_Helper_FileManager_Ex::deleteFile($work_dir);
                 $arrErrTmp[3] = array();
                 if ($res !== true) {
                     $arrErrTmp[3]['bkup_name'] = 'バックアップに失敗しました。(' . $res . ')';
                 }
                 // DBにデータ更新
                 if (SC_Utils_Ex::isBlank($arrErrTmp[3])) {
                     $this->lfUpdBkupData($arrData);
                 } else {
                     $arrForm = $arrData;
                     $arrErr = $arrErrTmp[3];
                 }
                 $this->tpl_onload = "alert('バックアップ完了しました');";
             } else {
                 $arrForm = $objFormParam->getHashArray();
                 $arrErr = array_merge((array) $arrErrTmp[1], (array) $arrErrTmp[2]);
             }
             break;
             // リストア
         // リストア
         case 'restore_config':
         case 'restore':
             // データベースに存在するかどうかチェック
             $arrErr = $this->lfCheckError($objFormParam->getHashArray(), $this->mode);
             // エラーがなければリストア処理を行う
             if (SC_Utils_Ex::isBlank($arrErr)) {
                 $arrData = $objFormParam->getHashArray();
                 $msg = '「' . $arrData['list_name'] . '」のリストアを開始します。';
                 GC_Utils_Ex::gfPrintLog($msg);
                 $success = $this->lfRestore($arrData['list_name'], $this->bkup_dir, $this->bkup_ext, $this->mode);
                 $msg = '「' . $arrData['list_name'] . '」の';
                 $msg .= $success ? 'リストアを終了しました。' : 'リストアに失敗しました。';
                 $this->tpl_restore_msg .= $msg . "\n";
                 GC_Utils_Ex::gfPrintLog($msg);
             }
             break;
             // 削除
         // 削除
         case 'delete':
             // データベースに存在するかどうかチェック
             $arrErr = $this->lfCheckError($objFormParam->getHashArray(), $this->mode);
             // エラーがなければリストア処理を行う
             if (SC_Utils_Ex::isBlank($arrErr)) {
                 $arrData = $objFormParam->getHashArray();
                 // DBとファイルを削除
                 $this->lfDeleteBackUp($arrData, $this->bkup_dir, $this->bkup_ext);
             }
             break;
             // ダウンロード
         // ダウンロード
         case 'download':
             // データベースに存在するかどうかチェック
             $arrErr = $this->lfCheckError($objFormParam->getHashArray(), $this->mode);
             // エラーがなければダウンロード処理を行う
             if (SC_Utils_Ex::isBlank($arrErr)) {
                 $arrData = $objFormParam->getHashArray();
                 $filename = $arrData['list_name'] . $this->bkup_ext;
                 $dl_file = $this->bkup_dir . $arrData['list_name'] . $this->bkup_ext;
                 // ダウンロード開始
                 SC_Response_Ex::headerForDownload($filename);
                 header('Content-Length: ' . filesize($dl_file));
                 readfile($dl_file);
                 SC_Response_Ex::actionExit();
                 break;
             }
         default:
             break;
     }
     // 不要になった変数を解放
     unset($arrErrTmp);
     // バックアップリストを取得する
     $arrBkupList = $this->lfGetBkupData('ORDER BY create_date DESC');
     // テンプレートファイルに渡すデータをセット
     $this->arrErr = isset($arrErr) ? $arrErr : array();
     $this->arrForm = isset($arrForm) ? $arrForm : array();
     $this->arrBkupList = $arrBkupList;
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     // パラメーター管理クラス
     $objFormParam = new SC_FormParam_Ex();
     // パラメーター情報の初期化
     $this->lfInitParam($this->tpl_mode, $objFormParam);
     $objFormParam->setParam($_GET);
     $this->arrErr = $objFormParam->checkError();
     $this->arrForm = $objFormParam->getHashArray();
     $this->tpl_zip_download_url_empty = !defined('ZIP_DOWNLOAD_URL') || strlen(ZIP_DOWNLOAD_URL) === 0 || ZIP_DOWNLOAD_URL === false;
     $this->tpl_zip_function_not_exists = !function_exists('zip_open');
     $this->tpl_skip_update_csv = $this->tpl_zip_download_url_empty || $this->tpl_zip_function_not_exists;
     if ($this->exec) {
         if (!empty($this->arrErr)) {
             trigger_error('', E_USER_ERROR);
         }
         switch ($this->tpl_mode) {
             // 自動登録
             case 'auto':
                 $this->lfAutoCommitZip();
                 break;
                 // DB手動登録
             // DB手動登録
             case 'manual':
                 $this->insertMtbZip($this->arrForm['startRowNum']);
                 break;
         }
         SC_Response_Ex::actionExit();
     }
     switch ($this->tpl_mode) {
         // 削除
         case 'delete':
             $this->lfDeleteZip();
             // 進捗・完了画面を表示しない
             $this->tpl_mode = null;
             break;
             // 郵便番号CSV更新
         // 郵便番号CSV更新
         case 'update_csv':
             $this->lfDownloadZipFileFromJp();
             $this->lfExtractZipFile();
             // 進捗・完了画面を表示しない
             $this->tpl_mode = null;
             break;
             // 自動登録時の郵便番号CSV更新
             // XXX iframe内にエラー表示しない様、ここでlfDownloadZipFileFromJp()を呼ぶ。
         // 自動登録時の郵便番号CSV更新
         // XXX iframe内にエラー表示しない様、ここでlfDownloadZipFileFromJp()を呼ぶ。
         case 'auto':
             if (!$this->tpl_skip_update_csv) {
                 $this->lfDownloadZipFileFromJp();
                 $this->lfExtractZipFile();
             }
             break;
     }
     $this->tpl_line = $this->countZipCsv();
     $this->tpl_count_mtb_zip = $this->countMtbZip();
     $this->tpl_csv_datetime = $this->lfGetCsvDatetime();
     // XXX PHP4 を切捨てたら、ダウンロードの必要性チェックなども行いたい
     // $arrHeader = get_headers(ZIP_DOWNLOAD_URL, 1);
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     // 会員管理クラス
     $objCustomer = new SC_Customer_Ex();
     // クッキー管理クラス
     $objCookie = new SC_Cookie_Ex();
     // パラメーター管理クラス
     $objFormParam = new SC_FormParam_Ex();
     // パラメーター情報の初期化
     $this->lfInitParam($objFormParam);
     // リクエスト値をフォームにセット
     $objFormParam->setParam($_POST);
     $url = htmlspecialchars($_POST['url'], ENT_QUOTES);
     // モードによって分岐
     switch ($this->getMode()) {
         case 'login':
             // --- ログイン
             // 入力値のエラーチェック
             $objFormParam->trimParam();
             $objFormParam->toLower('login_email');
             $arrErr = $objFormParam->checkError();
             // エラーの場合はエラー画面に遷移
             if (count($arrErr) > 0) {
                 if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) {
                     echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR);
                     SC_Response_Ex::actionExit();
                 } else {
                     SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
                     SC_Response_Ex::actionExit();
                 }
             }
             // 入力チェック後の値を取得
             $arrForm = $objFormParam->getHashArray();
             // クッキー保存判定
             if ($arrForm['login_memory'] == '1' && $arrForm['login_email'] != '') {
                 $objCookie->setCookie('login_email', $arrForm['login_email']);
             } else {
                 $objCookie->setCookie('login_email', '');
             }
             // 遷移先の制御
             if (count($arrErr) == 0) {
                 // ログイン処理
                 if ($objCustomer->doLogin($arrForm['login_email'], $arrForm['login_pass'])) {
                     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
                         // ログインが成功した場合は携帯端末IDを保存する。
                         $objCustomer->updateMobilePhoneId();
                         /*
                          * email がモバイルドメインでは無く,
                          * 携帯メールアドレスが登録されていない場合
                          */
                         $objMobile = new SC_Helper_Mobile_Ex();
                         if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) {
                             if (!$objCustomer->hasValue('email_mobile')) {
                                 SC_Response_Ex::sendRedirectFromUrlPath('entry/email_mobile.php');
                                 SC_Response_Ex::actionExit();
                             }
                         }
                     }
                     // --- ログインに成功した場合
                     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) {
                         echo SC_Utils_Ex::jsonEncode(array('success' => $url));
                     } else {
                         SC_Response_Ex::sendRedirect($url);
                     }
                     SC_Response_Ex::actionExit();
                 } else {
                     // --- ログインに失敗した場合
                     // ブルートフォースアタック対策
                     // ログイン失敗時に遅延させる
                     sleep(LOGIN_RETRY_INTERVAL);
                     $arrForm['login_email'] = strtolower($arrForm['login_email']);
                     $objQuery = SC_Query_Ex::getSingletonInstance();
                     $where = '(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0';
                     $exists = $objQuery->exists('dtb_customer', $where, array($arrForm['login_email'], $arrForm['login_email']));
                     // ログインエラー表示 TODO リファクタリング
                     if ($exists) {
                         if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) {
                             echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR);
                             SC_Response_Ex::actionExit();
                         } else {
                             SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
                             SC_Response_Ex::actionExit();
                         }
                     } else {
                         if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) {
                             echo $this->lfGetErrorMessage(SITE_LOGIN_ERROR);
                             SC_Response_Ex::actionExit();
                         } else {
                             SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
                             SC_Response_Ex::actionExit();
                         }
                     }
                 }
             } else {
                 // XXX 到達しない?
                 // 入力エラーの場合、元のアドレスに戻す。
                 SC_Response_Ex::sendRedirect($url);
                 SC_Response_Ex::actionExit();
             }
             break;
         case 'logout':
             // --- ログアウト
             // ログイン情報の解放
             $objCustomer->EndSession();
             // 画面遷移の制御
             $mypage_url_search = strpos('.' . $url, 'mypage');
             if ($mypage_url_search == 2) {
                 // マイページログイン中はログイン画面へ移行
                 SC_Response_Ex::sendRedirectFromUrlPath('mypage/login.php');
             } else {
                 // 上記以外の場合、トップへ遷移
                 SC_Response_Ex::sendRedirect(HTTP_URL);
             }
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objCartSess = new SC_CartSession_Ex();
     $objSiteSess = new SC_SiteSession_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objFormParam = $this->lfInitParam($_POST);
     $this->mode = $this->getMode();
     // モバイル対応
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         if (isset($_GET['cart_no'])) {
             $objFormParam->setValue('cart_no', $_GET['cart_no']);
         }
         if (isset($_GET['cartKey'])) {
             $objFormParam->setValue('cartKey', $_GET['cartKey']);
         }
     }
     $this->cartKeys = $objCartSess->getKeys();
     foreach ($this->cartKeys as $key) {
         // 商品購入中にカート内容が変更された。
         if ($objCartSess->getCancelPurchase($key)) {
             $this->tpl_message .= "商品購入中にカート内容が変更されましたので、お手数ですが購入手続きをやり直して下さい。\n";
         }
     }
     $cart_no = $objFormParam->getValue('cart_no');
     $cartKey = $objFormParam->getValue('cartKey');
     // エラーチェック
     $arrError = $objFormParam->checkError();
     if (isset($arrError) && !empty($arrError)) {
         SC_Utils_Ex::sfDispSiteError(CART_NOT_FOUND);
         SC_Response_Ex::actionExit();
     }
     switch ($this->mode) {
         case 'confirm':
             // カート内情報の取得
             $cartList = $objCartSess->getCartList($cartKey);
             // カート商品が1件以上存在する場合
             if (count($cartList) > 0) {
                 // カートを購入モードに設定
                 $this->lfSetCurrentCart($objSiteSess, $objCartSess, $cartKey);
                 // 購入ページへ
                 SC_Response_Ex::sendRedirect(SHOPPING_URL);
                 SC_Response_Ex::actionExit();
             }
             break;
         case 'up':
             //1個追加
             $objCartSess->upQuantity($cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         case 'down':
             //1個減らす
             $objCartSess->downQuantity($cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         case 'setQuantity':
             //数量変更
             $objCartSess->setQuantity($objFormParam->getValue('quantity'), $cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         case 'delete':
             //カートから削除
             $objCartSess->delProduct($cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
     $this->arrInfo = SC_Helper_DB_Ex::sfGetBasisData();
     $totalIncTax = 0;
     foreach ($this->cartKeys as $key) {
         // カート集計処理
         $this->tpl_message .= $objCartSess->checkProducts($key);
         $this->tpl_total_inctax[$key] = $objCartSess->getAllProductsTotal($key);
         $totalIncTax += $this->tpl_total_inctax[$key];
         $this->tpl_total_tax[$key] = $objCartSess->getAllProductsTax($key);
         // ポイント合計
         $this->tpl_total_point[$key] = $objCartSess->getAllProductsPoint($key);
         $this->arrData[$key] = $objCartSess->calculate($key, $objCustomer);
         // 送料無料チェック
         $this->arrData[$key]['is_deliv_free'] = $objCartSess->isDelivFree($key);
         // 送料無料までの金額を計算
         $this->tpl_deliv_free[$key] = $this->arrInfo['free_rule'] - $this->tpl_total_inctax[$key];
     }
     //商品の合計金額をセット
     $this->tpl_all_total_inctax = $totalIncTax;
     $this->tpl_category_id = $objFormParam->getValue('category_id');
     // ログイン判定
     if ($objCustomer->isLoginSuccess(true)) {
         $this->tpl_login = true;
         $this->tpl_user_point = $objCustomer->getValue('point');
         $this->tpl_name = $objCustomer->getValue('name01');
     }
     // 前頁のURLを取得
     // TODO: SC_CartSession::setPrevURL()利用不可。
     $this->lfGetCartPrevUrl($_SESSION, $_SERVER['HTTP_REFERER']);
     $this->tpl_prev_url = isset($_SESSION['cart_prev_url']) ? $_SESSION['cart_prev_url'] : '';
     // すべてのカートの内容を取得する
     $this->cartItems = $objCartSess->getAllCartList();
 }
 /**
  * Add product to authenticated user's favorites. (for Smart phone)
  *
  * @param type $objCustomer 
  * @return void
  */
 function doAddFavoriteSphone($objCustomer)
 {
     // ログイン中のユーザが商品をお気に入りにいれる処理(スマートフォン用)
     if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) {
         $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam);
         if (count($this->arrErr) == 0) {
             if ($this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'), $objCustomer->getValue('customer_id'))) {
                 $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
                 $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite_sphone', array($this));
                 print 'true';
                 SC_Response_Ex::actionExit();
             }
         }
         print 'error';
         SC_Response_Ex::actionExit();
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objDb = new SC_Helper_DB_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $objProduct = new SC_Product_Ex();
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     // パラメーター情報の初期化
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_POST);
     $this->arrHidden = $objFormParam->getSearchArray();
     $this->arrForm = $objFormParam->getFormParamList();
     switch ($this->getMode()) {
         case 'delete':
             // 商品、子テーブル(商品規格)、会員お気に入り商品の削除
             $this->doDelete('product_id = ?', array($objFormParam->getValue('product_id')));
             // 件数カウントバッチ実行
             $objDb->sfCountCategory($objQuery);
             $objDb->sfCountMaker($objQuery);
             // 削除後に検索結果を表示するため breakしない
             // 検索パラメーター生成後に処理実行するため breakしない
         // 削除後に検索結果を表示するため breakしない
         // 検索パラメーター生成後に処理実行するため breakしない
         case 'csv':
         case 'delete_all':
         case 'search':
             $objFormParam->convParam();
             $objFormParam->trimParam();
             $this->arrErr = $this->lfCheckError($objFormParam);
             $arrParam = $objFormParam->getHashArray();
             if (count($this->arrErr) == 0) {
                 $where = 'del_flg = 0';
                 $arrWhereVal = array();
                 foreach ($arrParam as $key => $val) {
                     if ($val == '') {
                         continue;
                     }
                     $this->buildQuery($key, $where, $arrWhereVal, $objFormParam, $objDb);
                 }
                 $order = 'update_date DESC';
                 /* -----------------------------------------------
                  * 処理を実行
                  * ----------------------------------------------- */
                 switch ($this->getMode()) {
                     // CSVを送信する。
                     case 'csv':
                         $objCSV = new SC_Helper_CSV_Ex();
                         // CSVを送信する。正常終了の場合、終了。
                         $objCSV->sfDownloadCsv(1, $where, $arrWhereVal, $order, true);
                         SC_Response_Ex::actionExit();
                         // 全件削除(ADMIN_MODE)
                     // 全件削除(ADMIN_MODE)
                     case 'delete_all':
                         $this->doDelete($where, $arrWhereVal);
                         break;
                         // 検索実行
                     // 検索実行
                     default:
                         // 行数の取得
                         $this->tpl_linemax = $this->getNumberOfLines($where, $arrWhereVal);
                         // ページ送りの処理
                         $page_max = SC_Utils_Ex::sfGetSearchPageMax($objFormParam->getValue('search_page_max'));
                         // ページ送りの取得
                         $objNavi = new SC_PageNavi_Ex($this->arrHidden['search_pageno'], $this->tpl_linemax, $page_max, 'fnNaviSearchPage', NAVI_PMAX);
                         $this->arrPagenavi = $objNavi->arrPagenavi;
                         // 検索結果の取得
                         $this->arrProducts = $this->findProducts($where, $arrWhereVal, $page_max, $objNavi->start_row, $order, $objProduct);
                         // 各商品ごとのカテゴリIDを取得
                         if (count($this->arrProducts) > 0) {
                             foreach ($this->arrProducts as $key => $val) {
                                 $this->arrProducts[$key]['categories'] = $objDb->sfGetCategoryId($val['product_id'], 0, true);
                                 $objDb->g_category_on = false;
                             }
                         }
                 }
             }
             break;
     }
     // カテゴリの読込
     list($this->arrCatKey, $this->arrCatVal) = $objDb->sfGetLevelCatList(false);
     $this->arrCatList = $this->lfGetIDName($this->arrCatKey, $this->arrCatVal);
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objDb = new SC_Helper_DB_Ex();
     $objFormParam = new SC_FormParam_Ex();
     // 入力パラメーター初期化
     $this->initParam($objFormParam);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     switch ($this->getMode()) {
         // カテゴリ登録/編集実行
         case 'edit':
             $this->doEdit($objFormParam);
             break;
             // 入力ボックスへ編集対象のカテゴリ名をセット
         // 入力ボックスへ編集対象のカテゴリ名をセット
         case 'pre_edit':
             $this->doPreEdit($objFormParam);
             break;
             // カテゴリ削除
         // カテゴリ削除
         case 'delete':
             $this->doDelete($objFormParam, $objDb);
             break;
             // 表示順を上へ
         // 表示順を上へ
         case 'up':
             $this->doUp($objFormParam);
             break;
             // 表示順を下へ
         // 表示順を下へ
         case 'down':
             $this->doDown($objFormParam);
             break;
             // FIXME r19909 によってテンプレートが削除されている
         // FIXME r19909 によってテンプレートが削除されている
         case 'moveByDnD':
             // DnDしたカテゴリと移動先のセットを分解する
             $keys = explode('-', $_POST['keySet']);
             if ($keys[0] && $keys[1]) {
                 $objQuery =& SC_Query_Ex::getSingletonInstance();
                 $objQuery->begin();
                 // 移動したデータのrank、level、parent_category_idを取得
                 $rank = $objQuery->get('rank', 'dtb_category', 'category_id = ?', array($keys[0]));
                 $level = $objQuery->get('level', 'dtb_category', 'category_id = ?', array($keys[0]));
                 $parent = $objQuery->get('parent_category_id', 'dtb_category', 'category_id = ?', array($keys[0]));
                 // 同一level内のrank配列を作成
                 $objQuery->setOption('ORDER BY rank DESC');
                 if ($level == 1) {
                     // 第1階層の時
                     $arrRet = $objQuery->select('rank', 'dtb_category', 'level = ?', array($level));
                 } else {
                     // 第2階層以下の時
                     $arrRet = $objQuery->select('rank', 'dtb_category', 'level = ? AND parent_category_id = ?', array($level, $parent));
                 }
                 for ($i = 0; $i < sizeof($arrRet); $i++) {
                     $rankAry[$i + 1] = $arrRet[$i]['rank'];
                 }
                 // 移動したデータのグループ内データ数
                 $my_count = $this->lfCountChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $keys[0]);
                 if ($rankAry[$keys[1]] > $rank) {
                     // データが今の位置より上がった時
                     $up_count = $rankAry[$keys[1]] - $rank;
                     $decAry = $objQuery->select('category_id', 'dtb_category', 'level = ? AND rank > ? AND rank <= ?', array($level, $rank, $rankAry[$keys[1]]));
                     foreach ($decAry as $value) {
                         // 上のグループから減算
                         $this->lfDownRankChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $value['category_id'], $my_count);
                     }
                     // 自分のグループに加算
                     $this->lfUpRankChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $keys[0], $up_count);
                 } else {
                     if ($rankAry[$keys[1]] < $rank) {
                         // データが今の位置より下がった時
                         $down_count = 0;
                         $incAry = $objQuery->select('category_id', 'dtb_category', 'level = ? AND rank < ? AND rank >= ?', array($level, $rank, $rankAry[$keys[1]]));
                         foreach ($incAry as $value) {
                             // 下のグループに加算
                             $this->lfUpRankChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $value['category_id'], $my_count);
                             // 合計減算値
                             $down_count += $this->lfCountChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $value['category_id']);
                         }
                         // 自分のグループから減算
                         $this->lfDownRankChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $keys[0], $down_count);
                     }
                 }
                 $objQuery->commit();
             }
             break;
             // カテゴリツリークリック時
         // カテゴリツリークリック時
         case 'tree':
             break;
             // CSVダウンロード
         // CSVダウンロード
         case 'csv':
             // CSVを送信する
             $objCSV = new SC_Helper_CSV_Ex();
             $objCSV->sfDownloadCsv('5', '', array(), '', true);
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
     $parent_category_id = $objFormParam->getValue('parent_category_id');
     // 空の場合は親カテゴリを0にする
     if (empty($parent_category_id)) {
         $parent_category_id = 0;
     }
     // 親カテゴリIDの保持
     $this->arrForm['parent_category_id'] = $parent_category_id;
     // カテゴリ一覧を取得
     $this->arrList = $this->findCategoiesByParentCategoryId($parent_category_id);
     // カテゴリツリーを取得
     $this->arrTree = $objDb->sfGetCatTree($parent_category_id);
     // ぱんくずの生成
     $arrBread = array();
     $objDb->findTree($this->arrTree, $parent_category_id, $arrBread);
     $this->tpl_bread_crumbs = SC_Utils_Ex::jsonEncode($arrBread);
 }