source: branches/comu-ver2/data/class/pages/admin/contents/LC_Page_Admin_Contents_CampaignCreateTag.php @ 18234

Revision 18234, 6.5 KB checked in by Seasoft, 15 years ago (diff)

#528(改行コードが混在している)

  • SVN属性の変更。ただし、以下は除外。
    • /data/module
    • /data/pdf
    • /html/test
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • 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-2007 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_PATH . "pages/LC_Page.php");
26
27/**
28 * キャンペーンタグ生成 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Admin_Contents_CampaignCreateTag extends LC_Page {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_mainpage = 'contents/campaign_create_tag.tpl';
47        $this->tpl_mainno = 'create';
48        $this->tpl_subtitle = '商品設定';
49    }
50
51    /**
52     * Page のプロセス.
53     *
54     * @return void
55     */
56    function process() {
57        $objView = new SC_AdminView();
58        $objSess = new SC_Session();
59        $objQuery = new SC_Query();
60        $objDb = new SC_Helper_DB_Ex();
61
62        // 認証可否の判定
63        SC_Utils_Ex::sfIsSuccess($objSess);
64
65        switch($_POST['mode']) {
66
67            // 商品検索
68        case  'search':
69            // POST値の引き継ぎ
70            $this->arrForm = $_POST;
71            // 入力文字の強制変換
72            $this->lfConvertParam();
73
74            $where = "del_flg = 0";
75
76            // where句生成
77            foreach ($this->arrForm as $key => $val) {
78                if($val == "") {
79                    continue;
80                }
81
82                switch ($key) {
83                case 'search_name':
84                    $where .= " AND name ILIKE ?";
85                    $arrval[] = "%$val%";
86                    break;
87                case 'search_category_id':
88                        list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val);
89                        if($tmp_where != "") {
90                            $where.= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")";
91                            $arrval = array_merge((array)$arrval, (array)$tmp_arrval);
92                    }
93                    break;
94                case 'search_product_id':
95                    $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)";
96                    $arrval[] = "$val%";
97                    break;
98                default:
99                    break;
100                }
101            }
102
103            $order = "update_date DESC, product_id DESC ";
104
105            // 読み込む列とテーブルの指定
106            $col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
107            $from = "vw_products_nonclass AS noncls ";
108
109            // 行数の取得
110            $linemax = $objQuery->count("dtb_products", $where, $arrval);
111            $this->tpl_linemax = $linemax;              // 何件が該当しました。表示用
112
113            // ページ送りの処理
114            if(is_numeric($_POST['search_page_max'])) {
115                $page_max = $_POST['search_page_max'];
116            } else {
117                $page_max = SEARCH_PMAX;
118            }
119
120            // ページ送りの取得
121            $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
122            $this->tpl_strnavi = $objNavi->strnavi;     // 表示文字列
123            $startno = $objNavi->start_row;
124
125            // 取得範囲の指定(開始行番号、行数のセット)
126            if(DB_TYPE != "mysql") $objQuery->setlimitoffset($page_max, $startno);
127            // 表示順序
128            $objQuery->setorder($order);
129
130            // 検索結果の取得
131            $this->arrProducts = $objQuery->select($col, $from, $where, $arrval);
132            break;
133
134            // タグ表示
135        case 'view':
136
137            // タグを生成
138            $create_tag = $this->lfGetCreateTag($_POST['product_id']);
139            $this->tpl_create_tag = $create_tag;
140            break;
141        }
142
143        // カテゴリ取得
144        $this->arrCatList = $objDb->sfGetCategoryList();
145
146        //---- ページ表示
147        $objView->assignobj($this);
148        $objView->display($this->tpl_mainpage);
149    }
150
151    /**
152     * デストラクタ.
153     *
154     * @return void
155     */
156    function destroy() {
157        parent::destroy();
158    }
159
160
161    /**
162     * 取得する文字数の変換を行うメソッド
163     *
164     * @return void
165     */
166    function lfConvertParam() {
167        /*
168         *  文字列の変換
169         *  K :  「半角(ハンカク)片仮名」を「全角片仮名」に変換
170         *  C :  「全角ひら仮名」を「全角かた仮名」に変換
171         *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
172         *  n :  「全角」数字を「半角(ハンカク)」に変換
173         */
174        $arrConvList['search_name'] = "KVa";
175        $arrConvList['search_product_code'] = "KVa";
176
177        // 文字変換
178        foreach ($arrConvList as $key => $val) {
179            // POSTされてきた値のみ変換する。
180            if(isset($this->arrForm[$key])) {
181                $this->arrForm[$key] = mb_convert_kana($this->arrForm[$key] ,$val);
182            }
183        }
184    }
185
186    /**
187     * キャンペーンページのための商品用タグを生成するメソッド
188     *
189     * @param string $product_id 商品ID
190     * @return void
191     */
192   
193    function lfGetCreateTag($product_id) {
194        // 書き込みタグ
195        $read_file = file_get_contents(CAMPAIGN_BLOC_PATH . "cart_tag.tpl");
196        $read_file = ereg_replace("<{assign_product_id}>", $product_id, $read_file);
197        // カートタグ保存用ファイル作成
198        $create_tag .= "<!--{* ▼商品ID$product_id *}-->\n";
199        $create_tag .= $read_file;
200
201        return $create_tag;
202    }
203
204}
205?>
Note: See TracBrowser for help on using the repository browser.