source: branches/dev/html/admin/contents/campaign_csv.php @ 8

Revision 8, 1.1 KB checked in by root, 17 years ago (diff)

new import

Line 
1<?php
2/*
3 * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once(DATA_PATH . "include/csv_output.inc");
8
9// CSV½ÐÎϥǡ¼¥¿¤òºîÀ®¤¹¤ë¡£
10function lfGetCSV($from, $where, $option, $arrval, $arrCsvOutputCols = "") {
11    global $arrCVSCOL;
12
13    //$cols = sfGetCommaList($arrCVSCOL);
14    $cols = sfGetCommaList($arrCsvOutputCols);
15   
16    $objQuery = new SC_Query();
17    $objQuery->setoption($option);
18   
19    $list_data = $objQuery->select($cols, $from, $where, $arrval); 
20
21    $max = count($list_data);
22    for($i = 0; $i < $max; $i++) {
23        // ³Æ¹àÌܤòCSV½ÐÎÏÍѤËÊÑ´¹¤¹¤ë¡£
24        $data .= lfMakeCSV($list_data[$i]);
25    }
26    return $data;
27}
28
29// ³Æ¹àÌܤòCSV½ÐÎÏÍѤËÊÑ´¹¤¹¤ë¡£
30function lfMakeCSV($list) {
31    global $arrPref;
32   
33    $line = "";
34   
35    foreach($list as $key => $val) {
36        $tmp = "";
37        switch($key) {
38        case 'order_pref':
39            $tmp = $arrPref[$val];
40            break;
41        default:
42            $tmp = $val;
43            break;
44        }
45
46        $tmp = ereg_replace("[\",]", " ", $tmp);
47        $line .= "\"".$tmp."\",";
48    }
49    // ʸËö¤Î","¤òÊÑ´¹
50    $line = ereg_replace(",$", "\n", $line);
51    return $line;
52}
53
54?>
Note: See TracBrowser for help on using the repository browser.