dynamic.html.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. /**
  3. * The dynamic view file of execution 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 Yanyi Cao <caoyanyi@easycorp.ltd>
  7. * @package execution
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('executionID', $executionID);
  12. /* zin: Define the feature bar on main menu. */
  13. featureBar
  14. (
  15. set::current($type),
  16. set::linkParams("executionID={$executionID}&type={key}"),
  17. set::labelCount($recTotal < \actionModel::MAXCOUNT ? $recTotal : (\actionModel::MAXCOUNT - 1) . '+'),
  18. li
  19. (
  20. setClass('w-40'),
  21. picker
  22. (
  23. setID('user'),
  24. set::name('user'),
  25. set::placeholder($lang->execution->viewByUser),
  26. set::items($userIdPairs),
  27. set::value($param),
  28. on::change('changeUser')
  29. )
  30. )
  31. );
  32. $content = null;
  33. if(empty($dateGroups))
  34. {
  35. $content = div
  36. (
  37. setClass('flex items-center justify-center h-64'),
  38. span
  39. (
  40. setClass('text-gray'),
  41. $lang->action->noDynamic
  42. )
  43. );
  44. }
  45. else
  46. {
  47. $content = array();
  48. $firstAction = '';
  49. $lastAction = '';
  50. foreach($dateGroups as $date => $actions)
  51. {
  52. $lastAction = end($actions);
  53. $isToday = date(DT_DATE4) == $date;
  54. if(empty($firstAction)) $firstAction = reset($actions);
  55. $content[] = li
  56. (
  57. div
  58. (
  59. setClass('cursor-pointer leading-5'),
  60. span
  61. (
  62. icon('angle-down text-primary border-2 rounded-full z-10 bg-canvas align-middle')
  63. ),
  64. span
  65. (
  66. setClass('ml-2'),
  67. $isToday ? $lang->action->dynamic->today : $date
  68. ),
  69. on::click('toggleCollapse')
  70. ),
  71. div
  72. (
  73. setClass('border-l border-l-1 mx-2 px-4 py-3'),
  74. div
  75. (
  76. setClass('flex-auto px-4 alert actions-box'),
  77. setClass($type == 'today' ? 'border-secondary' : ''),
  78. dynamic
  79. (
  80. set::dynamics($actions),
  81. set::users($accountPairs)
  82. )
  83. )
  84. )
  85. );
  86. }
  87. global $app;
  88. $hasMore = $app->control->loadModel('action')->hasMoreAction($lastAction);
  89. if($hasMore)
  90. {
  91. $content[] = li
  92. (
  93. a
  94. (
  95. setID('showMoreDynamic'),
  96. setClass('block text-center'),
  97. setData(array('lastid' => $lastAction->id)),
  98. set::href('###'),
  99. on::click('showMore'),
  100. icon('chevron-double-down')
  101. )
  102. );
  103. }
  104. $content = ul
  105. (
  106. setClass('timeline list-none pl-0'),
  107. $content
  108. );
  109. }
  110. panel($content);
  111. if(!empty($firstAction))
  112. {
  113. $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600);
  114. $lastDate = substr($lastAction->originalDate, 0, 10);
  115. $hasPre = $this->action->hasPreOrNext($firstDate, 'pre', $type);
  116. $hasNext = $this->action->hasPreOrNext($lastDate, 'next', $type);
  117. $preLink = $hasPre ? inlink('dynamic', "executionID=$executionID&type=$type&param=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
  118. $nextLink = $hasNext ? inlink('dynamic', "executionID=$executionID&type=$type&param=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
  119. if($hasPre || $hasNext)
  120. {
  121. floatPreNextBtn
  122. (
  123. empty($hasNext) ? null : set::preLink($nextLink),
  124. empty($hasPre) ? null : set::nextLink($preLink)
  125. );
  126. }
  127. }