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

Revision 22206, 6.1 KB checked in by kim, 11 years ago (diff)

#2003 copyrightを2013に更新

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