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

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