testtask.max.html.hook.php 1.5 KB

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