testtask.html.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * The testtask view file of user 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 Wang Yidong <yidong@easycorp.ltd>
  7. * @package user
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. include './featurebar.html.php';
  12. jsVar('trunkLang', $lang->trunk);
  13. $that = zget($lang->user->thirdPerson, $user->gender);
  14. $testtaskNavs['assignedTo'] = array('text' => sprintf($lang->user->testTask2Him, $that), 'url' => inlink('testtask', "userID={$user->id}&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"), 'load' => 'table', 'active' => true);
  15. $cols = array();
  16. foreach($config->user->defaultFields['testtask'] as $field) $cols[$field] = $config->testtask->dtable->fieldList[$field];
  17. $statusKey = 'status';
  18. $titleKey = 'pri';
  19. $statusValue = $cols[$statusKey];
  20. $statusValue['title'] = $lang->testtask->statusAB;
  21. unset($cols[$statusKey]);
  22. $titleIndex = array_search($titleKey, array_keys($cols)) + 1;
  23. $cols = array_merge(array_slice($cols, 0, $titleIndex), array($statusKey => $statusValue), array_slice($cols, $titleIndex));
  24. $cols['id']['checkbox'] = false;
  25. $cols['name']['data-app'] = 'qa';
  26. $cols = array_map(function($col)
  27. {
  28. unset($col['fixed'], $col['group']);
  29. return $col;
  30. }, $cols);
  31. $waitCount = 0;
  32. $testingCount = 0;
  33. $blockedCount = 0;
  34. $doneCount = 0;
  35. foreach($tasks as $task)
  36. {
  37. if($task->status == 'wait') $waitCount ++;
  38. if($task->status == 'doing') $testingCount ++;
  39. if($task->status == 'blocked') $blockedCount ++;
  40. if($task->status == 'done') $doneCount ++;
  41. }
  42. $summary = sprintf($lang->testtask->allSummary, count($tasks), $waitCount, $testingCount, $blockedCount, $doneCount);
  43. div
  44. (
  45. setClass('shadow-sm rounded canvas'),
  46. nav
  47. (
  48. setClass('dtable-sub-nav py-1'),
  49. set::items($testtaskNavs)
  50. ),
  51. dtable
  52. (
  53. set::_className('shadown-none'),
  54. set::extraHeight('+.dtable-sub-nav'),
  55. set::bordered(true),
  56. set::cols($cols),
  57. set::data(array_values($tasks)),
  58. set::orderBy($orderBy),
  59. set::sortLink(inlink('testtask', "userID={$user->id}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  60. set::footPager(usePager()),
  61. set::onRenderCell(jsRaw('window.renderCell')),
  62. set::footer(array(array('html' => $summary, 'className' => "text-dark"), 'flex', 'pager'))
  63. )
  64. );
  65. render();