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