Ignore:
Timestamp:
2007/09/04 13:07:32 (17 years ago)
Author:
nanasess
Message:

リファクタリング

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/helper/SC_Helper_CSV.php

    r15582 r15583  
    4646 
    4747        $masterData = new SC_DB_MasterData_Ex(); 
     48        $this->arrPref = $masterData->getMasterData("mtb_pref", 
     49                                  array("pref_id", "pref_name", "rank")); 
    4850        $this->arrSex = $masterData->getMasterData("mtb_sex"); 
    4951        $this->arrDISP = $masterData->getMasterData("mtb_disp"); 
     
    176178 
    177179        $max = count($list_data); 
     180        if (!isset($data)) $data = ""; 
    178181        for($i = 0; $i < $max; $i++) { 
    179182            // 各項目をCSV出力用に変換する。 
     
    185188    // 各項目をCSV出力用に変換する。 
    186189    function lfMakeCSV($list) { 
    187         global $arrPref; 
    188  
    189190        $line = ""; 
    190191 
     
    193194            switch($key) { 
    194195            case 'order_pref': 
    195                 $tmp = $arrPref[$val]; 
     196                $tmp = $this->arrPref[$val]; 
    196197                break; 
    197198            default: 
     
    204205        } 
    205206        // 文末の","を変換 
    206         $line = ereg_replace(",$", "\r\n", $line); 
     207        $line = $this->replaceLineSuffix($line); 
    207208        return $line; 
    208209    } 
     
    231232            } 
    232233            // 文末の","を変換 
    233             $line = ereg_replace(",$", "\r\n", $line); 
     234            $line = $this->replaceLineSuffix($line); 
    234235        } 
    235236        return $line; 
     
    262263        } 
    263264        // 文末の","を変換 
    264         $line = ereg_replace(",$", "\r\n", $line); 
     265        $line = $this->replaceLineSuffix($line); 
    265266        return $line; 
    266267    } 
     
    286287        } 
    287288        // 文末の","を変換 
    288         $line = ereg_replace(",$", "\r\n", $line); 
     289        $line = $this->replaceLineSuffix($line); 
    289290        return $line; 
     291    } 
     292 
     293    /** 
     294     * 行末の ',' を CRLF へ変換する. 
     295     * 
     296     * @access private 
     297     * @param string $line CSV出力用の1行分の文字列 
     298     * @return string 行末の ',' を CRLF に変換した文字列 
     299     */ 
     300    function replaceLineSuffix($line) { 
     301        return mb_ereg_replace(",$", "\r\n", $line); 
    290302    } 
    291303 
Note: See TracChangeset for help on using the changeset viewer.