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

Revision 21693, 6.1 KB checked in by h_yoshimoto, 12 years ago (diff)

#1692 フックポイント名を変更

  • 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-2011 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_REALDIR . 'pages/frontparts/bloc/LC_Page_FrontParts_Bloc.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 {
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        $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
66        $objPlugin->doAction('LC_Page_FrontParts_Bloc_SearchProducts_action_before', array($this));
67
68        // 商品ID取得
69        $product_id = $this -> lfGetProductId();
70        // カテゴリID取得
71        $category_id = $this -> lfGetCategoryId();
72        // メーカーID取得
73        $maker_id = $this -> lfGetMakerId();
74        // 選択中のカテゴリIDを判定する
75        $this->category_id = $this->lfGetSelectedCategoryId($product_id, $category_id);
76        // カテゴリ検索用選択リスト
77        $this->arrCatList = $this->lfGetCategoryList();
78        // 選択中のメーカーIDを判定する
79        $this->maker_id = $this->lfGetSelectedMakerId($product_id, $maker_id);
80        // メーカー検索用選択リスト
81        $this->arrMakerList = $this->lfGetMakerList();
82
83        // フックポイント.
84        $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
85        $objPlugin->doAction('LC_Page_FrontParts_Bloc_SearchProducts_action_after', array($this));
86    }
87
88    /**
89     * デストラクタ.
90     *
91     * @return void
92     */
93    function destroy() {
94        parent::destroy();
95    }
96
97    /**
98     * 商品IDを取得する.
99     *
100     * @return string $product_id 商品ID
101     */
102    function lfGetProductId() {
103        $product_id = '';
104        if (isset($_GET['product_id']) && $_GET['product_id'] != '' && is_numeric($_GET['product_id'])) {
105            $product_id = $_GET['product_id'];
106        }
107        return $product_id;
108    }
109
110    /**
111     * カテゴリIDを取得する.
112     *
113     * @return string $category_id カテゴリID
114     */
115    function lfGetCategoryId() {
116        $category_id = '';
117        if (isset($_GET['category_id']) && $_GET['category_id'] != '' && is_numeric($_GET['category_id'])) {
118            $category_id = $_GET['category_id'];
119        }
120        return $category_id;
121    }
122
123    /**
124     * メーカーIDを取得する.
125     *
126     * @return string $maker_id メーカーID
127     */
128    function lfGetMakerId() {
129        $maker_id = '';
130        if (isset($_GET['maker_id']) && $_GET['maker_id'] != '' && is_numeric($_GET['maker_id'])) {
131            $maker_id = $_GET['maker_id'];
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        // 選択中のカテゴリIDを判定する
143        $objDb = new SC_Helper_DB_Ex();
144        $arrCategoryId = $objDb->sfGetCategoryId($product_id, $category_id);
145        return $arrCategoryId;
146    }
147
148    /**
149     * 選択中のメーカーIDを取得する
150     *
151     * @return array $arrMakerId 選択中のメーカーID
152     */
153    function lfGetSelectedMakerId($product_id, $maker_id) {
154        // 選択中のメーカーIDを判定する
155        $objDb = new SC_Helper_DB_Ex();
156        $arrMakerId = $objDb->sfGetMakerId($product_id, $maker_id);
157        return $arrMakerId;
158    }
159
160    /**
161     * カテゴリ検索用選択リストを取得する
162     *
163     * @return array $arrCategoryList カテゴリ検索用選択リスト
164     */
165    function lfGetCategoryList() {
166        $objDb = new SC_Helper_DB_Ex();
167        // カテゴリ検索用選択リスト
168        $arrCategoryList = $objDb->sfGetCategoryList('', true, ' ');
169        if (is_array($arrCategoryList)) {
170            // 文字サイズを制限する
171            foreach ($arrCategoryList as $key => $val) {
172                $truncate_str = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
173                $arrCategoryList[$key] = preg_replace('/ /u', '&nbsp;&nbsp;', $truncate_str);
174            }
175        }
176        return $arrCategoryList;
177    }
178
179    /**
180     * メーカー検索用選択リストを取得する
181     *
182     * @return array $arrMakerList メーカー検索用選択リスト
183     */
184    function lfGetMakerList() {
185        $objDb = new SC_Helper_DB_Ex();
186        // メーカー検索用選択リスト
187        $arrMakerList = $objDb->sfGetMakerList('', true);
188        if (is_array($arrMakerList)) {
189            // 文字サイズを制限する
190            foreach ($arrMakerList as $key => $val) {
191                $arrMakerList[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
192            }
193        }
194        return $arrMakerList;
195    }
196
197}
Note: See TracBrowser for help on using the repository browser.