dynamic.html.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. /**
  3. * The dynamic view file of project 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 project
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('projectID', $projectID);
  12. /* zin: Define the feature bar on main menu. */
  13. featureBar
  14. (
  15. set::current($type),
  16. set::linkParams("projectID={$projectID}&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('my-4 cursor-pointer'),
  60. icon('angle-down text-primary border-2 rounded-full z-10 bg-canvas'),
  61. span
  62. (
  63. setClass('font-bold ml-2'),
  64. $isToday ? $lang->action->dynamic->today : $date
  65. ),
  66. on::click('toggleCollapse')
  67. ),
  68. div
  69. (
  70. setClass('flex-auto mx-6 mt-2 px-4 alert'),
  71. setClass($type == 'today' ? 'border-secondary' : ''),
  72. dynamic
  73. (
  74. set::dynamics($actions),
  75. set::users($accountPairs)
  76. )
  77. )
  78. );
  79. }
  80. global $app;
  81. $hasMore = $app->control->loadModel('action')->hasMoreAction($lastAction);
  82. if($hasMore)
  83. {
  84. $content[] = li
  85. (
  86. a
  87. (
  88. setID('showMoreDynamic'),
  89. setClass('block text-center'),
  90. setData(array('lastid' => $lastAction->id)),
  91. set::href('###'),
  92. on::click('showMore'),
  93. icon('chevron-double-down')
  94. )
  95. );
  96. }
  97. $content = ul
  98. (
  99. setClass('timeline list-none pl-0'),
  100. $content
  101. );
  102. }
  103. panel($content);
  104. if(!empty($firstAction))
  105. {
  106. $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600);
  107. $lastDate = substr($lastAction->originalDate, 0, 10);
  108. $hasPre = $this->action->hasPreOrNext($firstDate, 'pre', $type);
  109. $hasNext = $this->action->hasPreOrNext($lastDate, 'next', $type);
  110. $preLink = $hasPre ? inlink('dynamic', "projectID=$projectID&type=$type&param=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
  111. $nextLink = $hasNext ? inlink('dynamic', "projectID=$projectID&type=$type&param=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
  112. if($hasPre || $hasNext)
  113. {
  114. floatPreNextBtn
  115. (
  116. empty($hasNext) ? null : set::preLink($nextLink),
  117. empty($hasPre) ? null : set::nextLink($preLink)
  118. );
  119. }
  120. }