other-list.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <?php
  2. session_start();
  3. if (!isset($_SESSION['loggedin'])) {
  4. header('Location: pages-signin.html');
  5. exit;
  6. }
  7. ?>
  8. <!doctype html>
  9. <html class="fixed sidebar-left-collapsed">
  10. <head>
  11. <!-- jstree CSS -->
  12. <link rel="stylesheet" href="/Common/assets/vendor/jstree/themes/default/style.css" />
  13. <?php include("bim-support-header.html"); ?>
  14. <script src="./script/js/global.js"></script>
  15. <script src="./script/js/pdfobject.min.js"></script>
  16. <script type="application/javascript">
  17. var url_href = window.location.href;
  18. var url = new URL(url_href);
  19. var type = url.searchParams.get("type");
  20. if (type === null) {
  21. window.location.href = "other-list.php?type=收費建議";
  22. }
  23. var userName = '<?php echo $_SESSION['name']; ?>';
  24. var $grid;
  25. pageHeader = "BIM相關資源";
  26. </script>
  27. <style>
  28. .menu-item.active {
  29. color: #0088CC;
  30. }
  31. .jstree-anchor {
  32. width: 95%;
  33. text-overflow: ellipsis;
  34. overflow: hidden;
  35. white-space: nowrap;
  36. }
  37. th {
  38. text-align: center;
  39. width: 30%;
  40. font-size: 18px;
  41. }
  42. td {
  43. text-align: center;
  44. font-size: 18px;
  45. }
  46. </style>
  47. </head>
  48. <body>
  49. <canvas id="c"></canvas>
  50. <section class="body">
  51. <!-- start: header -->
  52. <header-menu></header-menu>
  53. <!-- end: header -->
  54. <div class="inner-wrapper">
  55. <!-- start: sidebar -->
  56. <side-bar></side-bar>
  57. <!-- end: sidebar -->
  58. <section role="main" class="content-body">
  59. <header class="page-header">
  60. <h2>{{pageHeader}}</h2>
  61. </header>
  62. <!-- start: page -->
  63. <section class="content-with-menu content-with-menu-has-toolbar media-gallery">
  64. <div class="content-with-menu-container">
  65. <inner-menu>
  66. <template v-slot:inner-equipment>
  67. <other-list></other-list>
  68. </template>
  69. </inner-menu>
  70. <div class="inner-body mg-main">
  71. <div class="inner-toolbar">
  72. <ul>
  73. <search-bar></search-bar>
  74. <li id="reset" style="padding-top: 10px;">
  75. <div class="input-group input-search" style="table-layout: auto;">
  76. <button class="btn btn-primary" type="button" id="resetbtn" data-toggle="tooltip" ><i class="fa fa-undo"></i></button>
  77. </div>
  78. </li>
  79. </ul>
  80. </div>
  81. <filter-content2></filter-content2>
  82. <div class="row">
  83. <div class="col-md-6">
  84. <section class="panel">
  85. <div class="panel-body">
  86. <h5 class="text-semibold text-dark text-uppercase">檔案下載</h5>
  87. <div id="treeAjaxHTML" style="height:400px;overflow: auto;"></div>
  88. </div>
  89. </section>
  90. <section class="panel">
  91. <div class="panel-body">
  92. <h5 class="text-semibold text-dark text-uppercase">檔案資訊</h5>
  93. <div id="fileTable" style="height:200px">
  94. <table class="table table-bordered mb-none" style="height: 100%;">
  95. <tbody>
  96. <tr>
  97. <th>檔案名稱</th>
  98. <td id="fileName"></td>
  99. </tr>
  100. <tr>
  101. <th>詳細資訊</th>
  102. <td id="fileDetail">尚未填寫</td>
  103. </tr>
  104. <tr>
  105. <th>檔案日期</th>
  106. <td id="fileDate"></td>
  107. </tr>
  108. <tr>
  109. <th>下載連結</th>
  110. <td id="fileLink"><a id="fileHerf" href="#" target="_blank"><i class="fa fa-download">檔案下載</i></a></td>
  111. </tr>
  112. </tbody>
  113. </table>
  114. </div>
  115. </div>
  116. </section>
  117. </div>
  118. <div class="col-md-6">
  119. <section class="panel">
  120. <div class="panel-body">
  121. <div id="pdfFile" style="height:720px"></div>
  122. </div>
  123. </section>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </section>
  129. <!-- end: page -->
  130. </section>
  131. </div>
  132. </section>
  133. <?php include("bim-support-body.html"); ?>
  134. <script>
  135. vm.mount('.body');
  136. $(document).ready(function() {
  137. PDFObject.embed("./assets/null.pdf", "#pdfFile");
  138. /*載入jstree */
  139. $('#treeAjaxHTML').jstree({
  140. 'core': {
  141. 'themes': {
  142. 'responsive': false
  143. },
  144. 'check_callback': true,
  145. 'data': {
  146. 'url': './script/php/getBIMData.php?folder=' + type, // 使用type獲取檔案目錄
  147. }
  148. },
  149. 'search': {
  150. 'show_only_matches': true,
  151. },
  152. 'types': { //依據檔案類型設定不同icon
  153. 'default': {
  154. 'icon': 'fa fa-folder'
  155. },
  156. 'file': {
  157. 'icon': 'fa fa-file-o'
  158. },
  159. 'pdf': {
  160. 'icon': 'fa fa-file-pdf-o'
  161. },
  162. 'word': {
  163. 'icon': 'fa fa-file-word-o'
  164. },
  165. 'excel': {
  166. 'icon': 'fa fa-file-excel-o'
  167. },
  168. 'ppt': {
  169. 'icon': 'fa fa-file-powerpoint-o'
  170. },
  171. 'f-open': {
  172. 'icon': 'fa fa-folder-open'
  173. },
  174. 'f-closed': {
  175. 'icon': 'fa fa-folder'
  176. }
  177. },
  178. 'plugins': ['types', 'search']
  179. }).on('select_node.jstree', function(event, data) {
  180. data.instance.toggle_node(data.node);
  181. //點選pdf時預覽
  182. if (data.node.text.includes(".pdf")) {
  183. PDFObject.embed(data.node.a_attr.href, "#pdfFile");
  184. } else {
  185. if (data.node.text.includes(".")) {
  186. PDFObject.embed("./assets/notPDF.pdf", "#pdfFile");
  187. }
  188. }
  189. //將檔案資訊填入下方表格
  190. if (data.node.text.includes(".")) {
  191. $("#fileName").empty();
  192. $("#fileName").append(data.node.text);
  193. $("#fileHerf").attr("href", data.node.a_attr.href);
  194. $("#fileDate").empty();
  195. $("#fileDate").append(data.node.a_attr.time);
  196. }
  197. }).bind('loaded.jstree', function(e, data) {
  198. });
  199. $("#treeAjaxHTML").on('open_node.jstree', function(event, data) {
  200. data.instance.set_type(data.node, 'f-open');
  201. });
  202. $("#treeAjaxHTML").on('close_node.jstree', function(event, data) {
  203. data.instance.set_type(data.node, 'f-closed');
  204. });
  205. });
  206. // 搜尋jstree
  207. $("#resetbtn").on('click', function(event) {
  208. $("#treeAjaxHTML").jstree("clear_search");
  209. $("#quicksearch").val('');
  210. })
  211. $("#searchBtn").on('click', function(event) {
  212. var search = $("#quicksearch").val();
  213. $("#treeAjaxHTML").jstree("search", search);
  214. })
  215. $("#quicksearch").on('keyup', function(e) {
  216. if (e.key === 'Enter' || e.keyCode === 13) {
  217. var search = $("#quicksearch").val();
  218. $("#treeAjaxHTML").jstree("search", search);
  219. }
  220. });
  221. $('[data-toggle="tooltip"]').tooltip({container: "body",placement:"right",title:"重置搜尋結果"});
  222. </script>
  223. <script src="/Common/assets/vendor/jstree/jstree.js"></script>
  224. </body>
  225. </html>