bug.report.html.hook.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace zin;
  3. global $app;
  4. $lang = data('lang');
  5. $execution = data('execution');
  6. $moduleID = data('moduleID');
  7. $browseType = data('browseType');
  8. $param = data('param');
  9. $productID = data('productID');
  10. $defaultProduct = data('defaultProduct');
  11. $canExportBug = hasPriv('bug', 'export');
  12. $canCreateBug = hasPriv('bug', 'create') && common::canModify('execution', $execution);
  13. if($canExportBug) $exportItem = array
  14. (
  15. 'icon' => 'export',
  16. 'class' => 'ghost',
  17. 'text' => $lang->export,
  18. 'data-toggle' => 'modal',
  19. 'url' => createLink('bug', 'export', "productID={$productID}&browseType=&executionID={$execution->id}")
  20. );
  21. if($canCreateBug) $createItem = array
  22. (
  23. 'icon' => 'plus',
  24. 'class' => 'primary createBug-btn',
  25. 'text' => $lang->bug->create,
  26. 'data-app' => 'execution',
  27. 'url' => createLink('bug', 'create', "productID={$defaultProduct}&branch=0&extras=executionID={$execution->id},moduleID={$moduleID}")
  28. );
  29. $toolbar = toolbar
  30. (
  31. hasPriv('execution', 'reportBug') ? item(set(array
  32. (
  33. 'icon' => 'bar-chart',
  34. 'class' => 'ghost',
  35. 'hint' => $lang->bug->report->common,
  36. 'data-app' => 'execution',
  37. 'url' => createLink('execution', 'reportbug', "executionID={$execution->id}")
  38. ))) : null,
  39. !empty($canExportBug) ? item(set($exportItem)) : null,
  40. !empty($createItem) ? item(set($createItem)) : null
  41. );
  42. query('#actionBar')->replaceWith($toolbar);
  43. pageJS('$(function(){$("#mainMenu .toolbar").prop("id", "actionBar"); });');