other-list.php 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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="assets/vendor/jstree/themes/default/style.css" />
  13. <!-- jstree CSS -->
  14. <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.4/themes/default/style.min.css"> -->
  15. <?php include("bim-support-header.html"); ?>
  16. <script src="./script/js/global.js"></script>
  17. <script src="./script/js/pdfobject.min.js"></script>
  18. <script type="application/javascript">
  19. var url_href = window.location.href;
  20. var url = new URL(url_href);
  21. var type = url.searchParams.get("type");
  22. if (type === null) {
  23. window.location.href = "other-list.php?type=收費建議";
  24. }
  25. var delFavoriteList = [];
  26. var i = 0;
  27. var path = [];
  28. var categoryList = [];
  29. var categoryTable = [];
  30. var id = [];
  31. var revitVersion = [];
  32. var userName = '<?php echo $_SESSION['name']; ?>';
  33. var url_href = window.location.href;
  34. var url = new URL(url_href);
  35. var $grid;
  36. var list;
  37. pageHeader = "BIM相關資源";
  38. </script>
  39. <style>
  40. .menu-item.active {
  41. color: #0088CC;
  42. }
  43. .jstree-anchor {
  44. width: 95%;
  45. text-overflow: ellipsis;
  46. overflow: hidden;
  47. white-space: nowrap;
  48. }
  49. th {
  50. text-align: center;
  51. width: 30%;
  52. font-size: 18px;
  53. }
  54. td {
  55. text-align: center;
  56. font-size: 18px;
  57. }
  58. </style>
  59. </head>
  60. <body>
  61. <canvas id="c"></canvas>
  62. <section class="body">
  63. <!-- start: header -->
  64. <header-menu></header-menu>
  65. <!-- end: header -->
  66. <div class="inner-wrapper">
  67. <!-- start: sidebar -->
  68. <side-bar></side-bar>
  69. <!-- end: sidebar -->
  70. <section role="main" class="content-body">
  71. <header class="page-header">
  72. <h2>{{pageHeader}}</h2>
  73. </header>
  74. <!-- start: page -->
  75. <section class="content-with-menu content-with-menu-has-toolbar media-gallery">
  76. <div class="content-with-menu-container">
  77. <inner-menu>
  78. <template v-slot:inner-equipment>
  79. <other-list></other-list>
  80. </template>
  81. </inner-menu>
  82. <div class="inner-body mg-main">
  83. <div class="inner-toolbar">
  84. <ul>
  85. <search-bar></search-bar>
  86. <li id="reset" style="padding-top: 10px; display:none;">
  87. <div class="input-group input-search" style="table-layout: auto;">
  88. <button class="btn btn-primary" type="button" id="resetbtn" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="清除搜尋結果"><i class="fa fa-undo"></i></button>
  89. </div>
  90. </li>
  91. </ul>
  92. </div>
  93. <filter-content2></filter-content2>
  94. <div class="row">
  95. <div class="col-md-6">
  96. <section class="panel">
  97. <div class="panel-body">
  98. <h5 class="text-semibold text-dark text-uppercase">檔案下載</h5>
  99. <div id="treeAjaxHTML" style="height:400px;overflow: auto;"></div>
  100. </div>
  101. </section>
  102. <section class="panel">
  103. <div class="panel-body">
  104. <h5 class="text-semibold text-dark text-uppercase">檔案資訊</h5>
  105. <div id="fileTable" style="height:200px">
  106. <table class="table table-bordered mb-none" style="height: 100%;">
  107. <tbody>
  108. <tr>
  109. <th>檔案名稱</th>
  110. <td id="fileName"></td>
  111. </tr>
  112. <tr>
  113. <th>詳細資訊</th>
  114. <td id="fileDetail">尚未填寫</td>
  115. </tr>
  116. <tr>
  117. <th>檔案日期</th>
  118. <td id="fileDate"></td>
  119. </tr>
  120. <tr>
  121. <th>下載連結</th>
  122. <td id="fileLink"><a id="fileHerf" href="#" target="_blank"><i class="fa fa-download">檔案下載</i></a></td>
  123. </tr>
  124. </tbody>
  125. </table>
  126. </div>
  127. </div>
  128. </section>
  129. </div>
  130. <div class="col-md-6">
  131. <section class="panel">
  132. <div class="panel-body">
  133. <div id="pdfFile" style="height:720px"></div>
  134. </div>
  135. </section>
  136. </div>
  137. </div>
  138. <!-- <div class="row mg-files" data-sort-destination="" data-sort-id="media-gallery" id="content" style="position: relative; height: 720.5px;">
  139. <isotope-item v-for="item in list" v-bind:name="item.APIName" v-bind:folder="item.APIID + item.APIName" v-bind:id="item.id" v-bind:object="item.object" v-bind:usage="item.usage" v-bind:software="item.software" v-bind:detail="item.detail" v-bind:operate="item.operate" v-bind:source="item.source">
  140. </isotope-item>
  141. </div> -->
  142. </div>
  143. </div>
  144. </section>
  145. <!-- end: page -->
  146. </section>
  147. </div>
  148. </section>
  149. <script>
  150. var folder = 'Dynamo/自動化汙水管線建置';
  151. $.ajax({
  152. url: "./script/php/getPath.php",
  153. type: "GET",
  154. async: false,
  155. data: {
  156. type: type,
  157. },
  158. contentType: "application/json",
  159. dataType: "json"
  160. }).done(function(data) {
  161. var table = data.table;
  162. for (i = 0; i < table.length; i++) {
  163. listObj = {};
  164. listObj["APIName"] = table[i].APIName;
  165. if (table[i].APIID == null)
  166. table[i].APIID = '';
  167. listObj["APIID"] = table[i].APIID;
  168. listObj["id"] = table[i].id;
  169. if (table[i].object != null)
  170. table[i].object = table[i].object.replaceAll(",", " ");
  171. listObj["object"] = table[i].object;
  172. if (table[i].usage != null)
  173. table[i].usage = table[i].usage.replaceAll(",", " ");
  174. listObj["usage"] = table[i].usage;
  175. listObj["software"] = table[i].software;
  176. listObj["detail"] = table[i].detail;
  177. listObj["operate"] = table[i].operate;
  178. listObj["source"] = table[i].source;
  179. list.push(listObj);
  180. }
  181. var filter = data.objectFilter;
  182. var filterArray = [];
  183. for (i = 0; i < filter.length; i++) {
  184. filterArray = filter[i].object.split(",")
  185. for (j = 0; j < filterArray.length; j++) {
  186. objectFilter.push(filterArray[j]);
  187. }
  188. }
  189. objectFilter = [...new Set(objectFilter)];
  190. filter = data.usageFilter;
  191. for (i = 0; i < filter.length; i++) {
  192. filterArray = filter[i].usage.split(",");
  193. for (j = 0; j < filterArray.length; j++) {
  194. usageFilter.push(filterArray[j]);
  195. }
  196. }
  197. usageFilter = [...new Set(usageFilter)];
  198. vm.mount('.body');
  199. }).error(function(error) {
  200. console.log(error);
  201. });
  202. </script>
  203. <?php include("bim-support-body.html"); ?>
  204. <script>
  205. $(document).ready(function() {
  206. PDFObject.embed("./assets/null.pdf", "#pdfFile");
  207. console.log(type);
  208. $('#treeAjaxHTML').jstree({
  209. 'core': {
  210. 'themes': {
  211. 'responsive': false
  212. },
  213. 'check_callback': true,
  214. 'data': {
  215. 'url': './script/php/getBIMData.php?folder=' + type,
  216. }
  217. },
  218. 'search': {
  219. 'show_only_matches': true,
  220. },
  221. 'types': {
  222. 'default': {
  223. 'icon': 'fa fa-folder'
  224. },
  225. 'file': {
  226. 'icon': 'fa fa-file-o'
  227. },
  228. 'pdf': {
  229. 'icon': 'fa fa-file-pdf-o'
  230. },
  231. 'word': {
  232. 'icon': 'fa fa-file-word-o'
  233. },
  234. 'excel': {
  235. 'icon': 'fa fa-file-excel-o'
  236. },
  237. 'ppt': {
  238. 'icon': 'fa fa-file-powerpoint-o'
  239. },
  240. 'f-open': {
  241. 'icon': 'fa fa-folder-open'
  242. },
  243. 'f-closed': {
  244. 'icon': 'fa fa-folder'
  245. }
  246. },
  247. 'plugins': ['types', 'search']
  248. }).on(
  249. 'select_node.jstree',
  250. function(event, data) {
  251. data.instance.toggle_node(data.node);
  252. /*if (data.node.text.includes(".") & !data.node.text.includes(".pdf")) {
  253. console.log(data.node);
  254. var link = document.createElement("a");
  255. link.download = data.node.text;
  256. link.href = data.node.a_attr.href;
  257. document.body.appendChild(link);
  258. link.click();
  259. document.body.removeChild(link);
  260. } else */
  261. if (data.node.text.includes(".pdf")) {
  262. PDFObject.embed(data.node.a_attr.href, "#pdfFile");
  263. } else {
  264. if (data.node.text.includes(".")) {
  265. PDFObject.embed("./assets/notPDF.pdf", "#pdfFile");
  266. }
  267. }
  268. if (data.node.text.includes(".")) {
  269. $("#fileName").empty();
  270. $("#fileName").append(data.node.text);
  271. $("#fileHerf").attr("href", data.node.a_attr.href);
  272. $("#fileDate").empty();
  273. $("#fileDate").append(data.node.a_attr.time);
  274. }
  275. }).bind('loaded.jstree', function(e, data) {
  276. // invoked after jstree has loaded
  277. /*$('.jstree-anchor').each(function(index) {
  278. if ($(this).attr('href').includes(".dll") || $(this).attr('href').includes(".dyn") || $(this).attr('href').includes(".exe") || $(this).attr('href').includes(".msi")) {
  279. folder.push($(this).attr('href'));
  280. }
  281. });
  282. if (api != null) {
  283. for (i = 0; i < api.length; i++) {
  284. var fileNames = api[i].split("/");
  285. fileName = fileNames[fileNames.length - 1];
  286. $("#apiList").append("<a download href='" + api[i] + "' id='api" + i + "'>" + fileName + "</a><br>");
  287. }
  288. }*/
  289. });
  290. $("#treeAjaxHTML").on('open_node.jstree', function(event, data) {
  291. data.instance.set_type(data.node, 'f-open');
  292. });
  293. $("#treeAjaxHTML").on('close_node.jstree', function(event, data) {
  294. data.instance.set_type(data.node, 'f-closed');
  295. });
  296. });
  297. $("#resetbtn").on('click', function(event) {
  298. $("#treeAjaxHTML").jstree("clear_search");
  299. $("#quicksearch").val('');
  300. })
  301. $("#searchBtn").on('click', function(event) {
  302. var search = $("#quicksearch").val();
  303. $("#treeAjaxHTML").jstree("search", search);
  304. })
  305. $("#quicksearch").on('keyup', function(e) {
  306. if (e.key === 'Enter' || e.keyCode === 13) {
  307. var search = $("#quicksearch").val();
  308. $("#treeAjaxHTML").jstree("search", search);
  309. }
  310. });
  311. </script>
  312. <script src="assets/vendor/jstree/jstree.js"></script>
  313. </body>
  314. </html>