mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-24 05:39:58 +09:00
issue 2667 create home menu cache file and save
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12152 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
35b35d24d3
commit
8417509874
8 changed files with 113 additions and 196 deletions
|
|
@ -33,6 +33,16 @@
|
|||
* @var array
|
||||
*/
|
||||
var $insertedMenuItemSrlList = array();
|
||||
/**
|
||||
* home module's mid
|
||||
* @var string
|
||||
*/
|
||||
private $homeModuleMid = NULL;
|
||||
/**
|
||||
* home menu cache file
|
||||
* @var string
|
||||
*/
|
||||
private $homeMenuCacheFile = './files/cache/menu/homeSitemap.php';
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
|
|
@ -41,6 +51,7 @@
|
|||
function init()
|
||||
{
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
//$this->homeMenuCacheFile = sprintf('./files/cache/menu/homeSitemap.php');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -778,6 +789,18 @@
|
|||
$parent_srl = 0;
|
||||
}
|
||||
|
||||
if(!$this->homeModuleMid)
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$columnList = array('modules.mid',);
|
||||
$output = $oModuleModel->getSiteInfo(0, $columnList);
|
||||
if($output->mid)
|
||||
{
|
||||
$this->homeModuleMid = $output->mid;
|
||||
}
|
||||
}
|
||||
|
||||
$this->moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $originMenu['is_shortcut'], $originMenu['url']);
|
||||
if(count($originMenu['list']) > 0)
|
||||
{
|
||||
|
|
@ -1133,6 +1156,19 @@
|
|||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->updateModule($moduleInfo);
|
||||
}
|
||||
|
||||
// change home menu cache file
|
||||
if($url == $this->homeModuleMid)
|
||||
{
|
||||
if(file_exists($this->homeMenuCacheFile))
|
||||
{
|
||||
@include($this->homeMenuCacheFile);
|
||||
}
|
||||
if(!$homeMenuSrl || $homeMenuSrl != $menu_srl)
|
||||
{
|
||||
$this->makeHomemenuCacheFile($menu_srl);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add a child
|
||||
} elseif($mode == 'insert') {
|
||||
|
|
@ -1829,5 +1865,18 @@
|
|||
$ext = $tmp_arr[count($tmp_arr)-1];
|
||||
return sprintf('%s%d.%s.%s', $path, $menuItemSrl, 'menu_'.$mode.'_btn', $ext);
|
||||
}
|
||||
|
||||
public function makeHomemenuCacheFile($menuSrl)
|
||||
{
|
||||
$cacheBuff .= sprintf('<?php if(!defined("__ZBXE__")) exit();');
|
||||
$cacheBuff .= sprintf('$homeMenuSrl = %d;', $menuSrl);
|
||||
|
||||
FileHandler::writeFile($this->homeMenuCacheFile, $cacheBuff);
|
||||
}
|
||||
|
||||
public function getHomeMenuCacheFile()
|
||||
{
|
||||
return $this->homeMenuCacheFile;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -354,6 +354,7 @@
|
|||
$menuSrl = Context::get('menu_srl');
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$columnList = array('modules.mid', 'modules.browser_title', 'sites.index_module_srl');
|
||||
$start_module = $oModuleModel->getSiteInfo(0, $columnList);
|
||||
|
||||
|
|
@ -364,6 +365,10 @@
|
|||
$output = $this->getMenu($menuSrl);
|
||||
$php_file = sprintf('./files/cache/menu/%s.php',$output->menu_srl);
|
||||
if(file_exists($php_file)) @include($php_file);
|
||||
else
|
||||
{
|
||||
$oMenuAdminController->makeXmlFile($menuSrl);
|
||||
}
|
||||
|
||||
if(count($menu->list)>0)
|
||||
{
|
||||
|
|
@ -376,7 +381,6 @@
|
|||
// menu recreate
|
||||
if($isMenuFixed)
|
||||
{
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$oMenuAdminController->makeXmlFile($menuSrl);
|
||||
}
|
||||
|
||||
|
|
@ -400,6 +404,10 @@
|
|||
unset($menuItems);
|
||||
$value->php_file = sprintf('./files/cache/menu/%s.php',$value->menu_srl);
|
||||
if(file_exists($value->php_file)) @include($value->php_file);
|
||||
else
|
||||
{
|
||||
$oMenuAdminController->makeXmlFile($value->menu_srl);
|
||||
}
|
||||
|
||||
$isMenuFixed = false;
|
||||
if(count($menu->list)>0)
|
||||
|
|
@ -413,7 +421,6 @@
|
|||
// menu recreate
|
||||
if($isMenuFixed)
|
||||
{
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$oMenuAdminController->makeXmlFile($value->menu_srl);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue