source: branches/version-2_13-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_SearchProducts.php @ 22856

Revision 22856, 5.6 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 主に空白・空白行の調整。もう少し整えたいが、一旦現状コミット。
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Ex.php';
25
26/**
27 * 検索ブロック のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id:LC_Page_FrontParts_Bloc_SearchProducts.php 15532 2007-08-31 14:39:46Z nanasess $
32 */
33class LC_Page_FrontParts_Bloc_SearchProducts extends LC_Page_FrontParts_Bloc_Ex
34{
35    /**
36     * Page を初期化する.
37     *
38     * @return void
39     */
40    function init()
41    {
42        parent::init();
43    }
44
45    /**
46     * Page のプロセス.
47     *
48     * @return void
49     */
50    function process()
51    {
52        $this->action();
53        $this->sendResponse();
54    }
55
56    /**
57     * Page のアクション.
58     *
59     * @return void
60     */
61    function action()
62    {
63        // 商品ID取得
64        $product_id = $this -> lfGetProductId();
65        // カテゴリID取得
66        $category_id = $this -> lfGetCategoryId();
67        // メーカーID取得
68        $maker_id = $this -> lfGetMakerId();
69        // 選択中のカテゴリIDを判定する
70        $this->category_id = $this->lfGetSelectedCategoryId($product_id, $category_id);
71        // カテゴリ検索用選択リスト
72        $this->arrCatList = $this->lfGetCategoryList();
73        // 選択中のメーカーIDを判定する
74        $this->maker_id = $this->lfGetSelectedMakerId($product_id, $maker_id);
75        // メーカー検索用選択リスト
76        $this->arrMakerList = $this->lfGetMakerList();
77
78
79    }
80
81    /**
82     * デストラクタ.
83     *
84     * @return void
85     */
86    function destroy()
87    {
88        parent::destroy();
89    }
90
91    /**
92     * 商品IDを取得する.
93     *
94     * @return string $product_id 商品ID
95     */
96    function lfGetProductId()
97    {
98        $product_id = '';
99        if (isset($_GET['product_id']) && $_GET['product_id'] != '' && is_numeric($_GET['product_id'])) {
100            $product_id = $_GET['product_id'];
101        }
102
103        return $product_id;
104    }
105
106    /**
107     * カテゴリIDを取得する.
108     *
109     * @return string $category_id カテゴリID
110     */
111    function lfGetCategoryId()
112    {
113        $category_id = '';
114        if (isset($_GET['category_id']) && $_GET['category_id'] != '' && is_numeric($_GET['category_id'])) {
115            $category_id = $_GET['category_id'];
116        }
117
118        return $category_id;
119    }
120
121    /**
122     * メーカーIDを取得する.
123     *
124     * @return string $maker_id メーカーID
125     */
126    function lfGetMakerId()
127    {
128        $maker_id = '';
129        if (isset($_GET['maker_id']) && $_GET['maker_id'] != '' && is_numeric($_GET['maker_id'])) {
130            $maker_id = $_GET['maker_id'];
131        }
132
133        return $maker_id;
134    }
135
136    /**
137     * 選択中のカテゴリIDを取得する
138     *
139     * @return array $arrCategoryId 選択中のカテゴリID
140     */
141    function lfGetSelectedCategoryId($product_id, $category_id)
142    {
143        // 選択中のカテゴリIDを判定する
144        $objDb = new SC_Helper_DB_Ex();
145        $arrCategoryId = $objDb->sfGetCategoryId($product_id, $category_id);
146
147        return $arrCategoryId;
148    }
149
150    /**
151     * 選択中のメーカーIDを取得する
152     *
153     * @return array $arrMakerId 選択中のメーカーID
154     */
155    function lfGetSelectedMakerId($product_id, $maker_id)
156    {
157        // 選択中のメーカーIDを判定する
158        $objDb = new SC_Helper_DB_Ex();
159        $arrMakerId = $objDb->sfGetMakerId($product_id, $maker_id);
160
161        return $arrMakerId;
162    }
163
164    /**
165     * カテゴリ検索用選択リストを取得する
166     *
167     * @return array $arrCategoryList カテゴリ検索用選択リスト
168     */
169    function lfGetCategoryList()
170    {
171        $objDb = new SC_Helper_DB_Ex();
172        // カテゴリ検索用選択リスト
173        $arrCategoryList = $objDb->sfGetCategoryList('', true, ' ');
174        if (is_array($arrCategoryList)) {
175            // 文字サイズを制限する
176            foreach ($arrCategoryList as $key => $val) {
177                $truncate_str = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
178                $arrCategoryList[$key] = preg_replace('/ /u', '&nbsp;&nbsp;', $truncate_str);
179            }
180        }
181
182        return $arrCategoryList;
183    }
184
185    /**
186     * メーカー検索用選択リストを取得する
187     *
188     * @return array $arrMakerList メーカー検索用選択リスト
189     */
190    function lfGetMakerList()
191    {
192        $objDb = new SC_Helper_DB_Ex();
193        // メーカー検索用選択リスト
194        $arrMakerList = $objDb->sfGetMakerList('', true);
195        if (is_array($arrMakerList)) {
196            // 文字サイズを制限する
197            foreach ($arrMakerList as $key => $val) {
198                $arrMakerList[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
199            }
200        }
201
202        return $arrMakerList;
203    }
204
205}
Note: See TracBrowser for help on using the repository browser.