roadmapblock.html.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * The roadmap view file of block 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 Mengyi Liu <liumengyi@easycorp.ltd>
  7. * @package block
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $productModel = $this->loadModel('product');
  12. $fnPrintSingleRoadmap = function($branchKey = 0) use ($roadmaps, $product, $productModel)
  13. {
  14. global $lang;
  15. $data = $productModel->buildRoadmapForUI($roadmaps, $branchKey);
  16. $hasRoadmaps = !empty($data) ;
  17. if(!$hasRoadmaps)
  18. {
  19. return div
  20. (
  21. setClass('empty-tip text-center'),
  22. span(setClass('text-gray'), $lang->release->noRelease),
  23. common::canModify('product', $product) && common::hasPriv('release', 'create') ? btn
  24. (
  25. setClass('ml-2'),
  26. setStyle('background', 'rgb(var(--color-primary-50-rgb))'),
  27. setStyle('box-shadow', 'none'),
  28. set::url(createLink('release', 'create', "productID=$product->id&branch=$branchKey")),
  29. span
  30. (
  31. icon('plus'),
  32. setClass('text-primary'),
  33. $lang->release->create
  34. )
  35. ) : null
  36. );
  37. }
  38. else
  39. {
  40. return roadMap(set::releases($data));
  41. }
  42. };
  43. $fnPrintBranchRoadmap = function() use ($branches, $roadmaps, $product, $productModel, $fnPrintSingleRoadmap)
  44. {
  45. $tabPaneItems = array();
  46. foreach($branches as $branchKey => $branchName)
  47. {
  48. $tabPaneItems[] = tabPane
  49. (
  50. set::key("roadmap_{$branchKey}"),
  51. set::title($branchName),
  52. set::active($branchKey == 0),
  53. $fnPrintSingleRoadmap($branchKey)
  54. );
  55. }
  56. return tabs($tabPaneItems);
  57. };
  58. panel
  59. (
  60. set('headingClass', 'border-b'),
  61. set::title($block->title),
  62. $product->type == 'normal' ? $fnPrintSingleRoadmap() : $fnPrintBranchRoadmap()
  63. );
  64. render();