[5] | 1 | <?php |
---|
| 2 | /* |
---|
[15] | 3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
---|
[5] | 4 | * |
---|
| 5 | * http://www.lockon.co.jp/ |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | require_once("../require.php"); |
---|
| 9 | |
---|
| 10 | class LC_Page { |
---|
| 11 | |
---|
| 12 | function LC_Page() { |
---|
| 13 | $this->tpl_mainpage = 'products/product_select.tpl'; |
---|
| 14 | $this->tpl_mainno = 'products'; |
---|
| 15 | $this->tpl_subnavi = ''; |
---|
| 16 | $this->tpl_subno = ""; |
---|
[11730] | 17 | $this->tpl_subtitle = '¾¦ÉÊÁªÂò'; |
---|
[5] | 18 | } |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | $conn = new SC_DBConn(); |
---|
| 22 | $objPage = new LC_Page(); |
---|
| 23 | $objView = new SC_AdminView(); |
---|
| 24 | $objSess = new SC_Session(); |
---|
| 25 | |
---|
[11730] | 26 | // ǧ¾Ú²ÄÈݤÎȽÄê |
---|
[5] | 27 | sfIsSuccess($objSess); |
---|
| 28 | |
---|
| 29 | if ($_POST['mode'] == "search") { |
---|
| 30 | |
---|
[11730] | 31 | // POSTÃͤΰú¤·Ñ¤® |
---|
[5] | 32 | $objPage->arrForm = $_POST; |
---|
[11730] | 33 | // ÆþÎÏʸ»ú¤Î¶¯À©ÊÑ´¹ |
---|
[5] | 34 | lfConvertParam(); |
---|
| 35 | |
---|
| 36 | $where = "del_flg = 0"; |
---|
| 37 | |
---|
[11730] | 38 | /* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */ |
---|
[5] | 39 | foreach ($objPage->arrForm as $key => $val) { |
---|
| 40 | if($val == "") { |
---|
| 41 | continue; |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | switch ($key) { |
---|
| 45 | case 'search_name': |
---|
| 46 | $where .= " AND name ILIKE ?"; |
---|
| 47 | $arrval[] = "%$val%"; |
---|
| 48 | break; |
---|
| 49 | case 'search_category_id': |
---|
[11730] | 50 | // »Ò¥«¥Æ¥´¥êID¤Î¼èÆÀ |
---|
[5] | 51 | $arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $val); |
---|
| 52 | $tmp_where = ""; |
---|
| 53 | foreach ($arrRet as $val) { |
---|
| 54 | if($tmp_where == "") { |
---|
| 55 | $tmp_where.= " AND ( category_id = ?"; |
---|
| 56 | } else { |
---|
| 57 | $tmp_where.= " OR category_id = ?"; |
---|
| 58 | } |
---|
| 59 | $arrval[] = $val; |
---|
| 60 | } |
---|
| 61 | $where.= $tmp_where . " )"; |
---|
| 62 | break; |
---|
| 63 | case 'search_product_code': |
---|
| 64 | $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)"; |
---|
[248] | 65 | $arrval[] = "$val%"; |
---|
[5] | 66 | break; |
---|
| 67 | default: |
---|
| 68 | break; |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | $order = "update_date DESC, product_id DESC "; |
---|
| 73 | |
---|
[11730] | 74 | // Æɤ߹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê |
---|
[5] | 75 | $col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited"; |
---|
| 76 | $from = "vw_products_nonclass AS noncls "; |
---|
| 77 | |
---|
| 78 | $objQuery = new SC_Query(); |
---|
[11730] | 79 | // ¹Ô¿ô¤Î¼èÆÀ |
---|
[5] | 80 | $linemax = $objQuery->count("dtb_products", $where, $arrval); |
---|
[11730] | 81 | $objPage->tpl_linemax = $linemax; // ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ |
---|
[5] | 82 | |
---|
[11730] | 83 | // ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý |
---|
[5] | 84 | if(is_numeric($_POST['search_page_max'])) { |
---|
| 85 | $page_max = $_POST['search_page_max']; |
---|
| 86 | } else { |
---|
| 87 | $page_max = SEARCH_PMAX; |
---|
| 88 | } |
---|
| 89 | |
---|
[11730] | 90 | // ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ |
---|
[5] | 91 | $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX); |
---|
[11730] | 92 | $objPage->tpl_strnavi = $objNavi->strnavi; // ɽ¼¨Ê¸»úÎó |
---|
[5] | 93 | $startno = $objNavi->start_row; |
---|
| 94 | |
---|
[11730] | 95 | // ¼èÆÀÈϰϤλØÄê(³«»Ï¹ÔÈֹ桢¹Ô¿ô¤Î¥»¥Ã¥È) |
---|
[5] | 96 | if(DB_TYPE != "mysql") $objQuery->setlimitoffset($page_max, $startno); |
---|
[11730] | 97 | // ɽ¼¨½ç½ø |
---|
[5] | 98 | $objQuery->setorder($order); |
---|
| 99 | |
---|
[11730] | 100 | // view¤â¹Ê¹þ¤ß¤ò¤«¤±¤ë(mysqlÍÑ) |
---|
[5] | 101 | sfViewWhere("&&noncls_where&&", $where, $arrval, $objQuery->order . " " . $objQuery->setlimitoffset($page_max, $startno, true)); |
---|
| 102 | |
---|
[11730] | 103 | // ¸¡º÷·ë²Ì¤Î¼èÆÀ |
---|
[5] | 104 | $objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval); |
---|
| 105 | |
---|
| 106 | } |
---|
| 107 | |
---|
[11730] | 108 | // ¥«¥Æ¥´¥ê¼èÆÀ |
---|
[5] | 109 | $objPage->arrCatList = sfGetCategoryList(); |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | |
---|
[11730] | 116 | //----¡¡¥Ú¡¼¥¸É½¼¨ |
---|
[5] | 117 | $objView->assignobj($objPage); |
---|
| 118 | $objView->display($objPage->tpl_mainpage); |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | |
---|
| 125 | //--------------------------------------------------------------------------------------------------------------------------------------------------------- |
---|
| 126 | |
---|
[11730] | 127 | /* ¼èÆÀʸ»úÎó¤ÎÊÑ´¹ */ |
---|
[5] | 128 | function lfConvertParam() { |
---|
| 129 | global $objPage; |
---|
| 130 | /* |
---|
[11730] | 131 | * ʸ»úÎó¤ÎÊÑ´¹ |
---|
| 132 | * K : ¡ÖȾ³Ñ(Êݶ¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹ |
---|
| 133 | * C : ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹ |
---|
| 134 | * V : ÂùÅÀÉÕ¤¤Îʸ»ú¤ò°ìʸ»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍѤ·¤Þ¤¹ |
---|
| 135 | * n : ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖȾ³Ñ(Êݶ¸)¡×¤ËÊÑ´¹ |
---|
[5] | 136 | */ |
---|
| 137 | $arrConvList['search_name'] = "KVa"; |
---|
| 138 | $arrConvList['search_product_code'] = "KVa"; |
---|
| 139 | |
---|
[11730] | 140 | // ʸ»úÊÑ´¹ |
---|
[5] | 141 | foreach ($arrConvList as $key => $val) { |
---|
[11730] | 142 | // POST¤µ¤ì¤Æ¤¤¿ÃͤΤßÊÑ´¹¤¹¤ë¡£ |
---|
[5] | 143 | if(isset($objPage->arrForm[$key])) { |
---|
| 144 | $objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val); |
---|
| 145 | } |
---|
| 146 | } |
---|
| 147 | } |
---|
| 148 | |
---|
| 149 | |
---|
| 150 | ?> |
---|