browse.html.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * The browse view file of trainplan 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 trainplan
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $cols = $config->trainplan->dtable->fieldList;
  12. $trainplans = initTableData($trainplans, $cols, $this->trainplan);
  13. $cols['trainee']['map'] = $users;
  14. featureBar
  15. (
  16. set::current($browseType),
  17. set::linkParams("projectID={$projectID}&browseType={key}&param=" . ($browseType == 'bysearch' ? 0 : $param)),
  18. li(searchToggle(set::open($browseType == 'bysearch')))
  19. );
  20. $canModify = common::canModify('project', $project);
  21. $canCreate = hasPriv('trainplan', 'create') && $canModify;
  22. $canBatchCreate = hasPriv('trainplan', 'batchCreate') && $canModify;
  23. $createLink = createLink('trainplan', 'create', "projectID={$projectID}");
  24. $batchCreateLink = createLink('trainplan', 'batchCreate', "project={$projectID}");
  25. $createItem = array('text' => $lang->trainplan->create, 'url' => $createLink, 'data-toggle' => 'modal', 'data-size' => 'sm');
  26. $batchCreateItem = array('text' => $lang->trainplan->batchCreate, 'url' => $batchCreateLink);
  27. $canBatchEdit = hasPriv('trainplan', 'batchEdit') && $canModify;
  28. $canBatchFinish = hasPriv('trainplan', 'batchFinish') && $canModify;
  29. toolbar
  30. (
  31. $canCreate && $canBatchCreate ? btngroup
  32. (
  33. btn(setClass('btn primary create-activity-btn'), set::icon('plus'), set::url($createLink), $lang->trainplan->create, setData(array('toggle' => 'modal', 'size' => 'sm'))),
  34. dropdown
  35. (
  36. btn(setClass('btn primary dropdown-toggle'), setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
  37. set::items(array($createItem, $batchCreateItem)),
  38. set::placement('bottom-end')
  39. )
  40. ) : null,
  41. $canCreate && !$canBatchCreate ? item(set($createItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null,
  42. $canBatchCreate && !$canCreate ? item(set($batchCreateItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null
  43. );
  44. $footToolbar = array();
  45. if($canBatchEdit) $footToolbar['items'][] = array('text' => $lang->edit, 'className' => 'primary batch-btn', 'data-url' => createLink('trainplan', 'batchEdit', "projectID={$projectID}"));
  46. if($canBatchFinish) $footToolbar['items'][] = array('text' => $lang->trainplan->finish, 'className' => 'primary batch-btn ajax-btn', 'data-url' => createLink('trainplan', 'batchFinish', "projectID={$projectID}"));
  47. dtable
  48. (
  49. set::id('trainplan'),
  50. set::checkable($canBatchEdit || $canBatchCheck ? true : false),
  51. set::data($trainplans),
  52. set::cols($cols),
  53. set::userMap($users),
  54. set::sortLink(inlink('browse', "projectID={$projectID}&browseType={$browseType}&param={$param}&orderBy={name}_{sortType}")),
  55. set::footToolbar($footToolbar),
  56. set::footPager(usePager())
  57. );