-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
202 lines (167 loc) · 5.69 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<html>
<head>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/vis/4.2.0/vis.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-sheetrock/1.0.0/dist/sheetrock.min.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/vis/4.2.0/vis.min.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#mynetwork {
width: 100%;
height: 100%;
border: 1px solid lightgray;
}
</style>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<div id="mynetwork"></div>
<script type="text/javascript">
$( document ).ready(function() {
// create an array with nodes
var nodes = new vis.DataSet(
<?php
/*
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
*/
$peoplehandle = fopen("http://docs.google.com/spreadsheets/d/1l1hC8J1PbR9Fzv0rI9OXc9OcXrEYC19f-eL2JJqBvnw/export?gid=0&format=csv", "r");
while(! feof($peoplehandle))
{
$personlist[] = fgetcsv($peoplehandle);
}
fclose($peoplehandle);
$people = array();
foreach(array_slice($personlist,1) as $person) {
if ($person[1] != ''){
$people[] = array('id' => $person[0], 'label' => $person[1], 'group' => 'people');
}
}
$depthandle = fopen("https://docs.google.com/spreadsheets/d/1l1hC8J1PbR9Fzv0rI9OXc9OcXrEYC19f-eL2JJqBvnw/export?gid=615164215&format=csv", "r");
while(! feof($depthandle))
{
$deptlist[] = fgetcsv($depthandle);
}
fclose($depthandle);
$departments = array();
foreach(array_slice($deptlist,1) as $department) {
if ($department[1] != ''){
$departments[] = array('id' => $department[0], 'label' => ($department[2] . ' ' . $department[1]), 'group' => 'departments');
}
}
$archandle = fopen("https://docs.google.com/spreadsheets/d/1l1hC8J1PbR9Fzv0rI9OXc9OcXrEYC19f-eL2JJqBvnw/export?gid=1442919662&format=csv", "r");
while(! feof($archandle))
{
$arclist[] = fgetcsv($archandle);
}
fclose($archandle);
$archives = array();
foreach(array_slice($arclist,1) as $archive) {
if ($archive[1] != ''){
$archives[] = array('id' => $archive[0], 'label' => ($archive[2] . ' ' . $archive[1]), 'group' => 'archives');
}
}
$pubhandle = fopen("https://docs.google.com/spreadsheets/d/1l1hC8J1PbR9Fzv0rI9OXc9OcXrEYC19f-eL2JJqBvnw/export?gid=1870068310&format=csv", "r");
while(! feof($pubhandle))
{
$publist[] = fgetcsv($pubhandle);
}
fclose($pubhandle);
$publications = array();
foreach(array_slice($publist,1) as $publication) {
if ($publication[1] != ''){
$publications[] = array('id' => $publication[0], 'label' => $publication[1], 'group' => 'journals');
}
}
$allnodes = array_merge($people, $publications, $departments, $archives);
print json_encode($allnodes);
?>
);
// create an array with edges
var edges = new vis.DataSet(
<?php
$archivaledgehandle = fopen("https://docs.google.com/spreadsheets/d/1l1hC8J1PbR9Fzv0rI9OXc9OcXrEYC19f-eL2JJqBvnw/export?gid=1266730310&format=csv", "r");
while(! feof($archivaledgehandle))
{
$archivaledgelist[] = fgetcsv($archivaledgehandle);
}
fclose($archivaledgehandle);
$archivaledges = array();
foreach(array_slice($archivaledgelist,1) as $archivaledge) {
$archivaledges[] = array('from' => $archivaledge[0], 'to' => $archivaledge[1], width => '1');
}
$pubedgehandle = fopen("https://docs.google.com/spreadsheets/d/1l1hC8J1PbR9Fzv0rI9OXc9OcXrEYC19f-eL2JJqBvnw/export?gid=1878598901&format=csv", "r");
while(! feof($pubedgehandle))
{
$pubedgelist[] = fgetcsv($pubedgehandle);
}
fclose($pubedgehandle);
$pubedges = array();
foreach(array_slice($pubedgelist,1) as $pubedge) {
$pubedges[] = array('from' => $pubedge[1], 'to' => $pubedge[2], width => '1');
}
$deptedgehandle = fopen("https://docs.google.com/spreadsheets/d/1l1hC8J1PbR9Fzv0rI9OXc9OcXrEYC19f-eL2JJqBvnw/export?gid=1494772489&format=csv", "r");
while(! feof($deptedgehandle))
{
$deptedgelist[] = fgetcsv($deptedgehandle);
}
fclose($deptedgehandle);
$deptedges = array();
foreach(array_slice($deptedgelist,1) as $deptedge) {
$deptedges[] = array('from' => $deptedge[0], 'to' => $deptedge[1], width => '1');
}
$alledges = array_merge($archivaledges, $pubedges, $deptedges);
print json_encode($alledges);
?>
);
// create a network
var container = document.getElementById('mynetwork');
// provide the data in the vis format
var data = {
nodes: nodes,
edges: edges
};
var options = {
autoResize: true,
groups: {
people: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf007',
}
},
departments: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf19c',
}
},
archives: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf187',
}
},
journals: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf02d',
}
}
}
};
// initialize your network!
var network = new vis.Network(container, data, options);
$(window).resize(function(){
$("div#mynetwork").width($(window).width());
$("div#mynetwork").height($(window).height());
network.redraw();
});
});
</script>
</body>
</html>