db.html.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * The db view file of dev module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Wang Yidong<yidong@easycorp.ltd>
  7. * @package dev
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $fnBuildContent = function() use ($fields, $selectedTable)
  12. {
  13. global $lang;
  14. $trItems = array();
  15. $i = 1;
  16. foreach($fields as $key => $field)
  17. {
  18. $trItems[] = h::tr
  19. (
  20. h::td($i),
  21. h::td($key),
  22. h::td($field['name']),
  23. h::td(setClass('break-all'), $field['type']),
  24. h::td(isset($field['options']['max']) ? $field['options']['max'] : ''),
  25. h::td($field['null'])
  26. );
  27. $i++;
  28. }
  29. return panel
  30. (
  31. set::title($selectedTable),
  32. set::bodyClass('p-0'),
  33. h::table
  34. (
  35. setClass('table bordered'),
  36. h::thead
  37. (
  38. h::tr
  39. (
  40. h::th(setClass('w-20'), $lang->dev->fields['id']),
  41. h::th(setClass('w-20'), $lang->dev->fields['name']),
  42. h::th(setClass('w-40'), $lang->dev->fields['desc']),
  43. h::th($lang->dev->fields['type']),
  44. h::th(setClass('w-20'), $lang->dev->fields['length']),
  45. h::th(setClass('w-28'), $lang->dev->fields['null'])
  46. )
  47. ),
  48. h::tbody($trItems)
  49. )
  50. );
  51. };
  52. $activeGroup = '';
  53. foreach($tableTree as $module)
  54. {
  55. if($module->active) $activeGroup = $module->id;
  56. }
  57. h::css("
  58. .sidebar .tree [data-level=\"0\"][id=\"{$activeGroup}\"] {color: var(--color-primary-600); font-weight:bolder}
  59. .sidebar .tree [data-level=\"1\"][id=\"{$selectedTable}\"] {color: var(--color-primary-600); font-weight:bolder}
  60. ");
  61. sidebar
  62. (
  63. setClass('bg-white'),
  64. h::header(setClass('h-10 flex items-center pl-4 flex-none gap-3'), span(setClass('text-lg font-semibold'), icon(setClass('pr-2'), 'list'), $lang->dev->dbList)),
  65. treeEditor(set(array('items' => $tableTree, 'canEdit' => false, 'canDelete' => false, 'canSplit' => false)))
  66. );
  67. div
  68. (
  69. setClass('bg-white'),
  70. $selectedTable ? $fnBuildContent() : null
  71. );