source: branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Seo.php @ 18820

Revision 18820, 6.8 KB checked in by nanasess, 14 years ago (diff)

#781(規格のデータベースを木構造に)

  • 規格の無い商品が品切れになってしまう不具合修正
  • 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-2010 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 * SEO管理 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Admin_Basis_Seo extends LC_Page {
35
36    // {{{ properties
37
38    /** エラー情報 */
39    var $arrErr;
40
41    // }}}
42    // {{{ functions
43
44    /**
45     * Page を初期化する.
46     *
47     * @return void
48     */
49    function init() {
50        parent::init();
51        $this->tpl_mainpage = 'basis/seo.tpl';
52        $this->tpl_subnavi = 'basis/subnavi.tpl';
53        $this->tpl_subno = 'seo';
54        $this->tpl_mainno = 'basis';
55        $this->tpl_subtitle = 'SEO管理';
56        $masterData = new SC_DB_MasterData_Ex();
57        $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
58        $this->arrTAXRULE = $masterData->getMasterData("mtb_taxrule");
59    }
60
61    /**
62     * Page のプロセス.
63     *
64     * @return void
65     */
66    function process() {
67        $objView = new SC_AdminView();
68        $objSess = new SC_Session();
69        $objQuery = new SC_Query();
70
71        // 認証可否の判定
72        SC_Utils_Ex::sfIsSuccess($objSess);
73
74        // データの取得
75        $objLayout = new SC_Helper_PageLayout_Ex();
76        $this->arrPageData = $objLayout->lfgetPageData(" edit_flg = 2 ");
77
78        if (isset($_POST['page_id'])) {
79            $page_id = $_POST['page_id'];
80        } else {
81            $page_id = "";
82        }
83
84        if (!isset($_POST['mode'])) $_POST['mode'] = "";
85
86        if($_POST['mode'] == "confirm") {
87            // エラーチェック
88            $this->arrErr[$page_id] = $this->lfErrorCheck($_POST['meta'][$page_id]);
89
90            // エラーがなければデータを更新
91            if(count($this->arrErr[$page_id]) == 0) {
92
93                // 更新データの変換
94                $arrMETA = $this->lfConvertParam($_POST['meta'][$page_id]);
95
96                // 更新データ配列生成
97                $arrUpdData = array($arrMETA['author'], $arrMETA['description'], $arrMETA['keyword'], $page_id);
98                // データ更新
99                $this->lfUpdPageData($arrUpdData);
100            }else{
101                // POSTのデータを再表示
102                $arrPageData = $this->lfSetData($arrPageData, $_POST['meta']);
103                $this->arrPageData = $arrPageData;
104            }
105        }
106
107        $arrDisp_flg = array();
108        // エラーがなければデータの取得
109        if(count($this->arrErr[$page_id]) == 0) {
110            // データの取得
111            $arrPageData = $objLayout->lfgetPageData(" edit_flg = 2 ");
112            $this->arrPageData = $arrPageData;
113        }
114
115        // 表示・非表示切り替え
116        foreach($arrPageData as $key => $val){
117            $arrDisp_flg[$val['page_id']] = $_POST['disp_flg'.$val['page_id']];
118        }
119
120        $this->disp_flg = $arrDisp_flg;
121
122        $objView->assignobj($this);
123        $objView->display(MAIN_FRAME);
124    }
125
126    /**
127     * デストラクタ.
128     *
129     * @return void
130     */
131    function destroy() {
132        parent::destroy();
133    }
134
135    /**
136     * ページレイアウトテーブルにデータ更新を行う.
137     *
138     * @param array $arrUpdData 更新データ
139     * @return integer 更新結果
140     */
141    function lfUpdPageData($arrUpdData = array()){
142        $objQuery = new SC_Query();
143        $sql = "";
144
145        // SQL生成
146        $sql .= " UPDATE ";
147        $sql .= "     dtb_pagelayout ";
148        $sql .= " SET ";
149        $sql .= "     author = ? , ";
150        $sql .= "     description = ? , ";
151        $sql .= "     keyword = ? ";
152        $sql .= " WHERE ";
153        $sql .= "     page_id = ? ";
154        $sql .= " ";
155
156        // SQL実行
157        $ret = $objQuery->query($sql, $arrUpdData);
158
159        return $ret;
160    }
161
162    /**
163     * 入力項目のエラーチェックを行う.
164     *
165     * @param array $array エラーチェック対象データ
166     * @return array エラー内容
167     */
168    function lfErrorCheck($array) {
169        $objErr = new SC_CheckError($array);
170
171        $objErr->doFunc(array("メタタグ:Author", "author", STEXT_LEN), array("MAX_LENGTH_CHECK"));
172        $objErr->doFunc(array("メタタグ:Description", "description", STEXT_LEN), array("MAX_LENGTH_CHECK"));
173        $objErr->doFunc(array("メタタグ:Keywords", "keyword", STEXT_LEN), array("MAX_LENGTH_CHECK"));
174
175        return $objErr->arrErr;
176    }
177
178    /**
179     * テンプレート表示データに値をセットする.
180     *
181     * @param array 表示元データ
182     * @param array 表示データ
183     * @return array 表示データ
184     */
185    function lfSetData($arrPageData, $arrDispData){
186
187        foreach($arrPageData as $key => $val){
188            $page_id = $val['page_id'];
189            $arrPageData[$key]['author'] = $arrDispData[$page_id]['author'];
190            $arrPageData[$key]['description'] = $arrDispData[$page_id]['description'];
191            $arrPageData[$key]['keyword'] = $arrDispData[$page_id]['keyword'];
192        }
193
194        return $arrPageData;
195    }
196
197    /* 取得文字列の変換 */
198    function lfConvertParam($array) {
199        /*
200         *  文字列の変換
201         *  K :  「半角(ハンカク)片仮名」を「全角片仮名」に変換
202         *  C :  「全角ひら仮名」を「全角かた仮名」に変換
203         *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
204         *  n :  「全角」数字を「半角(ハンカク)」に変換
205         *  a :  全角英数字を半角英数字に変換する
206         */
207        // 人物基本情報
208
209        // スポット商品
210        $arrConvList['author'] = "KVa";
211        $arrConvList['description'] = "KVa";
212        $arrConvList['keyword'] = "KVa";
213
214        // 文字変換
215        foreach ($arrConvList as $key => $val) {
216            // POSTされてきた値のみ変換する。
217            if(isset($array[$key])) {
218                $array[$key] = mb_convert_kana($array[$key] ,$val);
219            }
220        }
221        return $array;
222    }
223}
224?>
Note: See TracBrowser for help on using the repository browser.