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

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