Ignore:
Timestamp:
2011/02/23 14:06:50 (11 years ago)
Author:
coelacanth
Message:

#964 リファクタリング 宣言を除き, 引数や返り値が無く, すべて内部のメンバ変数で処理するような関数は極力作成しない

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php

    r20335 r20339  
    3333 */ 
    3434class LC_Page_Admin_Basis_Tradelaw extends LC_Page_Admin { 
    35  
    36     // {{{ properties 
    37  
    38     /** フォームパラメータの配列 */ 
    39     var $objFormParam; 
    4035 
    4136    // }}} 
     
    7772        $objDb = new SC_Helper_DB_Ex(); 
    7873 
    79         // パラメータ管理クラス 
    80         $this->objFormParam = new SC_FormParam(); 
    81         // パラメータ情報の初期化 
    82         $this->lfInitParam(); 
    83         // POST値の取得 
    84         $this->objFormParam->setParam($_POST); 
     74        $objFormParam = new SC_FormParam(); 
     75        $this->lfInitParam($objFormParam); 
     76        $objFormParam->setParam($_POST); 
    8577 
    8678        $cnt = $objDb->sfGetBasisCount(); 
     
    9385        if(!empty($_POST)) { 
    9486            // 入力値の変換 
    95             $this->objFormParam->convParam(); 
    96             $this->arrErr = $this->lfCheckError(); 
     87            $objFormParam->convParam(); 
     88            $this->arrErr = $this->lfCheckError($objFormParam); 
    9789 
    9890            if(count($this->arrErr) == 0) { 
    9991                switch($this->getMode()) { 
    10092                case 'update': 
    101                     $this->lfUpdateData(); // 既存編集 
     93                    $this->lfUpdateData($objFormParam->getHashArray()); // 既存編集 
    10294                    break; 
    10395                case 'insert': 
    104                     $this->lfInsertData(); // 新規作成 
     96                    $this->lfInsertData($objFormParam->getHashArray()); // 新規作成 
    10597                    break; 
    10698                default: 
     
    112104            } 
    113105        } else { 
    114             $arrCol = $this->objFormParam->getKeyList(); // キー名一覧を取得 
     106            $arrCol = $objFormParam->getKeyList(); // キー名一覧を取得 
    115107            $col    = SC_Utils_Ex::sfGetCommaList($arrCol); 
    116108            $arrRet = $objDb->sfGetBasisData(true, $col); 
    117             $this->objFormParam->setParam($arrRet); 
     109            $objFormParam->setParam($arrRet); 
    118110        } 
    119  
    120         $this->arrForm = $this->objFormParam->getFormParamList(); 
     111        $this->arrForm = $objFormParam->getFormParamList(); 
    121112    } 
    122113 
     
    131122 
    132123    /* パラメータ情報の初期化 */ 
    133     function lfInitParam() { 
    134         $this->objFormParam->addParam("販売業者", "law_company", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    135         $this->objFormParam->addParam("運営責任者", "law_manager", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    136         $this->objFormParam->addParam("郵便番号1", "law_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
    137         $this->objFormParam->addParam("郵便番号2", "law_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
    138         $this->objFormParam->addParam("都道府県", "law_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 
    139         $this->objFormParam->addParam("住所1", "law_addr01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    140         $this->objFormParam->addParam("住所2", "law_addr02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    141         $this->objFormParam->addParam("電話番号1", "law_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    142         $this->objFormParam->addParam("電話番号2", "law_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    143         $this->objFormParam->addParam("電話番号3", "law_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    144         $this->objFormParam->addParam("FAX番号1", "law_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    145         $this->objFormParam->addParam("FAX番号2", "law_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    146         $this->objFormParam->addParam("FAX番号3", "law_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    147         $this->objFormParam->addParam("メールアドレス", "law_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK")); 
    148         $this->objFormParam->addParam("URL", "law_url", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "URL_CHECK")); 
    149         $this->objFormParam->addParam("必要料金", "law_term01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    150         $this->objFormParam->addParam("注文方法", "law_term02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    151         $this->objFormParam->addParam("支払方法", "law_term03", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    152         $this->objFormParam->addParam("支払期限", "law_term04", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    153         $this->objFormParam->addParam("引き渡し時期", "law_term05", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    154         $this->objFormParam->addParam("返品・交換について", "law_term06", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
     124    function lfInitParam(&$objFormParam) { 
     125        $objFormParam->addParam("販売業者", "law_company", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
     126        $objFormParam->addParam("運営責任者", "law_manager", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
     127        $objFormParam->addParam("郵便番号1", "law_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
     128        $objFormParam->addParam("郵便番号2", "law_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
     129        $objFormParam->addParam("都道府県", "law_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 
     130        $objFormParam->addParam("住所1", "law_addr01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
     131        $objFormParam->addParam("住所2", "law_addr02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
     132        $objFormParam->addParam("電話番号1", "law_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
     133        $objFormParam->addParam("電話番号2", "law_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
     134        $objFormParam->addParam("電話番号3", "law_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
     135        $objFormParam->addParam("FAX番号1", "law_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
     136        $objFormParam->addParam("FAX番号2", "law_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
     137        $objFormParam->addParam("FAX番号3", "law_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
     138        $objFormParam->addParam("メールアドレス", "law_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK")); 
     139        $objFormParam->addParam("URL", "law_url", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "URL_CHECK")); 
     140        $objFormParam->addParam("必要料金", "law_term01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
     141        $objFormParam->addParam("注文方法", "law_term02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
     142        $objFormParam->addParam("支払方法", "law_term03", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
     143        $objFormParam->addParam("支払期限", "law_term04", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
     144        $objFormParam->addParam("引き渡し時期", "law_term05", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
     145        $objFormParam->addParam("返品・交換について", "law_term06", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    155146    } 
    156147 
    157     function lfUpdateData() { 
    158         // 入力データを渡す。 
    159         $sqlval = $this->objFormParam->getHashArray(); 
     148    function lfUpdateData($sqlval) { 
    160149        $sqlval['update_date'] = 'Now()'; 
    161150        $objQuery =& SC_Query::getSingletonInstance(); 
     
    164153    } 
    165154 
    166     function lfInsertData() { 
    167         // 入力データを渡す。 
    168         $sqlval = $this->objFormParam->getHashArray(); 
     155    function lfInsertData($sqlval) { 
    169156        $sqlval['update_date'] = 'Now()'; 
    170157        $objQuery =& SC_Query::getSingletonInstance(); 
     
    174161 
    175162    /* 入力内容のチェック */ 
    176     function lfCheckError() { 
     163    function lfCheckError(&$objFormParam) { 
    177164        // 入力データを渡す。 
    178         $arrRet =  $this->objFormParam->getHashArray(); 
     165        $arrRet =  $objFormParam->getHashArray(); 
    179166        $objErr = new SC_CheckError($arrRet); 
    180         $objErr->arrErr = $this->objFormParam->checkError(); 
     167        $objErr->arrErr = $objFormParam->checkError(); 
    181168 
    182169        // 電話番号チェック 
Note: See TracChangeset for help on using the changeset viewer.