execution.excel.html.hook.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace zin;
  3. global $app, $config;
  4. if($config->vision == 'lite') return;
  5. $lang = data('lang');
  6. $project = data('project');
  7. $projectID = data('projectID');
  8. $productID = data('productID');
  9. $isStage = data('isStage');
  10. $orderBy = data('orderBy');
  11. $status = data('status');
  12. $stageMode = array('waterfall', 'waterfallplus', 'ipd');
  13. $createLink = $isStage ? createLink('programplan', 'create', "projectID={$projectID}&productID={$productID}") : createLink('execution', 'create', "projectID={$projectID}");
  14. $canModifyProject = common::canModify('project', $project);
  15. $exportItems = array();
  16. if(hasPriv('execution', 'export')) $exportItems[] = array('text' => $lang->export, 'data-toggle' => 'modal', 'data-size' => 'sm', 'url' => createLink('execution', 'export', "status={$status}&productID={$productID}&orderBy={$orderBy}&from=project"));
  17. if(hasPriv('programplan', 'exportTemplate') && in_array($project->model, $stageMode)) $exportItems[] = array('text' => $lang->programplan->exportTemplate, 'data-toggle' => 'modal', 'data-size' => 'sm', 'url' => createLink('programplan', 'exportTemplate', "projectID={$projectID}"));
  18. $toolbar = toolbar
  19. (
  20. in_array($project->model, array('waterfall', 'waterfallplus', 'ipd')) && in_array($config->edition, array('max', 'ipd')) ? btnGroup
  21. (
  22. a(setClass('btn square'), icon('gantt-alt'), set::title($lang->programplan->gantt), set::href(createLink('programplan', 'browse', "projectID=$projectID&productID=$productID&type=gantt"))),
  23. a(setClass('btn square text-primary'), icon('list'), set::title($lang->project->bylist))
  24. ) : null,
  25. $exportItems ? dropdown
  26. (
  27. btn(set::type('link'), setClass('no-underline'), set::icon('export'), $lang->export),
  28. set::items($exportItems),
  29. set::placement('bottom-end')
  30. ) : null,
  31. $canModifyProject && hasPriv('programplan', 'import') && in_array($project->model, $stageMode) ? item(set(array
  32. (
  33. 'icon' => 'import',
  34. 'text' => $lang->programplan->importTask,
  35. 'class' => "no-underline btn btn-link",
  36. 'data-toggle' => 'modal',
  37. 'data-size' => 'sm',
  38. 'url' => createLink('programplan', 'import', "projectID={$projectID}")
  39. ))) : null,
  40. $canModifyProject && hasPriv('programplan', 'create') && $isStage && empty($product->deleted) ? item(set(array
  41. (
  42. 'icon' => 'plus',
  43. 'text' => $lang->programplan->create,
  44. 'class' => "primary create-execution-btn",
  45. 'url' => $createLink
  46. ))) : null,
  47. $canModifyProject && hasPriv('execution', 'create') && !$isStage && $project->model != 'agileplus' ? item(set(array
  48. (
  49. 'icon' => 'plus',
  50. 'text' => $isStage ? $lang->programplan->create : $lang->execution->create,
  51. 'class' => "primary create-execution-btn",
  52. 'url' => $createLink
  53. ))) : null,
  54. $canModifyProject && hasPriv('execution', 'create') && !$isStage && $project->model == 'agileplus' ? btngroup(
  55. setClass('create-execution-btn'),
  56. btn(setClass('btn primary'), set::icon('plus'), set::url($createLink), $lang->execution->create),
  57. dropdown
  58. (
  59. btn(setClass('btn primary dropdown-toggle'),
  60. setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
  61. set::items
  62. (
  63. array('text' => $lang->execution->create, 'url' => $createLink),
  64. array('text' => $lang->project->createKanban, 'url' => createLink('execution', 'create', "projectID={$projectID}&executionID=0&copyExecutionID=&planID=0&confirm=no&productID=0&extra=type=kanban"))
  65. ),
  66. set::placement('bottom-end')
  67. )
  68. ) : null
  69. );
  70. query('#actionBar')->replaceWith($toolbar);
  71. pageJS('$(function(){$("#mainMenu .toolbar").prop("id", "actionBar"); });');