Source for file LC_Page_Admin_Design.php
Documentation is available at LC_Page_Admin_Design.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2010 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 = "layout";
$this->tpl_subtitle = 'レイアウト設定';
$objLayout = new SC_Helper_PageLayout_Ex();
SC_Utils_Ex::sfIsSuccess($objSess);
if (isset ($_GET['page_id'])) {
$page_id = $_GET['page_id'];
}else if (isset ($_POST['page_id'])){
$page_id = $_POST['page_id'];
$this->arrEditPage = $objLayout->lfgetPageData();
$sel = ", pos.target_id, pos.bloc_id, pos.bloc_row ";
$from = ", dtb_blocposition AS pos";
$where .= " lay.page_id = ? AND ";
$where .= "lay.page_id = pos.page_id AND exists (select bloc_id from dtb_bloc as blc where pos.bloc_id = blc.bloc_id) ORDER BY lay.page_id,pos.target_id, pos.bloc_row, pos.bloc_id ";
$arrData = array($page_id);
$arrPageData = $objLayout->lfgetPageData("page_id = ?", array($page_id));
if (count($arrPageData) <= 0) {
$this->exists_page = $exists_page;
if (isset ($_GET['msg']) && $_GET['msg'] == "on") {
$this->complate_msg= "alert('登録が完了しました。');";
if (!isset ($_POST['mode'])) $_POST['mode'] = "";
if ($_POST['mode'] == 'new_bloc') {
if ($_POST['mode'] == 'new_page') {
if ($_POST['mode'] == 'confirm' or $_POST['mode'] == 'preview') {
$page_id = $_POST['page_id'];
if ($_POST['mode'] == 'preview') {
$masterData = new SC_DB_MasterData_Ex();
$arrTarget = $masterData->getMasterData("mtb_target");
$arrUpdBlocData = array();
$arrUpdData[$upd_cnt]['page_id'] = $page_id;
for($upd_cnt = 1; $upd_cnt <= $_POST['bloc_cnt']; $upd_cnt++ ){
if (!isset ($_POST['id_'. $upd_cnt])) {
$arrUpdBlocData[$upd_cnt]['name'] = $_POST['name_'. $upd_cnt]; // ブロック名称
$arrUpdBlocData[$upd_cnt]['id'] = $_POST['id_'. $upd_cnt]; // ブロックID
$arrUpdBlocData[$upd_cnt]['target_id'] = $arrTargetFlip[$_POST['target_id_'. $upd_cnt]]; // ターゲットID
$arrUpdBlocData[$upd_cnt]['top'] = $_POST['top_'. $upd_cnt]; // TOP座標
$arrUpdBlocData[$upd_cnt]['update_url'] = $_SERVER['HTTP_REFERER']; // 更新URL
$arrRet = array(); // データ取得用
$del_sql .= "DELETE FROM dtb_blocposition WHERE page_id = ? ";
$arrRet = $objDBConn->query($del_sql,array($page_id));
foreach($arrUpdBlocData as $key => $val){
$bloc_row = $this->lfGetRowID($arrUpdBlocData, $val);
$arrUpdBlocData[$key]['bloc_row'] = $bloc_row;
$arrUpdBlocData[$key]['page_id'] = $page_id; // ページID
ターゲットID 1:レフトナビ 2:ライトナビ 3:イン画面上部 4:メイン画面下部 5:欄外
if ($arrUpdBlocData[$key]['target_id'] == 5) {
$arrUpdBlocData[$key]['bloc_row'] = "0";
$ins_sql .= "INSERT INTO dtb_blocposition ";
$ins_sql .= " values ( ";
$ins_sql .= " ? "; // ページID
$ins_sql .= " ,? "; // ターゲットID
$ins_sql .= " ,? "; // ブロックID
$ins_sql .= " ,? "; // ブロックの並び順序
$ins_sql .= " ,(SELECT filename FROM dtb_bloc WHERE bloc_id = ?) "; // ファイル名称
$arrInsData = array($page_id,
$arrUpdBlocData[$key]['target_id'],
$arrUpdBlocData[$key]['id'],
$arrUpdBlocData[$key]['bloc_row'],
$arrUpdBlocData[$key]['id']
$arrRet = $objDBConn->query($ins_sql,$arrInsData);
if ($_POST['mode'] == 'preview') {
$_SESSION['preview'] = "ON";
$this->sendRedirect($this->getLocation(URL_DIR . "preview/index.php", array("filename" => $arrPageData[0]["filename"])));
array("page_id" => $page_id,
// データ削除処理 ベースデータでなければファイルを削除
if ($_POST['mode'] == 'delete' and !$objLayout->lfCheckBaseData($page_id)) {
$objLayout->lfDelPageData($page_id);
foreach($arrBlocPos as $key => $val){
if ($val['page_id'] == $page_id) {
$tpl_arrBloc = $this->lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt);
foreach($arrBloc as $key => $val){
$val['target_id'] = 5; // 未使用に追加する
$tpl_arrBloc = $this->lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt);
$this->tpl_arrBloc = $tpl_arrBloc;
$this->bloc_cnt = count($tpl_arrBloc);
$this->page_id = $page_id;
$arrPageData = $objLayout->lfgetPageData(' page_id = ?', array($page_id));
$this->arrPageData = $arrPageData[0];
$arrGlobalErr = explode("\n",$GLOBAL_ERR);
$errCnt = count($arrGlobalErr) - 8;
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
* @param string $sel Select句文
* @param string $where Where句文
* @param array $arrVa Where句の絞込条件値
* @return array ページレイアウト情報の配列
function lfgetLayoutData($sel = '' , $from = '', $where = '', $arrVal = ''){
$sql = ""; // データ取得SQL生成用
$arrRet = array(); // データ取得用
$sql .= " ,lay.page_name ";
$sql .= " ,lay.description ";
$sql .= " ,lay.keyword ";
$sql .= " ,lay.update_url ";
$sql .= " ,lay.create_date ";
$sql .= " ,lay.update_date ";
$sql .= " from dtb_pagelayout AS lay ";
$sql .= " ORDER BY lay.page_id ";
$arrRet = $objDBConn->getAll($sql, $arrVal);
* @param string $where Where句文
* @param array $arrVal Where句の絞込条件値
* @return array ブロック情報の配列
$sql = ""; // データ取得SQL生成用
$arrRet = array(); // データ取得用
$sql .= " WHERE " . $where;
$sql .= " ORDER BY bloc_id";
$arrRet = $objDBConn->getAll($sql, $arrVal);
* @param array $arrBloc Bloc情報
* @param array $tpl_arrBloc データをセットする配列
* @param integer $cnt 配列番号
* @return array データをセットした配列
$masterData = new SC_DB_MasterData_Ex();
$arrTarget = $masterData->getMasterData("mtb_target");
$tpl_arrBloc[$cnt]['target_id'] = $arrTarget[$val['target_id']];
$tpl_arrBloc[$cnt]['bloc_id'] = $val['bloc_id'];
$tpl_arrBloc[$cnt]['bloc_row'] =
isset ($val['bloc_row']) ? $val['bloc_row'] : "";
foreach($arrBloc as $bloc_key => $bloc_val){
if ($bloc_val['bloc_id'] == $val['bloc_id']) {
$bloc_name = $bloc_val['bloc_name'];
$tpl_arrBloc[$cnt]['name'] = $bloc_name;
* ブロックIDが配列に追加されているかのチェックを行う.
* @param array $arrBloc Bloc情報
* @param array $arrChkData チェックを行うデータ配列
* @return bool 存在する場合 true
foreach($arrChkData as $key => $val){
if ($val['bloc_id'] === $arrBloc['bloc_id'] ) {
* ブロックIDが何番目に配置されているかを調べる.
* @param array $arrUpdData 更新情報
* @param array $arrObj チェックを行うデータ配列
$no = 0; // カウント用(同じデータが必ず1件あるので、初期値は0)
// 対象データが何番目に配置されているのかを取得する。
foreach ($arrUpdData as $key => $val) {
if ($val['target_id'] === $arrObj['target_id'] and $val['top'] <= $arrObj['top']){
* @param array $arrPageData ページ情報の配列
$sql = ""; // データ更新SQL生成用
$arrUpdData = array(); // 更新データ生成用
$filename = $arrPageData[0]['filename'];
$arrPreData = $objLayout->lfgetPageData(" page_id = ? " , array("0"));
$del_tpl = USER_PATH . "templates/" . $filename . '.tpl';
$tplfile = TEMPLATE_DIR . $filename;
// filename が空の場合にはMYページと判断
$tplfile = TEMPLATE_DIR . "mypage/index";
$copyTo = USER_PATH . "templates/preview/" . TEMPLATE_NAME . "/" . $filename . ".tpl";
copy($tplfile . ".tpl", $copyTo);
$sql = "select page_name, header_chk, footer_chk from dtb_pagelayout where page_id = ?";
$ret = $objDBConn->getAll($sql, array($arrPageData[0]['page_id']));
$sql = " update dtb_pagelayout set ";
$sql .= " page_name = ?";
$sql .= " ,header_chk = ?";
$sql .= " ,footer_chk = ?";
$sql .= " ,filename = ?";
$sql .= " where page_id = 0";
$arrUpdData = array($ret[0]['page_id']
,USER_DIR . "templates/" . TEMPLATE_NAME . "/"
,USER_DIR . "templates/" . TEMPLATE_NAME . "/"
$objDBConn->query($sql,$arrUpdData);
Documentation generated on Fri, 24 Feb 2012 13:58:40 +0900 by Seasoft
|