-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbinterface_test.php
116 lines (76 loc) · 3.13 KB
/
dbinterface_test.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
<?php
for($i = 0; $i < 60; $i++) {
$ct = get_DB_ct($eventid);
$teachers[$ct] = Array('id' => $ct, 'gender' => 'm','type' => 'teacher', 'forename' => 'Maximilian', 'sign' => 'MM'.$ct, 'surname' => 'Musterlehrer', 'class' => '', 'offer' => 0, 'available' => true, 'bus' => 0 );
if (bcmod($i,2)) {
$teachers[$ct]['gender'] = 'f';
$teachers[$ct]['forename'] = 'Erika';
$teachers[$ct]['surname'] = 'Musterlehrerin';
$teachers[$ct]['sign'] = 'ME'.$ct;
}
for ($j = 0; $j < $info['props']['max_wishes']; $j++) {
$teachers[$ct]['wish_'.$j] = '';
}
}
for ($i = 0; $i < 10; $i++) {
$rd = array_rand($teachers);
$teachers[$rd]['available'] = false;
}
for ($i = 5; $i <= 12; $i++) {
for ($j = 1; $j <= 4; $j++) {
$abc = Array(1 => 'a', 2 => 'b', 3 => 'c', 4 => 'd');
if ($i <= 10) {
$classname = $i.$abc[$j];
} else {
$classname = 'K'.($i - 10).'-LKM'.$j;
}
$classes[$classname] = Array();
for ($k = 0; $k < 24; $k++) {
$ct = get_DB_ct($eventid);
$classes[$classname][$ct] = Array('id' => $ct, 'gender' => 'm', 'type' => 'student', 'forename' => 'Maximilian', 'surname' => 'Musterschüler', 'class' => $classname, 'offer' => 0, 'paid' => 0.0, 'cancelled' => 0, 'bus' => 0 );
if (bcmod($k,2)) {
$classes[$classname][$ct]['gender'] = 'f';
$classes[$classname][$ct]['forename'] = 'Erika';
$classes[$classname][$ct]['surname'] = 'Musterschülerin';
}
for ($l = 0; $l < $info['props']['max_wishes']; $l++) {
$classes[$classname][$ct]['wish_'.$l] = '';
}
}
$rd = array_rand($teachers);
while($teachers[$rd]['class'] != '') {
$rd = array_rand($teachers);
}
$teachers[$rd]['class'] = $classname;
}
}
$ct = get_DB_ct($eventid);
$buses[$ct] = Array('id'=>$ct,'type'=>'bus','company'=>'ReiseBUS','tag'=>'HPD-RB-'.$ct,'capacity'=>(50+rand(0,9)));
$ct = get_DB_ct($eventid);
$buses[$ct] = Array('id'=>$ct,'type'=>'bus','company'=>'ReiseBUS','tag'=>'HPD-RB-'.$ct,'capacity'=>(50+rand(0,9)));
$ct = get_DB_ct($eventid);
$buses[$ct] = Array('id'=>$ct,'type'=>'bus','company'=>'ReiseBUS','tag'=>'HPD-RB-'.$ct,'capacity'=>(50+rand(0,9)));
$ct = get_DB_ct($eventid);
$carpools[$ct] = Array('id'=>$ct,'type'=>'carpool','name'=>'','offers'=>'');
$buses[($ct-3)]['carpool'] = $ct;
$buses[($ct-2)]['carpool'] = $ct;
$ct = get_DB_ct($eventid);
$carpools[$ct] = Array('id'=>$ct,'type'=>'carpool','name'=>'','offers'=>'');
$buses[($ct-2)]['carpool'] = $ct;
$oe = parse_ini_file('./vorlagen/offers_example.ini',true);
foreach ($oe as $odata) {
$ct = get_DB_ct($eventid);
$offers[$ct] = $odata;
$rd = array_rand($teachers);
while($teachers[$rd]['offer'] != '' OR !$teachers[$rd]['available']) {
$rd = array_rand($teachers);
}
$offers[$ct]['teacher'] = $rd;
$teachers[$rd]['offer'] = $ct;
$cp = array_rand($carpools);
if ($carpools[$cp]['name'] != '') $carpools[$cp]['name'] .= ', ';
$carpools[$cp]['name'] .= substr($odata['name'],0,10).'.';
if ($carpools[$cp]['offers'] != '') $carpools[$cp]['offers'] .= ', ';
$carpools[$cp]['offers'] .= $ct;
}
?>