-
Notifications
You must be signed in to change notification settings - Fork 0
/
porter.php
102 lines (80 loc) · 3.05 KB
/
porter.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
<?php
require_once("util.php");
require("navbar.php");
print "<link rel=\"stylesheet\" href=\"style.css\">";
if(!is_file("config.json")){
header("Location: setup.php");
}else{
$config = json_decode(file_get_contents("config.json"), true);
}
?>
<form method="POST">
<div class="row">
<div class="col-4">
<h2>LAS:eR Export (lokal Speichern)</h2>
<input type="submit" name="exportLicense" value="Verträge exportieren">
<input type="submit" name="exportSub" value="Lizenzen exportieren">
<input type="submit" name="exportAll" value="Komplettexport">
</div>
<div class="col-4">
<h2>FOLIO Import</h2>
<input type="submit" name="importAll" value="Import">
</div>
</div>
</form>
<?php
if(isset($_POST['exportSub'])){
// Fetch list of local subscription
$SAVE_PATH = $config['SAVE_PATH'];
retrieveList($SAVE_PATH, "subscriptionList");
print "<hr><div class=\"flex-container\">Lizenzen exportiert.</div>";
}
if(isset($_POST['exportLicense'])){
// Fetch list of local subscriptions
$SAVE_PATH = $config['SAVE_PATH'];
retrieveList($SAVE_PATH, "licenseList");
print "<hr><div class=\"flex-container\">Verträge exportiert.</div>";
}
if(isset($_POST['exportAll'])){
$SAVE_PATH = $config['SAVE_PATH'];
retrieveList($SAVE_PATH, "licenseList");
retrieveList($SAVE_PATH, "subscriptionList");
print "<hr><div class=\"flex-container\">Verträge und Lizenzen exportiert.</div>";
}
if(isset($_POST['importSub'])){
$SAVE_PATH = $config['SAVE_PATH'];
$subscriptions = "$SAVE_PATH\\subscriptionList";
foreach(scandir($subscriptions) as $subscriptionDir){
if(!is_dir("$subscriptions\\$subscriptionDir")) continue;
if(in_array($subscriptionDir, array(".", ".."))) continue;
importResource("subscription", "$subscriptions\\$subscriptionDir");
}
print "<hr><div class=\"flex-container\">Daten importiert.</div>";
}
if(isset($_POST['importLicense'])){
$SAVE_PATH = $config['SAVE_PATH'];
$licenses = "$SAVE_PATH\\licenseList";
foreach(scandir($licenses) as $licenseDir){
if(!is_dir("$licenses\\$licenseDir")) continue;
if(in_array($licenseDir, array(".", ".."))) continue;
importResource("license", "$licenses\\$licenseDir");
}
print "<hr><div class=\"flex-container\">Daten importiert.</div>";
}
if(isset($_POST['importAll'])){
$SAVE_PATH = $config['SAVE_PATH'];
$licenses = "$SAVE_PATH\\licenseList";
$subscriptions = "$SAVE_PATH\\subscriptionList";
foreach(scandir($licenses) as $licenseDir){
if(!is_dir("$licenses\\$licenseDir")) continue;
if(in_array($licenseDir, array(".", ".."))) continue;
importResource("license", "$licenses\\$licenseDir");
}
foreach(scandir($subscriptions) as $subscriptionDir){
if(!is_dir("$subscriptions\\$subscriptionDir")) continue;
if(in_array($subscriptionDir, array(".", ".."))) continue;
importResource("subscription", "$subscriptions\\$subscriptionDir");
}
print "<hr><div class=\"flex-container\">Daten importiert.</div>";
}
?>