storykanban.html.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /**
  3. * The story kanban view file of execution module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Sun Guangming<sunguangming@easycorp.ltd>
  8. * @package execution
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. jsVar('cardLang', $lang->kanbancard);
  13. jsVar('unlinkLang', $lang->unlink);
  14. jsVar('hourUnit', $config->hourUnit);
  15. jsVar('executionID', $executionID);
  16. jsVar('priv', array(
  17. 'canViewStory' => common::hasPriv('execution', 'storyView'),
  18. 'canUnlinkStory' => (common::hasPriv('execution', 'unlinkStory') && $execution->hasProduct),
  19. 'canBatchChangeStage' => common::hasPriv('story', 'batchChangeStage')
  20. ));
  21. featureBar
  22. (
  23. li
  24. (
  25. setClass('nav-item'),
  26. a
  27. (
  28. setClass('active'),
  29. set::href(inlink('storykanban', "executionID={$execution->id}")),
  30. $lang->execution->kanban,
  31. span(setClass('label size-sm rounded-full white'), $total)
  32. )
  33. )
  34. );
  35. $canModifyProduct = common::canModify('product', $product);
  36. $canModifyExecution = common::canModify('execution', $execution);
  37. $canLinkStory = ($execution->hasProduct || $app->tab == 'execution') && $canModifyProduct && $canModifyExecution && hasPriv('execution', 'linkStory');
  38. $canCreate = $canModifyProduct && $canModifyExecution && hasPriv('story', 'create');
  39. $canBatchCreate = $canModifyProduct && $canModifyExecution && hasPriv('story', 'batchCreate');
  40. $createLink = createLink('story', 'create', "product={$product->id}&branch=0&moduleID=0&storyID=0&objectID={$execution->id}") . "#app={$app->tab}";
  41. $batchCreateLink = createLink('story', 'batchCreate', "productID={$product->id}&branch=0&moduleID=0&storyID=0&executionID={$execution->id}") . "#app={$app->tab}";
  42. $createItem = array('text' => $lang->story->create, 'url' => $createLink);
  43. $batchCreateItem = array('text' => $lang->story->batchCreate, 'url' => $batchCreateLink);
  44. $linkStoryUrl = createLink('execution', 'linkStory', "project={$execution->id}");
  45. $linkItem = array('text' => $lang->story->linkStory, 'url' => $linkStoryUrl, 'data-app' => $app->tab);
  46. $product ? toolbar(common::hasPriv('execution', 'storykanban') ? btnGroup(btn
  47. (
  48. set::icon('format-list-bulleted'),
  49. set::hint($lang->execution->list),
  50. set::url(inlink('story', "executionID={$execution->id}")),
  51. setData('app', $app->tab)
  52. ), btn
  53. (
  54. setClass('text-primary font-bold shadow-inner bg-canvas'),
  55. set::icon('kanban'),
  56. set::hint($lang->execution->kanban),
  57. set::url($this->createLink('execution', 'storykanban', "executionID={$execution->id}")),
  58. setData('app', $app->tab)
  59. )) : null, hasPriv('story', 'export') ? item(set(array
  60. (
  61. 'text' => $lang->story->export,
  62. 'icon' => 'export',
  63. 'class' => 'ghost',
  64. 'url' => createLink('story', 'export', "productID={$product->id}&orderBy=id_desc"),
  65. 'data-toggle' => 'modal'
  66. ))) : null, $canCreate && $canBatchCreate ? btngroup
  67. (
  68. btn
  69. (
  70. setClass('btn secondary'),
  71. set::icon('plus'),
  72. set::url($createLink),
  73. $lang->story->create
  74. ),
  75. dropdown
  76. (
  77. btn(setClass('btn secondary dropdown-toggle'),
  78. setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
  79. set::items(array_filter(array($createItem, $batchCreateItem))),
  80. set::placement('bottom-end')
  81. )
  82. ) : null, $canCreate && !$canBatchCreate ? item(set($createItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null, $canBatchCreate && !$canCreate ? item(set($batchCreateItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null, $canLinkStory && $canBeChanged ? btngroup(btn(
  83. setClass('btn primary'),
  84. set::icon('link'),
  85. set::url($linkStoryUrl),
  86. setData('app', $app->tab),
  87. $lang->story->linkStory
  88. )) : null) : null;
  89. div
  90. (
  91. set::id('kanban'),
  92. zui::kanban
  93. (
  94. set::key('kanban'),
  95. set::data($kanbanData),
  96. set::laneNameWidth(0),
  97. set::getItem(jsRaw('window.getItem')),
  98. set::getLane(jsRaw('window.getLane')),
  99. set::canDrop(jsRaw('window.canDrop')),
  100. set::onDrop(jsRaw('window.onDrop'))
  101. )
  102. );