dynamic.html.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?php
  2. /**
  3. * The dynamic view file of company 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 Mengyi Liu <liumengyi@easycorp.ltd>
  7. * @package company
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('browseType', $browseType);
  12. /* zin: Define the feature bar on main menu. */
  13. featureBar
  14. (
  15. set::current($browseType),
  16. set::linkParams("browseType={key}&param={$param}&recTotal=0&date=&direction=next&userID={$userID}&productID={$productID}&projectID={$projectID}&executionID={$executionID}&orderBy={$orderBy}"),
  17. set::labelCount($recTotal < \actionModel::MAXCOUNT ? $recTotal : (\actionModel::MAXCOUNT - 1) . '+'),
  18. li
  19. (
  20. setClass('w-28 ml-4'),
  21. picker
  22. (
  23. setID('user'),
  24. set::name('user'),
  25. set::placeholder($lang->user->common),
  26. set::items($userIdPairs),
  27. set::value($userID),
  28. on::change('changeItem')
  29. )
  30. ),
  31. $this->config->vision == 'rnd' ? li
  32. (
  33. setClass('w-28 ml-4'),
  34. picker
  35. (
  36. setID('product'),
  37. set::name('product'),
  38. set::placeholder($lang->product->common),
  39. set::items($products),
  40. set::value($productID),
  41. set::required(true),
  42. on::change('changeItem')
  43. )
  44. ) : null,
  45. li
  46. (
  47. setClass('w-28 ml-4'),
  48. picker
  49. (
  50. setID('project'),
  51. set::name('project'),
  52. set::placeholder($lang->project->common),
  53. set::items($projects),
  54. set::value($projectID),
  55. set::required(true),
  56. on::change('changeItem')
  57. )
  58. ),
  59. li
  60. (
  61. setClass('w-28 ml-4'),
  62. picker
  63. (
  64. setID('execution'),
  65. set::name('execution'),
  66. set::placeholder($lang->execution->common),
  67. set::items($executions),
  68. set::value($executionID),
  69. set::required(true),
  70. on::change('changeItem')
  71. )
  72. ),
  73. li(setClass('ml-4'), searchToggle(set::module('action'), set::open($browseType == 'bysearch')))
  74. );
  75. $content = null;
  76. if(empty($dateGroups))
  77. {
  78. $content = div
  79. (
  80. setClass('flex items-center justify-center h-64'),
  81. span
  82. (
  83. setClass('text-gray'),
  84. $lang->action->noDynamic
  85. )
  86. );
  87. }
  88. else
  89. {
  90. $content = array();
  91. $firstAction = '';
  92. $lastAction = '';
  93. foreach($dateGroups as $date => $actions)
  94. {
  95. $lastAction = end($actions);
  96. $isToday = date(DT_DATE3) == $date;
  97. if(empty($firstAction)) $firstAction = reset($actions);
  98. $content[] = li
  99. (
  100. div
  101. (
  102. setClass('cursor-pointer leading-5'),
  103. span
  104. (
  105. icon('angle-down text-primary border-2 rounded-full z-10 bg-canvas align-middle')
  106. ),
  107. span
  108. (
  109. setClass('ml-2'),
  110. $isToday ? $lang->today : $date
  111. ),
  112. on::click('toggleCollapse')
  113. ),
  114. div
  115. (
  116. setClass('border-l border-l-1 mx-2 px-4 py-3'),
  117. div
  118. (
  119. setClass('flex-auto px-4 alert actions-box'),
  120. setClass($browseType == 'today' ? 'border-secondary' : ''),
  121. dynamic
  122. (
  123. set::dynamics($actions),
  124. set::users($accountPairs)
  125. )
  126. )
  127. )
  128. );
  129. }
  130. global $app;
  131. $hasMore = $app->control->loadModel('action')->hasMoreAction($lastAction);
  132. if($hasMore)
  133. {
  134. $content[] = li
  135. (
  136. a
  137. (
  138. setID('showMoreDynamic'),
  139. setClass('block text-center'),
  140. setData(array('lastid' => $lastAction->id)),
  141. set::href('###'),
  142. on::click('showMore'),
  143. icon('chevron-double-down')
  144. )
  145. );
  146. }
  147. $content = ul
  148. (
  149. setClass('timeline list-none p-0'),
  150. $content
  151. );
  152. }
  153. panel
  154. (
  155. setID('companyDynamic'),
  156. $content
  157. );
  158. if(!empty($firstAction))
  159. {
  160. $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600);
  161. $lastDate = substr($lastAction->originalDate, 0, 10);
  162. $hasPre = $this->action->hasPreOrNext($firstDate, 'pre', $browseType);
  163. $hasNext = $this->action->hasPreOrNext($lastDate, 'next', $browseType);
  164. $preLink = $hasPre ? inlink('dynamic', "browseType={$browseType}&param={$param}&recTotal=0&date=" . strtotime($firstDate) . "&direction=pre&userID={$userID}&productID={$productID}&projectID={$projectID}&executionID={$executionID}") : 'javascript:;';
  165. $nextLink = $hasNext ? inlink('dynamic', "browseType={$browseType}&param={$param}&recTotal=0&date=" . strtotime($lastDate) . "&direction=next&userID={$userID}&productID={$productID}&projectID={$projectID}&executionID={$executionID}") : 'javascript:;';
  166. if($hasPre || $hasNext)
  167. {
  168. floatPreNextBtn
  169. (
  170. empty($hasNext) ? null : set::preLink($nextLink),
  171. empty($hasPre) ? null : set::nextLink($preLink)
  172. );
  173. }
  174. }