Changeset 18545
- Timestamp:
- 2010/02/03 15:37:12 (14 years ago)
- bzr:base-revision:
- ohkouchi@loop-az.jp-20100203061657-95zs5i4upxoc23qk
- bzr:committer:
- Kentaro Ohkouchi <ohkouchi@loop-az.jp>
- bzr:file-ids:
data/class/helper/SC_Helper_CSV.php 15535@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fhelper%2FSC_Helper_CSV.php- bzr:mapping-version:
- v4
- bzr:repository-uuid:
- 1e3b908f-19a9-db11-a64c-001125224ba8
- bzr:revision-id:
- ohkouchi@loop-az.jp-20100203063708-xz6vu301v9y9yevz
- bzr:revno:
- 2155
- bzr:revprop:branch-nick:
- branches/comu-ver2
- bzr:root:
- branches/comu-ver2
- bzr:timestamp:
- 2010-02-03 15:37:08.894000053 +0900
- bzr:user-agent:
- bzr2.0.4+bzr-svn1.0.1
- svn:original-date:
- 2010-02-03T06:37:08.894000Z
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/class/helper/SC_Helper_CSV.php
r18544 r18545 99 99 } 100 100 101 101 102 // CSVを送信する。(商品) 102 103 function sfDownloadProductsCsv($where, $arrval, $order) { … … 116 117 ,$arrval 117 118 ); 118 119 119 120 // 規格分類名一覧 120 121 if (in_array('classcategory_id1', $arrOutputCols) || in_array('classcategory_id2', $arrOutputCols)) { … … 124 125 125 126 $outputArray = array(); 126 127 127 128 // ヘッダ行 128 129 $outputArray[] = $arrOutput['disp_name']; 129 130 130 131 // データ行 131 132 foreach ($dataRows as $row) { … … 145 146 "category_id", 146 147 "product_id = ?", 147 148 }149 150 $outputArray[] = $row;151 }152 153 // CSVを送信する。154 $this->lfDownloadCsv($outputArray);155 156 // 成功終了157 return true;148 array($row['product_id'])); 149 } 150 151 $outputArray[] = $row; 152 } 153 154 // CSVを送信する。 155 $this->lfDownloadCsv($outputArray); 156 157 // 成功終了 158 return true; 158 159 } 159 160 … … 200 201 function sfDownloadCategoryCsv() { 201 202 202 // CSV出力タイトル行の作成203 $arrOutput = SC_Utils_Ex::sfSwapArray($this->sfgetCsvOutput(5, " WHERE csv_id = 5 AND status = 1"));204 if (count($arrOutput) <= 0) return false; // 失敗終了203 // CSV出力タイトル行の作成 204 $arrOutput = SC_Utils_Ex::sfSwapArray($this->sfgetCsvOutput(5, " WHERE csv_id = 5 AND status = 1")); 205 if (count($arrOutput) <= 0) return false; // 失敗終了 205 206 $arrOutputCols = $arrOutput['col']; 206 207 … … 213 214 ,'del_flg = 0' 214 215 ); 215 216 216 217 $outputArray = array(); 217 218 218 219 // ヘッダ行 219 220 $outputArray[] = $arrOutput['disp_name']; 220 221 221 222 // データ行 222 223 foreach ($dataRows as $row) { 223 224 $outputArray[] = $row; 224 225 } 225 226 226 227 // CSVを送信する。 227 228 $this->lfDownloadCsv($outputArray, 'category'); 228 229 229 230 // 成功終了 230 231 return true; … … 253 254 function lfMakeCSV($list) { 254 255 $line = ""; 255 256 eset($list); 257 while(list($key, $val) = each($list)){ 256 257 foreach($list as $key => $val) { 258 258 $tmp = ""; 259 259 switch($key) { 260 case 'order_pref':261 case 'deliv_pref':262 $tmp = $this->arrPref[$val];263 break;264 default:265 $tmp = $val;266 break;260 case 'order_pref': 261 case 'deliv_pref': 262 $tmp = $this->arrPref[$val]; 263 break; 264 default: 265 $tmp = $val; 266 break; 267 267 } 268 268 … … 278 278 function lfMakeReviewCSV($list) { 279 279 $line = ""; 280 reset($list); 281 while(list($key, $val) = each($list)){280 281 foreach($list as $key => $val) { 282 282 $tmp = ""; 283 283 switch($key) { … … 307 307 // 各項目をCSV出力用に変換する。(トラックバック) 308 308 function lfMakeTrackbackCSV($list) { 309 309 310 $line = ""; 310 reset($list); 311 while(list($key, $val) = each($list)){311 312 foreach($list as $key => $val) { 312 313 $tmp = ""; 313 314 switch($key) { … … 403 404 ); 404 405 } 405 406 406 407 407 /** 408 408 * 1次元配列を1行のCSVとして返す … … 410 410 */ 411 411 function sfArrayToCsv($fields, $delimiter = ',', $enclosure = '"', $arrayDelimiter = '|') { 412 412 413 413 if( strlen($delimiter) != 1 ) { 414 414 trigger_error('delimiter must be a single character', E_USER_WARNING); 415 415 return ""; 416 416 } 417 417 418 418 if( strlen($enclosure) < 1 ) { 419 419 trigger_error('enclosure must be a single character', E_USER_WARNING); 420 420 return ""; 421 421 } 422 422 423 423 foreach (array_keys($fields) as $key) { 424 424 $field =& $fields[$key]; 425 425 426 426 // 配列を「|」区切りの文字列に変換する 427 427 if (is_array($field)) { 428 428 $field = implode($arrayDelimiter, $field); 429 429 } 430 430 431 431 /* enclose a field that contains a delimiter, an enclosure character, or a newline */ 432 432 if ( … … 437 437 } 438 438 } 439 439 440 440 return implode($delimiter, $fields); 441 441 } 442 442 443 443 /** 444 444 * CSVを送信する。
Note: See TracChangeset
for help on using the changeset viewer.