component-favorite.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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">
  10. <head>
  11. <?php include("bim-support-header.html"); ?>
  12. <script src="./script/js/global.js"></script>
  13. <script type="application/javascript">
  14. var delFavoriteList = [];
  15. var i = 0;
  16. var path = [];
  17. var categoryList = [];
  18. var categoryTable = [];
  19. var id = [];
  20. var revitVersion = [];
  21. var userName = '<?php echo $_SESSION['name']; ?>';
  22. var $grid;
  23. //var year = [];
  24. pageHeader = "元件庫";
  25. </script>
  26. </head>
  27. <body>
  28. <canvas id="c"></canvas>
  29. <section class="body">
  30. <!-- start: header -->
  31. <header-menu></header-menu>
  32. <!-- end: header -->
  33. <div class="inner-wrapper">
  34. <!-- start: sidebar -->
  35. <side-bar></side-bar>
  36. <!-- end: sidebar -->
  37. <section role="main" class="content-body">
  38. <header class="page-header">
  39. <h2>{{pageHeader}}</h2>
  40. </header>
  41. <!-- start: page -->
  42. <section class="content-with-menu content-with-menu-has-toolbar media-gallery">
  43. <div class="content-with-menu-container">
  44. <inner-menu>
  45. <template v-slot:inner-upload>
  46. <upload-component></upload-component>
  47. <hr class="separator" />
  48. </template>
  49. <template v-slot:inner-equipment>
  50. <equipment-list></equipment-list>
  51. </template>
  52. </inner-menu>
  53. <div class="inner-body mg-main">
  54. <div class="inner-toolbar">
  55. <ul>
  56. <search-bar></search-bar>
  57. <filter-bar></filter-bar>
  58. <li class="right">
  59. <a href="#" id="mgSelectAll"><i class="fa fa-check-square"></i> <span data-all-text="選擇全部" data-none-text="取消全選">選擇全部</span></a>
  60. </li>
  61. <li class="right">
  62. <a href="#" onclick="DelFavorite();"><i class="fa fa-trash-o"></i> 移出清單</a>
  63. </li>
  64. </ul>
  65. </div>
  66. <filter-content></filter-content>
  67. <div class="row mg-files" data-sort-destination data-sort-id="media-gallery" id="content">
  68. </div>
  69. </div>
  70. </div>
  71. </section>
  72. <!-- end: page -->
  73. </section>
  74. </div>
  75. </section>
  76. <script>
  77. /*Vue */
  78. vm.mount('.body');
  79. </script>
  80. <?php include("bim-support-body.html"); ?>
  81. <script>
  82. $(document).ready(function() {
  83. $.ajax({
  84. url: "./script/php/equipment_group_favorite.php",
  85. type: "GET",
  86. data: {
  87. userName: userName,
  88. },
  89. contentType: "application/json",
  90. dataType: "json"
  91. }).done(function(data) {
  92. id = data.id;
  93. path = data.path;
  94. revitVersion = data.revitVersion;
  95. for (var i = 0; i < data.year.length; i++) {
  96. $("#revitVersion").append('<label><input type="checkbox" value=".' + data.year[i] + '" /> ' + data.year[i] + '</label> ');
  97. }
  98. $grid = $("#content").isotope({
  99. itemSelector: ".isotope-item",
  100. layoutMode: 'fitRows'
  101. })
  102. $.when(initThreeJS()).then(
  103. $grid.isotope()
  104. );
  105. }).error(function(error) {
  106. console.log(error);
  107. });
  108. });
  109. $(document).on("change", "input[name='delCheck']", function() {
  110. if ($(this).prop('checked') === true) {
  111. delFavoriteList.push($(this).attr('value'));
  112. } else {
  113. delFavoriteList.splice(delFavoriteList.indexOf($(this).attr('value')), 1);
  114. }
  115. });
  116. function DelFavorite() {
  117. $.ajax({
  118. url: "./script/php/addFavorite.php",
  119. type: "POST",
  120. data: {
  121. delFavoriteList: delFavoriteList,
  122. username: userName
  123. }
  124. }).done(function(data) {
  125. window.location.reload();
  126. }).error(function(error) {
  127. console.log(error);
  128. });
  129. }
  130. </script>
  131. <script src="script/js/3Dpic-favorite.js" type="module"></script>
  132. </body>
  133. </html>