view.html.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /**
  3. * The 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 <sunguangming@easycorp.ltd>
  7. * @package kanban
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $canModify = !empty($this->config->CRKanban) || $kanban->status != 'closed';
  12. $laneCount = 0;
  13. $groupCols = array(); // 卡片可以移动到的同一group下的列。
  14. foreach($kanbanList as $current => $region)
  15. {
  16. foreach($region['items'] as $index => $group)
  17. {
  18. $groupID = $group['id'];
  19. foreach($group['data']['cols'] as $colIndex => $col)
  20. {
  21. if($col['parent'] != '-1') $groupCols[$groupID][$col['id']] = $col['title'];
  22. }
  23. $kanbanList[$current]['items'][$index] = $group;
  24. $kanbanList[$current]['kanbanProps']['getLane'] = jsRaw('window.getLane');
  25. $kanbanList[$current]['kanbanProps']['getCol'] = jsRaw('window.getCol');
  26. $kanbanList[$current]['kanbanProps']['getItem'] = jsRaw('window.getItem');
  27. $kanbanList[$current]['kanbanProps']['colWidth'] = 'auto';
  28. $kanbanList[$current]['kanbanProps']['laneHeight'] = 'auto';
  29. $kanbanList[$current]['kanbanProps']['minColWidth'] = $kanban->fluidBoard == '0' ? $kanban->colWidth : $kanban->minColWidth;
  30. $kanbanList[$current]['kanbanProps']['maxColWidth'] = $kanban->fluidBoard == '0' ? $kanban->colWidth : $kanban->maxColWidth;
  31. $kanbanList[$current]['kanbanProps']['maxLaneHeight'] = '500';
  32. $kanbanList[$current]['kanbanProps']['colProps'] = array('actions' => jsRaw('window.getColActions'), 'titleAlign' => $kanban->alignment);
  33. $kanbanList[$current]['kanbanProps']['laneProps'] = array('actions' => jsRaw('window.getLaneActions'));
  34. $kanbanList[$current]['kanbanProps']['itemProps'] = array('actions' => jsRaw('window.getItemActions'));
  35. if($canModify)
  36. {
  37. $kanbanList[$current]['kanbanProps']['canDrop'] = jsRaw('window.canDrop');
  38. $kanbanList[$current]['kanbanProps']['onDrop'] = jsRaw('window.onDrop');
  39. }
  40. }
  41. $laneCount += $region['laneCount'];
  42. }
  43. $regionMenu = array();
  44. $regionMenu[] = li(set::className($regionID == 'all' ? 'active' : ''), a(set::href('javascript:;'), span(set::title($lang->kanbanregion->all), $lang->kanbanregion->all)), set('data-on', 'click'), set('data-call', 'clickRegionMenu'), set('data-params', 'event'), set('data-region', 'all'));
  45. foreach($regions as $currentRegionID => $regionName) $regionMenu[] = li(set::className($regionID == $currentRegionID ? 'active' : ''), a(set::href('javascript:;'), span(set::title($regionName), $regionName)), set('data-on', 'click'), set('data-call', 'clickRegionMenu'), set('data-params', 'event'), set('data-region', $currentRegionID));
  46. $app->loadLang('release');
  47. $app->loadLang('execution');
  48. $this->loadModel('productplan');
  49. $expireDays = isset($config->kanban->reminder->expireDays) ? $config->kanban->reminder->expireDays : 1;
  50. jsVar('laneCount', $laneCount);
  51. jsVar('kanbanLang', $lang->kanban);
  52. jsVar('columnLang', $lang->kanbancolumn);
  53. jsVar('laneLang', $lang->kanbanlane);
  54. jsVar('cardLang', $lang->kanbancard);
  55. jsVar('executionLang', $lang->execution);
  56. jsVar('releaseLang', $lang->release);
  57. jsVar('productplanLang', $lang->productplan);
  58. jsVar('ticketLang', isset($lang->ticket) ? $lang->ticket : '');
  59. jsVar('kanbanID', $kanban->id);
  60. jsVar('kanban', $kanban);
  61. jsVar('groupCols', $groupCols);
  62. jsVar('vision', $config->vision);
  63. jsVar('colorList', $config->kanban->cardColorList);
  64. jsVar('futureDate', $config->productplan->future);
  65. jsVar('canMoveCard', common::hasPriv('kanban', 'moveCard'));
  66. jsVar('canModify', (!empty($this->config->CRKanban) || $kanban->status != 'closed'));
  67. jsVar('canViewPlan', common::hasPriv('productplan', 'view') && $config->vision != 'lite');
  68. jsVar('canViewRelease', common::hasPriv('release', 'view') && $config->vision != 'lite');
  69. jsVar('canViewExecution', common::hasPriv('execution', 'task') && $config->vision != 'lite');
  70. jsVar('canViewBuild', common::hasPriv('build', 'view') && $config->vision != 'lite');
  71. jsVar('canViewTicket', common::hasPriv('ticket', 'view'));
  72. jsVar('userList', $userList);
  73. jsVar('expireDays', $expireDays);
  74. jsVar('today', helper::today());
  75. dropmenu(set::tab('kanban'), set::objectID($kanban->id));
  76. ul
  77. (
  78. set::className('regionMenu'),
  79. $regionMenu
  80. );
  81. div
  82. (
  83. set::id('kanbanList'),
  84. zui::kanbanList
  85. (
  86. set::key('kanban'),
  87. set('$replace', false),
  88. set::items($kanbanList),
  89. set::height('calc(100vh - 120px)')
  90. )
  91. );
  92. div(set::id('archivedCards'));
  93. div(set::id('archivedColumns'));