فهرست منبع

新增初版bim相關資源庫

manto07m 3 سال پیش
والد
کامیت
6a34ef0ad2
5فایلهای تغییر یافته به همراه329 افزوده شده و 1 حذف شده
  1. 1 0
      assets/null.pdf
  2. 247 0
      other-list.php
  3. 28 1
      script/js/global.js
  4. 8 0
      script/js/pdfobject.min.js
  5. 45 0
      script/php/getBIMData.php

+ 1 - 0
assets/null.pdf

@@ -0,0 +1 @@
+

+ 247 - 0
other-list.php

@@ -0,0 +1,247 @@
+<?php
+session_start();
+if (!isset($_SESSION['loggedin'])) {
+	header('Location: pages-signin.html');
+	exit;
+}
+?>
+<!doctype html>
+<html class="fixed">
+
+<head>
+	<!-- jstree CSS -->
+	<link rel="stylesheet" href="assets/vendor/jstree/themes/default/style.css" />
+	<?php include("bim-support-header.html"); ?>
+	<script src="./script/js/global.js"></script>
+	<script src="./script/js/pdfobject.min.js"></script>
+	<script type="application/javascript">
+		var delFavoriteList = [];
+		var i = 0;
+		var path = [];
+		var categoryList = [];
+		var categoryTable = [];
+		var id = [];
+		var revitVersion = [];
+		var userName = '<?php echo $_SESSION['name']; ?>';
+		var url_href = window.location.href;
+		var url = new URL(url_href);
+		var type = url.searchParams.get("type");
+		var $grid;
+		var list;
+
+		pageHeader = "BIM程式庫";
+	</script>
+</head>
+
+<body>
+	<canvas id="c"></canvas>
+	<section class="body">
+		<!-- start: header -->
+		<header-menu></header-menu>
+		<!-- end: header -->
+		<div class="inner-wrapper">
+			<!-- start: sidebar -->
+			<side-bar></side-bar>
+			<!-- end: sidebar -->
+			<section role="main" class="content-body">
+				<header class="page-header">
+					<h2>{{pageHeader}}</h2>
+				</header>
+				<!-- start: page -->
+				<section class="content-with-menu content-with-menu-has-toolbar media-gallery">
+					<div class="content-with-menu-container">
+						<inner-menu>
+							<template v-slot:inner-equipment>
+								<other-list></other-list>
+							</template>
+						</inner-menu>
+						<div class="inner-body mg-main">
+							<div class="inner-toolbar">
+								
+							</div>
+							<filter-content2></filter-content2>
+							<div class="row">
+								<div class="col-md-6">
+									<section class="panel">
+										<div class="panel-body">
+											<h5 class="text-semibold text-dark text-uppercase">檔案下載</h5>
+											<div id="treeAjaxHTML"  style="height:800px"></div>
+										</div>
+
+
+									</section>
+								</div>
+								<div class="col-md-6">
+									<section class="panel">
+										<div class="panel-body">
+											<div id="pdfFile" style="height:800px"></div>
+										</div>
+
+
+									</section>
+								</div>
+							</div>
+							<!-- <div class="row mg-files" data-sort-destination="" data-sort-id="media-gallery" id="content" style="position: relative; height: 720.5px;">
+								<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">
+								</isotope-item>
+
+							</div> -->
+						</div>
+					</div>
+				</section>
+				<!-- end: page -->
+			</section>
+		</div>
+	</section>
+	<script>
+		var folder = 'Dynamo/自動化汙水管線建置';
+		$.ajax({
+			url: "./script/php/getPath.php",
+			type: "GET",
+			async: false,
+			data: {
+				type: type,
+			},
+			contentType: "application/json",
+			dataType: "json"
+		}).done(function(data) {
+			var table = data.table;
+
+			for (i = 0; i < table.length; i++) {
+				listObj = {};
+				listObj["APIName"] = table[i].APIName;
+				if (table[i].APIID == null)
+					table[i].APIID = '';
+				listObj["APIID"] = table[i].APIID;
+				listObj["id"] = table[i].id;
+				if (table[i].object != null)
+					table[i].object = table[i].object.replaceAll(",", " ");
+				listObj["object"] = table[i].object;
+				if (table[i].usage != null)
+					table[i].usage = table[i].usage.replaceAll(",", " ");
+				listObj["usage"] = table[i].usage;
+				listObj["software"] = table[i].software;
+				listObj["detail"] = table[i].detail;
+				listObj["operate"] = table[i].operate;
+				listObj["source"] = table[i].source;
+				list.push(listObj);
+			}
+
+			var filter = data.objectFilter;
+			var filterArray = [];
+
+			for (i = 0; i < filter.length; i++) {
+				filterArray = filter[i].object.split(",")
+				for (j = 0; j < filterArray.length; j++) {
+					objectFilter.push(filterArray[j]);
+				}
+			}
+			objectFilter = [...new Set(objectFilter)];
+
+			filter = data.usageFilter;
+			for (i = 0; i < filter.length; i++) {
+				filterArray = filter[i].usage.split(",");
+				for (j = 0; j < filterArray.length; j++) {
+					usageFilter.push(filterArray[j]);
+				}
+			}
+			usageFilter = [...new Set(usageFilter)];
+
+			vm.mount('.body');
+		}).error(function(error) {
+			console.log(error);
+		});
+	</script>
+
+	<?php include("bim-support-body.html"); ?>
+
+	<script>
+		//	$(document).ready(function() {
+		$grid = $("#content").isotope({
+			itemSelector: ".isotope-item",
+			layoutMode: 'fitRows',
+			getSortData: {
+				name: '.name',
+			}
+		})
+
+		setTimeout(() => {
+			$grid.isotope({
+				sortBy: 'name'
+			})
+		}, 100);
+
+		//	});
+
+		$(document).ready(function() {
+			PDFObject.embed("./assets/null.pdf", "#pdfFile");
+			console.log(type);
+			$('#treeAjaxHTML').jstree({
+				'core': {
+					'themes': {
+						'responsive': false
+					},
+					'check_callback': true,
+					'data': {
+						'url': './script/php/getBIMData.php?folder=' + type,
+					}
+				},
+				'types': {
+					'default': {
+						'icon': 'fa fa-folder'
+					},
+					'file': {
+						'icon': 'fa fa-file'
+					},
+					'pdf': {
+						'icon': 'fa fa-file-pdf-o'
+					},
+					'word': {
+						'icon': 'fa fa-file-word-o'
+					},
+					'ppt': {
+						'icon': 'fa fa-file-powerpoint-o'
+					}
+				},
+				'plugins': ['types']
+			}).on(
+				'select_node.jstree',
+				function(event, data) {
+
+					data.instance.toggle_node(data.node);
+
+					if (data.node.text.includes(".") & !data.node.text.includes(".pdf")) {
+						console.log(data.node);
+						var link = document.createElement("a");
+						link.download = data.node.text;
+						link.href = data.node.a_attr.href;
+						document.body.appendChild(link);
+						link.click();
+						document.body.removeChild(link);
+
+					}else if(data.node.text.includes(".pdf")){
+						PDFObject.embed(data.node.a_attr.href, "#pdfFile");
+					}
+
+
+				}).bind('loaded.jstree', function(e, data) {
+				// invoked after jstree has loaded
+				/*$('.jstree-anchor').each(function(index) {
+					if ($(this).attr('href').includes(".dll") || $(this).attr('href').includes(".dyn") || $(this).attr('href').includes(".exe") || $(this).attr('href').includes(".msi")) {
+						folder.push($(this).attr('href'));
+					}
+				});
+				if (api != null) {
+					for (i = 0; i < api.length; i++) {
+						var fileNames = api[i].split("/");
+						fileName = fileNames[fileNames.length - 1];
+						$("#apiList").append("<a download href='" + api[i] + "' id='api" + i + "'>" + fileName + "</a><br>");
+					}
+				}*/
+			});
+		});
+	</script>
+	<script src="assets/vendor/jstree/jstree.js"></script>
+</body>
+
+</html>

