report.html.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?php
  2. /**
  3. * The detail view file of workflowgroup module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2024 禅道软件(青岛)有限公司(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 Gang Liu <liugang@chandao.com>
  7. * @package workflowgroup
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. /* 关闭总开关。 */
  12. if(!helper::hasFeature('process'))
  13. {
  14. div
  15. (
  16. setClass('dtable shadow ring rounded dtable-hover-row dtable-hover-col dtable-is-empty'),
  17. div
  18. (
  19. setClass('dtable-empty-tip'),
  20. div
  21. (
  22. setClass('row gap-4 items-center text-gray'),
  23. $lang->workflowgroup->noProcessTip
  24. )
  25. )
  26. );
  27. return;
  28. }
  29. /* 关闭项目流程开关。 */
  30. if(!$hasProcess)
  31. {
  32. $currentModuleName = $lang->process->common;
  33. include('../../../common/ext/ui/closefeaturenotice.html.php');
  34. return;
  35. }
  36. $html = '<table class="table">';
  37. $html .= '<thead>';
  38. $html .= "<tr>";
  39. foreach($lang->workflowgroup->reportThead as $key => $thead)
  40. {
  41. if(!$hasDeliverable && in_array($key, ['deliverable', 'approval', 'reviewcl'])) continue;
  42. if(!$hasAuditplan && $key == 'auditcl') continue;
  43. $html .= "<th>{$thead}</th>";
  44. }
  45. $html .= "</tr>";
  46. $html .= '</thead>';
  47. $html .= '<tbody>';
  48. foreach($report as $module => $processList)
  49. {
  50. $moduleRowspan = 0;
  51. $processRowspanMap = array();
  52. foreach($processList as $pid => $activityList)
  53. {
  54. $processRowspan = 0;
  55. foreach($activityList as $aid => $activity)
  56. {
  57. $activityRowspan = !empty($activity->deliverables) ? count($activity->deliverables) : 1;
  58. $processRowspan += $activityRowspan;
  59. $moduleRowspan += $activityRowspan;
  60. }
  61. $processRowspanMap[$pid] = $processRowspan;
  62. }
  63. $isModuleFirstRow = true;
  64. foreach($processList as $pid => $activityList)
  65. {
  66. $isProcessFirstRow = true;
  67. foreach($activityList as $aid => $activity)
  68. {
  69. $activityRowspan = !empty($activity->deliverables) ? count($activity->deliverables) : 1;
  70. $isActivityFirstRow = true;
  71. $activity->optional = $activity->optional ? $activity->optional : 'yes';
  72. if($activity->deliverables && $hasDeliverable)
  73. {
  74. foreach($activity->deliverables as $deliverable)
  75. {
  76. $html .= "<tr>";
  77. if($isModuleFirstRow)
  78. {
  79. $html .= "<td rowspan='{$moduleRowspan}'>{$activity->moduleName}</td>";
  80. $isModuleFirstRow = false;
  81. }
  82. if($isProcessFirstRow && $isActivityFirstRow)
  83. {
  84. $html .= "<td rowspan='{$processRowspanMap[$pid]}' class='text-center'>{$activity->pname}</td>";
  85. }
  86. $optional = zget($lang->activity->optionalList, $activity->optional, 'yes');
  87. $icon = $activity->optional == 'yes' ? "<i class='icon icon-crop text-primary' title='{$optional}'></i>" : "<i class='icon icon-crop-disabled text-primary' title='{$optional}'></i>";
  88. if($isActivityFirstRow)
  89. {
  90. $html .= "<td rowspan='{$activityRowspan}' class='text-center'>{$activity->aname} {$icon}</td>";
  91. if($hasAuditplan)
  92. {
  93. $auditclCount = hasPriv('auditcl', 'browse') ? html::a(createLink('auditcl', 'browse', "id={$groupID}&pid={$activity->pid}"), $activity->auditclCount) : $activity->auditclCount;
  94. $html .= "<td rowspan='{$activityRowspan}' class='text-center'>{$auditclCount}</td>";
  95. }
  96. $isActivityFirstRow = false;
  97. }
  98. $trimmable = zget($lang->deliverable->trimmableList, $deliverable->trimmable, '1');
  99. $icon = $deliverable->trimmable == '1' ? "<i class='icon icon-crop text-primary' title='{$trimmable}'></i>" : "<i class='icon icon-crop-disabled text-primary' title='{$trimmable}'></i>";
  100. $html .= "<td class='text-center'>{$deliverable->name} {$icon}</td>";
  101. $html .= "<td class='text-center'>{$deliverable->flowName}</td>";
  102. $param = $deliverable->aid ? "id={$groupID}&type=byreview&aid={$deliverable->aid}" : "id={$groupID}";
  103. $reviewclCount = hasPriv('reviewcl', 'browse') ? html::a(createLink('reviewcl', 'browse', $param), $deliverable->reviewclCount) : $deliverable->reviewclCount;
  104. $html .= "<td class='text-center'>{$reviewclCount}</td>";
  105. $html .= "</tr>";
  106. }
  107. }
  108. else
  109. {
  110. $html .= "<tr>";
  111. if($isModuleFirstRow)
  112. {
  113. $html .= "<td rowspan='{$moduleRowspan}'>{$activity->moduleName}</td>";
  114. $isModuleFirstRow = false;
  115. }
  116. if($isProcessFirstRow)
  117. {
  118. $html .= "<td rowspan='{$processRowspanMap[$pid]}' class='text-center'>{$activity->pname}</td>";
  119. }
  120. if(empty($activity->aname))
  121. {
  122. $html .= "<td class='text-center'></td>";
  123. if($hasAuditplan) $html .= "<td class='text-center'></td>";
  124. }
  125. else
  126. {
  127. $optional = zget($lang->activity->optionalList, $activity->optional, 'yes');
  128. $icon = $activity->optional == 'yes' ? "<i class='icon icon-crop text-primary' title='{$optional}'></i>" : "<i class='icon icon-crop-disabled text-primary' title='{$optional}'></i>";
  129. $html .= "<td class='text-center'>{$activity->aname} {$icon}</td>";
  130. if($hasAuditplan)
  131. {
  132. $auditclCount = hasPriv('auditcl', 'browse') ? html::a(createLink('auditcl', 'browse', "id={$groupID}&pid={$activity->pid}"), $activity->auditclCount) : $activity->auditclCount;
  133. $html .= "<td class='text-center'>{$auditclCount}</td>";
  134. }
  135. }
  136. if($hasDeliverable)
  137. {
  138. $html .= "<td class='text-center'></td>";
  139. $html .= "<td class='text-center'></td>";
  140. $html .= "<td class='text-center'></td>";
  141. }
  142. $html .= "</tr>";
  143. }
  144. $isProcessFirstRow = false;
  145. }
  146. }
  147. }
  148. $html .= '</tbody>';
  149. $html .= '</table>';
  150. h::css('.table td {border: 1px solid #ebedf3;}');
  151. panel(html($html));