browse.html.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * The browse view file of design 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 Shujie Tian<tianshujie@easycorp.ltd>
  7. * @package design
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('+type', strtolower($type));
  12. jsVar('projectID', $projectID);
  13. jsVar('productID', $productID);
  14. /* zin: Define the set::module('design') feature bar on main menu. */
  15. featureBar
  16. (
  17. li(searchToggle(set::open($type == 'bySearch')))
  18. );
  19. /* zin: Define the toolbar on main menu. */
  20. $canBeChanged = common::canModify('project', $project);
  21. $canCreate = $canBeChanged && hasPriv('design', 'create');
  22. $canBatchCreate = $canBeChanged && hasPriv('design', 'batchCreate');
  23. $createItem = array('text' => $lang->design->create, 'url' => helper::createLink('design', 'create', "projectID={$projectID}&productID={$productID}&type={$type}"));
  24. $batchCreateItem = array('text' => $lang->design->batchCreate, 'url' => helper::createLink('design', 'batchCreate', "projectID={$projectID}&productID={$productID}&type={$type}"));
  25. toolbar
  26. (
  27. $canCreate && $canBatchCreate ? btnGroup
  28. (
  29. btn(setClass('btn primary design-create-btn'), set::icon('plus'), set::url($createItem['url']), $lang->design->create),
  30. dropdown
  31. (
  32. btn(setClass('btn primary dropdown-toggle'),
  33. setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
  34. set::items(array_filter(array($createItem, $batchCreateItem))),
  35. set::placement('bottom-end')
  36. )
  37. ) : null,
  38. $canCreate && !$canBatchCreate ? item(set($createItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null,
  39. $canBatchCreate && !$canCreate ? item(set($batchCreateItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null
  40. );
  41. jsVar('confirmDelete', $lang->design->confirmDelete);
  42. $tableData = initTableData($designs, $config->design->dtable->fieldList, $this->design);
  43. foreach($tableData as $design)
  44. {
  45. if(!isset($design->actions)) continue;
  46. foreach($design->actions as &$action)
  47. {
  48. $actionName = $action['name'];
  49. if(!empty($design->frozen) && in_array($actionName, array('edit', 'delete'))) $action['hint'] = sprintf($this->lang->design->frozenTip, $this->lang->design->$actionName);
  50. }
  51. }
  52. dtable
  53. (
  54. set::userMap($users),
  55. set::cols($config->design->dtable->fieldList),
  56. set::data($tableData),
  57. set::orderBy($orderBy),
  58. set::sortLink(createLink('design', 'browse', "projectID={$projectID}&productID={$productID}&type={$type}&param={$param}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  59. set::footPager(
  60. usePager()
  61. )
  62. );
  63. /* ====== Render page ====== */
  64. render();