Commit 77b1f814 by 叶明星

Merge branch 'ymx-账期管理-2018091009' into development

parents 13339d29 8ac8db53
......@@ -9,25 +9,6 @@ use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
function CheckActive($menus, &$arr, $url)
{
for ($i = 0; $i < count($menus); $i++) {
$menu = $menus[$i];
array_push($arr, $i);
if (isset($menu->href) && ($menu->href == $url || ($menu->href == '/' && $url == '//')))
return true;
if (isset($menu->childs) && count($menu->childs) > 0) {
$ret = CheckActive($menu->childs, $arr, $url);
if ($ret)
return $ret;
}
array_pop($arr);
}
return false;
}
function createMenuReal($menus, $active, $level)
{
$subclass = ($level == 0) ? 'nav-second-level' : 'nav-third-level';
......@@ -70,21 +51,6 @@ function createMenu($menus, $url)
return createMenuReal($menus, $actives, 0);
}
function Crumbs($menus, $uri)
{
$actives = [];
CheckActive($menus, $actives, $uri);
$ret = '';
foreach ($actives as $k => $v) {
if ($k == count($actives) - 1) {
$ret .= '<li class="active"><a>' . $menus[$actives[0]]->childs[$actives[1]]->title . '</a></li>';
} else {
$ret .= '<li><a href="#">' . $menus[$actives[0]]->title . '</a></li>';
}
}
return $ret;
}
class WebController extends Controller
{
// 页面用户、菜单信息
......
......@@ -195,3 +195,37 @@
\LogReport::write(\LogReport::anlyError($err_msg, $file, $line, $err_code, $method));
}
function Crumbs($menus, $uri)
{
$actives = [];
CheckActive($menus, $actives, $uri);
$ret = '';
foreach ($actives as $k => $v) {
if ($k == count($actives) - 1) {
$ret .= '<li class="active"><a>' . $menus[$actives[0]]->childs[$actives[1]]->title . '</a></li>';
} else {
$ret .= '<li><a href="#">' . $menus[$actives[0]]->title . '</a></li>';
}
}
return $ret;
}
function CheckActive($menus, &$arr, $url)
{
for ($i = 0; $i < count($menus); $i++) {
$menu = $menus[$i];
array_push($arr, $i);
if (isset($menu->href) && ($menu->href == $url || ($menu->href == '/' && $url == '//')))
return true;
if (isset($menu->childs) && count($menu->childs) > 0) {
$ret = CheckActive($menu->childs, $arr, $url);
if ($ret)
return $ret;
}
array_pop($arr);
}
return false;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment