relation.html.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * The relation view file of execution module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2024 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license business(商业软件)
  7. * @author Qiyu Xie <xieqiyu@chandao.com>
  8. * @package execution
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. jsVar('typeHintList', $lang->execution->relation->typeHintList);
  13. jsVar('confirmBatchDelete', $lang->execution->gantt->confirmBatchDelete);
  14. featureBar(set::current('all'), set::linkParams('executionID=' . ($executionID ? $executionID : $projectID)));
  15. toolbar
  16. (
  17. common::hasPriv($app->rawModule, 'createRelation') ? btn
  18. (
  19. setClass('btn secondary'),
  20. set::icon('plus'),
  21. set::url($this->createLink($app->rawModule, 'createRelation', "projectID=$projectID&executionID=$executionID")),
  22. setData(array('app' => $this->app->tab)),
  23. $lang->execution->createRelation
  24. ) : null,
  25. common::hasPriv('task', 'create') && !$isLimited && !empty($executionID) ? btn
  26. (
  27. setClass('btn primary'),
  28. set::icon('plus'),
  29. set::url($this->createLink('task', 'create', "execution=$executionID")),
  30. setData(array('toggle' => 'modal', 'size' => 'lg')),
  31. $lang->task->create
  32. ) : null
  33. );
  34. $cols = $this->loadModel('datatable')->getSetting('execution');
  35. $cols['actions']['list']['edit']['url'] = array('module' => $app->rawModule, 'method' => 'editRelation', 'params' => "relationID={id}&projectID=$projectID&executionID=$executionID");
  36. $cols['actions']['list']['delete']['url'] = array('module' => $app->rawModule, 'method' => 'deleteRelation', 'params' => "relationID={id}&projectID=$projectID&executionID=$executionID");
  37. $cols['task']['map'] = $tasks;
  38. $cols['pretask']['map'] = $tasks;
  39. $relations = initTableData($relations, $cols, $this->loadModel($app->rawModule));
  40. $canBatchEdit = common::hasPriv($app->rawModule, 'batchEditRelation');
  41. $canBatchDelete = common::hasPriv($app->rawModule, 'batchDeleteRelation');
  42. $canBatchAction = $canBatchEdit || $canBatchDelete;
  43. $footToolbar = array();
  44. if($canBatchAction)
  45. {
  46. $footToolbar['items'] = array();
  47. if($canBatchEdit) $footToolbar['items'][] = array('text' => $lang->execution->maintain, 'className' => 'batch-btn', 'btnType' => 'secondary', 'data-url' => createLink($app->rawModule, 'batchEditRelation', "projectID=$projectID&executionID=$executionID"));
  48. if($canBatchDelete) $footToolbar['items'][] = array('text' => $lang->delete, 'className' => 'batch-btn batchDeleteBtn', 'btnType' => 'secondary', 'data-url' => createLink($app->rawModule, 'batchDeleteRelation', "projectID=$projectID&executionID=$executionID"));
  49. }
  50. dtable
  51. (
  52. set::cols($cols),
  53. set::data(array_values($relations)),
  54. set::onRenderCell(jsRaw('window.renderCell')),
  55. set::footPager(usePager(array
  56. (
  57. 'recPerPage' => $pager->recPerPage,
  58. 'recTotal' => $pager->recTotal,
  59. 'linkCreator' => helper::createLink($app->rawModule, 'relation', "executionID=" . ($executionID ? $executionID : $projectID) . "&recTotal={$pager->recTotal}&recPerPage={recPerPage}&page={page}")
  60. ))),
  61. set::checkable($canBatchAction),
  62. set::footToolbar($footToolbar),
  63. on::click('.batch-btn')->call('handleBatchBtnClick', jsRaw('this'))
  64. );