scrumoverviewblock.html.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <?php
  2. /**
  3. * The scrumoverview 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. $cells = array();
  12. $hasRisk = helper::hasFeature('risk');
  13. $hasIssue = helper::hasFeature('issue');
  14. $isEn = $app->getClientLang() == 'en';
  15. foreach($config->block->projectstatistic->items as $module => $items)
  16. {
  17. $cellItems = array();
  18. foreach($items as $item)
  19. {
  20. $field = $item['field'];
  21. $unit = $item['unit'];
  22. $cellItems[] = item
  23. (
  24. set::name
  25. (
  26. $lang->block->projectstatistic->{$field},
  27. !isset($lang->block->tooltips[$field]) ? ':' : null
  28. ),
  29. to::suffixName
  30. (
  31. isset($lang->block->tooltips[$field]) ? icon
  32. (
  33. setClass('text-light text-sm'),
  34. toggle::tooltip
  35. (
  36. array
  37. (
  38. 'title' => $lang->block->tooltips[$field],
  39. 'placement' => 'bottom-end',
  40. 'type' => 'white',
  41. 'className' => 'text-dark border border-light leading-5 w-60'
  42. )
  43. ),
  44. 'help',
  45. ':'
  46. ) : null
  47. ),
  48. span
  49. (
  50. setClass('font-bold text-black mr-0.5' . ($isEn ? ' pl-1' : '')),
  51. round(zget($project, $field, 0), 2)
  52. ),
  53. span
  54. (
  55. setClass('text-gray'),
  56. $lang->block->projectstatistic->{$unit}
  57. )
  58. );
  59. }
  60. $cells[] = cell
  61. (
  62. setClass('flex-1 overflow-hidden whitespace-nowrap project-statistic-table scrum' . (($module != 'cost' && $longBlock) || ($module != 'task' && $module != 'cost' && !$longBlock) ? ' border-l pl-4 ' : ' ml-4') . (!$longBlock && $module != 'cost' && $module != 'story'? ' border-t' : '')),
  63. set::width($longBlock ? ($module == 'cost' ? 'calc(25% - 1rem)' : '25%') : 'calc(50% - 1rem)'),
  64. div
  65. (
  66. setClass('pt-1'),
  67. span
  68. (
  69. setClass('font-bold'),
  70. $lang->block->projectstatistic->{$module}
  71. )
  72. ),
  73. tableData
  74. (
  75. set::width('100%'),
  76. $cellItems
  77. )
  78. );
  79. }
  80. $width = $config->edition != 'open' ? '33%' : '50%';
  81. $remainingDays = zget($project, 'remainingDays' , 0);
  82. panel
  83. (
  84. to::titleSuffix
  85. (
  86. icon
  87. (
  88. setClass('text-light text-sm cursor-pointer'),
  89. toggle::tooltip
  90. (
  91. array
  92. (
  93. 'title' => sprintf($lang->block->tooltips['metricTime'], $metricTime),
  94. 'placement' => $app->getClientLang() == 'en' ? 'bottom-end' : 'bottom',
  95. 'type' => 'white',
  96. 'className' => 'text-dark border border-light leading-5'
  97. )
  98. ),
  99. 'help'
  100. )
  101. ),
  102. setClass('scrumoverview-block ' . ($longBlock ? 'block-long' : 'block-sm')),
  103. set::bodyClass('no-shadow border-t'),
  104. set::title($block->title),
  105. div
  106. (
  107. setClass('flex flex-wrap h-full w-full' . (!$longBlock ? ' flex-wrap' : '')),
  108. div(setClass('flex w-full bg-white leading-6 px-2 py-1 mt-1 mx-3 shadow-sm items-center gap-x-2 justify-between' . ($longBlock ? ' h-10 mb-2 flex-nowrap' : 'h-20 mb-4 flex-wrap')), cell
  109. (
  110. setClass('text-left'),
  111. $project->status != 'closed' && $project->end != LONG_TIME ? span
  112. (
  113. setClass('text-gray'),
  114. $remainingDays >= 0 ? $lang->block->projectstatistic->leftDaysPre : $lang->block->projectstatistic->delayDaysPre,
  115. span
  116. (
  117. setClass('font-bold text-black px-1'),
  118. abs($remainingDays)
  119. ),
  120. $lang->block->projectstatistic->day
  121. ) : span
  122. (
  123. setClass('text-gray'),
  124. $project->status == 'closed' ? $lang->block->projectstatistic->projectClosed : $lang->block->projectstatistic->longTimeProject
  125. )
  126. ), in_array($config->edition, array('max', 'ipd')) && ($hasIssue || $hasRisk) ? cell
  127. (
  128. setClass('flex-1 text-left' . (!$longBlock ? ' w-full' : '')),
  129. icon('bullhorn text-warning'),
  130. $hasRisk ? span
  131. (
  132. setClass('text-gray mr-5'),
  133. $lang->block->projectstatistic->existRisks,
  134. span
  135. (
  136. setClass('font-bold text-warning'),
  137. round(zget($project, 'risks', 0), 2)
  138. )
  139. ) : null,
  140. $hasIssue ? span
  141. (
  142. setClass('text-gray'),
  143. $lang->block->projectstatistic->existIssues,
  144. span
  145. (
  146. setClass('font-bold text-warning'),
  147. zget($project, 'issues', 0)
  148. )
  149. ) : null
  150. ) : '', (!empty($project->executions) && $project->multiple) ? cell
  151. (
  152. setClass('flex-1 overflow-hidden whitespace-nowrap' . (!$longBlock ? ' text-left w-full' : ' text-right')),
  153. $longBlock ? set::width($width) : '',
  154. span
  155. (
  156. setClass('text-gray'),
  157. $lang->block->projectstatistic->lastestExecution,
  158. hasPriv('execution', 'task') ? a
  159. (
  160. setClass('pl-2'),
  161. set::href(helper::createLink('execution', 'task', "executionID={$project->executions[0]->id}")),
  162. set('title', $project->executions[0]->name),
  163. $project->executions[0]->name
  164. ) : span
  165. (
  166. setClass('pl-2'),
  167. $project->executions[0]->name
  168. )
  169. )
  170. ) : null),
  171. div
  172. (
  173. setClass('flex w-full' . (!$longBlock ? ' flex-wrap' : '')),
  174. $cells
  175. )
  176. )
  177. );
  178. render();