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

Revision 22796, 5.6 KB checked in by h_yoshimoto, 11 years ago (diff)

#2236 2.12.3リリース以降の2.12-devへのコミット差し戻し

  • 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
24// {{{ requires
25require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Ex.php';
26
27/**
28 * 検索ブロック のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id:LC_Page_FrontParts_Bloc_SearchProducts.php 15532 2007-08-31 14:39:46Z nanasess $
33 */
34class LC_Page_FrontParts_Bloc_SearchProducts extends LC_Page_FrontParts_Bloc_Ex {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46    }
47
48    /**
49     * Page のプロセス.
50     *
51     * @return void
52     */
53    function process() {
54        $this->action();
55        $this->sendResponse();
56    }
57
58    /**
59     * Page のアクション.
60     *
61     * @return void
62     */
63    function action() {
64
65        // 商品ID取得
66        $product_id = $this -> lfGetProductId();
67        // カテゴリID取得
68        $category_id = $this -> lfGetCategoryId();
69        // メーカーID取得
70        $maker_id = $this -> lfGetMakerId();
71        // 選択中のカテゴリIDを判定する
72        $this->category_id = $this->lfGetSelectedCategoryId($product_id, $category_id);
73        // カテゴリ検索用選択リスト
74        $this->arrCatList = $this->lfGetCategoryList();
75        // 選択中のメーカーIDを判定する
76        $this->maker_id = $this->lfGetSelectedMakerId($product_id, $maker_id);
77        // メーカー検索用選択リスト
78        $this->arrMakerList = $this->lfGetMakerList();
79
80
81    }
82
83    /**
84     * デストラクタ.
85     *
86     * @return void
87     */
88    function destroy() {
89        parent::destroy();
90    }
91
92    /**
93     * 商品IDを取得する.
94     *
95     * @return string $product_id 商品ID
96     */
97    function lfGetProductId() {
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        return $product_id;
103    }
104
105    /**
106     * カテゴリIDを取得する.
107     *
108     * @return string $category_id カテゴリID
109     */
110    function lfGetCategoryId() {
111        $category_id = '';
112        if (isset($_GET['category_id']) && $_GET['category_id'] != '' && is_numeric($_GET['category_id'])) {
113            $category_id = $_GET['category_id'];
114        }
115        return $category_id;
116    }
117
118    /**
119     * メーカーIDを取得する.
120     *
121     * @return string $maker_id メーカーID
122     */
123    function lfGetMakerId() {
124        $maker_id = '';
125        if (isset($_GET['maker_id']) && $_GET['maker_id'] != '' && is_numeric($_GET['maker_id'])) {
126            $maker_id = $_GET['maker_id'];
127        }
128        return $maker_id;
129    }
130
131    /**
132     * 選択中のカテゴリIDを取得する
133     *
134     * @return array $arrCategoryId 選択中のカテゴリID
135     */
136    function lfGetSelectedCategoryId($product_id, $category_id) {
137        // 選択中のカテゴリIDを判定する
138        $objDb = new SC_Helper_DB_Ex();
139        $arrCategoryId = $objDb->sfGetCategoryId($product_id, $category_id);
140        return $arrCategoryId;
141    }
142
143    /**
144     * 選択中のメーカーIDを取得する
145     *
146     * @return array $arrMakerId 選択中のメーカーID
147     */
148    function lfGetSelectedMakerId($product_id, $maker_id) {
149        // 選択中のメーカーIDを判定する
150        $objDb = new SC_Helper_DB_Ex();
151        $arrMakerId = $objDb->sfGetMakerId($product_id, $maker_id);
152        return $arrMakerId;
153    }
154
155    /**
156     * カテゴリ検索用選択リストを取得する
157     *
158     * @return array $arrCategoryList カテゴリ検索用選択リスト
159     */
160    function lfGetCategoryList() {
161        $objDb = new SC_Helper_DB_Ex();
162        // カテゴリ検索用選択リスト
163        $arrCategoryList = $objDb->sfGetCategoryList('', true, ' ');
164        if (is_array($arrCategoryList)) {
165            // 文字サイズを制限する
166            foreach ($arrCategoryList as $key => $val) {
167                $truncate_str = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
168                $arrCategoryList[$key] = preg_replace('/ /u', '&nbsp;&nbsp;', $truncate_str);
169            }
170        }
171        return $arrCategoryList;
172    }
173
174    /**
175     * メーカー検索用選択リストを取得する
176     *
177     * @return array $arrMakerList メーカー検索用選択リスト
178     */
179    function lfGetMakerList() {
180        $objDb = new SC_Helper_DB_Ex();
181        // メーカー検索用選択リスト
182        $arrMakerList = $objDb->sfGetMakerList('', true);
183        if (is_array($arrMakerList)) {
184            // 文字サイズを制限する
185            foreach ($arrMakerList as $key => $val) {
186                $arrMakerList[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
187            }
188        }
189        return $arrMakerList;
190    }
191
192}
Note: See TracBrowser for help on using the repository browser.