/
extras.php
93 lines (85 loc) · 2.6 KB
/
extras.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
<?php
/*
* für die options für die dropdown menüs
* hier einige vorlagen später auch noch in die HTML umzusetzen
*/
//options für die abteilungen
$abteilung = $out;
$abt = Abteilung::getAll();
$options = [];
// zum abwählen
$options[0] = ['value' => 0, 'label' => ''];
foreach ($abt as $o) {
$options[$o->getId()] = ['value' => $o->getId(), 'label' => $o->getName()];
if ($o->getId() === $abteilung->getAbteilung()->getId()) {
$options[$o->getId()]['selected'] = TRUE;
}
}
// options für die vorgesetzten
$vorgesetzte = Mitarbeiter::getAll();
$options2 = [];
// zum abwählen
$options2[0] = ['value' => 0, 'label' => ''];
$hatVorgesetzte = FALSE;
foreach ($vorgesetzte as $o) {
$options2[$o->getId()] = ['value' => $o->getId(), 'label' => $o->getVorname() . ' ' . $o->getNachname()];
if ($o->getVorgesetzter() !== NULL) {
if ($o->getId() === $out->getId()) {
$options2[$o->getVorgesetzter()->getId()]['selected'] = TRUE;
$hatVorgesetzte = TRUE;
}
}
}
if ($hatVorgesetzte == FALSE) {
$options2[0]['selected'] = TRUE;
}
?>
<!-- für den clicklistener -->
<script>
$("button").click(Mitarbeiter);
function Mitarbeiter() {
$.post("index.php",
{
ajax: "true",
action: "showList",
area: "Auto",
view: "listeAuto",
id: this.id
},
function (data, status) {
$('#content').html(data);
$("button").click(Mitarbeiter2);
});
}
function Mitarbeiter2() {
$.post("index.php",
{
ajax: "true",
action: "showList",
area: "Mitarbeiter",
view: "listeMitarbeiter",
id: this.id
},
function (data, status) {
$('#content').html(data);
$("button").click(Mitarbeiter);
});
}
$("button").click(function () {
alert(this.id);
// alert(this.value);
$.post("index.php",
{
ajax: "true",
// action: "showList",
action: "showInsert",
area: "ProjektMitarbeiter",
// view: "listeAuto",
view: "formularProjektMitarbeiter",
id: this.id
},
function (data, status) {
$('#content').html(data);
});
});
</script>