epic.html.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. /**
  3. * The epic 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 Yuting Wang <wangyuting@easycorp.ltd>
  7. * @package my
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. include 'header.html.php';
  12. jsVar('window.globalSearchType', 'epic');
  13. jsVar('showGrade', $showGrade);
  14. jsVar('gradeGroup', $gradeGroup);
  15. featureBar
  16. (
  17. set::current($type),
  18. set::linkParams("mode=epic&type={key}&param="),
  19. li(searchToggle(set::module($this->app->rawMethod . 'Epic'), set::open($type == 'bysearch')))
  20. );
  21. $viewType = $this->cookie->storyViewType ? $this->cookie->storyViewType : 'tree';
  22. toolbar
  23. (
  24. item(set(array
  25. (
  26. 'type' => 'btnGroup',
  27. 'items' => array(array
  28. (
  29. 'icon' => 'list',
  30. 'class' => 'btn-icon switchButton' . ($viewType == 'tiled' ? ' text-primary' : ''),
  31. 'data-type' => 'tiled',
  32. 'hint' => $lang->story->viewTypeList['tiled']
  33. ), array
  34. (
  35. 'icon' => 'treeview',
  36. 'class' => 'switchButton btn-icon' . ($viewType == 'tree' ? ' text-primary' : ''),
  37. 'data-type' => 'tree',
  38. 'hint' => $lang->story->viewTypeList['tree']
  39. ))
  40. )))
  41. );
  42. $canBatchEdit = common::hasPriv('epic', 'batchEdit');
  43. $canBatchReview = common::hasPriv('epic', 'batchReview');
  44. $canBatchAssignTo = common::hasPriv('epic', 'batchAssignTo');
  45. $canBatchClose = common::hasPriv('epic', 'batchClose');
  46. $canBatchAction = $canBatchEdit || $canBatchReview || $canBatchAssignTo || $canBatchClose;
  47. $reviewItems = array();
  48. if($canBatchReview)
  49. {
  50. $rejectItems = array();
  51. foreach($lang->story->reasonList as $key => $reason)
  52. {
  53. if(!$key || $key == 'subdivided' || $key == 'duplicate') continue;
  54. $rejectItems[] = array('text' => $reason, 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('epic', 'batchReview', "result=reject&reason={$key}&storyType=epic"));
  55. }
  56. foreach($lang->story->reviewResultList as $key => $result)
  57. {
  58. if(!$key || $key == 'revert') continue;
  59. if($key == 'reject')
  60. {
  61. $reviewItems[] = array('text' => $result, 'class' => 'not-hide-menu', 'items' => $rejectItems);
  62. }
  63. else
  64. {
  65. $reviewItems[] = array('text' => $result, 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('epic', 'batchReview', "result={$key}&reason=&storyType=epic"));
  66. }
  67. }
  68. }
  69. $assignedToItems = array();
  70. if($canBatchAssignTo)
  71. {
  72. $pinyinItems = common::convert2Pinyin($users);
  73. foreach($users as $key => $value)
  74. {
  75. if(empty($key) || $key == 'closed') continue;
  76. $assignedToItems[] = array('text' => $value, 'keys' => zget($pinyinItems, $value, ''), 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('epic', 'batchAssignTo', "storyType=epic&assignedTo={$key}"));
  77. }
  78. }
  79. $footToolbar = array('items' => array
  80. (
  81. $canBatchEdit ? array('text' => $lang->edit, 'className' => 'batch-btn', 'data-url' => helper::createLink('epic', 'batchEdit', "productID=0&executionID=0&branch=0&storyType=epic&from={$app->rawMethod}")) : null,
  82. $canBatchReview ? array('caret' => 'up', 'text' => $lang->story->review, 'type' => 'dropdown', 'items' => $reviewItems, 'data-placement' => 'top-start') : null,
  83. $canBatchAssignTo ? array('caret' => 'up', 'text' => $lang->story->assignedTo, 'type' => 'dropdown', 'items' => $assignedToItems, 'data-placement' => 'top-start', 'data-menu' => array('searchBox' => true)) : null,
  84. $canBatchClose ? array('text' => $lang->story->close, 'className' => 'batch-btn', 'data-url' => helper::createLink('epic', 'batchClose', "productID=0&executionID=0&storyType=epic&from={$app->rawMethod}")) : null
  85. ), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary'));
  86. if($canBatchAction) $config->my->epic->dtable->fieldList['id']['type'] = 'checkID';
  87. $stories = initTableData($stories, $config->my->epic->dtable->fieldList, $this->story);
  88. foreach($stories as $id => $story)
  89. {
  90. if(!isset($story->actions)) continue;
  91. foreach($story->actions as $key => $action)
  92. {
  93. if(!empty($story->frozen) && in_array($action['name'], array('edit', 'change'))) $stories[$id]->actions[$key]['hint'] = sprintf($lang->story->frozenTip, $lang->story->{$action['name']});
  94. }
  95. }
  96. if($viewType == 'tiled') $config->my->epic->dtable->fieldList['title']['nestedToggle'] = false;
  97. $cols = array_values($config->my->epic->dtable->fieldList);
  98. $data = array_values($stories);
  99. dtable
  100. (
  101. set::cols($cols),
  102. set::data($data),
  103. set::userMap($users),
  104. set::fixedLeftWidth('44%'),
  105. set::checkable($canBatchAction ? true : false),
  106. set::onRenderCell(jsRaw('window.renderCell')),
  107. set::orderBy($orderBy),
  108. set::sortLink(createLink('my', $app->rawMethod, "mode={$mode}&type={$type}&param={$param}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  109. set::footToolbar($footToolbar),
  110. set::footPager(usePager()),
  111. set::emptyTip(sprintf($lang->my->noData, $lang->ERCommon))
  112. );
  113. render();