source: branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_ReviewEdit.php @ 22567

Revision 22567, 6.1 KB checked in by shutta, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.12.4)
Zend Framework PHP 標準コーディング規約のコーディングスタイルへ準拠。
classおよびfunctionの開始波括弧「{」のスタイルを修正。

  • 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_REALDIR . 'pages/admin/products/LC_Page_Admin_Products_Review.php';
26
27/**
28 * レビュー編集 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Admin_Products_ReviewEdit extends LC_Page_Admin_Products_Review
35{
36
37    // }}}
38    // {{{ functions
39
40    /**
41     * Page を初期化する.
42     *
43     * @return void
44     */
45    function init()
46    {
47        parent::init();
48        $this->tpl_mainpage = 'products/review_edit.tpl';
49        $this->tpl_mainno = 'products';
50        $this->tpl_subno = 'review';
51        // 両方選択可能
52        $this->tpl_status_change = true;
53
54        $masterData = new SC_DB_MasterData_Ex();
55        $this->arrRECOMMEND = $masterData->getMasterData('mtb_recommend');
56        $this->tpl_maintitle = '商品管理';
57        $this->tpl_subtitle = 'レビュー管理';
58        $this->arrSex = $masterData->getMasterData('mtb_sex');
59    }
60
61    /**
62     * Page のプロセス.
63     *
64     * @return void
65     */
66    function process()
67    {
68        $this->action();
69        $this->sendResponse();
70    }
71
72    /**
73     * Page のアクション.
74     *
75     * @return void
76     */
77    function action()
78    {
79
80        // パラメーター情報の初期化
81        $objFormParam = new SC_FormParam_Ex();
82        $this->lfInitParam($objFormParam);
83        $objFormParam->setParam($_POST);
84        $objFormParam->convParam();
85        // 検索ワードの引き継ぎ
86        $this->arrSearchHidden = $objFormParam->getSearchArray();
87        $this->arrForm = $objFormParam->getHashArray();
88
89        switch ($this->getMode()) {
90            // 登録
91            case 'complete':
92                $this->arrErr = $objFormParam->checkError();
93                // エラー無し
94                if (SC_Utils_Ex::isBlank($this->arrErr)) {
95                    // レビュー情報の更新
96                    $this->lfRegistReviewData($this->arrForm['review_id'], $objFormParam);
97                    // レビュー情報のDB取得
98                    $this->arrForm = $this->lfGetReviewData($this->arrForm['review_id']);
99                    $this->tpl_onload = "alert('登録が完了しました。');";
100                }
101                break;
102            default:
103                // レビュー情報のDB取得
104                $this->arrForm = $this->lfGetReviewData($this->arrForm['review_id']);
105                break;
106        }
107
108    }
109
110    /**
111     * デストラクタ.
112     *
113     * @return void
114     */
115    function destroy()
116    {
117        parent::destroy();
118    }
119
120    /**
121     * パラメーター情報の初期化を行う.
122     *
123     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
124     * @return void
125     */
126    function lfInitParam(&$objFormParam)
127    {
128        // 検索条件のパラメーターを初期化
129        parent::lfInitParam($objFormParam);
130        $objFormParam->addParam('レビューID', 'review_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
131        $objFormParam->addParam('商品名', 'name', '', '', array(), '', false);
132        $objFormParam->addParam('投稿日', 'create_date', '', '', array(), '', false);
133
134        // 登録情報
135        $objFormParam->addParam('レビュー表示', 'status', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
136        $objFormParam->addParam('投稿者名', 'reviewer_name', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
137        $objFormParam->addParam('投稿者URL', 'reviewer_url', URL_LEN, 'KVCa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
138        $objFormParam->addParam('性別', 'sex', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
139        $objFormParam->addParam('おすすめレベル', 'recommend_level', INT_LEN, 'n', array('SELECT_CHECK'));
140        $objFormParam->addParam('タイトル', 'title', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
141        $objFormParam->addParam('コメント', 'comment', LTEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
142    }
143
144    /**
145     * レビュー情報のDB取得
146     *
147     * @param integer $review_id レビューID
148     * @return array レビュー情報
149     */
150    function lfGetReviewData($review_id)
151    {
152        $objQuery =& SC_Query_Ex::getSingletonInstance();
153        $select='review_id, A.product_id, reviewer_name, sex, recommend_level, ';
154        $select.='reviewer_url, title, comment, A.status, A.create_date, A.update_date, name';
155        $from = 'dtb_review AS A LEFT JOIN dtb_products AS B ON A.product_id = B.product_id ';
156        $where = 'A.del_flg = 0 AND B.del_flg = 0 AND review_id = ? ';
157        $arrReview = $objQuery->select($select, $from, $where, array($review_id));
158        if (empty($arrReview)) {
159            SC_Utils_Ex::sfDispError('');
160        }
161        return $arrReview[0];
162    }
163
164    /**
165     * レビュー情報の更新
166     *
167     * @param integer $review_id レビューID
168     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
169     * @return void
170     */
171    function lfRegistReviewData($review_id, &$objFormParam)
172    {
173        $objQuery =& SC_Query_Ex::getSingletonInstance();
174        $arrValues = $objFormParam->getDbArray();
175        $arrValues['update_date'] = 'CURRENT_TIMESTAMP';
176        $objQuery->update('dtb_review', $arrValues, 'review_id = ?', array($review_id));
177    }
178}
Note: See TracBrowser for help on using the repository browser.