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

Revision 23605, 5.7 KB checked in by kimoto, 10 years ago (diff)

#2448 typo修正・ソース整形・ソースコメントの改善 for 2.13.3

Scrutinizer Auto-Fixes

This patch was automatically generated as part of the following inspection:
 https://scrutinizer-ci.com/g/nobuhiko/EC-CUBE/inspections/d8722894-69a6-4b1b-898d-43618035c60d

Enabled analysis tools:

  • PHP Analyzer
  • PHP PDepend
  • PHP Similarity Analyzer
  • PHP Change Tracking Analyzer
  • 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-2014 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    public function init()
41    {
42        parent::init();
43    }
44
45    /**
46     * Page のプロセス.
47     *
48     * @return void
49     */
50    public function process()
51    {
52        $this->action();
53        $this->sendResponse();
54    }
55
56    /**
57     * Page のアクション.
58     *
59     * @return void
60     */
61    public 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     * 商品IDを取得する.
81     *
82     * @return string $product_id 商品ID
83     */
84    public function lfGetProductId()
85    {
86        $product_id = '';
87        if (isset($_GET['product_id']) && $_GET['product_id'] != '' && is_numeric($_GET['product_id'])) {
88            $product_id = $_GET['product_id'];
89        }
90
91        return $product_id;
92    }
93
94    /**
95     * カテゴリIDを取得する.
96     *
97     * @return string $category_id カテゴリID
98     */
99    public function lfGetCategoryId()
100    {
101        $category_id = '';
102        if (isset($_GET['category_id']) && $_GET['category_id'] != '' && is_numeric($_GET['category_id'])) {
103            $category_id = $_GET['category_id'];
104        }
105
106        return $category_id;
107    }
108
109    /**
110     * メーカーIDを取得する.
111     *
112     * @return string $maker_id メーカーID
113     */
114    public function lfGetMakerId()
115    {
116        $maker_id = '';
117        if (isset($_GET['maker_id']) && $_GET['maker_id'] != '' && is_numeric($_GET['maker_id'])) {
118            $maker_id = $_GET['maker_id'];
119        }
120
121        return $maker_id;
122    }
123
124    /**
125     * 選択中のカテゴリIDを取得する
126     *
127     * @param string $product_id
128     * @param string $category_id
129     * @return array $arrCategoryId 選択中のカテゴリID
130     */
131    public function lfGetSelectedCategoryId($product_id, $category_id)
132    {
133        // 選択中のカテゴリIDを判定する
134        $objDb = new SC_Helper_DB_Ex();
135        $arrCategoryId = $objDb->sfGetCategoryId($product_id, $category_id);
136
137        return $arrCategoryId;
138    }
139
140    /**
141     * 選択中のメーカーIDを取得する
142     *
143     * @param string $product_id
144     * @param string $maker_id
145     * @return array $arrMakerId 選択中のメーカーID
146     */
147    public function lfGetSelectedMakerId($product_id, $maker_id)
148    {
149        // 選択中のメーカーIDを判定する
150        $objDb = new SC_Helper_DB_Ex();
151        $arrMakerId = $objDb->sfGetMakerId($product_id, $maker_id);
152
153        return $arrMakerId;
154    }
155
156    /**
157     * カテゴリ検索用選択リストを取得する
158     *
159     * @return array $arrCategoryList カテゴリ検索用選択リスト
160     */
161    public function lfGetCategoryList()
162    {
163        $objDb = new SC_Helper_DB_Ex();
164        // カテゴリ検索用選択リスト
165        $arrCategoryList = $objDb->sfGetCategoryList('', true, ' ');
166        if (is_array($arrCategoryList)) {
167            // 文字サイズを制限する
168            foreach ($arrCategoryList as $key => $val) {
169                $truncate_str = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
170                $arrCategoryList[$key] = preg_replace('/ /u', '&nbsp;&nbsp;', $truncate_str);
171            }
172        }
173
174        return $arrCategoryList;
175    }
176
177    /**
178     * メーカー検索用選択リストを取得する
179     *
180     * @return array $arrMakerList メーカー検索用選択リスト
181     */
182    public function lfGetMakerList()
183    {
184        $objDb = new SC_Helper_DB_Ex();
185        // メーカー検索用選択リスト
186        $arrMakerList = $objDb->sfGetMakerList('', true);
187        if (is_array($arrMakerList)) {
188            // 文字サイズを制限する
189            foreach ($arrMakerList as $key => $val) {
190                $arrMakerList[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
191            }
192        }
193
194        return $arrMakerList;
195    }
196}
Note: See TracBrowser for help on using the repository browser.