guideblock.html.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. /**
  3. * The guide block view file of block 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 Yuting Wang <wangyuting@easycorp.ltd>
  7. * @package block
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. /**
  12. * 获取区块左侧的帮助列表。
  13. * Get guide tabs on the left side.
  14. *
  15. * @param string $blockNavCode
  16. * @return array
  17. */
  18. $getGuideTabs = function(string $blockNavCode): array
  19. {
  20. global $lang, $config, $app;
  21. $navTabs = array();
  22. $selected = key($lang->block->guideTabs);
  23. foreach($lang->block->guideTabs as $tab => $tabName)
  24. {
  25. if(strpos($tab, 'download') !== false && (!isset($config->xxserver->installed) || !$config->xuanxuan->turnon)) continue;
  26. if($tab == 'downloadMoblie' && common::checkNotCN()) continue;
  27. if(($tab == 'preference' || $tab == 'systemMode') && $config->vision == 'lite') continue;
  28. if($tab == 'systemMode' && !common::hasPriv('custom', 'mode')) continue;
  29. if($tab == 'preference' && !common::hasPriv('my', 'preference')) continue;
  30. if($tab == 'visionSwitch' && !strpos($app->user->visions, ',')) continue;
  31. $navTabs[] = li
  32. (
  33. set('class', 'nav-item w-full'),
  34. a
  35. (
  36. set('class', 'ellipsis guide-tab text-dark title ' . ($tab == $selected ? ' active' : '')),
  37. set('data-tab', $tab),
  38. set('data-toggle', 'tab'),
  39. set('href', "#tab{$blockNavCode}Content{$tab}"),
  40. $tabName
  41. )
  42. );
  43. }
  44. return $navTabs;
  45. };
  46. /**
  47. * 获取区块右侧显示的帮助信息。
  48. * Get guide information.
  49. *
  50. * @param string $blockNavCode
  51. * @return array
  52. */
  53. $getGuideInfo = function($blockNavID, $URSRList): array
  54. {
  55. global $lang;
  56. $selected = key($lang->block->guideTabs);
  57. $tabItems = array();
  58. foreach($lang->block->guideTabs as $tab => $tabName)
  59. {
  60. include_once (strtolower($tab) . '.html.php');
  61. $function = '\zin\print' . ucfirst($tab);
  62. $tabItems[] = div
  63. (
  64. set('class', 'tab-pane h-full' . ($tab == $selected ? ' active' : '')),
  65. set('id', "tab{$blockNavID}Content{$tab}"),
  66. $function($URSRList)
  67. );
  68. }
  69. return $tabItems;
  70. };
  71. $blockNavCode = 'nav-' . uniqid();
  72. $config->URSRList = $URSRList;
  73. $config->programID = $programID;
  74. $config->programs = $programs;
  75. $config->URSR = $URSR;
  76. $config->programLink = $programLink;
  77. $config->productLink = $productLink;
  78. $config->projectLink = $projectLink;
  79. $config->executionLink = $executionLink;
  80. $usedMode = zget($config->global, 'mode', 'light');
  81. $isEn = $app->getClientLang() == 'en';
  82. jsVar('changeModeTips', sprintf($lang->custom->changeModeTips, $lang->custom->modeList[$usedMode == 'light' ? 'ALM' : 'light']));
  83. blockPanel
  84. (
  85. setClass('guide-block'),
  86. to::heading
  87. (
  88. !commonModel::isTutorialMode() && $config->vision == 'rnd' ? btn
  89. (
  90. set::id('tutorial-start-btn'),
  91. set::url('tutorial', 'start'),
  92. set::type('warning'),
  93. toggle::modal(array('class-name' => 'tutorial-start')),
  94. $lang->block->tutorial
  95. ) : null
  96. ),
  97. div
  98. (
  99. set('class', 'flex h-full overflow-hidden'),
  100. cell
  101. (
  102. set('width', '18%'),
  103. set('class', 'border-r overflow-y-auto px-2 py-4'),
  104. $isEn ? set::style(array('flex' => '0 0 18%')) : null,
  105. ul
  106. (
  107. set('class', 'nav nav-stacked'),
  108. $getGuideTabs($blockNavCode)
  109. )
  110. ),
  111. cell
  112. (
  113. set('class', 'tab-content'),
  114. set('width', '82%'),
  115. $getGuideInfo($blockNavCode, $URSRList)
  116. )
  117. )
  118. );
  119. render();