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

Revision 23461, 4.7 KB checked in by pineray, 10 years ago (diff)

#2560 pageクラスからdtb_reviewテーブルを直接指定している箇所をなくす

  • 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        $objReview = new SC_Helper_Review_Ex();
75        // パラメーター情報の初期化
76        $objFormParam = new SC_FormParam_Ex();
77        $this->lfInitParam($objFormParam);
78        $objFormParam->setParam($_POST);
79        $objFormParam->convParam();
80        // 検索ワードの引き継ぎ
81        $this->arrSearchHidden = $objFormParam->getSearchArray();
82        $this->arrForm = $objFormParam->getHashArray();
83
84        switch ($this->getMode()) {
85            // 登録
86            case 'complete':
87                $this->arrErr = $objFormParam->checkError();
88                // エラー無し
89                if (SC_Utils_Ex::isBlank($this->arrErr)) {
90                    // レビュー情報の更新
91                    $arrValues = $objFormParam->getDbArray();
92                    $objReview->save($arrValues);
93                    // レビュー情報のDB取得
94                    $this->arrForm = $objReview->get($this->arrForm['review_id']);
95                    $this->tpl_onload = "alert('登録が完了しました。');";
96                }
97                break;
98            default:
99                // レビュー情報のDB取得
100                $this->arrForm = $objReview->get($this->arrForm['review_id']);
101                break;
102        }
103
104    }
105
106    /**
107     * パラメーター情報の初期化を行う.
108     *
109     * @param  SC_FormParam $objFormParam SC_FormParam インスタンス
110     * @return void
111     */
112    public function lfInitParam(&$objFormParam)
113    {
114        // 検索条件のパラメーターを初期化
115        parent::lfInitParam($objFormParam);
116        $objFormParam->addParam('レビューID', 'review_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
117        $objFormParam->addParam('商品名', 'name', '', '', array(), '', false);
118        $objFormParam->addParam('投稿日', 'create_date', '', '', array(), '', false);
119
120        // 登録情報
121        $objFormParam->addParam('レビュー表示', 'status', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
122        $objFormParam->addParam('投稿者名', 'reviewer_name', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
123        $objFormParam->addParam('投稿者URL', 'reviewer_url', URL_LEN, 'KVCa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
124        $objFormParam->addParam('性別', 'sex', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
125        $objFormParam->addParam('おすすめレベル', 'recommend_level', INT_LEN, 'n', array('SELECT_CHECK'));
126        $objFormParam->addParam('タイトル', 'title', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
127        $objFormParam->addParam('コメント', 'comment', LTEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
128    }
129}
Note: See TracBrowser for help on using the repository browser.