Changeset 15581


Ignore:
Timestamp:
2007/09/04 12:44:09 (17 years ago)
Author:
nanasess
Message:

リファクタリング

  • 関数を移動し, 元ファイル削除
Location:
branches/feature-module-update
Files:
1 deleted
1 edited

Legend:

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

    r15566 r15581  
    163163        } 
    164164        return $data; 
     165    } 
     166 
     167    // CSV出力データを作成する。 
     168    function lfGetCSV($from, $where, $option, $arrval, $arrCsvOutputCols = "") { 
     169 
     170        $cols = SC_Utils_Ex::sfGetCommaList($arrCsvOutputCols); 
     171 
     172        $objQuery = new SC_Query(); 
     173        $objQuery->setoption($option); 
     174 
     175        $list_data = $objQuery->select($cols, $from, $where, $arrval); 
     176 
     177        $max = count($list_data); 
     178        for($i = 0; $i < $max; $i++) { 
     179            // 各項目をCSV出力用に変換する。 
     180            $data .= $this->lfMakeCSV($list_data[$i]); 
     181        } 
     182        return $data; 
     183    } 
     184 
     185    // 各項目をCSV出力用に変換する。 
     186    function lfMakeCSV($list) { 
     187        global $arrPref; 
     188 
     189        $line = ""; 
     190 
     191        foreach($list as $key => $val) { 
     192            $tmp = ""; 
     193            switch($key) { 
     194            case 'order_pref': 
     195                $tmp = $arrPref[$val]; 
     196                break; 
     197            default: 
     198                $tmp = $val; 
     199                break; 
     200            } 
     201 
     202            $tmp = ereg_replace("[\",]", " ", $tmp); 
     203            $line .= "\"".$tmp."\","; 
     204        } 
     205        // 文末の","を変換 
     206        $line = ereg_replace(",$", "\r\n", $line); 
     207        return $line; 
    165208    } 
    166209 
Note: See TracChangeset for help on using the changeset viewer.