Ignore:
Timestamp:
2011/02/07 11:54:44 (13 years ago)
Author:
kimoto
Message:

リファクタリング #979

File:
1 edited

Legend:

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

    r20087 r20106  
    4545        parent::init(); 
    4646 
    47         $this->objFormParam = new SC_FormParam(); 
    48         $this->lfInitParam(); 
     47 
    4948    } 
    5049 
     
    6665    function action() { 
    6766        $objCustomer    = new SC_Customer; 
     67        $objFormParam   = new SC_FormParam(); 
     68 
     69        $this->lfInitParam($objFormParam); 
     70        $objFormParam->setParam($_POST); 
    6871 
    6972        if ($_SERVER['REQUEST_METHOD'] == 'POST') { 
    70             $this->objFormParam->setParam($_POST); 
    71             $this->objFormParam->convParam(); 
    72             $this->arrErr = $this->lfCheckError($objCustomer); 
     73            $this->arrErr = $this->lfCheckError($objFormParam); 
    7374 
    7475            if (empty($this->arrErr)) { 
    75                 $this->lfRegister($objCustomer); 
     76                $this->lfRegistEmailMobile(strtolower($objFormParam->getValue('email_mobile')), 
     77                                           $objCustomer->getValue('customer_id')); 
    7678                $this->tpl_mainpage = 'entry/email_mobile_complete.tpl'; 
    7779                $this->tpl_title = '携帯メール登録完了'; 
     
    8082 
    8183        $this->tpl_name = $objCustomer->getValue('name01'); 
    82         $this->arrForm  = $this->objFormParam->getFormParamList(); 
     84        $this->arrForm  = $objFormParam->getFormParamList(); 
    8385    } 
    8486 
     
    98100     * @return void 
    99101     */ 
    100     function lfInitParam() { 
    101         $this->objFormParam->addParam('メールアドレス', 'email_mobile', MTEXT_LEN, 'a', 
     102    function lfInitParam(&$objFormParam) { 
     103        $objFormParam->addParam('メールアドレス', 'email_mobile', MTEXT_LEN, 'a', 
    102104                                array('NO_SPTAB', 'EXIST_CHECK', 'MAX_LENGTH_CHECK', 'CHANGE_LOWER', 'EMAIL_CHAR_CHECK', 'EMAIL_CHECK', 'MOBILE_EMAIL_CHECK')); 
    103105    } 
    104106 
    105107    /** 
    106      * lfCheckError 
     108     * エラーチェックする 
    107109     * 
     110     * @param mixed $objFormParam 
    108111     * @param mixed $objCustomer 
    109      * @access public 
    110      * @return void 
     112     * @access private 
     113     * @return array エラー情報の配列 
    111114     */ 
    112     function lfCheckError(&$objCustomer) { 
    113         $arrRet         = $this->objFormParam->getHashArray(); 
    114         $objErr         = new SC_CheckError($arrRet); 
    115         $objErr->arrErr = $this->objFormParam->checkError(); 
     115    function lfCheckError(&$objFormParam) { 
     116        $objFormParam->convParam(); 
     117        $objErr         = new SC_CheckError(); 
     118        $objErr->arrErr = $objFormParam->checkError(); 
    116119 
    117120        $objErr->doFunc(array("メールアドレス", "email_mobile"), array("CHECK_REGIST_CUSTOMER_EMAIL")); 
     
    121124 
    122125    /** 
    123      * lfRegister 
    124126     * 
     127     * 携帯メールアドレスが登録されていないユーザーに携帯アドレスを登録する 
     128     * 
     129     * 登録完了後にsessionのemail_mobileを更新する 
     130     * 
     131     * @param mixed $objFormParam 
    125132     * @param mixed $objCustomer 
    126      * @access public 
     133     * @access private 
    127134     * @return void 
    128135     */ 
    129     function lfRegister(&$objCustomer) { 
    130         $customer_id    = $objCustomer->getValue('customer_id'); 
    131         $email_mobile   = strtolower($this->objFormParam->getValue('email_mobile')); 
    132  
    133         $objQuery       = new SC_Query(); 
    134         $objQuery->update('dtb_customer', array('email_mobile' => $email_mobile), 'customer_id = ?', array($customer_id)); 
     136    function lfRegistEmailMobile($email_mobile, $customer_id) { 
     137        $objQuery = SC_Query::getSingletonInstance(); 
     138        $objQuery->update('dtb_customer', 
     139                          array('email_mobile' => $email_mobile), 
     140                          'customer_id = ?', array($customer_id)); 
    135141 
    136142        $objCustomer->setValue('email_mobile', $email_mobile); 
Note: See TracChangeset for help on using the changeset viewer.