source: branches/comu-ver2/data/class/pages/admin/basis/LC_Page_Admin_Basis_Seo.php @ 18701

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

Copyright の更新(#601)

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