* Add function for left menu tree.

This commit is contained in:
caoyanyi
2023-02-17 14:08:57 +08:00
parent fc6d8cd821
commit 9eb9981ae7
9 changed files with 107 additions and 31 deletions
+1
View File
@@ -247,3 +247,4 @@ $config->disableFeature = array();
if(!helper::hasFeature('waterfall')) $config->disableFeature = array('design', 'stage', 'programplan', 'weekly', 'researchplan', 'researchreport', 'gapanalysis');
$config->dev->disableMainMenu = array('project', 'product', 'execution');
$config->dev->projectMenus = array('project', 'scrum', 'waterfall', 'kanbanProject');
+1
View File
@@ -135,6 +135,7 @@ class dev extends control
$this->view->featureBar = $this->lang->dev->featureBar['langItem'];
$this->view->originalLangs = $this->dev->getOriginalLang($type, $module, $method, $language);
$this->view->customedLangs = $this->dev->getCustomedLang($type, $module, $method, $language);
$this->view->menuTree = $this->dev->getMenuTree($type, $module, $method);
$this->view->moduleName = $moduleName;
$this->view->language = str_replace('-', '_', $language);
$this->display();
+6 -21
View File
@@ -31,7 +31,7 @@ $(function()
function handleClickItem(clickId)
{
var clearId = $('.label-list > .text-primary').attr('labelid');
if(clearId && clearId !== clickId)
if(clearId && clearId !== clickId)
{
removeActive(clearId);
};
@@ -41,29 +41,14 @@ $(function()
addActive(clickId);
};
}
function initMenu()
{
if (navTypes.includes(type))
{
var myTreeData = [{
title: '水果',
children: [
{title: '橘子', key: 'juzi jz'},
{title: '瓜', key: '123'}
]
}, {
title: '坚果',
children: [
{title: '向日葵'},
{title: '瓜子'}
]
}, {
title: '蔬菜'
}];
$('#menuTree').tree(
{
data: myTreeData
data: menuTree
});
}
$('.menu-tree .search-input').on('input', function()
@@ -71,15 +56,15 @@ $(function()
var val = $(this).val();
if (!val)
{
var updateData = myTreeData;
var updateData = menuTree;
}
else
{
var updateData = [];
for (var i = 0; i < myTreeData.length; i++)
for (var i = 0; i < menuTree.length; i++)
{
var item = {};
$.extend(true, item, myTreeData[i])
$.extend(true, item, menuTree[i])
if (item.children)
{
var children = [];
+5
View File
@@ -192,3 +192,8 @@ $lang->dev->featureBar['langItem']['first'] = 'First Menu';
$lang->dev->featureBar['langItem']['second'] = 'Second Menu';
$lang->dev->featureBar['langItem']['third'] = 'Third Menu';
$lang->dev->featureBar['langItem']['feature'] = 'Search Tab';
$lang->dev->projectMenu['project'] = "{$lang->projectCommon} Common";
$lang->dev->projectMenu['scrum'] = "Scrum {$lang->projectCommon}";
$lang->dev->projectMenu['waterfall'] = "Waterfall {$lang->projectCommon}";
$lang->dev->projectMenu['kanbanProject'] = "Kanban {$lang->projectCommon}";
+5
View File
@@ -192,3 +192,8 @@ $lang->dev->featureBar['langItem']['first'] = 'First Menu';
$lang->dev->featureBar['langItem']['second'] = 'Second Menu';
$lang->dev->featureBar['langItem']['third'] = 'Third Menu';
$lang->dev->featureBar['langItem']['feature'] = 'Search Tab';
$lang->dev->projectMenu['project'] = "{$lang->projectCommon} Common";
$lang->dev->projectMenu['scrum'] = "Scrum {$lang->projectCommon}";
$lang->dev->projectMenu['waterfall'] = "Waterfall {$lang->projectCommon}";
$lang->dev->projectMenu['kanbanProject'] = "Kanban {$lang->projectCommon}";
+5
View File
@@ -192,3 +192,8 @@ $lang->dev->featureBar['langItem']['first'] = 'First Menu';
$lang->dev->featureBar['langItem']['second'] = 'Second Menu';
$lang->dev->featureBar['langItem']['third'] = 'Third Menu';
$lang->dev->featureBar['langItem']['feature'] = 'Search Tab';
$lang->dev->projectMenu['project'] = "{$lang->projectCommon} Common";
$lang->dev->projectMenu['scrum'] = "Scrum {$lang->projectCommon}";
$lang->dev->projectMenu['waterfall'] = "Waterfall {$lang->projectCommon}";
$lang->dev->projectMenu['kanbanProject'] = "Kanban {$lang->projectCommon}";
+5
View File
@@ -191,3 +191,8 @@ $lang->dev->featureBar['langItem']['first'] = '一级菜单';
$lang->dev->featureBar['langItem']['second'] = '二级菜单';
$lang->dev->featureBar['langItem']['third'] = '三级菜单';
$lang->dev->featureBar['langItem']['feature'] = '检索标签';
$lang->dev->projectMenu['project'] = "{$lang->projectCommon}通用";
$lang->dev->projectMenu['scrum'] = "敏捷{$lang->projectCommon}";
$lang->dev->projectMenu['waterfall'] = "瀑布{$lang->projectCommon}";
$lang->dev->projectMenu['kanbanProject'] = "看板{$lang->projectCommon}";
+78 -10
View File
@@ -401,19 +401,12 @@ class devModel extends model
$lang = $defaultLang->$module->menu->$method['subMenu'];
}
foreach($lang as $linkKey => $link)
$menus = $this->getLinkTitle($lang);
foreach($menus as $linkKey => $menu)
{
if($type == 'first' and in_array($linkKey, $this->config->dev->disableMainMenu)) continue;
if(is_array($link))
{
if(!isset($link['link'])) continue;
$link = $link['link'];
}
$link = strip_tags($link);
$link = explode('|', $link);
$originalLangs[$langKey . $linkKey] = trim($link[0]);
$originalLangs[$langKey . $linkKey] = $menu;
}
return $originalLangs;
@@ -550,4 +543,79 @@ class devModel extends model
return $lang;
}
/**
* Get menu tree.
*
* @param string $type
* @param string $module
* @param string $method
* @access public
* @return array
*/
public function getMenuTree($type = 'second', $module = '', $method = '')
{
$menuTree = array();
if(!in_array($type, $this->config->dev->navTypes)) return $menuTree;
$lang = new stdclass();
if($type == 'second')
{
if(empty($module)) $module = 'my';
$menus = $this->getLinkTitle($this->lang->mainNav);
$menusPinYin = common::convert2Pinyin($menus);
foreach($menus as $menuKey => $menu)
{
$menuItem = new stdclass();
$menuItem->title = $menu;
$menuItem->module = $menuKey;
$menuItem->method = '';
$menuItem->active = ($module == $menuKey and $method == '') ? 1 : 0;
$menuItem->key = zget($menusPinYin, $menu, '');
$menuItem->children = array();
if($menuKey == 'project')
{
$menusPinYin = common::convert2Pinyin($this->lang->dev->projectMenu);
foreach($this->config->dev->projectMenus as $subMenuKey)
{
$subMenu = new stdClass();
$subMenu->title = $this->lang->dev->projectMenu[$subMenuKey];
$subMenu->key = zget($menusPinYin, $this->lang->dev->projectMenu[$subMenuKey], '');
$subMenu->module = $subMenuKey;
$subMenu->method = '';
$subMenu->active = ($module == $subMenuKey and $method == '') ? 1 : 0;
$menuItem->children[] = $subMenu;
}
}
$menuTree[] = $menuItem;
}
}
return $menuTree;
}
/**
* Get links title.
*
* @param array $menus
* @access public
* @return void
*/
public function getLinkTitle($menus)
{
$linksTitle = array();
foreach($menus as $menuKey => $menu)
{
if(is_array($menu) and !isset($menu['link'])) continue;
$link = is_array($menu) ? strip_tags($menu['link']) : strip_tags($menu);
$link = explode('|', $link);
$linksTitle[$menuKey] = trim($link[0]);
}
return $linksTitle;
}
}
+1
View File
@@ -12,6 +12,7 @@
?>
<?php js::set('type', $type); ?>
<?php js::set('navTypes', $config->dev->navTypes); ?>
<?php js::set('menuTree', $menuTree)?>
<?php include 'header.html.php';?>
<div id='mainMenu' class='clearfix menu-secondary'>
<div class="btn-toolBar pull-left">