forked from StandeBoer/PvB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
174 lines (161 loc) · 8.13 KB
/
index.php
File metadata and controls
174 lines (161 loc) · 8.13 KB
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
<?php
include("check.php");
include("connect.php");
?>
<html>
<head>
<meta charset="UTF-8">
<title>MiniProeve</title>
<link type="text/css" rel="stylesheet" media="screen,projection" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/css/materialize.min.css" />
<link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link type="text/css" rel="stylesheet" href="stylesheet.css">
<style>
textArea{
min-height: 500px;
}
</style>
</head>
<body class="achtergrond">
<?php
include("navbar.php");
include("ModalAddStudent.php");
include("ModalAddKerntaak.php");
include("ModalAddWerkproces.php");
include("ModalAddCriterium.php");
?>
<div class="row">
<div class="col s12 m4 l3 sidebar">
<h2>Welkom</h2>
<?php
$get_name = "SELECT user_first_name, user_last_name FROM users WHERE user_emailadres = '" . $_SESSION['email'] . "'";
$result_get_name = $conn->query($get_name);
if ($result_get_name->num_rows > 0) {
while ($row_get_name = $result_get_name->fetch_assoc()) {
?>
<h4><?php echo $row_get_name['user_first_name'] . ' ' . $row_get_name['user_last_name']; ?></h4>
<?php
}
} else {
echo 'Not logged in';
}
?>
<!-- Button voor de modal voor het toevoegen van een student -->
<ul class="collection">
<li class="collection-item"><button data-target="ModalAddStudent" class="btn modal-trigger" style="width:250px">Student Toevoegen</button></li>
<li class="collection-item"><button data-target="ModalAddKerntaak" class="btn modal-trigger" style="width:250px">Kerntaak Toevoegen</button></li>
<li class="collection-item"><button data-target="ModalAddWerkproces" class="btn modal-trigger" style="width:250px">Werkproces Toevoegen</button></li>
<li class="collection-item"><button data-target="ModalAddCriterium" class="btn modal-trigger" style="width:250px">Criterium Toevoegen</button></li>
</ul>
</div>
<div class="col s12 m8 l9">
</div>
</div>
<!--EINDE CODE VOOR KLAS TOEVOEGEN BACKEND -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/js/materialize.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
$(".modal-trigger").leanModal();
$("select").material_select();
$(".button-collapse").sideNav();
// Edit criteria
$("button[name=EditCriterium]").on('click', function () {
// waarde van het geselecteerde id ophalen
id_criterium = $(this).data("id");
//alert(id_criterium);
// Velden leeg maken
document.getElementById("criterium_id").value = "";
document.getElementById("criterium_naam").value = "";
// ophalen van informatie, met ajax om naam/omschrijving kerntaak op te halen
$.ajax({
type: 'GET',
url: 'json_edit_criterium.php',
data: {id: id_criterium},
dataType: 'json',
success: function (data) {
//console.log(data);
$("#criterium_id").val(data.id);
$("#criterium_naam").val(data.name);
$("#criterium_naam").removeClass("hide");
},
});
});
// Delete criteria
$("button[name=DeleteCriterium]").click(function (event) {
event.preventDefault();
// ophalen van het id
var werkproces_criterium_id = $(this).data("id");
// link aanpassen
$("#delhref").attr("href", "delete_criterium.php?id=" + werkproces_criterium_id);
});
// Add criteria
$("select[name=kerntaak_criterium_option]").on('change', function () {
// waarde van geslecteerde id ophalen
kt = this.value;
//alert(kt);
// Alles leeg maken:
$("select[name=werkproces_criterium_option]").empty().append($('<option>', {
value: 0,
text: "Kies een werkproces",
}));
// ophalen van informatie, met ajax
$.ajax({
type: 'GET',
url: 'json_add_criterium.php',
data: {id: kt},
dataType: 'json',
success: function (data) {
//alert(data);
$.each(data, function (index, element) {
//console.log(element.name);
$("select[name=werkproces_criterium_option]").append($('<option>', {
value: element.id,
text: element.name
}));
});
// toepassen css
// ** material only! **
$("select[name=werkproces_criterium_option]").material_select();
// als alles is opgehaald. Select weer laten zien.
//$("select[name=werkproces]").show();
$("select[name=werkproces_criterium_option]").closest('.select-wrapper').removeClass("hide");
}
});
});
$("select[name=werkproces_criterium_option]").on('change', function () {
$("input[name=criterium_oms]").removeClass("hide");
$("button[name=new_criterium_submit]").removeClass("hide");
});
//Student toevoegen modal klas afhankelijk van cohort
$("select[name=cohort_option]").on('change', function () {
modal_cohort_id = this.value;
//alert(modal_cohort_id);
$("select[name=klas_option]").empty().append($('<option>', {
value: 0,
text: "Kies een klas",
}));
// ophalen van informatie, met ajax
$.ajax({
type: 'GET',
url: 'json_show_klas.php',
data: {id: modal_cohort_id},
dataType: 'json',
success: function (data) {
//console.log(data);
$.each(data, function (index, element) {
//console.log(element.klas_name);
$("select[name=klas_option]").append($('<option>', {
value: element.klas_id,
text: element.klas_name
}));
});
$("select[name=klas_option]").removeClass("hide");
$("select[name=klas_option]").material_select();
}
});
}); F
});
</script>
</body>
</html>