-
Notifications
You must be signed in to change notification settings - Fork 0
/
indexelevi.html
512 lines (451 loc) · 21.5 KB
/
indexelevi.html
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="shortcut icon" href="images/favicon.png" />
<script src="canvasjs.min.js"></script>
</head>
<body>
<div class="container-scroller">
<div class="container-scroller">
<nav class="navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
<div class="navbar-menu-wrapper d-flex align-items-center justify-content-end">
<ul class="navbar-nav mr-lg-2">
<li class="nav-item nav-profile dropdown">
<i class="mdi mdi-new-box"></i> <p class="mb-0"> <a href="chat.html">Trivia</a></p></li>
<li class="nav-item nav-profile dropdown">
<a class="nav-link" href="#" data-toggle="dropdown" id="profileDropdown">
<img src="images/useri.png" alt="profile"/>
<?php
session_start();
if($_SESSION['elevid']==""){header("Location: index.html");die();}
$servername = "localhost";
$username = "alina";
$password = "alyne2006";
$dbname = "site";
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql="SELECT CONCAT(registrelevi.nume,' ',registrelevi.prenume) AS np FROM registrelevi WHERE id=".$_SESSION['elevid'];
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo '<span class="nav-use-status">'.$row['np'].'</span>';}}
?>
</a>
</li>
<li class="nav-item nav-user-status dropdown">
<p class="mb-0"><a href="logout.html">Delogare</a></p>
</li>
</ul>
</div>
</nav>
<div class="container-fluid page-body-wrapper">
<div class="theme-setting-wrapper">
<div id="settings-trigger"><i class="typcn typcn-cog-outline"></i></div>
<div id="theme-settings" class="settings-panel">
<div class="sidebar-bg-options selected" id="sidebar-light-theme"><div class="img-ss rounded-circle bg-light border mr-3"></div>Light</div>
<div class="sidebar-bg-options" id="sidebar-dark-theme"><div class="img-ss rounded-circle bg-dark border mr-3"></div>Dark</div>
<div class="color-tiles mx-0 px-4">
</div>
</div>
</div>
<div class="main-panel">
<div class="content-wrapper">
<div class="row">
<div class="col-xl-12 grid-margin stretch-card flex-column">
<div class="row">
<div class="col-md-6 grid-margin stretch-card">
<div class="card">
<div class="form-group row"><div class="col-sm-7">
<?php $servername = "localhost";
$username = "alina";
$password = "alyne2006";
$dbname = "site";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if(isset($_POST['buton'])){
if(isset($_SESSION['testr'])){
$sql="UPDATE inceptest
INNER JOIN (
SELECT ROUND(SUM(CASE WHEN cerinte.raspc=rezolvare.raspuns THEN 1 END )*100/ COUNT(*), 2) AS rez FROM cerinte
JOIN inceptest ON cerinte.nrtest=inceptest.nrtest
LEFT JOIN rezolvare ON rezolvare.nrtest=inceptest.nrtest AND cerinte.id= rezolvare.nrex WHERE inceptest.id =".(int)$_SESSION['testr'].") AS b ON 1=1
SET nota=b.rez,testfin=1,timpfin=NOW()
WHERE inceptest.id=". $_SESSION['testr']; $result = mysqli_query($conn, $sql);
$_SESSION['testr']="";}}
if($_SESSION['testr']!=""){
echo '<h1 class="display-5"><b> Aveti deja un test in desfasurare:</b></h1>';
?>
</div>
<div class="col-sm-4">
</div></div>
<div class="table-responsive">
<table class="table" id="tabel1">
<thead>
<tr>
<th>Materie</th>
<th>Nume profesor</th>
<th>Test</th>
<th>Timp</th>
</tr>
</thead>
<?php
$servername = "localhost";
$username = "alina";
$password = "alyne2006";
$dbname = "site";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT test.id, CONCAT(registrprof.nume,' ',registrprof.prenume) AS np, materii.materir,profilee.profil, timp.timp FROM test
LEFT JOIN registrprof
ON test.profesor=registrprof.id
LEFT JOIN materii
ON test.materie=materii.id
LEFT JOIN profilee
ON test.profil=profilee.id
LEFT JOIN timp
ON test.timp=timp.id
JOIN inceptest
ON test.id=inceptest.nrtest
WHERE inceptest.id=". (int)$_SESSION['testr'];
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo" <thead>
<tr>
<td>".$row['materir']."</td>
<td>".$row['np']."</td>
<td>".$row['id']."</td>
<td>".$row['timp']."</td>
<td><a href='rezolvaretest.html?idtest=".$row['id']."'>Continua test</a></td>
</tr>
</thead>"; }
}
echo'</table>';
echo '<br><br>
<p>Doriti sa incepeti un test nou?
<form action="indexelevi.html" method="post">
<input class="btn btn-primary btn-lg font-weight-medium auth-form-btn" type="submit" name="buton" value="Da">
</form> ';
}
else {?>
<select class="form-control form-control-sm select-mov" id="materir" name="materir" onchange="myFunction(this.value,'')">
<option value="" selected disabled hidden>Materie</option>
<?php
$servername = "localhost";
$username = "alina";
$password = "alyne2006";
$dbname = "site";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT id,materir FROM materii";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo "<option value=".$row['materir'].">" .$row['materir']."</option>";
}}?>
</select>
</div>
<div class="col-sm-4">
<select class="form-control form-control-sm select-mov" id="timp" name="timp" onchange="myFunction('',this.value)">
<option value="" selected disabled hidden>Timp de rezolvare</option>
<?php
$servername = "localhost";
$username = "alina";
$password = "alyne2006";
$dbname = "site";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT id,timp FROM timp";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo "<option value=".$row['timp'].">" .$row['timp']."</option>";
}}
?>
</select>
</div></div>
<div class="table-responsive">
<table class="table" id="tabel">
<thead>
<tr>
<th>Materie</th>
<th>Nume profesor</th>
<th>Test</th>
<th>Timp</th>
</tr>
</thead>
<?php
$servername = "localhost";
$username = "alina";
$password = "alyne2006";
$dbname = "site";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT test.id, CONCAT(registrprof.nume,' ',registrprof.prenume) as np, materii.materir,profilee.profil, timp.timp FROM test
LEFT JOIN registrprof
ON test.profesor=registrprof.id
LEFT JOIN materii
ON test.materie=materii.id
LEFT JOIN profilee
ON test.profil=profilee.id
LEFT JOIN timp
ON test.timp=timp.id WHERE test.profil=". $_SESSION['profil'];
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo" <thead>
<tr>
<td>".$row['materir']."</td>
<td>".$row['np']."</td>
<td>".$row['id']."</td>
<td>".$row['timp']."</td>
<td><a href='rezolvaretest.html?idtest=".$row['id']."'>Incepe test</a></td>
</tr>
</thead>";
}
}}
?>
</tbody>
</table>
</div>
</div></div>
<div class="col-md-6 grid-margin stretch-card">
<div class="card">
<div class="card-body d-flex flex-column ">
<div class="d-flex justify-content-between align-items-center mb-2">
<div class="table-responsive">
<table class="table" id="tabel">
<thead>
<tr>
<th>Materie</th>
<th>Nume profesor</th>
<th>Test</th>
<th>Nota</th>
</tr>
</thead>
<?php
$servername = "localhost";
$username = "alina";
$password = "alyne2006";
$dbname = "site";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT test.id, CONCAT(registrprof.nume,' ',registrprof.prenume) AS np ,inceptest.nota AS nota, materii.materir,profilee.profil FROM test
LEFT JOIN registrprof
ON test.profesor=registrprof.id
LEFT JOIN materii
ON test.materie=materii.id
LEFT JOIN profilee
ON test.profil=profilee.id
LEFT JOIN inceptest
ON inceptest.nrtest=test.id
WHERE inceptest.testfin=1
AND inceptest.elevid=".$_SESSION['elevid']." ORDER BY inceptest.timpfin ";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo" <thead>
<tr>
<td>".$row['materir']."</td>
<td>".$row['np']."</td>
<td>".$row['id']."</td>
<td>".$row['nota']."</td>
<td><a href='vizualizaretest.html?idtest=".$row['id']."'>Vizualizare test</a></td>
</tr>
</thead>";
}}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 grid-margin stretch-card">
<div class="card">
<!-- <div class="dim">
</div>--!>
<div class="card-body d-flex flex-column justify-content-between" >
<!-- <div class="d-flex justify-content-between align-items-center mb-2">--!>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<!-- </div>--!>
<!--<canvas id="sales-chart-b" class="mt-auto" height="38"></canvas>--!>
</div>
</div>
</div>
<div class="col-md-6 grid-margin stretch-card">
<div class="card" >
<!-- <div class="dim">
</div>--!>
<div class="card-body d-flex flex-column justify-content-between" >
<!-- <div class="d-flex justify-content-between align-items-center mb-2">--!>
<div id="chartContainer2" style="height: 370px; width: 100%;"></div>
<!-- <canvas id="sales-chart-b" class="mt-auto" height="38"></canvas>--!>
<!-- </div>--!>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function myFunction(input,inputtimp) {
filter = input.toUpperCase();
filtertimp = inputtimp.toUpperCase();
if (filter=="") {
var e = document.getElementById("materir");
var input = e.options[e.selectedIndex].value;
console.log("aici0");
console.log(filter);
}
if (filtertimp=="") {
var e = document.getElementById("timp");
var inputtimp = e.options[e.selectedIndex].value;
console.log("aici0");
console.log(filter);
}
filter = input.toUpperCase();
filtertimp = inputtimp.toUpperCase();
table = document.getElementById("tabel");
tr = table.getElementsByTagName("tr");
console.log(tr);
for (i = 0; i < tr.length; i++) {
tdtimp = tr[i].getElementsByTagName("td")[3];
td = tr[i].getElementsByTagName("td")[0];
if (td) {
txtValue = td.textContent || td.innerText;
txtValuetimp = tdtimp.textContent || tdtimp.innerText;
if ((txtValue.toUpperCase().indexOf(filter) > -1) && (txtValuetimp.toUpperCase().indexOf(filtertimp) > -1) ) {
console.log("aici1");
console.log(filter);
console.log("aici2");
console.log(td);
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>
<script>
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title:{
text: "Numarul de teste rezolvate in ultimele 10 zile"
},
axisY: {
title: "Teste rezolvate ",
valueFormatString: "",
suffix: "",
stripLines: [{
value: 500000,
label: "Average"
}]
},
data: [{
yValueFormatString: "",
xValueFormatString: "YYYY-MM-DD",
type: "line",
dataPoints: [
<?php
$servername = "localhost";
$username = "alina";
$password = "alyne2006";
$dbname = "site";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT COUNT(*) as total,DATE(timp) as timp FROM inceptest GROUP BY DATE(timp) ORDER BY DATE(timp) LIMIT 10";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) { $l=0;
while ($row = mysqli_fetch_assoc($result)) {$l=$l+1;
echo' { x:'.$l.', y: '.$row['total'].', label: "'.$row['timp'].'"},';
}}
?>
]
}],
});
chart.render();
var chart2 = new CanvasJS.Chart("chartContainer2", {
title:{
text: "Rezultate Teste"
},
legend: {
maxWidth: 350,
itemWidth: 120
},
data: [{
type: "pie",
showInLegend: true,
legendText: "{indexLabel}",
dataPoints: [
<?php
$servername = "localhost";
$username = "alina";
$password = "alyne2006";
$dbname = "site";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT COUNT(*) AS nr,ROUND(nota/10,2) AS noti FROM inceptest WHERE nota IS NOT NULL AND elevid=".$_SESSION['elevid']." GROUP BY nota";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo' { y : '.$row['nr'].' , indexLabel: "'.$row['noti'].'"},';
}}
?>
]
}],
});
chart2.render();
}
</script>
</body>
</html>