Ignore:
Timestamp:
2008/02/25 19:11:59 (16 years ago)
Author:
pineray
Message:

コンタクトをリファクタリング

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/pages/contact/LC_Page_Contact.php

    r16741 r17074  
    3838 
    3939    /** 
    40      * Page を初期化する. 
    41      * 
    42      * @return void 
    43      */ 
    44     function init() { 
    45         parent::init(); 
    46         $this->tpl_mainpage = 'contact/index.tpl'; 
    47         $this->tpl_title = 'お問い合わせ(入力ページ)'; 
    48         $this->tpl_page_category = 'contact'; 
    49  
    50         $masterData = new SC_DB_MasterData_Ex(); 
    51         $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank")); 
    52     } 
    53  
    54     /** 
    55      * Page のプロセス. 
    56      * 
    57      * @return void 
    58      */ 
    59     function process() { 
    60         global $objCampaignSess; 
    61  
    62         $conn = new SC_DBConn(); 
    63         $this->objView = new SC_SiteView(); 
    64         $objCampaignSess = new SC_CampaignSession(); 
    65         $objDb = new SC_Helper_DB_Ex(); 
    66         $CONF = $objDb->sf_getBasisData();          // 店舗基本情報 
    67         SC_Utils_Ex::sfDomainSessionStart(); 
    68  
    69         $objCustomer = new SC_Customer(); 
    70  
    71         $this->arrData = isset($_SESSION['customer']) ? $_SESSION['customer'] : ""; 
    72  
    73         // レイアウトデザインを取得 
    74         $layout = new SC_Helper_PageLayout_Ex(); 
    75         $layout->sfGetPageLayout($this, false, DEF_LAYOUT); 
    76  
    77         //フォーム値変換用カラム 
    78         $arrConvertColumn = array( 
     40     * フォーム値変換用カラム 
     41     * 
     42     * 
     43     */ 
     44     var $arrConvertColumn = array( 
    7945                                     array(  "column" => "name01",      "convert" => "aKV" ), 
    8046                                     array(  "column" => "name02",      "convert" => "aKV" ), 
     
    9359                                  ); 
    9460 
     61    /** 
     62     * Page を初期化する. 
     63     * 
     64     * @return void 
     65     */ 
     66    function init() { 
     67        parent::init(); 
     68        $this->tpl_mainpage = 'contact/index.tpl'; 
     69        $this->tpl_title = 'お問い合わせ(入力ページ)'; 
     70        $this->tpl_page_category = 'contact'; 
     71 
     72        $masterData = new SC_DB_MasterData_Ex(); 
     73        $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank")); 
     74    } 
     75 
     76    /** 
     77     * Page のプロセス. 
     78     * 
     79     * @return void 
     80     */ 
     81    function process() { 
     82        global $objCampaignSess; 
     83 
     84        $conn = new SC_DBConn(); 
     85        $this->objView = new SC_SiteView(); 
     86        $objCampaignSess = new SC_CampaignSession(); 
     87        $objDb = new SC_Helper_DB_Ex(); 
     88        $CONF = $objDb->sf_getBasisData();          // 店舗基本情報 
     89        SC_Utils_Ex::sfDomainSessionStart(); 
     90 
     91        $objCustomer = new SC_Customer(); 
     92 
     93        $this->arrData = isset($_SESSION['customer']) ? $_SESSION['customer'] : ""; 
     94 
     95        // レイアウトデザインを取得 
     96        $layout = new SC_Helper_PageLayout_Ex(); 
     97        $layout->sfGetPageLayout($this, false, DEF_LAYOUT); 
     98 
     99        //フォーム値変換用カラム 
     100        $arrConvertColumn = $this->lfGetConvertColumn(); 
     101 
    95102        if (!isset($_POST['mode'])) $_POST['mode'] = ""; 
    96103 
    97104        switch ($_POST['mode']) { 
    98105            case 'confirm': 
    99             // エラーチェック 
    100             $this->arrForm = $_POST; 
    101             $this->arrForm['email'] = strtolower($_POST['email']); 
    102             $this->arrForm = $this->lfConvertParam($this->arrForm,$arrConvertColumn); 
    103             $this->arrErr = $this->lfErrorCheck($this->arrForm); 
    104             if ( ! $this->arrErr ){ 
    105                 // エラー無しで完了画面 
    106                 $this->tpl_mainpage = 'contact/confirm.tpl'; 
    107                 $this->tpl_title = 'お問い合わせ(確認ページ)'; 
    108             } else { 
    109                 foreach ($this->arrForm as $key => $val){ 
    110                     $this->$key = $val; 
    111                 } 
    112             } 
    113             break; 
     106              $this->lfContactConfirm(); 
     107              break; 
    114108 
    115109            case 'return': 
    116             foreach ($_POST as $key => $val){ 
    117                 $this->$key = $val; 
    118                 } 
    119             break; 
     110              $this->lfContactReturn(); 
     111              break; 
    120112 
    121113            case 'complete': 
    122             $this->arrForm = $_POST; 
    123             $this->arrForm['email'] = strtolower($_POST['email']); 
    124             $this->arrForm = $this->lfConvertParam($this->arrForm,$arrConvertColumn); 
    125             $this->arrErr = $this->lfErrorCheck($this->arrForm); 
    126             if(!$this->arrErr) { 
    127                 $this->lfSendMail($CONF, $this); 
    128                 // 完了ページへ移動する 
    129                 $this->sendRedirect($this->getLocation("./complete.php", array(), true)); 
    130                 exit; 
    131             } else { 
    132                 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 
    133             } 
    134             break; 
     114              $this->lfContactComplete(); 
     115              break; 
    135116 
    136117            default: 
    137             break; 
     118              break; 
    138119        } 
    139120 
     
    181162    // }}} 
    182163    // {{{ protected functions 
     164 
     165    /** 
     166     * 確認画面 
     167     * 
     168     * @return void 
     169     */ 
     170    function lfContactConfirm() { 
     171        // エラーチェック 
     172        $this->arrForm = $_POST; 
     173        $this->arrForm['email'] = strtolower($_POST['email']); 
     174        $this->arrForm = $this->lfConvertParam($this->arrForm,$this->arrConvertColumn); 
     175        $this->arrErr = $this->lfErrorCheck($this->arrForm); 
     176        if ( ! $this->arrErr ){ 
     177            // エラー無しで完了画面 
     178            $this->tpl_mainpage = 'contact/confirm.tpl'; 
     179            $this->tpl_title = 'お問い合わせ(確認ページ)'; 
     180        } else { 
     181            foreach ($this->arrForm as $key => $val){ 
     182                $this->$key = $val; 
     183            } 
     184        } 
     185    } 
     186 
     187    /** 
     188     * 前に戻る 
     189     * 
     190     * @return void 
     191     */ 
     192    function lfContactReturn() { 
     193        foreach ($_POST as $key => $val){ 
     194            $this->$key = $val; 
     195        } 
     196    } 
     197 
     198    /** 
     199     * 完了ページへ 
     200     * 
     201     * @return void 
     202     */ 
     203    function lfContactComplete() { 
     204        $this->arrForm = $_POST; 
     205        $this->arrForm['email'] = strtolower($_POST['email']); 
     206        $this->arrForm = $this->lfConvertParam($this->arrForm,$this->arrConvertColumn); 
     207        $this->arrErr = $this->lfErrorCheck($this->arrForm); 
     208        if(!$this->arrErr) { 
     209            $this->lfSendMail($CONF, $this); 
     210            // 完了ページへ移動する 
     211            $this->sendRedirect($this->getLocation("./complete.php", array(), true)); 
     212            exit; 
     213        } else { 
     214            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 
     215        } 
     216    } 
    183217 
    184218    //エラーチェック処理部 
Note: See TracChangeset for help on using the changeset viewer.