This repository has been archived by the owner on Dec 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvoti-new.php
169 lines (162 loc) · 9.13 KB
/
voti-new.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
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
<?php
include "include/top.php";
// $axios = new axios;
// $axios->postREFamilyData = $_SESSION["getPostREFamily"];
// $axios->QuadrimestreFT = $_COOKIE["QuadrimestreFT"];
// $axios->QuadrimestreFTAll = $_SESSION["QuadrimestreFTAll"];
// $axios->student = $_SESSION["getStudentId"][$_COOKIE['studentNumber']];
// $axios->cookies = $_SESSION["cookies"];
// $result = $axios->getVote();
?>
<!DOCTYPE html>
<html>
<head>
<title>Voti | REDignus</title>
<?php include "include/head.php"; ?>
<style>
.nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active {
border-color: rgb(0, 0, 0, 0.5) rgb(0, 0, 0, 0.5) #fff;
}
</style>
</head>
<body>
<div class="wrapper">
<!-- Apertura Wrapper -->
<!-- Sidebar -->
<?php include "include/sidebar.php"; ?>
<!-- Page Content -->
<div id="content">
<?php include "include/navbar.php"; ?>
<div class="container-fluid">
<br>
<div class="jumbotron">
<div class="text-center">
<a href="opzioni" class="text-right badge badge-pill badge-secondary">Torna alla vecchia versione</a>
</div>
<br>
<div class="card-header" style="background-color: transparent; border-bottom: 1px solid rgb(0, 0, 0, 0.5);">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link active" id="votimenu" onclick="voti();">Voti</a>
</li>
<li class="nav-item">
<a class="nav-link" id="mediamenu" onclick="media();">Media</a>
</li>
</ul>
</div>
<div id="votilista">
<br>
<div class="text-center">
<br>
<h2>Caricamento</h2>
<i class="fas fa-circle-notch fa-spin fa-4x"></i>
</div>
</div>
</div>
</div>
<?php include "include/footer.php"; ?>
<script>
function voti() {
// Ajax Stringa voti
$('#votilista').html('<div class="text-center"><br><h2>Caricamento</h2><i class="fas fa-circle-notch fa-spin fa-4x"></i></div>');
$( "#votimenu" ).addClass( "active" );
$( "#mediamenu" ).removeClass( "active" );
$.getJSON('api/ajax/voti', function(data) {
// Per ogni voto
var numcollaps = 0;
$('#votilista').html('<br>');
data.forEach(element => {
numcollaps++;
// Imposta il colore del voto
if (null === element.realVote) {
var colorevoto = "bg-primary";
} else if (element.realVote.replace(',', '.') >= 6) {
var colorevoto = "bg-success";
} else {
var colorevoto = "bg-danger";
}
if ("" === element.comment) {
asterisco = "";
} else {
asterisco = '<span style="color: red;">*</span>';
}
// Salva le informazioni precedenti
var precedente = $('#votilista').html();
// Stampa il voto più le informazioni precedenti
$('#votilista').html(precedente + '<div class="row" data-toggle="collapse" data-target="#collapse'+numcollaps+'" aria-expanded="true" aria-controls="collapse'+numcollaps+'">'+
'<div class="col-8 col-lg-10">'+
'<div class="row" style="height: 100%;">'+
'<div class="col text-center">'+
'<h5>'+asterisco+' '+element.date+' </h5>'+
'<hr>'+
'<h5> '+element.topic+' </h5>'+
'<div id="collapse'+numcollaps+'" class="collapse">'+
'<p> '+element.comment+' </p>'+
'<p><small class="text-body"> '+element.teacher+' </small></p>'+
'</div>'+
'</div>'+
'</div>'+
'</div>'+
'<div class="col-4 col-lg-2">'+
'<div class="p-2 '+colorevoto+' text-white" style="height: 100%; display: flex; justify-content: center; align-items: center;">'+
'<div class="text-center">'+
'<p class="text-white"> '+element.type+' </p>'+
'<h5> '+element.vote+' </h5>'+
'</div>'+
'</div>'+
'</div>'+
'</div>'+
'<hr style="border-top: 1px solid rgb(0, 0, 0, 0.5)">');
});
});
}
voti();
</script>
<script>
// Ajax Stringa voti
function media() {
$('#votilista').html('<div class="text-center"><br><h2>Caricamento</h2><i class="fas fa-circle-notch fa-spin fa-4x"></i></div>');
$("#mediamenu").addClass("active");
$("#votimenu").removeClass("active");
$.getJSON('api/ajax/mediaMateria', function(data) {
// Per ogni voto
var numcollaps = 0;
$('#votilista').html('<br>');
data.forEach(element => {
numcollaps++;
// Imposta il colore del voto
if (null === element.average) {
var colorevoto = "bg-primary";
} else if (element.average.replace(',', '.') >= 6) {
var colorevoto = "bg-success";
} else {
var colorevoto = "bg-danger";
}
// Salva le informazioni precedenti
var precedente = $('#votilista').html();
// Stampa il voto più le informazioni precedenti
$('#votilista').html(precedente + '<div class="row" data-toggle="collapse" data-target="#collapse'+numcollaps+'" aria-expanded="true" aria-controls="collapse'+numcollaps+'">'+
'<div class="col-8 col-lg-10">'+
'<div class="row" style="height: 100%;" >'+
'<div class="col text-center" style="height: 100%; display: flex; justify-content: center; align-items: center;">'+
'<h5> '+element.name+' </h5>'+
'</div>'+
'</div>'+
'</div>'+
'<div class="col-4 col-lg-2">'+
'<div class="p-2 '+colorevoto+' text-white" style="height: 100%; display: flex; justify-content: center; align-items: center;">'+
'<div class="text-center">'+
'<h5> '+element.average+' </h5>'+
'</div>'+
'</div>'+
'</div>'+
'</div>'+
'<hr style="border-top: 1px solid rgb(0, 0, 0, 0.5)">');
});
});
}
</script>
</div><!-- Page Content -->
</div><!-- Chiusura Wrapper -->
</body>
</html>