stakeholder.html.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /**
  3. * The stakeholder view file of program 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 dingguodong <dingguodong@easycorp.ltd>
  7. * @package program
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. dropmenu();
  12. /* Feature bar. */
  13. featureBar
  14. (
  15. li
  16. (
  17. set::className('nav-item'),
  18. a
  19. (
  20. set::href(createLink('program', 'stakeholder', "proram={$programID}&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}")),
  21. setClass('active'),
  22. setData('app', $app->tab),
  23. $lang->program->stakeholder
  24. )
  25. )
  26. );
  27. /* Toolbar. */
  28. $createLink = $this->createLink('program', 'createstakeholder', "programID=$programID");
  29. if(hasPriv('program', 'createstakeholder')) toolbar(btn(setClass('btn primary'), set::icon('plus'), set::url($createLink), $lang->program->createStakeholder));
  30. /* Create datatable with reusing stakeholder module. */
  31. $this->loadModel('stakeholder');
  32. $role = array();
  33. $role['id'] = 'role';
  34. $role['title'] = $lang->user->role;
  35. $role['name'] = 'role';
  36. $role['type'] = 'text';
  37. $role['show'] = true;
  38. $fieldListKeys = array_keys($this->config->stakeholder->dtable->fieldList);
  39. array_splice($fieldListKeys, array_search('phone', array_keys($this->config->stakeholder->dtable->fieldList), true), 0, 'role');
  40. $fieldListExtend = array();
  41. foreach($fieldListKeys as $key)
  42. {
  43. if($key == 'role') $fieldListExtend[$key] = $role;
  44. else $fieldListExtend[$key] = $this->config->stakeholder->dtable->fieldList[$key];
  45. }
  46. $fieldListExtend['id']['type'] = 'checkID';
  47. $this->config->stakeholder->dtable->fieldList = $fieldListExtend;
  48. $cols = $this->loadModel('datatable')->getSetting('stakeholder');
  49. unset($cols['name']['link']);
  50. /* Set list and menu of actions to customize the actions of stakeholder in program module. */
  51. $cols['actions']['list'] = array('unlinkStakeholder' => array
  52. (
  53. 'icon' => 'unlink',
  54. 'className' => 'ajax-submit',
  55. 'text' => $lang->program->unlinkStakeholder,
  56. 'hint' => $lang->program->unlinkStakeholder,
  57. 'url' => array('module' => 'program', 'method' => 'unlinkStakeholder', 'params' => "programID={$programID}&id={id}"),
  58. 'data-confirm' => $lang->program->confirmUnlink
  59. ));
  60. $cols['actions']['menu'] = array('unlinkStakeholder');
  61. $data = initTableData($stakeholders, $cols, $this->stakeholder);
  62. foreach($data as $rowData)
  63. {
  64. $rowData->name = $rowData->realname;
  65. $rowData->from = $lang->stakeholder->fromList[$rowData->from];
  66. $rowData->role = $lang->user->roleList[$rowData->role];
  67. }
  68. jsVar('summeryTpl', $lang->program->checkedProjects);
  69. jsVar('confirmBatchUnlinkTip', $lang->program->confirmBatchUnlink);
  70. dtable
  71. (
  72. set::customCols(false),
  73. set::cols($cols),
  74. set::data($data),
  75. set::footPager(usePager()),
  76. set::checkable(true),
  77. set::orderBy($orderBy),
  78. set::sortLink(createLink('program', 'stakeholder', "programID={$programID}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  79. set::footToolbar(array
  80. (
  81. 'type' => 'btn-group',
  82. 'items' => array(array
  83. (
  84. 'text' => $lang->unlink,
  85. 'class' => 'btn primary batch-unlink',
  86. 'data-url' => createLink('program', 'batchUnlinkStakeholders', "programID={$programID}")
  87. ))
  88. ))
  89. );
  90. render();