mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 19:21:40 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@344 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
11bc4f8ea4
commit
ad5597222e
4 changed files with 68 additions and 32 deletions
|
|
@ -174,27 +174,30 @@
|
|||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($oModule->module_info->layout_srl);
|
||||
|
||||
// 레이아웃 정보중 extra_vars의 이름과 값을 $layout_info에 입력
|
||||
if($layout_info->extra_var_count) {
|
||||
foreach($layout_info->extra_var as $var_id => $val) {
|
||||
$layout_info->{$var_id} = $val->value;
|
||||
}
|
||||
unset($layout_info->extra_var);
|
||||
}
|
||||
|
||||
// 레이아웃 정보중 menu를 Context::set
|
||||
if($layout_info->menu_count) {
|
||||
foreach($layout_info->menu as $menu_id => $menu) {
|
||||
if(file_exists($menu->php_file)) include($menu->php_file);
|
||||
Context::set($menu_id, $menu);
|
||||
}
|
||||
}
|
||||
if($layout_info) {
|
||||
|
||||
// 레이아웃 정보를 Context::set
|
||||
Context::set('layout_info', $layout_info);
|
||||
// 레이아웃 정보중 extra_vars의 이름과 값을 $layout_info에 입력
|
||||
if($layout_info->extra_var_count) {
|
||||
foreach($layout_info->extra_var as $var_id => $val) {
|
||||
$layout_info->{$var_id} = $val->value;
|
||||
}
|
||||
unset($layout_info->extra_var);
|
||||
}
|
||||
|
||||
// 레이아웃 정보중 menu를 Context::set
|
||||
if($layout_info->menu_count) {
|
||||
foreach($layout_info->menu as $menu_id => $menu) {
|
||||
if(file_exists($menu->php_file)) include($menu->php_file);
|
||||
Context::set($menu_id, $menu);
|
||||
}
|
||||
}
|
||||
|
||||
$oModule->setLayoutPath($layout_info->path);
|
||||
$oModule->setLayoutFile('layout');
|
||||
// 레이아웃 정보를 Context::set
|
||||
Context::set('layout_info', $layout_info);
|
||||
|
||||
$oModule->setLayoutPath($layout_info->path);
|
||||
$oModule->setLayoutFile('layout');
|
||||
}
|
||||
}
|
||||
|
||||
// 컨텐츠 출력
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<!-- 1차 메뉴 -->
|
||||
<!--@foreach($main_menu->list as $key => $val)-->
|
||||
|
||||
<!--@if($zbfe_url==$val['url'])-->
|
||||
<!--@if($val['selected'])-->
|
||||
{@ $selected_style = 'style="font-weight:bold;"'}
|
||||
{@ $second_menu_list = $val['list']; }
|
||||
<!--@else-->
|
||||
|
|
@ -27,7 +27,23 @@
|
|||
<!-- 2차 메뉴 -->
|
||||
<!--@foreach($second_menu_list as $key => $val)-->
|
||||
|
||||
<!--@if($zbfe_url==$val['url'])-->
|
||||
<!--@if($val['selected'])-->
|
||||
{@ $selected_style = 'style="font-weight:bold;"'}
|
||||
{@ $third_menu_list = $val['list']; }
|
||||
<!--@else-->
|
||||
{@ $selected_style = ''; }
|
||||
<!--@end-->
|
||||
|
||||
<span {$selected_style}>
|
||||
<a href="#" onclick="location.href='{$val['href']}';return false;">{$val['text']}</a>
|
||||
</span>
|
||||
<!--@end-->
|
||||
</div>
|
||||
|
||||
<!-- 3차 메뉴 -->
|
||||
<!--@foreach($third_menu_list as $key => $val)-->
|
||||
|
||||
<!--@if($val['selected'])-->
|
||||
{@ $selected_style = 'style="font-weight:bold;"'}
|
||||
<!--@else-->
|
||||
{@ $selected_style = ''; }
|
||||
|
|
|
|||
|
|
@ -244,9 +244,14 @@
|
|||
$tree[$parent_srl][$menu_srl] = $node;
|
||||
}
|
||||
|
||||
// 파일 생성
|
||||
// xml 캐시 파일 생성
|
||||
$xml_buff = sprintf('<root>%s</root>', $this->getXmlTree($tree[0], $tree));
|
||||
$php_buff = sprintf('<?php if(!__ZB5__) exit(); $menu->list = array(%s); ?>', $this->getPhpCacheCode($tree[0], $tree));
|
||||
|
||||
// php 캐시 파일 생성
|
||||
$php_output = $this->getPhpCacheCode($tree[0], $tree);
|
||||
$php_buff = sprintf('<?php if(!__ZB5__) exit(); $menu->list = array(%s); ?>', $php_output['buff']);
|
||||
|
||||
// 파일 저장
|
||||
FileHandler::writeFile($xml_file, $xml_buff);
|
||||
FileHandler::writeFile($php_file, $php_buff);
|
||||
return $xml_file;
|
||||
|
|
@ -289,17 +294,27 @@
|
|||
* 이 캐시는 ModuleHandler::displayContent() 에서 include하여 Context::set() 한다
|
||||
**/
|
||||
function getPhpCacheCode($source_node, $tree) {
|
||||
if(!$source_node) return;
|
||||
$output = array("buff"=>"", "url_list"=>array());
|
||||
if(!$source_node) return $output;
|
||||
|
||||
foreach($source_node as $menu_srl => $node) {
|
||||
$child_buff = "";
|
||||
|
||||
if($menu_srl&&$tree[$menu_srl]) $child_buff = $this->getPhpCacheCode($tree[$menu_srl], $tree);
|
||||
// 자식 노드가 있으면 자식 노드의 데이터를 먼저 얻어옴
|
||||
if($menu_srl&&$tree[$menu_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_srl], $tree);
|
||||
else $child_output = array("buff"=>"", "url_list"=>array());
|
||||
|
||||
// 노드의 url에 ://가 있으면 바로 링크, 아니면 제로보드의 링크를 설정한다 ($node->href가 완성된 url)
|
||||
if($node->url && !strpos($node->url, '://')) $node->href = "./?".$node->url;
|
||||
else $node->href = $node->url;
|
||||
|
||||
// 현재 노드의 url값이 공란이 아니라면 url_list 배열값에 입력
|
||||
if($node->url) {
|
||||
$child_output['url_list'][] = $node->url;
|
||||
$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
|
||||
}
|
||||
|
||||
// 속성을 생성한다 ( url_list를 이용해서 선택된 메뉴의 노드에 속하는지를 검사한다. 꽁수지만 빠르고 강력하다고 생각;;)
|
||||
$attribute = sprintf(
|
||||
'"node_srl"=>"%s","text"=>"%s","href"=>"%s","url"=>"%s","open_window"=>"%s","normal_btn"=>"%s","hover_btn"=>"%s","active_btn"=>"%s","group_srls"=>array(%s),"list"=>array(%s)',
|
||||
'"node_srl"=>"%s","text"=>"%s","href"=>"%s","url"=>"%s","open_window"=>"%s","normal_btn"=>"%s","hover_btn"=>"%s","active_btn"=>"%s","group_srls"=>array(%s),"selected"=>(in_array(Context::get("zbfe_url"),array(%s))?1:0),"list"=>array(%s)',
|
||||
$node->menu_srl,
|
||||
str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->name),
|
||||
str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->href),
|
||||
|
|
@ -309,12 +324,14 @@
|
|||
str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->hover_btn),
|
||||
str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->active_btn),
|
||||
$node->group_srls,
|
||||
$child_buff
|
||||
'"'.implode('","',$child_output['url_list']).'"',
|
||||
$child_output['buff']
|
||||
);
|
||||
|
||||
$buff .= sprintf('%s=>array(%s),', $node->menu_srl, $attribute);
|
||||
// buff 데이터를 생성한다
|
||||
$output['buff'] .= sprintf('%s=>array(%s),', $node->menu_srl, $attribute);
|
||||
}
|
||||
return $buff;
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<column name="modules.is_default" alias="is_default" />
|
||||
<column name="modules.menu_srl" alias="menu_srl" />
|
||||
<column name="modules.extra_vars" alias="extra_vars" />
|
||||
<column name="modules.layout_file" alias="layout_file" />
|
||||
<column name="modules.layout_srl" alias="layout_srl" />
|
||||
<column name="modules.grants" alias="grants" />
|
||||
<column name="modules.admin_id" alias="admin_id" />
|
||||
<column name="modules.header_text" alias="header_text" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue