browse.html.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
  2. <?php include $app->getModuleRoot() . 'common/view/datatable.fix.html.php';?>
  3. <?php js::set('unfoldStories', array());?>
  4. <?php js::set('poolID', $poolID);?>
  5. <div id="mainMenu" class="clearfix">
  6. <div class="btn-toolbar pull-left">
  7. <?php
  8. $moreMenu = array();
  9. foreach($lang->demand->labelList as $label => $labelName)
  10. {
  11. $active = $browseType == $label ? 'btn-active-text' : '';
  12. echo html::a($this->createLink('demand', 'browse', "poolID=$poolID&browseType=$label&param=0&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"), '<span class="text">' . $labelName . '</span>' . ($browseType == $label ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>" : ''), '', "class='btn btn-link $active'");
  13. }
  14. /* More drop menu. */
  15. echo "<div class='btn-group' id='more'>";
  16. $current = $lang->demand->more;
  17. $active = '';
  18. if(isset($lang->demand->moreSelects[$browseType]))
  19. {
  20. $current = "<span class='text'>{$lang->demand->moreSelects[$browseType]}</span> <span class='label label-light label-badge'>{$pager->recTotal}</span>";
  21. $active = 'btn-active-text';
  22. }
  23. echo html::a('javascript:;', $current . " <span class='caret'></span>", '', "data-toggle='dropdown' class='btn btn-link $active'");
  24. echo "<ul class='dropdown-menu'>";
  25. foreach($lang->demand->moreSelects as $key => $value)
  26. {
  27. if($key == '') continue;
  28. echo '<li' . ($key == $browseType ? " class='active'" : '') . '>';
  29. echo html::a($this->createLink('demand', 'browse', "poolID=$poolID&type=$key"), $value);
  30. }
  31. echo '</ul></div>';
  32. ?>
  33. <a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->searchAB;?></a>
  34. </div>
  35. <div class="btn-toolbar pull-right">
  36. <div class='btn-group'>
  37. <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>
  38. <ul class="dropdown-menu" id='exportActionMenu'>
  39. <?php
  40. $class = common::hasPriv('demand', 'export') ? '' : "class=disabled";
  41. $misc = common::hasPriv('demand', 'export') ? "data-toggle='modal' data-size='sm' class='export'" : "class=disabled";
  42. $link = common::hasPriv('demand', 'export') ? $this->createLink('demand', 'export', "poolID=$poolID&orderBy=$orderBy") : '#';
  43. echo "<li $class>" . html::a($link, $lang->demand->export, '', $misc) . "</li>";
  44. $class = common::hasPriv('demand', 'exportTemplate') ? '' : "class='disabled'";
  45. $link = common::hasPriv('demand', 'exportTemplate') ? $this->createLink('demand', 'exportTemplate', "poolID=$poolID") : '#';
  46. $misc = common::hasPriv('demand', 'exportTemplate') ? "data-toggle='modal' data-type='iframe' data-width='650px' class='exportTemplate'" : "class='disabled'";
  47. echo "<li $class>" . html::a($link, $lang->demand->exportTemplate, '', $misc) . '</li>';
  48. ?>
  49. </ul>
  50. <?php if(common::hasPriv('demand', 'import')) echo html::a($this->createLink('demand', 'import', "poolID=$poolID"), '<i class="icon-import muted"></i> <span class="text">' . $lang->demand->import . '</span>', '', "class='btn btn-link import' data-toggle='modal' data-type='iframe'");?>
  51. </div>
  52. <div class='btn-group dropdown'>
  53. <?php
  54. $createLink = $this->createLink('demand', 'create', "poolID=$poolID");
  55. $batchCreateLink = $this->createLink('demand', 'batchCreate', "poolID=$poolID");
  56. $buttonLink = '';
  57. $buttonTitle = '';
  58. if(common::hasPriv('demand', 'batchCreate'))
  59. {
  60. $buttonLink = $batchCreateLink;
  61. $buttonTitle = $lang->demand->batchCreate;
  62. }
  63. if(common::hasPriv('demand', 'create'))
  64. {
  65. $buttonLink = $createLink;
  66. $buttonTitle = $lang->demand->create;
  67. }
  68. $hidden = empty($buttonLink) ? 'hidden' : '';
  69. echo html::a($buttonLink, "<i class='icon icon-plus'></i> $buttonTitle", '', "class='btn btn-primary $hidden create-demand-btn'");
  70. ?>
  71. <?php if(!empty($poolID) and common::hasPriv('demand', 'batchCreate') and common::hasPriv('demand', 'create')): ?>
  72. <button type='button' class="btn btn-primary dropdown-toggle" data-toggle='dropdown'><span class='caret'></span></button>
  73. <ul class='dropdown-menu pull-right'>
  74. <li><?php echo html::a($createLink, $lang->demand->create);?> </li>
  75. <li><?php echo html::a($batchCreateLink, $lang->demand->batchCreate);?></li>
  76. </ul>
  77. <?php endif;?>
  78. </div>
  79. </div>
  80. </div>
  81. <div id="mainContent" class="main-row fade">
  82. <div class="main-col">
  83. <div class="cell<?php if($browseType == 'bysearch') echo ' show';?>" id="queryBox" data-module='demand' data-url="<?php echo $this->createLink('search', 'buildOldForm', 'module=demand');?>"></div>
  84. <?php if(empty($demands)):?>
  85. <div class="table-empty-tip">
  86. <p><span class="text-muted"><?php echo $lang->noData;?></span></p>
  87. </div>
  88. <?php else:?>
  89. <?php
  90. $vars = "poolID=$poolID&browseType=$browseType&param=0&orderBy=%s&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage&pageID=$pager->pageID";
  91. $datatableId = $this->moduleName . ucfirst($this->methodName);
  92. $useDatatable = (isset($config->datatable->$datatableId->mode) and $config->datatable->$datatableId->mode == 'datatable');
  93. if($useDatatable) include $app->getModuleRoot() . 'common/view/datatable.html.php';
  94. $setting = $this->datatable->getOldSetting('demand');
  95. $widths = $this->datatable->setFixedFieldWidth($setting);
  96. $columns = 0;
  97. ?>
  98. <form class='main-table' method='post' id='demandForm' <?php if(!$useDatatable) echo "data-ride='table'";?>>
  99. <div class="table-header fixed-right">
  100. <nav class="btn-toolbar pull-right setting"></nav>
  101. </div>
  102. <?php if(!$useDatatable) echo '<div class="table-responsive">';?>
  103. <table class='table has-sort-head <?php if($useDatatable) echo ' datatable';?>' id='demandList' data-fixed-left-width='<?php echo $widths['leftWidth']?>' data-fixed-right-width='<?php echo $widths['rightWidth']?>'>
  104. <thead>
  105. <tr>
  106. <?php
  107. foreach($setting as $value)
  108. {
  109. if($value->show)
  110. {
  111. if($value->id == 'BSA')
  112. {
  113. $fixed = $value->fixed == 'no' ? 'true' : 'false';
  114. echo "<th data-flex='$fixed' data-width='$value->width' style='width:$value->width' class='c-$value->id' title='{$lang->demand->bsaTip}'>";
  115. common::printOrderLink($value->id, $orderBy, $vars, $value->title);
  116. echo "</th>";
  117. continue;
  118. }
  119. $this->datatable->printHead($value, $orderBy, $vars);
  120. }
  121. }
  122. ?>
  123. </tr>
  124. </thead>
  125. <tbody>
  126. <?php foreach($demands as $demand):?>
  127. <tr data-id='<?php echo $demand->id?>' <?php if(!empty($demand->children)) echo "data-children=" . count($demand->children);?>>
  128. <?php foreach($setting as $value) $this->demand->printCell($value, $demand, $users, $useDatatable ? 'datatable' : 'table');?>
  129. </tr>
  130. <?php if(!empty($demand->children)):?>
  131. <?php $i = 0;?>
  132. <?php foreach($demand->children as $key => $child):?>
  133. <?php $class = $i == 0 ? ' table-child-top' : '';?>
  134. <?php $class .= ($i + 1 == count($demand->children)) ? ' table-child-bottom' : '';?>
  135. <tr class='table-children<?php echo $class;?> parent-<?php echo $demand->id;?>' data-id='<?php echo $child->id?>' data-status='<?php echo $child->status?>'>
  136. <?php if($this->app->getViewType() == 'xhtml'):?>
  137. <?php
  138. foreach($setting as $key => $value)
  139. {
  140. if($value->id == 'title' || $value->id == 'id' || $value->id == 'pri' || $value->id == 'status')
  141. {
  142. $this->demand->printCell($value, $child, $users, $useDatatable ? 'datatable' : 'table');
  143. }
  144. }?>
  145. <?php else:?>
  146. <?php foreach($setting as $key => $value) $this->demand->printCell($value, $child, $users, $useDatatable ? 'datatable' : 'table');?>
  147. <?php endif;?>
  148. </tr>
  149. <?php $i ++;?>
  150. <?php endforeach;?>
  151. <?php endif;?>
  152. <?php endforeach;?>
  153. </tbody>
  154. </table>
  155. <?php if(!$useDatatable) echo '</div>';?>
  156. <div class="table-footer">
  157. <?php if(common::hasPriv('demand', 'export')):?>
  158. <div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
  159. <?php endif;?>
  160. <?php $pager->show('right', 'pagerjs');?>
  161. </div>
  162. </form>
  163. <?php endif;?>
  164. </div>
  165. </div>
  166. <script>
  167. $('#toStoryBtn').on('click', function()
  168. {
  169. var demandID = $('#demand').val();
  170. var type = $("input[name*='totype']:checked").val();
  171. var link = createLink('demand', 'tostory', 'demandID=' + demandID + '&type=' + type);
  172. location.href = link;
  173. })
  174. function getDemandID(obj)
  175. {
  176. var demandID = $(obj).attr("data-id");
  177. $('#demand').val(demandID);
  178. }
  179. </script>
  180. <?php if(!empty($useDatatable)):?>
  181. <script>
  182. $(function(){$('#demandForm').table();})
  183. </script>
  184. <?php endif;?>
  185. <?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>