Source for file SC_Helper_PageLayout.php
Documentation is available at SC_Helper_PageLayout.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.
* Webページのレイアウト情報を制御するヘルパークラス.
* @author LOCKON CO.,LTD.
* @version $Id:SC_Helper_PageLayout.php 15532 2007-08-31 14:39:46Z nanasess $
* LC_Page オブジェクトにページのレイアウト情報をセットする.
* @param LC_Page $objPage ページ情報
* @param boolean $preview プレビュー表示の場合 true
* @param string $url ページのURL
$arrPageLayout =
array();
if ($preview ===
false) {
$url =
"http://" .
$_SERVER['HTTP_HOST'] .
$_SERVER['PHP_SELF'];
$arrPageData =
$this->lfgetPageData("url IN (?, ?) AND page_id <> 0" , array($url2, $url)); // $url は従来互換
$objPage->tpl_mainpage =
USER_PATH .
"templates/preview/"
.
TEMPLATE_NAME .
"/" .
$arrPageData[0]['filename'] .
".tpl";
foreach($arrPageData[0] as $key =>
$val) {
$debug_message.=
"arrPageData[$key]:" .
$val .
"\n";
$debug_message.=
"TEMPLATE_NAME:".
TEMPLATE_NAME .
"\n";
// tpl_mainpageの設定なし、又はトップページの場合
if (!isset
($objPage->tpl_mainpage) ||
$url ==
"index.php") {
$user_tpl =
HTML_PATH .
USER_DIR .
USER_PACKAGE_DIR .
TEMPLATE_NAME .
"/" .
$arrPageData[0]['filename'] .
".tpl";
$debug_message.=
"ユーザテンプレートチェック:".
$user_tpl.
"\n";
$objPage->tpl_mainpage =
$user_tpl;
$debug_message.=
"tpl_mainpage:ユーザーテンプレート\n";
$objPage->tpl_mainpage =
TEMPLATE_DIR .
$arrPageData[0]['filename'] .
".tpl";
$debug_message.=
"tpl_mainpage:標準テンプレート\n";
$debug_message.=
"tpl_mainpage:設定あり" .
"\n";
$debug_message.=
"tpl_mainpage:" .
$objPage->tpl_mainpage .
"\n";
if (!isset
($objPage->tpl_title)) {
$objPage->tpl_title =
$arrPageData[0]['page_name'];
$arrPageLayout =
$arrPageData[0];
$arrPageLayout['LeftNavi'] =
$this->lfGetNavi($arrNavi,1); // LEFT NAVI
$arrPageLayout['MainHead'] =
$this->lfGetNavi($arrNavi,2); // メイン上部
$arrPageLayout['RightNavi'] =
$this->lfGetNavi($arrNavi,3); // RIGHT NAVI
$arrPageLayout['MainFoot'] =
$this->lfGetNavi($arrNavi,4); // メイン下部
$objPage->arrPageLayout =
$arrPageLayout;
* @param string $where クエリのWHERE句
* @param array $arrVal WHERE句の条件値
* @return array ページ情報を格納した配列
function lfgetPageData($where =
'page_id <> 0', $where_vals =
array()) {
$arrRet =
array(); // データ取得用
$col =
" page_id"; // ページID
$col .=
" ,page_name"; // 名称
$col .=
" ,php_dir"; // php保存先ディレクトリ
$col .=
" ,tpl_dir"; // tpl保存先ディレクトリ
$col .=
" ,filename"; // ファイル名称
$col .=
" ,header_chk "; // ヘッダー使用FLG
$col .=
" ,footer_chk "; // フッター使用FLG
$col .=
" ,edit_flg "; // 編集可能FLG
$col .=
" ,author"; // authorタグ
$col .=
" ,description"; // descriptionタグ
$col .=
" ,keyword"; // keywordタグ
$col .=
" ,update_url"; // 更新URL
$col .=
" ,create_date"; // データ作成日
$col .=
" ,update_date"; // データ更新日
$table =
"dtb_pagelayout";
$objQuery->setOrder('page_id');
$arrRet =
$objQuery->select($col, $table, $where, $where_vals);
* @param string $url ページのURL
$col =
"target_id, bloc_name, tpl_path, php_path";
$table =
"dtb_blocposition AS pos INNER JOIN dtb_bloc AS bloc ON bloc.bloc_id = pos.bloc_id";
$where_vals[] =
$page_id;
$objQuery->setOrder('target_id, bloc_row');
$arrRet =
$objQuery->select($col, $table, $where, $where_vals);
* @param array $arrNavi ナビ情報の配列
* @param integer|string$target_id ターゲットID
* @return array ブロック情報の配列
foreach($arrNavi as $key =>
$val){
if ($target_id ==
$val['target_id']){
if ($val['php_path'] !=
'') {
$arrNavi[$key]['php_path'] =
HTML_PATH .
$val['php_path'];
$user_block_path =
USER_TEMPLATE_PATH .
TEMPLATE_NAME .
"/" .
$val['tpl_path'];
$arrNavi[$key]['tpl_path'] =
$user_block_path;
$arrNavi[$key]['tpl_path'] =
TEMPLATE_DIR .
$val['tpl_path'];
// phpから呼び出されるか、tplファイルが存在する場合
if($val['php_path'] !=
'' ||
is_file($arrNavi[$key]['tpl_path'])) {
$arrRet[] =
$arrNavi[$key];
* @param array $arrPageLayout レイアウト情報の配列
* @return integer $col_num カラム数
if (count($arrPageLayout['LeftNavi']) >
0) $col_num++
;
if (count($arrPageLayout['RightNavi']) >
0) $col_num++
;
* @param integer|string$page_id ページID
$arrDelData =
array(); // 抽出データ用
// page_id が空でない場合にはdeleteを実行
$arrPageData =
$this->lfgetPageData(" page_id = ? " , array($page_id));
$ret =
$objQuery->delete("dtb_pagelayout", "page_id = ?", array($page_id));
* @param array $arrData ページ情報の配列
* @return void // TODO boolean にするべき?
$del_php =
HTML_PATH .
$arrData['php_dir'] .
$arrData['filename'] .
".php";
$del_tpl =
HTML_PATH .
$arrData['tpl_dir'] .
$arrData['filename'] .
".tpl";
* @param integer|string$data ページID
* @return boolean ベースデータの場合 true
if ($arrChkData[0]['edit_flg'] ==
2){
Documentation generated on Tue, 28 Apr 2009 18:13:31 +0900 by phpDocumentor 1.4.2