viewarchivedcard.html.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?php
  2. /**
  3. * The view archived card view file of kanban 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 Sun Guangming<wangyuting@easycorp.ltd>
  7. * @package kanban
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $cardItems = array();
  12. $CRKanban = !(isset($this->config->CRKanban) and $this->config->CRKanban == '0' and $kanban->status == 'closed');
  13. foreach($cards as $card)
  14. {
  15. if($card->fromType == '') $assignedToList = explode(',', $card->assignedTo);
  16. if($card->fromType == 'execution') $assignedToList = $card->PM;
  17. if($card->fromType == 'build') $assignedToList = $card->builder;
  18. if($card->fromType == 'release' or $card->fromType == 'productplan') $assignedToList = $card->createdBy;
  19. if($card->fromType == 'ticket') $assignedToList = $card->assignedTo;
  20. $members = '';
  21. $count = 0;
  22. $beginAndEnd = '';
  23. $assignedToBox = array();
  24. if(is_array($assignedToList))
  25. {
  26. foreach($assignedToList as $index => $account)
  27. {
  28. if(!isset($users[$account]) or !isset($usersAvatar[$account]))
  29. {
  30. unset($assignedToList[$index]);
  31. continue;
  32. }
  33. $members .= $users[$account] . ' ';
  34. }
  35. $userCount = count($assignedToList);
  36. if($userCount > 0)
  37. {
  38. foreach($assignedToList as $account)
  39. {
  40. if($count > 2) continue;
  41. $assignedToBox[] = userAvatar(set::avatar($usersAvatar[$account]), set::account($account), set::realname($users[$account]), set::size('sm'));
  42. $count ++;
  43. }
  44. if($count > 2) $assignedToBox[] = span(setClass('font-bold'), '...');
  45. }
  46. }
  47. else
  48. {
  49. if(isset($usersAvatar[$assignedToList]) and isset($users[$assignedToList]))
  50. {
  51. $members .= $users[$assignedToList];
  52. $assignedToBox[] = userAvatar(set::avatar($usersAvatar[$assignedToList]), set::account($assignedToList), set::realname($users[$assignedToList]), set::size('sm'));
  53. }
  54. }
  55. if($card->begin < '1970-01-01' && $card->end > '1970-01-01')
  56. {
  57. $beginAndEnd = date("m/d", strtotime($card->end)) . $lang->kanbancard->deadlineAB;
  58. }
  59. else if($card->end < '1970-01-01' && $card->begin > '1970-01-01')
  60. {
  61. $beginAndEnd = date("m/d", strtotime($card->begin)) . $lang->kanbancard->beginAB;
  62. }
  63. else if($card->begin > '1970-01-01' && $card->end > '1970-01-01')
  64. {
  65. $beginAndEnd = date("m-d", strtotime($card->begin)) . ' ~ ' . date("m-d", strtotime($card->end));
  66. }
  67. $color = str_replace('#', '', $card->color);
  68. $cardItems[] = div
  69. (
  70. setClass("card-list flex color-{$color}"),
  71. div
  72. (
  73. setClass('card'),
  74. div
  75. (
  76. setClass('card-heading'),
  77. a
  78. (
  79. set
  80. (
  81. array
  82. (
  83. 'href' => inlink('viewCard', "cardID=$card->id"),
  84. 'data-toggle' => 'modal',
  85. 'data-size' => 'lg',
  86. 'class' => 'card-title'
  87. )
  88. ),
  89. !empty($card->title) ? $card->title : $card->name
  90. )
  91. ),
  92. div
  93. (
  94. setClass('card-content'),
  95. div
  96. (
  97. setClass('flex items-center'),
  98. span(setClass("pri-{$card->pri}"), $lang->kanbancard->priList[$card->pri]),
  99. span(setClass('date ml-1'), $beginAndEnd),
  100. div
  101. (
  102. setClass('flex-1 flex justify-end'),
  103. set::title($members),
  104. $assignedToBox
  105. )
  106. )
  107. ),
  108. ($kanban->performable and ($card->fromType == 'execution' or empty($card->fromType))) ? div
  109. (
  110. setClass('card-footer'),
  111. div
  112. (
  113. setClass('flex'),
  114. div
  115. (
  116. setClass('circle progress mt-3'),
  117. setStyle('width', '80%'),
  118. div
  119. (
  120. setClass('progress-bar'),
  121. setStyle('width', $card->progress . '%')
  122. )
  123. ),
  124. div
  125. (
  126. setClass('mt-2 ml-2'),
  127. $card->progress . '%'
  128. )
  129. )
  130. ) : null
  131. ),
  132. div
  133. (
  134. setClass('card-action flex-1 flex justify-center items-center col ml-2'),
  135. (commonModel::hasPriv('kanban', 'restoreCard') and $CRKanban) ? btn
  136. (
  137. set
  138. (
  139. array
  140. (
  141. 'class' => 'btn primary size-sm ajax-submit',
  142. 'url' => inlink('restoreCard', "cardID=$card->id"),
  143. 'data-confirm' => $lang->kanbancard->confirmRestore
  144. )
  145. ),
  146. $lang->kanban->restore
  147. ) : null,
  148. (commonModel::hasPriv('kanban', 'deleteCard') and $CRKanban) ? btn
  149. (
  150. set
  151. (
  152. array
  153. (
  154. 'class' => 'btn size-sm ajax-submit mt-2',
  155. 'url' => inlink('deleteCard', "cardID=$card->id"),
  156. 'data-confirm' => $lang->kanbancard->confirmDelete
  157. )
  158. ),
  159. $lang->delete
  160. ) : null
  161. )
  162. );
  163. }
  164. panel
  165. (
  166. to::heading
  167. (
  168. div
  169. (
  170. set('class', 'panel-title'),
  171. $lang->kanban->archivedCard
  172. )
  173. ),
  174. to::headingActions
  175. (
  176. btn
  177. (
  178. setClass('closeBtn ghost'),
  179. 'x'
  180. )
  181. ),
  182. div
  183. (
  184. setClass('panel-body'),
  185. $cardItems
  186. )
  187. );