browse.html.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <?php
  2. /**
  3. * The browse of risk module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2020 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Yuchun Li <liyuchun@cnezsoft.com>
  8. * @package risk
  9. * @version $Id: browse.html.php 4903 2020-09-04 09:32:59Z lyc $
  10. * @link http://www.zentao.net
  11. */
  12. ?>
  13. <?php include $app->getModuleRoot() . "common/view/header.html.php"?>
  14. <style>
  15. #querybox #searchform{border-bottom: 1px solid #ddd; margin-bottom: 20px;}
  16. </style>
  17. <?php
  18. js::set('pageSummary', $lang->risk->pageSummary);
  19. js::set('checkedSummary', $lang->risk->checkedSummary);
  20. js::set('pageRiskSummary', $lang->risk->pageRiskSummary);
  21. js::set('checkedRiskSummary', $lang->risk->checkedRiskSummary);
  22. js::set('browseType', $browseType);
  23. ?>
  24. <?php $hasRisklib = helper::hasFeature('risklib');?>
  25. <div id="mainMenu" class="clearfix">
  26. <div class="btn-toobar pull-left">
  27. <?php
  28. $menus = customModel::getFeatureMenu($this->moduleName, $this->methodName);
  29. foreach($menus as $menuItem)
  30. {
  31. $active = $menuItem->name == $browseType ? ' btn-active-text' : '';
  32. echo html::a($this->createLink('risk', 'browse', "projectID=$projectID&from=$from&browseType=$menuItem->name"), "<span class='text'>{$menuItem->text}</span> " . ($browseType == $menuItem->name ? "<span class='label label-light label-badge'>{$pager->recTotal}</span>" : ''), '', "class='btn btn-link $active' data-app='{$app->tab}'");
  33. }
  34. ?>
  35. <a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->risk->byQuery;?></a>
  36. </div>
  37. <div class="btn-toolbar pull-right">
  38. <div class='btn-group'>
  39. <button class="btn btn-link" data-toggle="dropdown"><i class="icon icon-export muted"></i> <span class="text"><?php echo $lang->export ?></span> <span class="caret"></span></button>
  40. <ul class='dropdown-menu pull-right' id='exportActionMenu'>
  41. <?php
  42. $class = common::hasPriv('risk', 'export') ? "" : "class='disabled'";
  43. $misc = common::hasPriv('risk', 'export') ? "class='export'" : "class='disabled'";
  44. $link = common::hasPriv('risk', 'export') ? $this->createLink('risk', 'export', "objectID=$projectID&browseType=$browseType&orderBy=$orderBy") : '#';
  45. echo "<li $class>" . html::a($link, $lang->risk->export, '', $misc) . "</li>";
  46. ?>
  47. </ul>
  48. </div>
  49. <div class='btn-group'>
  50. <button class="btn btn-link" data-toggle="dropdown"><i class="icon icon-import muted"></i> <span class="text"><?php echo $lang->import;?></span> <span class="caret"></span></button>
  51. <ul class='dropdown-menu pull-right' id='importActionMenu'>
  52. <?php
  53. $class = (common::hasPriv('risk', 'importFromLib') and $hasRisklib) ? '' : "class=disabled";
  54. $misc = (common::hasPriv('risk', 'importFromLib') and $hasRisklib) ? "data-app='{$app->tab}'" : "class=disabled";
  55. $link = (common::hasPriv('risk', 'importFromLib') and $hasRisklib) ? $this->createLink('risk', 'importFromLib', "projectID=$projectID&from=$from") : '#';
  56. echo "<li $class>" . html::a($link, $lang->risk->importFromLib, '', $misc) . "</li>";
  57. ?>
  58. </ul>
  59. </div>
  60. <div class='btn-group dropdown'>
  61. <?php
  62. if(common::hasPriv('risk', 'create'))
  63. {
  64. $actionLink = $this->createLink('risk', 'create', "projectID=$projectID&from=$from");
  65. echo html::a($actionLink, "<i class='icon icon-plus'></i> {$lang->risk->create}", '', "class='btn btn-primary' data-app='{$app->tab}'");
  66. }
  67. elseif(common::hasPriv('risk', 'batchCreate'))
  68. {
  69. $actionLink = $this->createLink('risk', 'batchCreate', "projectID=$projectID&from=$from");
  70. echo html::a($actionLink, "<i class='icon icon-plus'></i> {$lang->risk->batchCreate}", '', "class='btn btn-primary' data-app='{$app->tab}'");
  71. }
  72. ?>
  73. <?php if((common::hasPriv('risk', 'create')) and (common::hasPriv('risk', 'batchCreate'))):?>
  74. <button type='button' class='btn btn-primary dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>
  75. <ul class='dropdown-menu pull-right'>
  76. <li><?php echo html::a($actionLink, $lang->risk->create, '', "data-app='{$app->tab}'");?></li>
  77. <li><?php echo html::a($this->createLink('risk', 'batchCreate', "projectID=$projectID&from=$from"), $lang->risk->batchCreate, '', "data-app='{$app->tab}'");?></li>
  78. </ul>
  79. <?php endif;?>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="cell<?php if($browseType == 'bysearch') echo ' show';?>" id="queryBox" data-url="<?php echo $this->createLink('search', 'buildOldForm', 'module=risk');?>" data-module='risk'></div>
  84. <div id="mainContent" class="main-table">
  85. <?php if(empty($risks)):?>
  86. <div class="table-empty-tip">
  87. <p>
  88. <span class="text-muted"><?php echo $lang->noData;?></span>
  89. <?php if(common::hasPriv('risk', 'create')):?>
  90. <?php echo html::a($this->createLink('risk', 'create', "projectID=$projectID&from=$from"), "<i class='icon icon-plus'></i> " . $lang->risk->create, '', "class='btn btn-info' data-app='{$app->tab}'");?>
  91. <?php endif;?>
  92. </p>
  93. </div>
  94. <?php else:?>
  95. <form class="main-table table-risk" method="post" id="riskForm">
  96. <table class="table has-sort-head" id='riskList'>
  97. <?php $canBatchImportToLib = (common::hasPriv('risk', 'batchImportToLib') and $hasRisklib);?>
  98. <?php $vars = "projectID=$projectID&from=$from&browseType=$browseType&param=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
  99. <thead>
  100. <tr>
  101. <th class='text-left w-90px'>
  102. <?php
  103. if($canBatchImportToLib) echo "<div class='checkbox-primary check-all' title='{$this->lang->selectAll}'><label></label></div>";
  104. common::printOrderLink('id', $orderBy, $vars, $lang->risk->id);
  105. ?>
  106. </th>
  107. <th class='text-left c-name'><?php common::printOrderLink('name', $orderBy, $vars, $lang->risk->name);?></th>
  108. <th class='c-pri text-center' title='<?php echo $lang->risk->pri;?>'><?php common::printOrderLink('pri', $orderBy, $vars, $lang->risk->priAB);?></th>
  109. <th class='c-rate text-center'><?php common::printOrderLink('rate', $orderBy, $vars, $lang->risk->rate);?></th>
  110. <th class='c-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->risk->status);?></th>
  111. <th class='c-category'><?php common::printOrderLink('category', $orderBy, $vars, $lang->risk->category);?></th>
  112. <th class='c-identifiedDate'><?php common::printOrderLink('identifiedDate', $orderBy, $vars, $lang->risk->identifiedDate);?></th>
  113. <th class='c-assignedTo'><?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->risk->assignedTo);?></th>
  114. <th class='c-strategy'><?php common::printOrderLink('strategy', $orderBy, $vars, $lang->risk->strategy);?></th>
  115. <th class='c-actions-7 text-center'><?php echo $lang->actions;?></th>
  116. </tr>
  117. </thead>
  118. <tbody>
  119. <?php $showDividing = ((common::hasPriv('risk', 'track') or common::hasPriv('risk', 'close') or common::hasPriv('risk', 'cancel') or common::hasPriv('risk', 'hangup')) and (common::hasPriv('risk', 'activate') or common::hasPriv('effort', 'createForObject') or common::hasPriv('risk', 'edit')));?>
  120. <?php foreach($risks as $risk):?>
  121. <tr data-id='<?php echo $risk->id ?>' data-status='<?php echo $risk->status?>'>
  122. <td>
  123. <?php echo $canBatchImportToLib ? html::checkbox('riskIDList', array($risk->id => '')) . sprintf('%03d',$risk->id) : sprintf('%03d',$risk->id);?>
  124. </td>
  125. <td class='c-name' title=<?php echo $risk->name;?>>
  126. <?php
  127. if(commonModel::hasPriv('risk', 'view'))
  128. {
  129. echo html::a($this->createLink('risk', 'view', "riskID=$risk->id&from=$from"), $risk->name, '', "data-app='{$app->tab}'");
  130. }
  131. else
  132. {
  133. echo $risk->name;
  134. }
  135. ?>
  136. </td>
  137. <td class='text-center'><?php echo "<span class='pri-{$risk->pri}'>" . zget($lang->risk->priList, $risk->pri) . "</span>";?></td>
  138. <td class='text-center'><?php echo $risk->rate;?></td>
  139. <td class='status-risk status-<?php echo $risk->status?>'><?php echo zget($lang->risk->statusList, $risk->status);?></td>
  140. <td><?php echo zget($lang->risk->categoryList, $risk->category);?></td>
  141. <td><?php echo $risk->identifiedDate == '0000-00-00' ? '' : $risk->identifiedDate;?></td>
  142. <td><?php echo $this->risk->printAssignedHtml($risk, $users);?></td>
  143. <td><?php echo zget($lang->risk->strategyList, $risk->strategy);?></td>
  144. <td class='c-actions'>
  145. <?php
  146. $params = "riskID=$risk->id";
  147. common::printIcon('risk', 'track', $params, $risk, "list", 'checked', '', 'iframe', true);
  148. common::printIcon('risk', 'close', $params, $risk, "list", '', '', 'iframe', true);
  149. common::printIcon('risk', 'cancel', $params, $risk, "list", '', '', 'iframe', true);
  150. common::printIcon('risk', 'hangup', $params, $risk, "list", 'pause', '', 'iframe', true);
  151. if($showDividing) echo '<div class="dividing-line"></div>';
  152. common::printIcon('risk', 'activate', $params, $risk, "list", '', '', 'iframe', true);
  153. common::printIcon('effort', 'createForObject', "objectType=risk&objectID=$risk->id", '', 'list', 'time', '', 'iframe', true, '', $lang->risk->effort);
  154. common::printIcon('risk', 'edit', $params . "&from=$from", $risk, "list");
  155. ?>
  156. </td>
  157. </tr>
  158. <?php endforeach;?>
  159. </tbody>
  160. </table>
  161. <div class='table-footer'>
  162. <?php if($canBatchImportToLib):?>
  163. <div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
  164. <div class="table-actions btn-toolbar">
  165. <?php echo html::a('#batchImportToLib', $lang->risk->importToLib, '', 'class="btn" data-toggle="modal" id="importToLib"');?>
  166. </div>
  167. <?php endif;?>
  168. <div class="table-statistic"></div>
  169. <?php $pager->show('right', 'pagerjs');?>
  170. </div>
  171. <?php endif;?>
  172. </form>
  173. </div>
  174. <div class="modal fade" id="batchImportToLib">
  175. <div class="modal-dialog mw-500px">
  176. <div class="modal-content">
  177. <div class="modal-header">
  178. <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon icon-close"></i></button>
  179. <h4 class="modal-title"><?php echo $lang->risk->importToLib;?></h4>
  180. </div>
  181. <div class="modal-body">
  182. <form method='post' class='form-ajax' action='<?php echo $this->createLink('risk', 'batchImportToLib');?>'>
  183. <table class='table table-form'>
  184. <tr>
  185. <th><?php echo $lang->risk->lib;?></th>
  186. <td>
  187. <?php echo html::select('lib', $libs, '', "class='form-control chosen' required");?>
  188. </td>
  189. </tr>
  190. <?php if(!common::hasPriv('assetlib', 'approveIssue') and !common::hasPriv('assetlib', 'batchApproveIssue')):?>
  191. <tr>
  192. <th><?php echo $lang->risk->approver;?></th>
  193. <td>
  194. <?php echo html::select('assignedTo', $approvers, '', "class='form-control chosen'");?>
  195. </td>
  196. </tr>
  197. <?php endif;?>
  198. <tr>
  199. <td colspan='2' class='text-center'>
  200. <?php echo html::hidden('riskIDList', '');?>
  201. <?php echo html::submitButton($lang->import, '', 'btn btn-primary');?>
  202. </td>
  203. </tr>
  204. </table>
  205. </form>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. <?php include $app->getModuleRoot() . "common/view/footer.html.php"?>