dashboard.html.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. /**
  3. * The dashboard 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. foreach($blocks as $block)
  12. {
  13. $block->color = isset($block->params->color) ? $block->params->color : null;
  14. $block->fetch = isset($block->blockLink) ? $block->blockLink : null;
  15. }
  16. $blocks = json_decode(json_encode($blocks), true);
  17. $blockMenuItems = array();
  18. $blockMenuItems[] = array('text' => $lang->block->refresh, 'className' => 'not-open-url', 'data' => array('type' => 'refresh'));
  19. if($this->app->user->account != 'guest')
  20. {
  21. $blockMenuItems[] = array('text' => $lang->edit, 'className' => 'not-open-url', 'data' => array('type' => 'edit', 'url' => createLink('block', 'edit', "blockID={id}"), 'size' => 'sm'));
  22. if(count($blocks) > 1) $blockMenuItems[] = array('text' => $lang->block->hidden, 'className' => 'not-open-url', 'data' => array('type' => 'delete', 'url' => createLink('block', 'delete', "blockID={id}"), 'confirm' => $lang->block->confirmRemoveBlock));
  23. if($this->app->user->admin && count($blocks) > 1) $blockMenuItems[] = array('text' => $lang->block->closeForever, 'className' => 'not-open-url', 'data' => array('type' => 'delete', 'url' => createLink('block', 'close', "blockID={id}"), 'confirm' => $lang->block->confirmClose));
  24. }
  25. $blockMenuItems[] = array('text' => $lang->block->createBlock, 'className' => 'not-open-url', 'data' => array('type' => 'create', 'url' => createLink('block', 'create', "dashboard=$dashboard"), 'toggle' => 'modal', 'size' => 'sm'));
  26. $blockMenuItems[] = array('text' => $lang->block->reset, 'className' => 'not-open-url', 'data' => array('type' => 'reset', 'url' => createLink('block', 'reset', "dashboard=$dashboard"), 'confirm' => $lang->block->confirmReset));
  27. dashboard
  28. (
  29. set::key("dashboard-{$dashboard}" . (!empty($objectID) ? "-$objectID" : '')),
  30. set::onlyLoadVisible(false),
  31. set::forceUpdateID(time()),
  32. set::blocks(array_values($blocks)),
  33. set::blockMenu(array('items' => $blockMenuItems)),
  34. set::emptyBlockContent(array('html' => '<div class="panel rounded bg-canvas panel-block shadow"><div class="panel-heading border-b h-12"></div></div>')),
  35. set::onClickMenu(jsRaw('handleClickBlockMenu')),
  36. set::onLayoutChange(jsRaw('handleLayoutChange'))
  37. );
  38. $upgradeRemind = $this->loadModel('misc')->getUpgradeRemind();
  39. if($upgradeRemind)
  40. {
  41. $clientLang = common::checkNotCN() ? 'en' : 'cn';
  42. $guideInfo = $this->config->upgradeGuide[$config->edition];
  43. $version = $guideInfo['version'];
  44. $imagePath = $guideInfo['imagePath'];
  45. $moreLink = 'https://api.zentao.net/goto.php?item=' . $guideInfo['linkItem'];
  46. modal
  47. (
  48. setID('upgradeModal'),
  49. div
  50. (
  51. setClass('page-block pageOne'),
  52. img(set::src("{$imagePath}{$clientLang}_upgrade_guide1_{$version}.svg")),
  53. div(setClass('learn-more-link flex justify-end text-root text-primary-600'), a(set::href($moreLink), set::target('_blank'), $lang->block->learnMore . ' >')),
  54. div
  55. (
  56. setClass('my-6 text-center'),
  57. btn
  58. (
  59. setClass('primary'),
  60. on::click("togglePage('pageTwo')"),
  61. $lang->block->nextPage
  62. )
  63. )
  64. ),
  65. div
  66. (
  67. setClass('page-block pageTwo hidden'),
  68. img(set::src("{$imagePath}{$clientLang}_upgrade_guide2_{$version}.svg")),
  69. div(setClass('learn-more-link flex justify-end text-root text-primary-600'), a(set::href($moreLink), set::target('_blank'), $lang->block->learnMore . ' >')),
  70. div
  71. (
  72. setClass('my-6 text-center'),
  73. btn
  74. (
  75. setClass('mr-4'),
  76. on::click("togglePage('pageOne')"),
  77. $lang->block->prevPage
  78. ),
  79. btn
  80. (
  81. setClass('primary'),
  82. on::click("togglePage('pageThree')"),
  83. $lang->block->nextPage
  84. )
  85. )
  86. ),
  87. div
  88. (
  89. setClass('page-block pageThree hidden'),
  90. img(set::src("{$imagePath}{$clientLang}_upgrade_guide3_{$version}.svg")),
  91. div(setClass('learn-more-link flex justify-end text-root text-primary-600'), a(set::href($moreLink), set::target('_blank'), $lang->block->learnMore . ' >')),
  92. div
  93. (
  94. setClass('my-6 text-center'),
  95. btn
  96. (
  97. setClass('mr-4'),
  98. on::click("togglePage('pageTwo')"),
  99. $lang->block->prevPage
  100. ),
  101. btn
  102. (
  103. setClass('primary'),
  104. on::click("togglePage('pageFour')"),
  105. $lang->block->nextPage
  106. )
  107. )
  108. ),
  109. div
  110. (
  111. setClass('page-block pageFour hidden'),
  112. img(set::src("{$imagePath}{$clientLang}_upgrade_guide4_{$version}.svg")),
  113. div(setClass('learn-more-link flex justify-end text-root text-primary-600'), a(set::href($moreLink), set::target('_blank'), $lang->block->learnMore . ' >')),
  114. div
  115. (
  116. setClass('my-6 text-center'),
  117. btn
  118. (
  119. setClass('mr-4'),
  120. on::click("togglePage('pageThree')"),
  121. $lang->block->prevPage
  122. ),
  123. btn
  124. (
  125. setClass('primary'),
  126. setData('dismiss', 'modal'),
  127. $lang->block->experience
  128. )
  129. )
  130. )
  131. );
  132. }
  133. else
  134. {
  135. $pluginRemind = $this->misc->getPluginRemind();
  136. if($pluginRemind)
  137. {
  138. modal
  139. (
  140. setID('expiredModal'),
  141. set::title($lang->misc->expiredTipsTitle),
  142. html($pluginRemind)
  143. );
  144. }
  145. else
  146. {
  147. $metriclibRemind = $this->misc->getMetriclibRemind();
  148. if($metriclibRemind)
  149. {
  150. modal
  151. (
  152. setID('metriclibModal'),
  153. html($metriclibRemind)
  154. );
  155. }
  156. }
  157. }
  158. render();