forked from hbeyer/libreto
/
saveProject.php
108 lines (94 loc) · 3.67 KB
/
saveProject.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
<?php
include('classDefinition.php');
include('makeEntry.php');
include('ingest.php');
include('encode.php');
include('parseDOM.php');
include('makeIndex.php');
include('makeSection.php');
include('makeNavigation.php');
include('makeHead.php');
include('makeGeoDataSheet.php');
include('makeCloudList.php');
include('makeDoughnutList.php');
include('storeBeacon.php');
include('setConfiguration.php');
//$thisCatalogue = setConfiguration('liddel');
//$thisCatalogue = setConfiguration('bahn');
$thisCatalogue = setConfiguration('rehl');
$facets = $thisCatalogue->facets;
//Erstelle ein Verzeichnis für das Projekt (wird momentan vom Skript storeData.php erledigt.
$folderName = fileNameTrans($thisCatalogue->heading);
/*if(is_dir($folderName) == FALSE) {
mkdir($folderName, 0700);
} */
// Erstellt Kopien der proprietären CSS- und JS-Datei im Projektverzeichnis
copy ('proprietary.css', $folderName.'/proprietary.css');
copy ('proprietary.js', $folderName.'/proprietary.js');
copy ('chart.js', $folderName.'/chart.js');
// Hole die vom Skript storeData.php zwischengespeicherten Daten aus dem Projektverzeichnis
$dataString = file_get_contents($folderName.'/data-'.$thisCatalogue->key);
$data = unserialize($dataString);
unset($dataString);
// Füge die Datasheets für den GeoBrowser dem Projektverzeichnis hinzu (zeitweise aufgehoben)
//makeGeoDataSheet($data, $folderName, 'KML');
//makeGeoDataSheet($data, $folderName, 'CSV');
/* Hier werden die Strukturen (jeweils ein Array aus section-Objekten) gebildet
und im Array $structures zwischengespeichert.
*/
$structures = array();
include('fieldList.php');
foreach($facets as $facet) {
if(in_array($facet, $indexFields)) {
$structure = makeSections($data, $facet);
if(in_array($facet, $volumeFields)) {
foreach($structure as $section) {
$section = makeVolumes($section);
}
}
$structures[] = $structure;
}
}
// Zu jeder Struktur wird eine Liste mit Kategorien für das Inhaltsverzeichnis berechnet.
$count = 0;
$tocs = array();
foreach($structures as $structure) {
$tocs[$facets[$count]] = makeToC($structure);
$count++;
}
// Für jede Struktur wird jetzt eine HTML-Datei berechnet und gespeichert.
$count = 0;
foreach($structures as $structure) {
$facet = $facets[$count];
$navigation = makeNavigation($thisCatalogue->heading, $tocs, $facet);
$content = makeHead($thisCatalogue, $navigation, $facet);
$content .= makeList($structure, $thisCatalogue);
$content .= $foot;
$fileName = fileNameTrans($folderName.'/'.$thisCatalogue->heading).'-'.$facet.'.html';
$datei = fopen($fileName,"w");
fwrite($datei, $content, 3000000);
fclose($datei);
$count++;
}
unset($structures);
// Erzeugen der Seite mit den Word Clouds
$navigation = makeNavigation($thisCatalogue->heading, $tocs, 'jqcloud');
$content = makeHead($thisCatalogue, $navigation, 'jqcloud');
$content .= makeCloudPageContent($data, $facets, $folderName);
$content .= $foot;
$fileName = fileNameTrans($folderName.'/'.$thisCatalogue->heading).'-wordCloud.html';
$datei = fopen($fileName,"w");
fwrite($datei, $content, 3000000);
fclose($datei);
// Erzeugen der Seite mit den Doughnut Charts
$navigation = makeNavigation($thisCatalogue->heading, $tocs, 'doughnut');
$content = makeHead($thisCatalogue, $navigation, 'doughnut');
$content .= makeDoughnutPageContent($data, $facets, $folderName);
$content .= $foot;
$fileName = fileNameTrans($folderName.'/'.$thisCatalogue->heading).'-doughnut.html';
$datei = fopen($fileName,"w");
fwrite($datei, $content, 3000000);
fclose($datei);
// Lösche die von storeBeacon erzeugte temporäre Datei
//unlink($folderName.'/beaconStore-'.$thisCatalogue->key);
?>