view.max.html.hook.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace zin;
  3. global $lang;
  4. $task = data('task');
  5. if($task->joint)
  6. {
  7. $stories = data('stories') ? data('stories') : array();
  8. $products = data('products');
  9. $executions = data('executions');
  10. $builds = data('builds');
  11. $linkedStories = array();
  12. $linkedStories[] = section
  13. (
  14. set::title($lang->testtask->linkedStories),
  15. div($lang->SRCommon, ":", !empty($stories) ? a(set::href('javascript:;'), setData(array('toggle' => 'modal', 'target' => '#storyList', 'size' => 'lg')), count($stories)) : 0, $lang->testtask->unit)
  16. );
  17. $storyCols = array();
  18. $storyCols[] = array('name' => 'id', 'title' => $lang->story->id, 'type' => 'id', 'fixed' => 'left', 'sortType' => false);
  19. $storyCols[] = array('name' => 'title', 'title' => $lang->story->title, 'type' => 'title', 'fixed' => 'left', 'link' => array('module' => 'story', 'method' => 'view', 'params' => "storyID={id}"), 'sortType' => false);
  20. $storyCols[] = array('name' => 'pri', 'title' => $lang->story->pri, 'type' => 'pri', 'priList' => $lang->story->priList, 'sortType' => false);
  21. $storyCols[] = array('name' => 'openedBy', 'title' => $lang->story->openedBy, 'type' => 'user', 'sortType' => false);
  22. $storyCols[] = array('name' => 'assignedTo', 'title' => $lang->story->assignedTo, 'type' => 'user', 'sortType' => false);
  23. $storyCols[] = array('name' => 'estimate', 'title' => $lang->story->estimate, 'type' => 'number', 'sortType' => false);
  24. $storyCols[] = array('name' => 'status', 'title' => $lang->story->status, 'type' => 'status', 'sortType' => false, 'statusMap' => $lang->story->statusList);
  25. $linkedStories[] = modal
  26. (
  27. setID('storyList'),
  28. set::title($lang->SRCommon),
  29. dtable
  30. (
  31. set::cols(array_values($storyCols)),
  32. set::data(array_values($stories)),
  33. set::userMap(data('users'))
  34. )
  35. );
  36. query('#descBox')->after($linkedStories);
  37. $productBox = array();
  38. $executionBox = array();
  39. $buildBox = array();
  40. foreach($products as $productID => $productName) $productBox[] = div(a(set::href(createLink('product', 'view', "productID={$productID}")), set::title($productName), $productName));
  41. foreach($executions as $executionID => $executionName) $executionBox[] = div(a(set::href(createLink('execution', 'story', "executionID={$executionID}")), set::title($executionName), $executionName));
  42. foreach($builds as $buildID => $buildName) $buildBox[] = div(a(set::href(createLink('build', 'view', "buildID={$buildID}")), set::title($buildName), $buildName));
  43. query('#buildText')->closest('tbody')->prepend(h::tr(h::th(setClass('py-1.5 pr-2 font-normal nowrap text-right'), $lang->testtask->product), h::td(setClass('py-1.5 pl-2 w-full'), $productBox)));
  44. query('#executionText')->empty()->after($executionBox);
  45. query('#buildText')->empty()->after($buildBox);
  46. }