- Timestamp:
- 2013/02/18 19:09:54 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/helper/SC_Helper_CSV.php
r22267 r22567 13 13 * @version $Id$ 14 14 */ 15 class SC_Helper_CSV { 15 class SC_Helper_CSV 16 { 16 17 17 18 // {{{ properties … … 29 30 * デフォルトコンストラクタ. 30 31 */ 31 function __construct() { 32 function __construct() 33 { 32 34 $this->init(); 33 35 } … … 42 44 * @return void 43 45 */ 44 function init() { 46 function init() 47 { 45 48 $this->arrSubnavi = array( 46 49 1 => 'product', … … 70 73 * @return mixed $is_download = true時 成功失敗フラグ(boolean) 、$is_downalod = false時 string 71 74 */ 72 function sfDownloadCsv($csv_id, $where = '', $arrVal = array(), $order = '', $is_download = false) { 75 function sfDownloadCsv($csv_id, $where = '', $arrVal = array(), $order = '', $is_download = false) 76 { 73 77 // CSV出力タイトル行の作成 74 78 $arrOutput = SC_Utils_Ex::sfSwapArray($this->sfGetCsvOutput($csv_id, 'status = ' . CSV_COLUMN_STATUS_FLG_ENABLE)); … … 116 120 * @return array CSV 項目の配列 117 121 */ 118 function sfGetCsvOutput($csv_id = '', $where = '', $arrVal = array(), $order = 'rank, no') { 122 function sfGetCsvOutput($csv_id = '', $where = '', $arrVal = array(), $order = 'rank, no') 123 { 119 124 $objQuery =& SC_Query_Ex::getSingletonInstance(); 120 125 … … 142 147 * @return boolean true:インポート可能、false:インポート不可 143 148 */ 144 function sfIsImportCSVFrame(&$arrCSVFrame) { 149 function sfIsImportCSVFrame(&$arrCSVFrame) 150 { 145 151 $result = true; 146 152 foreach ($arrCSVFrame as $val) { … … 163 169 * @return boolean true:更新可能、false:新規追加のみ不可 164 170 */ 165 function sfIsUpdateCSVFrame(&$arrCSVFrame) { 171 function sfIsUpdateCSVFrame(&$arrCSVFrame) 172 { 166 173 $result = true; 167 174 foreach ($arrCSVFrame as $val) { … … 182 189 * @return integer CSV のカウント数 183 190 */ 184 function sfGetCSVRecordCount($fp) { 191 function sfGetCSVRecordCount($fp) 192 { 185 193 $count = 0; 186 194 while (!feof($fp)) { … … 202 210 * @return boolean true (true:固定 false:中断) 203 211 */ 204 function cbOutputCSV($data) { 212 function cbOutputCSV($data) 213 { 205 214 $line = $this->sfArrayToCSV($data); 206 215 $line = mb_convert_encoding($line, 'SJIS-Win'); … … 221 230 * @return mixed $is_download = true時 成功失敗フラグ(boolean) 、$is_downalod = false時 string 222 231 */ 223 function sfDownloadCsvFromSql($sql, $arrVal = array(), $file_head = 'csv', $arrHeader = array(), $is_download = false) { 232 function sfDownloadCsvFromSql($sql, $arrVal = array(), $file_head = 'csv', $arrHeader = array(), $is_download = false) 233 { 224 234 $objQuery =& SC_Query_Ex::getSingletonInstance(); 225 235 … … 265 275 * @return string 結果行 266 276 */ 267 function sfArrayToCsv($fields, $delimiter = ',', $enclosure = '"', $arrayDelimiter = '|') { 277 function sfArrayToCsv($fields, $delimiter = ',', $enclosure = '"', $arrayDelimiter = '|') 278 { 268 279 if (strlen($delimiter) != 1) { 269 280 trigger_error('delimiter must be a single character', E_USER_WARNING); … … 302 313 * @return void 303 314 */ 304 function lfDownloadCsv($arrData, $prefix = '') { 315 function lfDownloadCsv($arrData, $prefix = '') 316 { 305 317 306 318 if ($prefix == '') { … … 332 344 * @return void 333 345 */ 334 function lfDownloadCSVFile($filepath, $prefix = '') { 346 function lfDownloadCSVFile($filepath, $prefix = '') 347 { 335 348 $file_name = $prefix . date('YmdHis') . '.csv'; 336 349
Note: See TracChangeset
for help on using the changeset viewer.