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