browse.html.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * The browse view file of demand module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2024 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Yuting Wang <wangyuting@easycorp.ltd>
  8. * @package demand
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. $canExport = hasPriv('demand', 'export');
  13. $canExportTemplate = hasPriv('demand', 'exportTemplate');
  14. $canCreate = hasPriv('demand', 'create');
  15. $canBatchCreate = hasPriv('demand', 'batchCreate');
  16. $exportItem = array('text' => $lang->demand->export, 'data-toggle' => 'modal', 'data-size' => 'sm','url' => createLink('demand', 'export', "poolID={$poolID}&orderBy={$orderBy}"));
  17. $exportTemplateItem = array('text' => $lang->demand->exportTemplate, 'data-toggle' => 'modal', 'data-size' => 'sm','url' => createLink('demand', 'exportTemplate', "poolID={$poolID}"));
  18. $createItem = array('text' => $lang->demand->create, 'url' => createLink('demand', 'create', "poolID={$poolID}"));
  19. $batchCreateItem = array('text' => $lang->demand->batchCreate, 'url' => createLink('demand', 'batchCreate', "poolID={$poolID}"));
  20. $cols = $this->loadModel('datatable')->getSetting('demand');
  21. $cols['product']['map'] = $products + array('' => $lang->demand->undetermined);
  22. $cols['mailto']['map'] = $users;
  23. $cols['reviewedBy']['map'] = $users;
  24. $demands = initTableData($demands, $cols, $this->demand);
  25. $linkParams = '';
  26. foreach($app->rawParams as $key => $value) $linkParams = $key != 'orderBy' ? "{$linkParams}&{$key}={$value}" : "{$linkParams}&orderBy={name}_{sortType}";
  27. featureBar
  28. (
  29. set::current($browseType),
  30. set::linkParams("poolID={$poolID}&browseType={key}&param=&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"),
  31. li(searchToggle(set::open($browseType == 'bysearch')))
  32. );
  33. toolbar
  34. (
  35. $canExport && $canExportTemplate ? dropdown
  36. (
  37. btn
  38. (
  39. setClass('btn ghost dropdown-toggle'),
  40. set::icon('export'),
  41. $lang->export
  42. ),
  43. set::items(array($exportItem, $exportTemplateItem)),
  44. set::placement('bottom-end')
  45. ) : null,
  46. $canExport && !$canExportTemplate ? item(set($exportItem + array('class' => 'btn ghost', 'icon' => 'export'))) : null,
  47. $canExportTemplate && !$canExport ? item(set($exportTemplateItem + array('class' => 'btn ghost', 'icon' => 'export'))) : null,
  48. hasPriv('demand', 'import') ? item
  49. (
  50. setClass('ghost'),
  51. set::icon('import'),
  52. set::url(createLink('demand', 'import', "poolID={$poolID}")),
  53. setData(array('toggle' => 'modal')),
  54. set::text($lang->demand->import)
  55. ) : null,
  56. $canCreate && $canBatchCreate ? btngroup
  57. (
  58. btn(setClass('btn primary create-demand-btn'), set::icon('plus'), set::url(createLink('demand', 'create', "poolID={$poolID}")), $lang->demand->create),
  59. dropdown
  60. (
  61. btn(setClass('btn primary dropdown-toggle'), setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
  62. set::items(array($createItem, $batchCreateItem)),
  63. set::placement('bottom-end')
  64. )
  65. ) : null,
  66. $canCreate && !$canBatchCreate ? item(set($createItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null,
  67. $canBatchCreate && !$canCreate ? item(set($batchCreateItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null
  68. );
  69. jsVar('recall', $lang->demand->recall);
  70. jsVar('recallChange', $lang->demand->recallChange);
  71. jsVar('childrenAB', $lang->demand->childrenAB);
  72. dtable
  73. (
  74. set::cols($cols),
  75. set::data($demands),
  76. set::customCols(true),
  77. set::checkable($canExport),
  78. set::userMap($users),
  79. set::orderBy($orderBy),
  80. set::sortLink(createLink($app->rawModule, $app->rawMethod, $linkParams)),
  81. set::onRenderCell(jsRaw('window.onRenderCell')),
  82. set::footPager(usePager())
  83. );
  84. render();