menu.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | home
  5. |--------------------------------------------------------------------------
  6. */
  7. # 项目列表中的管理选项:
  8. # 数据库基本配置与数据管理、模板列表与生成、项目基本配置与管理等
  9. $view
  10. # 项目管理的链接
  11. /*
  12. ->fetch('#project-url@href', function()
  13. {
  14. return Maze::load('manage/menu.link#project');//这里可以改写成Maze::object('manage/menu.link')->project
  15. })
  16. # 日志的链接
  17. ->fetch('#log-url@href', function()
  18. {
  19. return Maze::load('manage/menu.link#log');
  20. })
  21. */
  22. ->fetch(array('.admin-manage@style', 0), 'manage/auth.manage')
  23. ->fetch(array('.admin-manage@style', 1), 'manage/auth.manage')
  24. # 另外一种形式
  25. # 退出的链接
  26. //->fetch('#logout-url@href', 'manage/menu.link#logout')
  27. # 首页的链接
  28. ->fetch('#index-url@href', 'manage/menu.link#index')
  29. # 项目列表
  30. ->fetch
  31. (
  32. '.project-list',
  33. 'manage/menu.left',
  34. array
  35. (
  36. 'a' => array
  37. (
  38. 'data-target' => '.<{$v.key}>-menu',
  39. 'class++' => '<{if(Maze::input("menu") != $v.key && $v.type != 1):?> collapsed<{endif;}>',
  40. ),
  41. '.project-name' => array
  42. (
  43. 'html' => '<{$v.name}>',
  44. ),
  45. 'i' => array
  46. (
  47. 'class' => 'glyphicon glyphicon-folder-close',
  48. ),
  49. /*
  50. ul的内容还可以这样写,但是拼写太痛苦
  51. 'ul' => array
  52. (
  53. 'id' => '#collapse-nav-<{$k}>',
  54. 'html' => '<{foreach($v["child"] as $i => $j){echo \'<li><a href="admin-user.html" class="am-cf"><span class="am-icon-check"></span> \' . $j["lang"] . \' </a></li>\';}}>',
  55. ),
  56. */
  57. 'ul' => array
  58. (
  59. 'id' => '<{$v.key}>-menu',
  60. 'class' => '<{$v.key}>-menu nav nav-list collapse',
  61. # 此处实际上是个例子,处理多个classname的问题
  62. 'class--' => ' in', //菜单关闭状态
  63. # 第一个默认打开
  64. //'class++' => ' <{Maze::first("am-in", $i)}>',
  65. //'class++' => ' am-in', //菜单打开状态
  66. //根据当前url打开
  67. 'class++' => '<{if(Maze::input("menu") == $v.key || $v.type == 1):?> in<{endif;}>',
  68. 'li' => array
  69. (
  70. # 数据处理
  71. '{data}' => '$v.child',
  72. 'class--' => 'active', //菜单关闭状态
  73. 'class++' => '<{if(Maze::input("menu_id") == $vi.id):?>active<{endif;}>',
  74. 'a' => array
  75. (
  76. 'href' => '<{$vi.link}>',
  77. 'html' => '<span class="glyphicon glyphicon-chevron-right"></span>&nbsp;&nbsp;<{$vi.name}>',
  78. )
  79. ),
  80. ),
  81. )
  82. )
  83. # display
  84. ->display();