+ 28 - 1
script/js/global.js

@@ -1,4 +1,4 @@
-var bimSupport = "BIM支援網";
+var bimSupport = "BIM資源網";
 var pageHeader = "";
 var list = new Array();
 var objectFilter = [];
@@ -87,6 +87,7 @@ vm.component('side-bar', {
                                 <side-bar-list href="component-list.php" fa="fa fa-briefcase" span="BIM元件庫"></side-bar-list>
                                 <side-bar-list href="api-list.php" fa="fa fa-gear" span="BIM程式庫"></side-bar-list>    
                                 <side-bar-list href="video-list.php" fa="fa fa-video-camera" span="亞新教育訓練平台"></side-bar-list>
+                                <side-bar-list href="other-list.php" fa="fa fa-tasks" span="BIM相關資源"></side-bar-list>
                             </ul>
                         </li>
                     </ul>
@@ -523,6 +524,32 @@ vm.component('api-list', {
 </div>`,
 });
 
+vm.component('other-list', {
+    data() {
+        return {
+            jsonData: jsonData,
+            userName: userName,
+            url: "component-favorite.php?userName=" + userName,
+        }
+    },
+    template: `<div class="sidebar-widget m-none">
+    <div class="widget-header clearfix">
+        <h6 class="title pull-left mt-xs">類別</h6>                    
+    </div>
+    <div class="widget-content">
+        <ul class="mg-folders">
+            <inner-menu-li href="other-list.php?type=收費建議" name="收費建議"></inner-menu-li>
+            <inner-menu-li href="other-list.php?type=契約需求範例" name="契約需求範例"></inner-menu-li>
+            <inner-menu-li href="other-list.php?type=驗收標準" name="驗收標準"></inner-menu-li>
+            <inner-menu-li href="other-list.php?type=BIM專案管理" name="BIM專案管理"></inner-menu-li>
+            <inner-menu-li href="other-list.php?type=樣板" name="樣板"></inner-menu-li>
+            <inner-menu-li href="other-list.php?type=其他" name="其他"></inner-menu-li>
+        </ul>
+    </div>
+    <hr class="separator" />
+</div>`,
+});
+
 vm.component('isotope-item', {
     data() {
         return {

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 8 - 0
script/js/pdfobject.min.js


+ 45 - 0
script/php/getBIMData.php

@@ -0,0 +1,45 @@
+<?php
+$folder = 'BIM專案管理';
+if (isset($_GET["folder"])) {
+    $folder = $_GET["folder"];
+}
+$root = '../../assets/BIMData';
+
+$ajax = array();
+FindPath($root, $folder, $ajax);
+
+//echo json_encode($ajax, JSON_UNESCAPED_UNICODE);
+
+function FindPath($root, $folder, $ajax)
+{
+
+    $rootPath = $root . '/' . $folder;
+    $paths = array_diff(scandir($root . '/' . $folder), array('.', '..', 'Thumbs.db'));
+    echo ("<ul>");
+    foreach ($paths as $path) {
+
+        if (str_contains($path, '.')) {
+            //if (!str_contains(strtolower($path), '.png')) {
+                if(str_contains($path,'.pdf')){
+                    echo ("<li data-jstree='{ " . '"type" : "pdf"' . " }' >");
+                }else if(str_contains($path,'.doc')){
+                    echo ("<li data-jstree='{ " . '"type" : "word"' . " }' >");
+                }else if(str_contains($path,'.ppt')){
+                    echo ("<li data-jstree='{ " . '"type" : "ppt"' . " }' >");
+                }else{
+                    echo ("<li data-jstree='{ " . '"type" : "file"' . " }' >");
+                }
+                
+                $path = "<a href='" . substr($rootPath, 4) . "/" . $path . "'>" . $path . "</a>";
+                echo ($path);
+                echo ("</li>");
+            //}
+        } else {
+            echo ("<li>");
+            echo ($path);
+            FindPath($rootPath, $path, $ajax);
+            echo ("</li>");
+        }
+    }
+    echo ("</ul>");
+}

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است