menu.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '显示',
  6. 2 => '不显示',
  7. );
  8. $target = array
  9. (
  10. '_blank' => '是',
  11. '_self' => '否',
  12. );
  13. $time = time();
  14. return array
  15. (
  16. # 表名
  17. 'name' => 'menu',
  18. # 显示给用户看的名称
  19. 'lang' => '菜单管理',
  20. # 后台菜单排序
  21. 'order' => 9,
  22. # 数据结构
  23. 'struct' => array
  24. (
  25. 'id' => array
  26. (
  27. 'type' => 'int-11',
  28. 'name' => '菜单ID',
  29. 'default' => '',
  30. 'desc' => '',
  31. 'match' => 'is_numeric',
  32. 'search' => 'order',
  33. //'list' => true,
  34. 'order' => 'desc',
  35. ),
  36. 'name' => array
  37. (
  38. 'type' => 'varchar-32',
  39. 'name' => '菜单名称',
  40. 'default' => '',
  41. 'desc' => '请输入菜单名称',
  42. 'match' => 'is_string',
  43. 'update' => 'text',
  44. 'search' => 'fulltext',
  45. 'list' => true,
  46. ),
  47. 'key' => array
  48. (
  49. 'type' => 'varchar-32',
  50. 'name' => '菜单key-对应前台的选中效果',
  51. 'default' => '',
  52. 'desc' => '菜单key',
  53. 'match' => 'is_string',
  54. 'update' => 'text',
  55. 'list' => true,
  56. ),
  57. 'icon' => array
  58. (
  59. 'type' => 'varchar-150',
  60. 'name' => '图标-宽度为150的图片',
  61. 'default' => '',
  62. 'desc' => '请选择图标',
  63. 'match' => 'option',
  64. 'update' => 'image',
  65. 'key' => '1',
  66. 'place' => '150',
  67. ),
  68. 'link' => array
  69. (
  70. 'type' => 'text-200',
  71. 'name' => '链接',
  72. 'default' => '',
  73. 'desc' => '请输入链接',
  74. 'match' => 'option',
  75. 'update' => 'textarea',
  76. ),
  77. 'target' => array
  78. (
  79. 'type' => 'varchar-24',
  80. 'name' => '打开新页面',
  81. 'default' => '_self',
  82. 'desc' => '打开新页面',
  83. 'match' => 'option',
  84. 'option' => $target,
  85. 'update' => 'radio',
  86. //'list' => true,
  87. ),
  88. 'reorder' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => '排序(数值越大越靠前)',
  92. 'default' => '1',
  93. 'desc' => '请输入排序',
  94. 'match' => 'option',
  95. 'update' => 'text',
  96. 'search' => 'order',
  97. 'list' => true,
  98. 'order' => 'desc',
  99. 'edit' => true,
  100. ),
  101. 'state' => array
  102. (
  103. 'type' => 'tinyint-1',
  104. 'name' => '状态',
  105. 'default' => '1',
  106. 'desc' => '请选择状态',
  107. 'match' => 'is_numeric',
  108. 'option' => $option,
  109. 'update' => 'radio',
  110. ),
  111. 'cdate' => array
  112. (
  113. 'type' => 'int-11',
  114. 'name' => '录入时间',
  115. 'match' => array('is_numeric', $time),
  116. 'desc' => '',
  117. # 只有insert时才生效
  118. 'insert' => true,
  119. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  120. ),
  121. ),
  122. # 默认值
  123. 'default' => array
  124. (
  125. 'col' => 'name,`key`,icon,link,reorder,target,state,cdate',
  126. 'value' => array
  127. (
  128. '"领任务", "task", "ico-gettask", "'. Dever::url("task/list", 'main') . '",10, "_self",1,' . $time,
  129. '"我的任务", "user_task", "ico-task", "'. Dever::url("user/task", 'main') . '",9, "_self",1,' . $time,
  130. '"我的账户", "user", "ico-account", "'. Dever::url("user/account", 'main') . '",8, "_self",1,' . $time,
  131. ),
  132. ),
  133. );