Source for file LC_Page_Admin_Design_Bloc.php
Documentation is available at LC_Page_Admin_Design_Bloc.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(CLASS_PATH .
"pages/LC_Page.php");
* @author LOCKON CO.,LTD.
$this->tpl_subnavi =
'design/subnavi.tpl';
$this->tpl_subno_edit =
'bloc';
$this->tpl_subno =
"bloc";
$this->tpl_subtitle =
'ブロック編集';
$package_path =
USER_TEMPLATE_PATH .
"/" .
TEMPLATE_NAME .
"/";
if (isset
($_POST['bloc_id'])) {
$bloc_id =
$_POST['bloc_id'];
}else if (isset
($_GET['bloc_id'])) {
$bloc_id =
$_GET['bloc_id'];
$this->bloc_id =
$bloc_id;
// bloc_id が指定されている場合にはブロックデータの取得
$arrBlocData =
$this->lfgetBlocData(" bloc_id = ? " , array($bloc_id));
if (is_file($package_path .
$arrBlocData[0]['tpl_path'])) {
$arrBlocData[0]['tpl_path'] =
$package_path .
$arrBlocData[0]['tpl_path'];
// 存在しない場合は指定テンプレートのブロックを取得
$arrBlocData[0]['tpl_path'] =
TEMPLATE_DIR .
$arrBlocData[0]['tpl_path'];
$this->arrBlocData =
$arrBlocData[0];
if (isset
($_GET['msg']) &&
$_GET['msg'] ==
"on") {
if (!isset
($_POST['mode'])) $_POST['mode'] =
"";
$prev_path =
USER_INC_PATH .
'preview/bloc_preview.tpl';
$fp =
fopen($prev_path,"w");
fwrite($fp, $_POST['bloc_html']); // FIXME いきなり POST はちょっと...
$this->arrBlocData['tpl_data'] =
$_POST['bloc_html'];
$this->arrBlocData['tpl_path'] =
$prev_path;
$this->arrBlocData['bloc_name'] =
$_POST['bloc_name'];
$this->arrBlocData['filename'] =
$_POST['filename'];
$this->text_row =
$_POST['html_area_row'];
if (count($this->arrErr) ==
0) {
$old_bloc_path =
$package_path .
$arrBlocData[0]['tpl_path'];
$new_bloc_path =
$package_path .
BLOC_DIR .
$_POST['filename'] .
".tpl";
$fp =
fopen($new_bloc_path,"w");
fwrite($fp, $_POST['bloc_html']); // FIXME いきなり POST はちょっと...
$arrBlocData =
$this->lfgetBlocData(" filename = ? " , array($_POST['filename']));
$bloc_id =
$arrBlocData[0]['bloc_id'];
array("bloc_id" =>
$bloc_id,
$this->arrBlocData =
$_POST;
$sql =
""; // データ更新SQL生成用
$arrDelData =
array(); // 更新データ生成用
$arrUpdData =
array($arrData['bloc_name'], BLOC_DIR .
$arrData['filename'] .
'.tpl', $arrData['filename']);
// bloc_id が空でない場合にはdeleteを実行
if ($_POST['bloc_id'] !==
'') {
$sql =
" DELETE FROM dtb_bloc WHERE bloc_id = ?";
$ret =
$objDBConn->query($sql,array($_POST['bloc_id']));
$sql =
"DELETE FROM dtb_blocposition WHERE bloc_id = ?";
$ret =
$objDBConn->query($sql,array($_POST['bloc_id']));
$del_file =
$package_path .
BLOC_DIR .
$arrBlocData[0]['filename'].
'.tpl';
if(isset
($_POST['mode'])) {
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
* @param string $where Where句文
* @param array $arrVal Where句の絞込条件値
$sql =
""; // データ取得SQL生成用
$arrRet =
array(); // データ取得用
$sql .=
" WHERE " .
$where;
$sql .=
" ORDER BY bloc_id";
$arrRet =
$objDBConn->getAll($sql, $arrVal);
* @param array $arrData 更新データ
$sql =
""; // データ更新SQL生成用
$arrUpdData =
array(); // 更新データ生成用
$arrChk =
array(); // 排他チェック用
$arrUpdData =
array($arrData['bloc_name'], BLOC_DIR .
$arrData['filename'] .
'.tpl', $arrData['filename']);
if($arrData['bloc_id'] !==
''){
$arrChk =
$this->lfgetBlocData("bloc_id = ?", array($arrData['bloc_id']));
// bloc_id が空 若しくは データが存在していない場合にはINSERTを行う
if ($arrData['bloc_id'] ===
'' or !isset
($arrChk[0])) {
$sql =
" INSERT INTO dtb_bloc";
$sql .=
" bloc_name "; // ブロック名称
$sql .=
" ,tpl_path "; // テンプレート保存先
$sql .=
" ,filename "; // ファイル名称
$sql .=
" ,create_date "; // 作成日
$sql .=
" ,update_date "; // 更新日
$sql .=
" ) VALUES ( ?,?,?,now(),now() )";
// データが存在してる場合にはアップデートを行う
$sql =
" UPDATE dtb_bloc";
$sql .=
" bloc_name = ? "; // ブロック名称
$sql .=
" ,tpl_path = ? "; // テンプレート保存先
$sql .=
" ,filename = ? "; // テンプレートファイル名
$sql .=
" ,update_date = now()";
$sql .=
" WHERE bloc_id = ?";
$ret =
$objDBConn->query($sql,$arrUpdData);
* @param array $arrData 入力データ
$objErr->doFunc(array("ブロック名", "bloc_name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
$objErr->doFunc(array("ファイル名", "filename", STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK","FILE_NAME_CHECK"));
// 同一のファイル名が存在している場合にはエラー
if(!isset
($objErr->arrErr['filename']) and $array['filename'] !==
''){
$arrChk =
$this->lfgetBlocData("filename = ?", array($array['filename']));
if (count($arrChk[0]) >=
1 and $arrChk[0]['bloc_id'] !=
$array['bloc_id']) {
$objErr->arrErr['filename'] =
'※ 同じファイル名のデータが存在しています。別の名称を付けてください。';
Documentation generated on Tue, 28 Apr 2009 18:11:05 +0900 by phpDocumentor 1.4.2