browse.html.php 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /**
  3. * The browse view file of auditplan module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Yuting Wang <wangyuting@easycorp.ltd>
  7. * @package auditplan
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $app->loadLang('activity');
  12. $cols = $this->loadModel('datatable')->getSetting('auditplan');
  13. if(!empty($cols['execution'])) $cols['execution']['map'] = $executions;
  14. $auditplans = initTableData($auditplans, $cols, $this->auditplan);
  15. foreach($auditplans as $auditplan)
  16. {
  17. foreach($auditplan->actions as $index => $action)
  18. {
  19. if($action['name'] == 'createNc')
  20. {
  21. $action['disabled'] = true;
  22. if(hasPriv('nc', 'create') && $auditplan->status == 'wait' && $browseType != 'iscycle' && $auditplan->objectType != 'zoutput') $action['disabled'] = false;
  23. $auditplan->actions[$index] = $action;
  24. }
  25. }
  26. }
  27. $canModify = common::canModify('project', $project);
  28. $canCreate = hasPriv('auditplan', 'create') && $canModify;
  29. $canBatchCreate = hasPriv('auditplan', 'batchCreate') && $canModify;
  30. $createLink = createLink('auditplan', 'create', "projectID={$projectID}") . "#app={$app->tab}";
  31. $batchCreateLink = createLink('auditplan', 'batchCreate', "projectID={$projectID}") . "#app={$app->tab}";
  32. $createItem = array('text' => $lang->auditplan->create, 'url' => $createLink, 'data-toggle' => 'modal');
  33. $batchCreateItem = array('text' => $lang->auditplan->batchCreate, 'url' => $batchCreateLink);
  34. $canBatchEdit = hasPriv('auditplan', 'batchEdit') && $canModify;
  35. $canBatchCheck = hasPriv('auditplan', 'batchCheck') && $canModify;
  36. $queryMenuLink = inlink('browse', "projectID={$projectID}&browseType=bysearch&param={queryID}");
  37. featureBar
  38. (
  39. set::current($browseType),
  40. set::linkParams("projectID={$projectID}&browseType={key}&param=" . ($browseType == 'bysearch' ? 0 : $param)),
  41. set::queryMenuLinkCallback(array(function ($key) use ($queryMenuLink) {
  42. return str_replace('{queryID}', (string)$key, $queryMenuLink);
  43. })),
  44. li(searchToggle(set::open($browseType == 'bysearch')))
  45. );
  46. toolbar
  47. (
  48. $canCreate && $canBatchCreate ? btngroup
  49. (
  50. btn(setClass('btn primary create-activity-btn'), set::icon('plus'), set::url($createLink), $lang->auditplan->create, setData(array('toggle' => 'modal'))),
  51. dropdown
  52. (
  53. btn(setClass('btn primary dropdown-toggle'), setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
  54. set::items(array($createItem, $batchCreateItem)),
  55. set::placement('bottom-end')
  56. )
  57. ) : null,
  58. $canCreate && !$canBatchCreate ? item(set($createItem + array('class' => 'btn primary', 'icon' => 'plus', 'data-toggle' => 'modal'))) : null,
  59. $canBatchCreate && !$canCreate ? item(set($batchCreateItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null
  60. );
  61. $footToolbar = array();
  62. if($canBatchEdit) $footToolbar['items'][] = array('text' => $lang->edit, 'className' => 'primary batch-btn', 'data-url' => createLink('auditplan', 'batchEdit', "projectID={$projectID}"));
  63. if($canBatchCheck) $footToolbar['items'][] = array('text' => $lang->auditplan->batchCheck, 'className' => 'primary batch-btn', 'data-url' => createLink('auditplan', 'batchCheck', "projectID={$projectID}"));
  64. sidebar
  65. (
  66. moduleMenu
  67. (
  68. set::modules($moduleTree),
  69. set::activeKey($moduleID),
  70. set::allText($lang->activity->allProcesses),
  71. set::settingLink(''),
  72. set::showDisplay(false),
  73. set::closeLink(createLink('auditplan', 'browse', "projectID={$projectID}&browseType={$browseType}")),
  74. set::app($app->tab)
  75. )
  76. );
  77. dtable
  78. (
  79. set::id('auditplan'),
  80. set::customCols(true),
  81. set::checkable($canBatchEdit || $canBatchCheck ? true : false),
  82. set::data($auditplans),
  83. set::cols($cols),
  84. set::userMap($users),
  85. set::sortLink(inlink('browse', "projectID={$projectID}&browseType={$browseType}&param={$param}&orderBy={name}_{sortType}")),
  86. set::onRenderCell(jsRaw('window.onRenderCell')),
  87. set::footToolbar($footToolbar),
  88. set::footPager(usePager())
  89. );