Ignore:
Timestamp:
2011/01/18 20:06:28 (13 years ago)
Author:
kotani
Message:

#880(mobile/sphoneディレクトリを削除)に対応。(mobile/mypageディレクトリ)

  • モバイルサイトのMYページをPCサイトの動作に合わせる。
  • mobileAction() を削除し、ビジネスロジック統一。
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage.php

    r19915 r19959  
    5050        parent::init(); 
    5151        $this->tpl_title = 'MYページ'; 
    52         $this->tpl_subtitle = '購入履歴一覧'; 
     52        if (Net_UserAgent_Mobile::isMobile() === true){ 
     53            $this->tpl_subtitle = 'MYページ'; 
     54        } else { 
     55            $this->tpl_subtitle = '購入履歴一覧'; 
     56        } 
    5357        $this->tpl_navi = TEMPLATE_REALDIR . 'mypage/navi.tpl'; 
    5458        $this->tpl_mainno = 'mypage'; 
     
    6468    function process() { 
    6569        parent::process(); 
    66         if (Net_UserAgent_Mobile::isMobile() === true){ 
    67             $this->mobileAction(); 
    68         } else { 
    69             $this->action(); 
    70         } 
     70        $this->action(); 
    7171        $this->sendResponse(); 
    7272    } 
     
    8383         
    8484        // 退会判定用情報の取得 
    85         $this->tpl_login = $objCustomer->isLoginSuccess(); 
     85        $this->tpl_login = $objCustomer->isLoginSuccess(true); 
    8686 
    8787        // ログインチェック 
    88         if(!$objCustomer->isLoginSuccess()) { 
     88        if(!$objCustomer->isLoginSuccess(true)) { 
    8989            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 
    9090        }else { 
     
    109109        $this->tpl_linemax = $linemax; 
    110110 
    111         // ページ送りの取得 
    112         $objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX); 
    113         $this->tpl_strnavi = $objNavi->strnavi;     // 表示文字列 
    114         $startno = $objNavi->start_row; 
     111        if (Net_UserAgent_Mobile::isMobile() === true){ 
     112            define ("HISTORY_NUM", 5);  // TODO 
     113            $pageNo = isset($_GET['pageno']) ? (int) $_GET['pageno'] : 0; // TODO 
    115114 
    116         // 取得範囲の指定(開始行番号、行数のセット) 
    117         $objQuery->setLimitOffset(SEARCH_PMAX, $startno); 
     115            // ページ送りの取得 
     116            // next 
     117            if ($pageNo + HISTORY_NUM < $linemax) { 
     118                $next = "<a href='index.php?pageno=" . ($pageNo + HISTORY_NUM) . "'>次へ→</a>"; 
     119            } else { 
     120                $next = ""; 
     121            } 
     122 
     123            // previous 
     124            if ($pageNo - HISTORY_NUM > 0) { 
     125                $previous = "<a href='index.php?pageno=" . ($pageNo - HISTORY_NUM) . "'>←前へ</a>"; 
     126            } elseif ($pageNo == 0) { 
     127                $previous = ""; 
     128            } else { 
     129                $previous = "<a href='index.php?pageno=0'>←前へ</a>"; 
     130            } 
     131 
     132            // bar 
     133            if ($next != '' && $previous != '') { 
     134                $bar = " | "; 
     135            } else { 
     136                $bar = ""; 
     137            } 
     138 
     139            $this->tpl_strnavi = $previous . $bar . $next; 
     140 
     141            // 取得範囲の指定(開始行番号、行数のセット) 
     142            $objQuery->setLimitOffset(HISTORY_NUM, $pageNo); 
     143        } else { 
     144            // ページ送りの取得 
     145            $objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX); 
     146            $this->tpl_strnavi = $objNavi->strnavi;     // 表示文字列 
     147            $startno = $objNavi->start_row; 
     148             
     149            // 取得範囲の指定(開始行番号、行数のセット) 
     150            $objQuery->setLimitOffset(SEARCH_PMAX, $startno); 
     151        } 
     152         
    118153        // 表示順序 
    119154        $objQuery->setOrder($order); 
     
    126161        $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); 
    127162 
    128     } 
    129      
    130     /** 
    131      * Page のAction(モバイル). 
    132      * 
    133      * @return void 
    134      */ 
    135     function mobileAction() { 
    136         $objQuery = new SC_Query(); 
    137         $objCustomer = new SC_Customer(); 
    138         // クッキー管理クラス 
    139         $objCookie = new SC_Cookie(COOKIE_EXPIRE); 
    140         // パラメータ管理クラス 
    141         $objFormParam = new SC_FormParam(); 
    142         // パラメータ情報の初期化 
    143         $this->lfInitParam($objFormParam); 
    144         // POST値の取得 
    145         $objFormParam->setParam($_POST); 
    146  
    147         // 携帯端末IDが一致する会員が存在するかどうかをチェックする。 
    148         $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId(); 
    149  
    150         if (!isset($_POST['mode'])) $_POST['mode'] = ""; 
    151  
    152         // ログイン処理 
    153         if($_POST['mode'] == 'login') { 
    154             $objFormParam->toLower('login_email'); 
    155             $arrErr = $objFormParam->checkError(); 
    156             $arrForm =  $objFormParam->getHashArray(); 
    157  
    158             // クッキー保存判定 
    159             if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") { 
    160                 $objCookie->setCookie('login_email', $_POST['login_email']); 
    161             } else { 
    162                 $objCookie->setCookie('login_email', ''); 
    163             } 
    164  
    165             if (count($arrErr) == 0){ 
    166                 if($objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) || 
    167                    $objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) { 
    168                     // ログインが成功した場合は携帯端末IDを保存する。 
    169                     $objCustomer->updateMobilePhoneId(); 
    170  
    171                     /* 
    172                      * email がモバイルドメインでは無く, 
    173                      * 携帯メールアドレスが登録されていない場合 
    174                      */ 
    175                     $objMobile = new SC_Helper_Mobile_Ex(); 
    176                     if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) { 
    177                         if (!$objCustomer->hasValue('email_mobile')) { 
    178                             SC_Response_Ex::sendRedirectFromUrlPath('entry/email_mobile.php'); 
    179                             exit; 
    180                         } 
    181                     } 
    182                 } else { 
    183                     $objQuery = new SC_Query; 
    184                     $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0"; 
    185                     $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email'])); 
    186  
    187                     if($ret > 0) { 
    188                         SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); 
    189                     } else { 
    190                         SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR); 
    191                     } 
    192                 } 
    193             } 
    194         } 
    195  
    196         /* 
    197          * ログインチェック 
    198          * 携帯メールの登録を必須にする場合は isLoginSuccess(false) にする 
    199          */ 
    200         if(!$objCustomer->isLoginSuccess(true)) { 
    201             $this->tpl_mainpage = 'mypage/login.tpl'; 
    202             foreach ($objFormParam->getHashArray() as $key => $val) { 
    203                 $this->$key = $val; 
    204             } 
    205             if (empty($arrErr)) $arrErr = array(); 
    206             $this->arrErr = $arrErr; 
    207         }else { 
    208             //マイページトップ顧客情報表示用 
    209             $this->CustomerName1 = $objCustomer->getvalue('name01'); 
    210             $this->CustomerName2 = $objCustomer->getvalue('name02'); 
    211             $this->CustomerPoint = $objCustomer->getvalue('point'); 
    212         } 
    213163    } 
    214164 
Note: See TracChangeset for help on using the changeset viewer.