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