all.html.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <?php
  2. /**
  3. * The html productlist file of productlist method of product module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(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 Yangyang Shi <shiyangyang@cnezsoft.com>
  8. * @package ZenTaoPMS
  9. * @version $Id
  10. */
  11. ?>
  12. <?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
  13. <?php include $app->getModuleRoot() . 'common/view/sortable.html.php';?>
  14. <?php $app->loadLang('roadmap');?>
  15. <?php js::set('productLines', $productLines); ?>
  16. <?php $canBatchEdit = common::hasPriv('product', 'batchEdit'); ?>
  17. <div id="mainMenu" class="clearfix">
  18. <div class="btn-toolBar pull-left">
  19. <?php common::sortFeatureMenu();?>
  20. <?php foreach($lang->product->featureBar['all'] as $key => $label):?>
  21. <?php $recTotalLabel = $browseType == $key ? " <span class='label label-light label-badge'>{$recTotal}</span>" : '';?>
  22. <?php echo html::a(inlink("all", "browseType=$key&orderBy=$orderBy"), "<span class='text'>{$label}</span>" . $recTotalLabel, '', "class='btn btn-link' id='{$key}Tab'");?>
  23. <?php endforeach;?>
  24. <?php if($canBatchEdit) echo html::checkbox('showEdit', array('1' => $lang->product->edit), $showBatchEdit);?>
  25. <a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->product->searchStory;?></a>
  26. </div>
  27. <div class="btn-toolbar pull-right">
  28. <?php common::printLink('product', 'export', "programID=0&status=$browseType&orderBy=$orderBy", "<i class='icon-export muted'> </i>" . $lang->export, '', "class='btn btn-link export'", true, true)?>
  29. <?php if(in_array($config->systemMode, array('ALM', 'PLM'))):?>
  30. <?php common::printLink('product', 'manageLine', '', "<i class='icon-edit'></i> &nbsp;" . $lang->product->line, '', 'class="btn btn-link iframe"', '', true);?>
  31. <?php endif;?>
  32. <?php common::printLink('product', 'create', '', '<i class="icon icon-plus"></i>' . $lang->product->create, '', 'class="btn btn-primary create-product-btn"');?>
  33. </div>
  34. </div>
  35. <div id="mainContent" class="main-row fade">
  36. <?php if(empty($productStructure)):?>
  37. <div class="cell<?php if($browseType == 'bySearch') echo ' show';?>" id="queryBox" data-module='product' data-url="<?php echo $this->createLink('search', 'buildOldForm', 'module=product');?>"></div>
  38. <div class="table-empty-tip">
  39. <p><span class="text-muted"><?php echo $lang->product->noProduct;?></span></p>
  40. </div>
  41. <?php else:?>
  42. <div class="main-col">
  43. <div class="cell<?php if($browseType == 'bySearch') echo ' show';?>" id="queryBox" data-module='product' data-url="<?php echo $this->createLink('search', 'buildOldForm', 'module=product');?>"></div>
  44. <form class="main-table table-product" data-ride="table" data-nested='true' id="productListForm" method="post" action='<?php echo inLink('batchEdit', '');?>' data-preserve-nested='true' data-expand-nest-child='true'>
  45. <table id="productList" class="table has-sort-head table-nested table-fixed">
  46. <?php $vars = "browseType=$browseType&orderBy=%s";?>
  47. <thead>
  48. <tr class="text-center">
  49. <?php if($canBatchEdit):?>
  50. <th class='text-left c-checkbox' rowspan="2">
  51. <?php echo "<div class='checkbox-primary check-all' title='{$this->lang->selectAll}'><label></label></div>";?>
  52. </th>
  53. <?php endif;?>
  54. <th class='table-nest-title text-left c-name' rowspan="2">
  55. <?php if(in_array($config->systemMode, array('ALM', 'PLM'))):?>
  56. <a class='table-nest-toggle table-nest-toggle-global' data-expand-text='<?php echo $lang->expand; ?>' data-collapse-text='<?php echo $lang->collapse; ?>'></a>
  57. <?php endif;?>
  58. <?php common::printOrderLink('name', $orderBy, $vars, $lang->product->name);?>
  59. </th>
  60. <th class='c-PO' rowspan="2">
  61. <?php common::printOrderLink('PO', $orderBy, $vars, $lang->product->PO);?>
  62. </th>
  63. <th class='c-PO' rowspan="2">
  64. <?php common::printOrderLink('PMT', $orderBy, $vars, $lang->product->PMT);?>
  65. </th>
  66. <th class='c-PO' rowspan="2">
  67. <?php common::printOrderLink('type', $orderBy, $vars, $lang->product->type);?>
  68. </th>
  69. <th class="c-roadmap" colspan="2"><?php echo $lang->roadmap->common;?></th>
  70. <th class="c-story" colspan="4"><?php echo $lang->story->requirement;?></th>
  71. <?php
  72. $extendFields = $this->product->getFlowExtendFields();
  73. foreach($extendFields as $extendField) echo "<th rowspan='2'>{$extendField->name}</th>";
  74. ?>
  75. <th class='c-actions' rowspan="2"><?php echo $lang->actions;?></th>
  76. </tr>
  77. <tr class="text-center">
  78. <th style="border-left: 1px solid #ddd;"><?php echo $lang->roadmap->statusList['wait'];?></th>
  79. <th><?php echo $lang->roadmap->statusList['launched'];?></th>
  80. <th style="border-left: 1px solid #ddd;"><?php echo $lang->story->draft;?></th>
  81. <th><?php echo $lang->story->activate;?></th>
  82. <th><?php echo $lang->story->statusList['launched'];?></th>
  83. <th><?php echo $lang->story->statusList['developing'];?></th>
  84. </tr>
  85. </thead>
  86. <tbody id="productTableList">
  87. <?php $lineNames = array();?>
  88. <?php foreach($productStructure as $programID => $program):?>
  89. <?php
  90. $trAttrs = "data-id='program.$programID' data-parent='0' data-nested='true'";
  91. $trClass = 'is-top-level table-nest-child text-center';
  92. $trAttrs .= " class='$trClass'";
  93. ?>
  94. <?php
  95. if(isset($programLines[$programID]))
  96. {
  97. foreach($programLines[$programID] as $lineID => $lineName)
  98. {
  99. if(!isset($program[$lineID]))
  100. {
  101. $program[$lineID] = array();
  102. $program[$lineID]['product'] = '';
  103. $program[$lineID]['lineName'] = $lineName;
  104. }
  105. }
  106. }
  107. ?>
  108. <?php if(isset($program['programName']) and in_array($config->systemMode, array('ALM', 'PLM'))):?>
  109. <tr class="row-program" <?php echo $trAttrs;?>>
  110. <?php if($canBatchEdit):?>
  111. <td class='c-checkbox'><div class='checkbox-primary program-checkbox'><label></label></div></td>
  112. <?php endif;?>
  113. <td class='text-left table-nest-title' title="<?php echo $program['programName']?>">
  114. <i class="table-nest-icon icon table-nest-toggle icon-plus"></i>
  115. <i class="icon icon-cards-view"></i>
  116. <span><?php echo $program['programName']?></span>
  117. </td>
  118. <td class='c-manager'>
  119. <?php
  120. if(!empty($program['programPM']))
  121. {
  122. $programPM = $program['programPM'];
  123. $userName = zget($users, $programPM);
  124. echo html::smallAvatar(array('avatar' => $usersAvatar[$programPM], 'account' => $programPM, 'name' => $userName), 'avatar-circle avatar-top avatar-' . zget($userIdPairs, $programPM));
  125. $userID = isset($userIdPairs[$programPM]) ? $userIdPairs[$programPM] : '';
  126. echo html::a($this->createLink('user', 'profile', "userID=$userID", '', true), $userName, '', "title='{$userName}' class='iframe' data-width='600'");
  127. }
  128. ?>
  129. </td>
  130. <td></td>
  131. <td>
  132. <?php
  133. $counts = 0;
  134. if(isset($programProducts[$programID]))
  135. {
  136. foreach(array_keys($programProducts[$programID]) as $programProduct)
  137. {
  138. if($programID == 0 && !isset($productLinePairs[$programProduct])) continue;
  139. $counts += isset($roadmapGroup[$programProduct]['wait']) ? $roadmapGroup[$programProduct]['wait']->count : 0;
  140. }
  141. }
  142. echo $counts;
  143. ?>
  144. </td>
  145. <td>
  146. <?php
  147. $counts = 0;
  148. if(isset($programProducts[$programID]))
  149. {
  150. foreach(array_keys($programProducts[$programID]) as $programProduct)
  151. {
  152. if($programID == 0 && !isset($productLinePairs[$programProduct])) continue;
  153. $counts += isset($roadmapGroup[$programProduct]['launched']) ? $roadmapGroup[$programProduct]['launched']->count : 0;
  154. }
  155. }
  156. echo $counts;
  157. ?>
  158. </td>
  159. <td><?php echo $program['draftStories'];?></td>
  160. <td><?php echo $program['activeStories'];?></td>
  161. <td><?php echo $program['launchedStories'];?></td>
  162. <td><?php echo $program['developingStories'];?></td>
  163. <?php foreach($extendFields as $extendField) echo "<td></td>";?>
  164. <td></td>
  165. </tr>
  166. <?php unset($program['programName']);?>
  167. <?php endif;?>
  168. <?php foreach($program as $lineID => $line):?>
  169. <?php if(isset($line['lineName']) and isset($line['products']) and is_array($line['products']) and in_array($config->systemMode, array('ALM', 'PLM'))):?>
  170. <?php $lineNames[] = $line['lineName'];?>
  171. <?php
  172. if(in_array($config->systemMode, array('ALM', 'PLM')))
  173. {
  174. $trAttrs = "data-id='line.$lineID' data-parent='program.$programID'";
  175. $trAttrs .= " data-nest-parent='program.$programID' data-nest-path='program.$programID,line.$lineID'" . "class='text-center'";
  176. }
  177. else
  178. {
  179. $trAttrs = "data-id='line.$lineID' data-parent='0' data-nested='true'";
  180. $trClass = 'is-top-level table-nest-child text-center';
  181. $trAttrs .= " class='$trClass'";
  182. }
  183. ?>
  184. <tr class="row-line" <?php echo $trAttrs;?>>
  185. <?php if($canBatchEdit):?>
  186. <td class='c-checkbox'><div class='checkbox-primary program-checkbox'><label></label></div></td>
  187. <?php endif;?>
  188. <td class='text-left table-nest-title' title="<?php echo $line['lineName']?>">
  189. <span class="table-nest-icon icon table-nest-toggle"></span>
  190. <?php echo $line['lineName']?>
  191. </td>
  192. <td></td>
  193. <td></td>
  194. <td><?php echo isset($lineRoadmapGroup[$lineID]) ? $lineRoadmapGroup[$lineID]->wait : 0;?></td>
  195. <td><?php echo isset($lineRoadmapGroup[$lineID]) ? $lineRoadmapGroup[$lineID]->launched : 0;?></td>
  196. <td><?php echo isset($line['draftStories']) ? $line['draftStories'] : 0;?></td>
  197. <td><?php echo isset($line['activeStories']) ? $line['activeStories'] : 0;?></td>
  198. <td><?php echo isset($line['launchedStories']) ? $line['launchedStories'] : 0;?></td>
  199. <td><?php echo isset($line['developingStories']) ? $line['developingStories'] : 0;?></td>
  200. <?php foreach($extendFields as $extendField) echo "<td></td>";?>
  201. <td></td>
  202. </tr>
  203. <?php unset($line['lineName']);?>
  204. <?php endif;?>
  205. <?php if(isset($line['products']) and is_array($line['products'])):?>
  206. <?php foreach($line['products'] as $productID => $product):?>
  207. <?php
  208. $trClass = '';
  209. if($product->line and in_array($config->systemMode, array('ALM', 'PLM')))
  210. {
  211. $path = "program.$product->program,line.$product->line,$product->id";
  212. $trAttrs = "data-id='$product->id' data-parent='line.$product->line'";
  213. $trClass .= ' is-nest-child table-nest';
  214. $trAttrs .= " data-nest-parent='line.$product->line' data-nest-path='$path'";
  215. }
  216. elseif($product->program and in_array($config->systemMode, array('ALM', 'PLM')))
  217. {
  218. $trAttrs = "data-id='$product->id' data-parent='program.$product->program'";
  219. $trClass .= ' is-nest-child table-nest';
  220. $trAttrs .= " data-nest-parent='program.$product->program' data-nest-path='program.$product->program,$product->id'";
  221. }
  222. else
  223. {
  224. $trAttrs = "data-id='$product->id' data-parent='0'";
  225. $trClass .= ' no-nest';
  226. }
  227. $trAttrs .= " class='$trClass'";
  228. ?>
  229. <tr class="row-product" <?php echo $trAttrs;?>>
  230. <?php if($canBatchEdit):?>
  231. <td class='c-checkbox'><?php echo html::checkbox('productIDList', array($product->id => ''));?></td>
  232. <?php endif;?>
  233. <td class="c-name text-left sort-handler table-nest-title" title='<?php echo $product->name?>'>
  234. <?php
  235. echo html::a($this->createLink('product', 'browse', 'productID=' . $product->id . '&branch=&browseType=&param=0&storyType=requirement'), $product->name);
  236. ?>
  237. </td>
  238. <td class='c-manager'>
  239. <?php
  240. if(!empty($product->PO))
  241. {
  242. $userName = zget($users, $product->PO);
  243. echo html::smallAvatar(array('avatar' => $usersAvatar[$product->PO], 'account' => $product->PO, 'name' => $userName), 'avatar-circle avatar-' . zget($userIdPairs, $product->PO));
  244. $userID = isset($userIdPairs[$product->PO]) ? $userIdPairs[$product->PO] : '';
  245. echo html::a($this->createLink('user', 'profile', "userID=$userID", '', true), $userName, '', "title='{$userName}' class='iframe' data-width='600'");
  246. }
  247. ?>
  248. </td>
  249. <?php
  250. $PMTList = '';
  251. foreach(explode(',', $product->PMT) as $PMT) $PMTList .= zget($users, $PMT) . "&nbsp;";
  252. ?>
  253. <td class='c-manager' title=<?php echo $PMTList;?>>
  254. <?php echo $PMTList;?>
  255. </td>
  256. <td><?php echo zget($lang->product->typeList, $product->type, '');?></td>
  257. <td><?php echo isset($roadmapGroup[$product->id]['wait']) ? $roadmapGroup[$product->id]['wait']->count : 0;?></td>
  258. <td><?php echo isset($roadmapGroup[$product->id]['launched']) ? $roadmapGroup[$product->id]['launched']->count : 0;?></td>
  259. <td><?php echo $product->draftStories;?></td>
  260. <td><?php echo $product->activeStories;?></td>
  261. <td><?php echo $product->launchedStories;?></td>
  262. <td><?php echo $product->developingStories;?></td>
  263. <?php foreach($extendFields as $extendField) echo "<td>" . $this->loadModel('flow')->getFieldValue($extendField, $product) . "</td>";?>
  264. <td class='c-actions'><?php echo $this->product->buildOrOperateMenu($product, 'browse');?></td>
  265. </tr>
  266. <?php endforeach;?>
  267. <?php endif;?>
  268. <?php endforeach;?>
  269. <?php endforeach;?>
  270. </tbody>
  271. </table>
  272. <div class='table-footer'>
  273. <?php echo $pager->show('left', 'pagerjs');?>
  274. <?php if(!empty($product) and $canBatchEdit):?>
  275. <div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
  276. <?php
  277. $summary = (empty($productLines) or $this->config->systemMode == 'light') ? sprintf($lang->product->pageSummary, count($productStats)) : sprintf($lang->product->lineSummary, count($lineNames), count($productStats));
  278. echo "<div id='productsCount' class='statistic'>$summary</div>";
  279. ?>
  280. <div class="table-actions btn-toolbar">
  281. <?php
  282. $actionLink = $this->createLink('product', 'batchEdit');
  283. echo html::commonButton($lang->edit, "id='editBtn' data-form-action='$actionLink'");
  284. ?>
  285. </div>
  286. <?php endif;?>
  287. </div>
  288. </form>
  289. </div>
  290. <?php endif;?>
  291. </div>
  292. <?php js::set('orderBy', $orderBy)?>
  293. <?php js::set('browseType', $browseType)?>
  294. <?php js::set('checkedProducts', $lang->product->checkedProducts);?>
  295. <?php js::set('cilentLang', $this->app->getClientLang());?>
  296. <?php if(commonModel::isTutorialMode()): ?>
  297. <style>
  298. #productListForm {overflow: hidden;}
  299. #productList .table-nest-title {width: 200px;}
  300. </style>
  301. <?php endif; ?>
  302. <?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>