testtask.html.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /**
  3. * The testtask view file of execution 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 execution
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('allTasks', $lang->testtask->allTasks);
  12. jsVar('pageSummary', sprintf($lang->testtask->allSummary, count($tasks), $waitCount, $testingCount, $blockedCount, $doneCount));
  13. jsVar('checkedAllSummary', $lang->testtask->checkedAllSummary);
  14. $productItems[] = array('text' => $lang->testtask->all, 'url' => createLink('execution', 'testtask', array('executionID' => $executionID)));
  15. foreach($products as $currentProductID => $productName)
  16. {
  17. $productItems[] = array('text' => $productName, 'url' => createLink('execution', 'testtask', array('executionID' => $executionID, 'productID' => $currentProductID)));
  18. }
  19. $productDropdown = dropdown
  20. (
  21. to('trigger', btn($productID ? zget($products, $productID) : $lang->testtask->all, setClass('ghost'))),
  22. set::items($productItems)
  23. );
  24. featureBar
  25. (
  26. li
  27. (
  28. setClass('nav-item'),
  29. a
  30. (
  31. set('class', 'active'),
  32. $lang->testtask->browse
  33. )
  34. ),
  35. to::before($productDropdown)
  36. );
  37. $canCreate = $canBeChanged && hasPriv('testtask', 'create');
  38. toolbar
  39. (
  40. $canCreate ? btn
  41. (
  42. setClass('btn primary'),
  43. set::icon('plus'),
  44. set::url(createLink('testtask', 'create', "product=0&executionID=$executionID&build=0&projectID=$execution->project")),
  45. set('data-app', $app->tab),
  46. $lang->testtask->create
  47. ) : null
  48. );
  49. foreach($tasks as $id => $task) $tasks[$id]->taskID = $task->id;
  50. $tasks = initTableData(array_values($tasks), $config->execution->testtask->dtable->fieldList, $this->testtask);
  51. $footToolbar = array();
  52. if($canBeChanged and common::hasPriv('testreport', 'browse'))
  53. {
  54. $footToolbar = array('items' => array
  55. (
  56. array('text' => $lang->testreport->common, 'className' => 'batch-btn', 'data-url' => createLink('execution', 'testreport', "objectID=$executionID&objctType=execution"))
  57. ), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary'));
  58. }
  59. dtable
  60. (
  61. set::id('taskTable'),
  62. set::userMap($users),
  63. set::cols($config->execution->testtask->dtable->fieldList),
  64. set::data($tasks),
  65. set::plugins(array('cellspan')),
  66. set::onRenderCell(jsRaw('window.onRenderCell')),
  67. set::orderBy($orderBy),
  68. set::sortLink(createLink('execution', 'testtask', "executionID={$execution->id}&productID={$productID}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&page={$pager->pageID}")),
  69. set::getCellSpan(jsRaw('window.getCellSpan')),
  70. set::footToolbar($footToolbar),
  71. set::footPager(usePager(array
  72. (
  73. 'recPerPage' => $pager->recPerPage,
  74. 'recTotal' => $pager->recTotal,
  75. 'linkCreator' => helper::createLink('execution', 'testtask', "executionID={$execution->id}&productID={$productID}&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={recPerPage}&page={page}")
  76. ))),
  77. set::checkInfo(jsRaw('function(checkedIDList){return window.setStatistics(this, checkedIDList);}')),
  78. set::emptyTip($lang->testtask->noTesttask),
  79. set::createTip($lang->testtask->create),
  80. set::createLink($canCreate ? createLink('testtask', 'create', "product=0&executionID=$executionID&build=0&projectID=$execution->project") : '')
  81. );