execution.html.php 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?php
  2. /**
  3. * The all view file of execution module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(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 Sun Guangming<sunguangming@easycorp.ltd>
  8. * @package execution
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. jsVar('status', $status);
  13. jsVar('projectID', $projectID);
  14. jsVar('orderBy', $orderBy);
  15. jsVar('productID', $productID);
  16. jsVar('typeList', $lang->execution->typeList);
  17. jsVar('delayed', $lang->execution->delayed);
  18. jsVar('delayWarning', $lang->task->delayWarning);
  19. jsVar('pageExecSummary', $lang->execution->pageExecSummary);
  20. jsVar('checkedExecSummary', $lang->execution->checkedExecSummary);
  21. jsVar('confirmCreateStage', $lang->project->confirmCreateStage);
  22. $searchTask = strtolower($status) == 'bysearch';
  23. $footToolbar = array();
  24. $canModify = common::canModify('project', $project);
  25. $canBatchEdit = hasPriv('execution', 'batchEdit');
  26. $canBatchChangeStatus = hasPriv('execution', 'batchChangeStatus');
  27. $canBatchAction = $canModify && ($canBatchEdit || $canBatchChangeStatus);
  28. if($canBatchAction)
  29. {
  30. if($canBatchEdit && empty($hasFrozenExecutions))
  31. {
  32. $footToolbar['items'][] = array
  33. (
  34. 'type' => 'btn-group',
  35. 'items' => array
  36. (
  37. array('text' => $lang->edit, 'className' => "secondary size-sm batch-btn", 'btnType' => 'primary', 'data-url' => createLink('execution', 'batchEdit')),
  38. )
  39. );
  40. }
  41. if($canBatchChangeStatus)
  42. {
  43. $statusItems = array();
  44. foreach($lang->execution->statusList as $key => $value)
  45. {
  46. $statusItems[] = array('text' => $value, 'innerClass' => 'batch-btn ajax-btn', 'data-url' => createLink('execution', 'batchChangeStatus', "status=$key"));
  47. }
  48. $footToolbar['items'][] = array('caret' => 'up', 'text' => $lang->statusAB, 'className' => 'btn btn-caret size-sm secondary', 'items' => $statusItems, 'type' => 'dropdown', 'data-placement' => 'top-start');
  49. }
  50. }
  51. /* Generate data table fields. */
  52. $fieldList = $config->project->execution->dtable->fieldList;
  53. $fieldList['status']['statusMap']['changed'] = $lang->task->storyChange;
  54. if(!empty($project->isTpl)) unset($fieldList['deliverable']);
  55. /* waterfall & waterfallplus & ipd model with different edit link. */
  56. if(in_array($project->model, array('waterfall', 'waterfallplus', 'ipd')))
  57. {
  58. $fieldList['actions']['actionsMap']['edit']['data-size'] = 'md';
  59. $fieldList['actions']['actionsMap']['edit']['url'] = createLink('programplan', 'edit', "stageID={rawID}&projectID={projectID}");
  60. $fieldList['actions']['actionsMap']['createChildStage']['url'] = 'javascript:confirmCreateStage({projectID}, {productID}, {rawID}, {hasChild});';
  61. }
  62. if(!$this->cookie->showStage && !$this->cookie->showTask)
  63. {
  64. $fieldList['nameCol']['type'] = 'title';
  65. if(!in_array($project->model, array('waterfall', 'waterfallplus', 'ipd'))) unset($fieldList['nameCol']['nestedToggle']);
  66. }
  67. if(!$project->hasProduct) unset($fieldList['productName']);
  68. $config->project->execution->dtable->fieldList = $fieldList;
  69. $fieldList = $this->loadModel('datatable')->getSetting('project', 'execution');
  70. $fieldList['nameCol']['name'] = 'nameCol';
  71. $fieldList['actions']['width'] = '160';
  72. foreach(array_keys($fieldList['actions']['actionsMap']) as $actionKey) unset($fieldList['actions']['actionsMap'][$actionKey]['text']);
  73. $fieldList['status']['statusMap']['changed'] = $lang->task->storyChange;
  74. $executions = $this->execution->generateRow($executionStats, $users, $avatarList);
  75. foreach($executions as $execution) $execution->nameCol = $execution->name;
  76. /* zin: Define the feature bar on main menu. */
  77. $productItems = array();
  78. foreach($productList as $key => $value) $productItems[] = array('text' => $value, 'active' => $key == $productID, 'url' => createLink('project', 'execution', "status={$status}&projectID={$projectID}&orderBy={$orderBy}&productID={$key}"));
  79. $productName = !empty($product) ? $product->name : '';
  80. $showProduct = (in_array($project->model, array('waterfall', 'waterfallplus', 'ipd')) && $project->stageBy == 'product') || in_array($project->model, array('agileplus', 'scrum'));
  81. $productLabel = $productName ? $productName : $lang->product->all;
  82. featureBar
  83. (
  84. ($showProduct && $project->hasProduct && empty($project->isTpl)) ? to::leading
  85. (
  86. dropdown
  87. (
  88. to('trigger', btn($productLabel, setClass('ghost'))),
  89. set::items($productItems)
  90. )
  91. ) : null,
  92. set::module('project'),
  93. set::method('execution'),
  94. set::current($status),
  95. set::link('project', 'execution', "status={key}&projectID={$projectID}&orderBy={$orderBy}&productID={$productID}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"),
  96. li
  97. (
  98. checkbox
  99. (
  100. set::id('showTask'),
  101. set::name('showTask'),
  102. set::checked($this->cookie->showTask ? 'checked' : ''),
  103. set::text($lang->programplan->stageCustom['task']),
  104. set::rootClass('ml-4')
  105. )
  106. ),
  107. $project->model == 'ipd' ? li
  108. (
  109. checkbox
  110. (
  111. set::id('showStage'),
  112. set::name('showStage'),
  113. set::checked($this->cookie->showStage ? 'checked' : ''),
  114. set::text($lang->programplan->stageCustom['point']),
  115. set::rootClass('ml-4')
  116. )
  117. ) : null,
  118. $this->cookie->showTask ? li(setClass('ml-2'), searchToggle(set::module('projectTask'), set::open($searchTask))) : null
  119. );
  120. /* zin: Define the toolbar on main menu. */
  121. $createLink = $isStage ? createLink('programplan', 'create', "projectID={$projectID}&productID={$productID}") : createLink('execution', 'create', "projectID={$projectID}");
  122. $canModifyProject = common::canModify('project', $project);
  123. if(!$canModifyProject) $fieldList['actions']['actionsMap'] = array();
  124. toolbar
  125. (
  126. in_array($project->model, array('waterfall', 'waterfallplus', 'ipd')) && in_array($this->config->edition, array('max', 'ipd')) ? btnGroup
  127. (
  128. a(setClass('btn square'), icon('gantt-alt'), set::title($lang->programplan->gantt), set::href(createLink('programplan', 'browse', "projectID=$projectID&productID=$productID&type=gantt"))),
  129. a(setClass('btn square text-primary'), icon('list'), set::title($lang->project->bylist))
  130. ) : null,
  131. hasPriv('execution', 'export') ? item(set(array
  132. (
  133. 'icon' => 'export',
  134. 'text' => $lang->programplan->exporting,
  135. 'class' => "ghost export",
  136. 'data-toggle' => "modal",
  137. 'url' => createLink('execution', 'export', "status={$status}&productID={$productID}&orderBy={$orderBy}&from=project")
  138. ))) : null,
  139. $canModifyProject && common::hasPriv('programplan', 'create') && $isStage && empty($product->deleted) ? item(set(array
  140. (
  141. 'icon' => 'plus',
  142. 'text' => $lang->programplan->create,
  143. 'class' => "primary create-execution-btn",
  144. 'url' => $createLink
  145. ))) : null,
  146. $canModifyProject && hasPriv('execution', 'create') && !$isStage && $project->model != 'agileplus' ? item(set(array
  147. (
  148. 'icon' => 'plus',
  149. 'text' => $isStage ? $lang->programplan->create : $lang->execution->create,
  150. 'class' => "primary create-execution-btn",
  151. 'url' => $createLink
  152. ))) : null,
  153. $canModifyProject && hasPriv('execution', 'create') && !$isStage && $project->model == 'agileplus' ? btngroup(
  154. setClass('create-execution-btn'),
  155. btn(setClass('btn primary'), set::icon('plus'), set::url($createLink), $lang->execution->create),
  156. dropdown
  157. (
  158. btn(setClass('btn primary dropdown-toggle'),
  159. setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
  160. set::items
  161. (
  162. array('text' => $lang->execution->create, 'url' => $createLink),
  163. array('text' => $lang->project->createKanban, 'url' => createLink('execution', 'create', "projectID={$projectID}&executionID=0&copyExecutionID=&planID=0&confirm=no&productID=0&extra=type=kanban"))
  164. ),
  165. set::placement('bottom-end')
  166. )
  167. ) : null
  168. );
  169. $canCreateExecution = $canModifyProject && $isStage ? common::hasPriv('programplan', 'create') : common::hasPriv('execution', 'create');
  170. dtable
  171. (
  172. set::userMap($users),
  173. set::cols($fieldList),
  174. set::data($executions),
  175. set::customCols(true),
  176. set::checkable($canBatchAction),
  177. set::onRenderCell(jsRaw('window.onRenderCell')),
  178. set::canRowCheckable(jsRaw("function(rowID){return this.getRowInfo(rowID).data.id.indexOf('pid') > -1;}")),
  179. set::checkInfo(jsRaw("function(checkedIDList){ return window.footerSummary(this, checkedIDList);}")),
  180. set::footToolbar($footToolbar),
  181. set::orderBy($orderBy),
  182. set::sortLink(createLink('project', 'execution', "status={$status}&projectID=$projectID&orderBy={name}_{sortType}&productID={$productID}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  183. set::footPager(usePager(array('linkCreator' => createLink('project', 'execution', "status={$status}&projectID=$projectID&orderBy={$orderBy}&productID={$productID}&recTotal={recTotal}&recPerPage={recPerPage}&page={page}")))),
  184. set::emptyTip(!$searchTask ? $lang->execution->noExecution : $lang->task->noTask),
  185. set::createTip($isStage ? $lang->programplan->create : $lang->execution->create),
  186. set::createLink($canCreateExecution && !$searchTask && !$hasFrozenExecutions ? $createLink : ''),
  187. set::createAttr($isStage ? 'data-app="project"' : 'data-app="execution"')
  188. );
  189. render();