source: branches/dev/html/admin/customer/index.php @ 15133

Revision 15133, 15.9 KB checked in by naka, 14 years ago (diff)
Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once("../require.php");
8require_once(DATA_PATH . "include/csv_output.inc");
9
10//---- ¥Ú¡¼¥¸É½¼¨ÍÑ¥¯¥é¥¹
11class LC_Page {
12    var $arrSession;
13    var $tpl_mode;
14    var $list_data;
15    var $search_data;
16    var $arrErr;
17    var $arrYear;
18    var $arrMonth;
19    var $arrDay;
20    var $arrJob;
21    var $arrSex;
22    var $arrPageMax;
23    var $count;
24    var $search_SQL;
25   
26    var $tpl_strnavi;
27   
28    var $arrHtmlmail;
29
30    function LC_Page() {
31        $this->tpl_mainpage = 'customer/index.tpl';
32        $this->tpl_mainno = 'customer';
33        $this->tpl_subnavi = 'customer/subnavi.tpl';
34        $this->tpl_subno = 'index';
35        $this->tpl_pager = DATA_PATH . 'Smarty/templates/admin/pager.tpl';
36        $this->tpl_subtitle = '¸ÜµÒ¥Þ¥¹¥¿';
37       
38        global $arrPref;
39        $this->arrPref = $arrPref;
40        global $arrJob;
41        $arrJob["ÉÔÌÀ"] = "ÉÔÌÀ";
42        $this->arrJob = $arrJob;
43        global $arrSex;     
44        $this->arrSex = $arrSex;
45        global $arrPageRows;
46        $this->arrPageRows = $arrPageRows;
47       
48        global $arrMAILMAGATYPE;
49        $this->arrMAILMAGATYPE = $arrMAILMAGATYPE;
50        $this->arrHtmlmail[''] = "¤¹¤Ù¤Æ";
51        $this->arrHtmlmail[1] = $arrMAILMAGATYPE[1];
52        $this->arrHtmlmail[2] = $arrMAILMAGATYPE[2];       
53    }
54}
55
56//----¡¡CSV¥À¥¦¥ó¥í¡¼¥ÉÍÑ
57$arrColumnCSV= array(
58                        0  => array("sql" => "customer_id", "csv" => "customer_id", "header" => "¸ÜµÒID"),
59                        1  => array("sql" => "name01", "csv" => "name01", "header" => "̾Á°1"),
60                        2  => array("sql" => "name02", "csv" => "name02", "header" => "̾Á°2"),
61                        3  => array("sql" => "kana01", "csv" => "kana01", "header" => "¥Õ¥ê¥¬¥Ê1"),
62                        4  => array("sql" => "kana02", "csv" => "kana02", "header" => "¥Õ¥ê¥¬¥Ê2"),
63                        5  => array("sql" => "zip01", "csv" => "zip01", "header" => "͹ÊØÈÖ¹æ1"),
64                        6  => array("sql" => "zip02", "csv" => "zip02", "header" => "͹ÊØÈÖ¹æ2"),
65                        7  => array("sql" => "pref", "csv" => "pref", "header" => "ÅÔÆ»Éܸ©"),
66                        8  => array("sql" => "addr01", "csv" => "addr01", "header" => "½»½ê1"),
67                        9  => array("sql" => "addr02", "csv" => "addr02", "header" => "½»½ê2"),
68                        10 => array("sql" => "email", "csv" => "email", "header" => "E-MAIL"),
69                        11 => array("sql" => "tel01", "csv" => "tel01", "header" => "TEL1"),
70                        12 => array("sql" => "tel02", "csv" => "tel02", "header" => "TEL2"),
71                        13 => array("sql" => "tel03", "csv" => "tel03", "header" => "TEL3"),
72                        14 => array("sql" => "fax01", "csv" => "fax01", "header" => "FAX1"),
73                        15 => array("sql" => "fax02", "csv" => "fax02", "header" => "FAX2"),
74                        16 => array("sql" => "fax03", "csv" => "fax03", "header" => "FAX3"),
75                        17 => array("sql" => "CASE WHEN sex = 1 THEN 'ÃËÀ­' ELSE '½÷À­' END AS sex", "csv" => "sex", "header" => "À­ÊÌ"),
76                        18 => array("sql" => "job", "csv" => "job", "header" => "¿¦¶È"),
77                        19 => array("sql" => "cast(birth as date) AS birth", "csv" => "birth", "header" => "ÃÂÀ¸Æü"),
78                        20 => array("sql" => "cast(first_buy_date as date) AS first_buy_date", "csv" => "first_buy_date", "header" => "½é²ó¹ØÆþÆü"),
79                        21 => array("sql" => "cast(last_buy_date as date) AS last_buy_date", "csv" => "last_buy_date", "header" => "ºÇ½ª¹ØÆþÆü"),
80                        22 => array("sql" => "buy_times", "csv" => "buy_times", "header" => "¹ØÆþ²ó¿ô"),
81                        23 => array("sql" => "point", "csv" => "point", "header" => "¥Ý¥¤¥ó¥È»Ä¹â"),
82                        24 => array("sql" => "note", "csv" => "note", "header" => "È÷¹Í"),
83                        25 => array("sql" => "cast(create_date as date) AS create_date", "csv" => "create_date", "header" => "ÅÐÏ¿Æü"),
84                        26 => array("sql" => "cast(update_date as date) AS update_date", "csv" => "update_date", "header" => "¹¹¿·Æü")
85                    );
86
87//---- ¥Ú¡¼¥¸½é´üÀßÄê
88$objQuery = new SC_Query();
89$objPage = new LC_Page();
90$objView = new SC_AdminView();
91$objDate = new SC_Date(1901);
92$objPage->arrYear = $objDate->getYear();    //¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
93$objPage->arrMonth = $objDate->getMonth();
94$objPage->arrDay = $objDate->getDay();
95$objPage->objDate = $objDate;
96
97// ǧ¾Ú²ÄÈݤÎȽÄê
98$objSess = new SC_Session();
99sfIsSuccess($objSess);
100
101// POSTÃͤΰú¤­·Ñ¤®
102$objPage->arrForm = $_POST;
103
104// ¥Ú¡¼¥¸Á÷¤êÍÑ
105$objPage->arrHidden['search_pageno'] = $_POST['search_pageno'];
106
107// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
108foreach ($_POST as $key => $val) {
109    switch($key) {
110        case 'sex':
111            $objPage->arrHidden[$key] = sfMergeParamCheckBoxes($val);
112            if(!is_array($val)) {
113                $objPage->arrForm[$key] = split("-", $val);
114            }
115            break;
116        default:
117            $objPage->arrHidden[$key] = $val;
118            break;
119    }
120}
121
122// ¸ÜµÒºï½ü
123if ($_POST['mode'] == "delete") {
124    $sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
125    $result_customer = $objQuery->conn->getAll($sql, array($_POST["edit_customer_id"]));
126
127    if ($result_customer[0]["status"] == 2) {           //Ëܲñ°÷ºï½ü
128        $arrDel = array("del_flg" => 1, "update_date" => "NOW()");
129        $objQuery->conn->autoExecute("dtb_customer", $arrDel, "customer_id = " .addslashes($_POST["edit_customer_id"]) );
130    } elseif ($result_customer[0]["status"] == 1) {     //²¾²ñ°÷ºï½ü
131        $sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
132        $objQuery->conn->query($sql, array($_POST["edit_customer_id"]));
133    }
134}
135if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all") {
136    // ÆþÎÏʸ»ú¤Î¶¯À©ÊÑ´¹
137    lfConvertParam();
138    // ¥¨¥é¡¼¥Á¥§¥Ã¥¯
139    $objPage->arrErr = lfCheckError($objPage->arrForm);
140
141    $where = "del_flg = 0";
142
143    /* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */
144    if (count($objPage->arrErr) == 0) {
145       
146        //-- ¸¡º÷¥Ç¡¼¥¿¼èÆÀ
147        $objSelect = new SC_CustomerList($objPage->arrForm, "customer");
148       
149        // ɽ¼¨·ï¿ôÀßÄê
150        $page_rows = $objPage->arrForm['page_rows'];
151        if(is_numeric($page_rows)) {   
152            $page_max = $page_rows;
153        } else {
154            $page_max = SEARCH_PMAX;
155        }
156       
157        if ($objPage->arrForm['search_pageno'] == 0){
158            $objPage->arrForm['search_pageno'] = 1;
159        }
160       
161        $offset = $page_max * ($objPage->arrForm['search_pageno'] - 1);
162        $objSelect->setLimitOffset($page_max, $offset);     
163       
164        if ($_POST["mode"] == 'csv') {
165            $searchSql = $objSelect->getListCSV($arrColumnCSV);
166        }else{
167            $searchSql = $objSelect->getList();
168        }
169       
170        $objPage->search_data = $objQuery->conn->getAll($searchSql, $objSelect->arrVal);
171       
172        switch($_POST['mode']) {
173        case 'csv':
174            $i = 0;
175            $header = "";
176           
177            // CSV¥«¥é¥à¼èÆÀ
178            $arrCsvOutput = (sfgetCsvOutput(2, " WHERE csv_id = 2 AND status = 1"));
179
180            if (count($arrCsvOutput) <= 0) break;
181
182            foreach($arrCsvOutput as $data) {
183                $arrColumn[] = $data["col"];
184                if ($i != 0) $header .= ", ";
185                $header .= $data["disp_name"];
186                $i ++;
187            }
188            $header .= "\n";
189
190            //-¡¡ÅÔÆ»Éܸ©/¿¦¶È¤ÎÊÑ´¹
191            for($i = 0; $i < count($objPage->search_data); $i ++) {
192                $objPage->search_data[$i]["pref"] = $arrPref[ $objPage->search_data[$i]["pref"] ];
193                $objPage->search_data[$i]["job"]  = $arrJob[ $objPage->search_data[$i]["job"] ];
194            }
195
196            //-¡¡CSV½ÐÎÏ
197            $data = lfGetCSVData($objPage->search_data, $arrColumn);
198           
199            sfCSVDownload($header.$data);
200            exit;
201            break;
202        case 'delete_all':
203            // ¸¡º÷·ë²Ì¤ò¤¹¤Ù¤Æºï½ü
204            $where = "product_id IN (SELECT product_id FROM vw_products_nonclass AS noncls WHERE $where)";
205            $sqlval['del_flg'] = 1;
206            $objQuery->update("dtb_products", $sqlval, $where, $arrval);
207
208            $sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
209            $result_customer = $objQuery->conn->getAll($sql, array($_POST["del_customer_id"]));
210
211            if ($result_customer[0]["status"] == 2) {           //Ëܲñ°÷ºï½ü
212                $arrDel = array("del_flg" => 1, "update_date" => "NOW()");
213                $objQuery->conn->autoExecute("dtb_customer", $arrDel, "customer_id = " .addslashes($_POST["del_customer_id"]) );
214            } elseif ($result_customer[0]["status"] == 1) {     //²¾²ñ°÷ºï½ü
215                $sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
216                $objQuery->conn->query($sql, array($_POST["del_customer_id"]));
217            }
218           
219            break;
220        default:
221
222            // ¹Ô¿ô¤Î¼èÆÀ
223            $linemax = $objQuery->conn->getOne( $objSelect->getListCount(), $objSelect->arrVal);
224            $objPage->tpl_linemax = $linemax;               // ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
225
226            // ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
227            $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnCustomerPage", NAVI_PMAX);
228            $startno = $objNavi->start_row;
229            $objPage->arrPagenavi = $objNavi->arrPagenavi;     
230        }
231    }
232}
233
234$objPage->arrCatList = sfGetCategoryList();
235
236//----¡¡¥Ú¡¼¥¸É½¼¨
237$objView->assignobj($objPage);
238$objView->display(MAIN_FRAME);
239
240
241//--------------------------------------------------------------------------------------------------------------------------------------
242
243//----¡¡¼èÆÀʸ»úÎó¤ÎÊÑ´¹
244function lfConvertParam() {
245    global $objPage;
246   
247    /*
248     *  ʸ»úÎó¤ÎÊÑ´¹
249     *  K :  ¡ÖȾ³Ñ(ŽÊŽÝŽ¶Ž¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
250     *  C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
251     *  V :  ÂùÅÀÉÕ¤­¤Îʸ»ú¤ò°ìʸ»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍѤ·¤Þ¤¹ 
252     *  n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖȾ³Ñ(ŽÊŽÝŽ¶Ž¸)¡×¤ËÊÑ´¹
253     *  a :  Á´³Ñ±Ñ¿ô»ú¤òȾ³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
254     */
255    // ¥«¥é¥à̾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
256    $arrConvList['customer_id'] = "n" ;
257    $arrConvList['name'] = "aKV" ;
258    $arrConvList['pref'] = "n" ;
259    $arrConvList['kana'] = "CKV" ;
260    $arrConvList['b_start_year'] = "n" ;
261    $arrConvList['b_start_month'] = "n" ;
262    $arrConvList['b_start_day'] = "n" ;
263    $arrConvList['b_end_year'] = "n" ;
264    $arrConvList['b_end_month'] = "n" ;
265    $arrConvList['b_end_day'] = "n" ;
266    $arrConvList['tel'] = "n" ;
267    $arrConvList['birth_month'] = "n" ;
268    $arrConvList['email'] = "a" ;
269    $arrConvList['buy_total_from'] = "n" ;
270    $arrConvList['buy_total_to'] = "n" ;
271    $arrConvList['buy_times_from'] = "n" ;
272    $arrConvList['buy_times_to'] = "n" ;
273    $arrConvList['start_year'] = "n" ;
274    $arrConvList['start_month'] = "n" ;
275    $arrConvList['start_day'] = "n" ;
276    $arrConvList['end_year'] = "n" ;
277    $arrConvList['end_month'] = "n" ;
278    $arrConvList['end_day'] = "n" ;
279    $arrConvList['page_rows'] = "n" ;
280    $arrConvList['buy_start_year'] = "n" ;      //¡¡ºÇ½ª¹ØÆþÆü START ǯ
281    $arrConvList['buy_start_month'] = "n" ;     //¡¡ºÇ½ª¹ØÆþÆü START ·î
282    $arrConvList['buy_start_day'] = "n" ;       //¡¡ºÇ½ª¹ØÆþÆü START Æü
283    $arrConvList['buy_end_year'] = "n" ;            //¡¡ºÇ½ª¹ØÆþÆü END ǯ
284    $arrConvList['buy_end_month'] = "n" ;       //¡¡ºÇ½ª¹ØÆþÆü END ·î
285    $arrConvList['buy_end_day'] = "n" ;         //¡¡ºÇ½ª¹ØÆþÆü END Æü
286    $arrConvList['buy_product_name'] = "aKV" ;  //¡¡¹ØÆþ¾¦ÉÊ̾
287    $arrConvList['buy_product_code'] = "aKV" ;  //¡¡¹ØÆþ¾¦ÉÊ¥³¡¼¥É
288    $arrConvList['category_id'] = "" ;          //¡¡¥«¥Æ¥´¥ê
289       
290    // ʸ»úÊÑ´¹
291    foreach ($arrConvList as $key => $val) {
292        // POST¤µ¤ì¤Æ¤­¤¿ÃͤΤßÊÑ´¹¤¹¤ë¡£
293        if(isset($objPage->arrForm[$key])) {
294            $objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
295        }
296    }
297}
298
299
300//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
301function lfCheckError($array) {
302
303    $objErr = new SC_CheckError($array);
304   
305    $objErr->doFunc(array("¸ÜµÒ¥³¡¼¥É", "customer_id", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
306    $objErr->doFunc(array("ÅÔÆ»Éܸ©", "pref", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
307    $objErr->doFunc(array("¸ÜµÒ̾", "name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
308    $objErr->doFunc(array("¸ÜµÒ̾(¥«¥Ê)", "kana", STEXT_LEN), array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANABLANK_CHECK"));
309    $objErr->doFunc(array("ÃÂÀ¸Æü(³«»ÏÆü)", "b_start_year", "b_start_month", "b_start_day"), array("CHECK_DATE"));
310    $objErr->doFunc(array("ÃÂÀ¸Æü(½ªÎ»Æü)", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_DATE"));
311    $objErr->doFunc(array("ÃÂÀ¸Æü(³«»ÏÆü)","ÃÂÀ¸Æü(½ªÎ»Æü)", "b_start_year", "b_start_month", "b_start_day", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_SET_TERM"));
312    $objErr->doFunc(array("ÃÂÀ¸·î", "birth_month", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
313    $objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
314    $objErr->doFunc(array('·ÈÂӥ᡼¥ë¥¢¥É¥ì¥¹', "email_mobile", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
315    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ", "tel", TEL_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
316    $objErr->doFunc(array("¹ØÆþ¶â³Û(³«»Ï)", "buy_total_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
317    $objErr->doFunc(array("¹ØÆþ¶â³Û(½ªÎ»)", "buy_total_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
318    if ( (is_numeric($array["buy_total_from"]) && is_numeric($array["buy_total_to"]) ) && ($array["buy_total_from"] > $array["buy_total_to"]) ) $objErr->arrErr["buy_total_from"] .= "¢¨ ¹ØÆþ¶â³Û¤Î»ØÄêÈϰϤ¬ÉÔÀµ¤Ç¤¹¡£";
319    $objErr->doFunc(array("¹ØÆþ²ó¿ô(³«»Ï)", "buy_times_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
320    $objErr->doFunc(array("¹ØÆþ²ó¿ô(½ªÎ»)", "buy_times_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
321    if ( (is_numeric($array["buy_times_from"]) && is_numeric($array["buy_times_to"]) ) && ($array["buy_times_from"] > $array["buy_times_to"]) ) $objErr->arrErr["buy_times_from"] .= "¢¨ ¹ØÆþ²ó¿ô¤Î»ØÄêÈϰϤ¬ÉÔÀµ¤Ç¤¹¡£";
322    $objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(³«»ÏÆü)", "start_year", "start_month", "start_day",), array("CHECK_DATE"));
323    $objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "end_year", "end_month", "end_day"), array("CHECK_DATE"));   
324    $objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(³«»ÏÆü)","ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "start_year", "start_month", "start_day", "end_year", "end_month", "end_day"), array("CHECK_SET_TERM"));
325    $objErr->doFunc(array("ɽ¼¨·ï¿ô", "page_rows", 3), array("NUM_CHECK","MAX_LENGTH_CHECK")); 
326    $objErr->doFunc(array("ºÇ½ª¹ØÆþÆü(³«»ÏÆü)", "buy_start_year", "buy_start_month", "buy_start_day",), array("CHECK_DATE"));   //ºÇ½ª¹ØÆþÆü(³«»ÏÆü)
327    $objErr->doFunc(array("ºÇ½ª¹ØÆþ(½ªÎ»Æü)", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_DATE"));            //ºÇ½ª¹ØÆþÆü(½ªÎ»Æü)
328    //¹ØÆþ¶â³Û(from) ¡ä ¹ØÆþ¶â³Û(to) ¤Î¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë
329    $objErr->doFunc(array("ºÇ½ª¹ØÆþÆü(³«»ÏÆü)","ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "buy_start_year", "buy_start_month", "buy_start_day", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_SET_TERM"));
330    $objErr->doFunc(array("¹ØÆþ¾¦ÉÊ¥³¡¼¥É", "buy_product_code", STEXT_LEN), array("MAX_LENGTH_CHECK"));                     //¹ØÆþ¾¦ÉÊ¥³¡¼¥É
331    $objErr->doFunc(array("¹ØÆþ¾¦ÉÊ̾", "buy_product_name", STEXT_LEN), array("MAX_LENGTH_CHECK"));                         //¹ØÆþ¾¦ÉÊ̾¾Î
332
333    return $objErr->arrErr;
334}
335
336function lfSetWhere($arrForm){
337    foreach ($arrForm as $key => $val) {
338       
339        $val = sfManualEscape($val);
340       
341        if($val == "") continue;
342       
343        switch ($key) {
344            case 'product_id':
345                $where .= " AND product_id = ?";
346                $arrval[] = $val;
347                break;
348            case 'product_class_id':
349                $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_class_id = ?)";
350                $arrval[] = $val;
351                break;
352            case 'name':
353                $where .= " AND name ILIKE ?";
354                $arrval[] = "%$val%";
355                break;
356            case 'category_id':
357                list($tmp_where, $tmp_arrval) = sfGetCatWhere($val);
358                if($tmp_where != "") {
359                    $where.= " AND $tmp_where";
360                    $arrval = array_merge($arrval, $tmp_arrval);
361                }
362                break;
363            case 'product_code':
364                $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
365                $arrval[] = "%$val%";
366                break;
367            case 'startyear':
368                $date = sfGetTimestamp($_POST['startyear'], $_POST['startmonth'], $_POST['startday']);
369                $where.= " AND update_date >= ?";
370                $arrval[] = $date;
371                break;
372            case 'endyear':
373                $date = sfGetTimestamp($_POST['endyear'], $_POST['endmonth'], $_POST['endday']);
374                $where.= " AND update_date <= ?";
375                $arrval[] = $date;
376                break;
377            case 'product_flag':
378                global $arrSTATUS;
379                $product_flag = sfSearchCheckBoxes($val);
380                if($product_flag != "") {
381                    $where.= " AND product_flag LIKE ?";
382                    $arrval[] = $product_flag;                 
383                }
384                break;
385            case 'status':
386                $tmp_where = "";
387                foreach ($val as $element){
388                    if ($element != ""){
389                        if ($tmp_where == ""){
390                            $tmp_where.="AND (status LIKE ? ";
391                        }else{
392                            $tmp_where.="OR status LIKE ? ";
393                        }
394                        $arrval[]=$element;
395                    }
396                }
397                if ($tmp_where != ""){
398                    $tmp_where.=")";
399                    $where.= "$tmp_where";
400                }   
401                break;
402            default:
403                break;
404        }
405    }
406}
407
408//---- CSV½ÐÎÏÍѥǡ¼¥¿¼èÆÀ
409function lfGetCSVData( $array, $arrayIndex){   
410   
411    for ($i=0; $i<count($array); $i++){
412       
413        for ($j=0; $j<count($array[$i]); $j++ ){
414            if ( $j > 0 ) $return .= ",";
415            $return .= "\"";           
416            if ( $arrayIndex ){
417                $return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\""; 
418            } else {
419                $return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
420            }
421        }
422        $return .= "\n";           
423    }
424   
425    return $return;
426}
427
428
429?>
Note: See TracBrowser for help on using the repository browser.