testtaskblock.max.html.hook.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace zin;
  3. query('dtable')->each(function($node)
  4. {
  5. $node->setProp('key', 'testtask');
  6. $node->setProp('plugins', array('cellspan'));
  7. $node->setProp('getCellSpan', jsRaw('window.getCellSpan'));
  8. $node->setProp('onRenderCell', jsRaw('window.onRenderCell'));
  9. $data = $node->prop('data');
  10. $testtasks = array();
  11. foreach($data as $testtask)
  12. {
  13. if($testtask->joint && !empty($testtask->productGroup))
  14. {
  15. $trowspan = 0;
  16. foreach($testtask->productGroup as $builds) $trowspan += count($builds);
  17. $testtask->trowspan = $trowspan;
  18. foreach($testtask->productGroup as $builds)
  19. {
  20. $testtask->prowspan = count($builds);
  21. foreach($builds as $build)
  22. {
  23. $testtaskInfo = clone $testtask;
  24. $testtaskInfo->build = $build->id;
  25. $testtaskInfo->product = $build->product;
  26. $testtaskInfo->buildName = $build->name;
  27. $testtaskInfo->projectName = $build->projectName;
  28. $testtaskInfo->executionName = $build->executionName;
  29. $testtaskInfo->productName = $build->productName;
  30. $testtaskInfo->executionBuild = $build->executionName . '/' . $build->name;
  31. $testtasks[] = $testtaskInfo;
  32. }
  33. }
  34. }
  35. else
  36. {
  37. $testtasks[] = $testtask;
  38. }
  39. }
  40. $node->setProp('data', $testtasks);
  41. });