menu.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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' => 'order,fulltext',
  45. 'list' => '"<a href=\"{link}\" target=\"_blank\">{name}</a>"',
  46. ),
  47. 'link' => array
  48. (
  49. 'type' => 'text-200',
  50. 'name' => '链接',
  51. 'default' => '',
  52. 'desc' => '请输入链接',
  53. 'match' => 'option',
  54. 'update' => 'textarea',
  55. ),
  56. 'target' => array
  57. (
  58. 'type' => 'varchar-24',
  59. 'name' => '打开新页面',
  60. 'default' => '_self',
  61. 'desc' => '打开新页面',
  62. 'match' => 'option',
  63. 'option' => $target,
  64. 'update' => 'radio',
  65. //'list' => true,
  66. ),
  67. 'reorder' => array
  68. (
  69. 'type' => 'int-11',
  70. 'name' => '排序(数值越大越靠前)',
  71. 'default' => '1',
  72. 'desc' => '请输入排序',
  73. 'match' => 'option',
  74. 'update' => 'text',
  75. 'search' => 'order',
  76. 'list' => true,
  77. 'order' => 'desc',
  78. 'edit' => true,
  79. ),
  80. 'state' => array
  81. (
  82. 'type' => 'tinyint-1',
  83. 'name' => '状态',
  84. 'default' => '1',
  85. 'desc' => '请选择状态',
  86. 'match' => 'is_numeric',
  87. 'option' => $option,
  88. 'update' => 'radio',
  89. ),
  90. 'cdate' => array
  91. (
  92. 'type' => 'int-11',
  93. 'name' => '录入时间',
  94. 'match' => array('is_numeric', time()),
  95. 'desc' => '',
  96. # 只有insert时才生效
  97. 'insert' => true,
  98. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  99. ),
  100. ),
  101. # 默认值
  102. 'default' => array
  103. (
  104. 'col' => 'name,link,reorder,target,state,cdate',
  105. 'value' => array
  106. (
  107. '"社区","'. Dever::url("forum/list", 'main') . '",10, "_self",1,' . $time,
  108. ),
  109. ),
  110. );