dynamic.html.php 3.5 KB

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