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

Revision 23124, 6.0 KB checked in by kimoto, 11 years ago (diff)

#2043 typo修正・ソース整形・ソースコメントの改善 for 2.13.0
PHP4的な書き方の修正

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