forked from OvidiuRusu/TW
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestraport.php
More file actions
183 lines (173 loc) · 5.89 KB
/
testraport.php
File metadata and controls
183 lines (173 loc) · 5.89 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
175
176
177
178
179
180
181
182
183
<?php
session_start();
include('connection.php');
require("reporting/fpdf.php");
class PDF extends FPDF
{
function CreateTableMedii($header,$materie){
// Column widths
$w = array(53, 30);
// Header
for($i=0;$i<count($header);$i++)
$this->Cell($w[$i],7,$header[$i],1,0,'C');
$this->Ln();
$result = mysql_query("select student.IdStudent as idstud, student.Nume as n, student.Prenume as p from student
left join student_materie on student.IdStudent=student_materie.IdStudent
left join materie on student_materie.IdMaterie = materie.IdMaterie
where student_materie.Status='In Curs'
and materie.Nume='$materie'");
$y=0;
while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$y=$y+6;
$this->SetXY(65,41+$y);
$this->Cell($w[0],6,$line["n"]." ".$line["p"],1,0,'LR');
$idstud = $line["idstud"];
$result2 = mysql_query("select assignment.IdAssignment as idassign from assignment
join materie on materie.idMaterie=assignment.idMaterie
where materie.nume = '$materie'");
$medie=0;
$nr=0;
while($line2 = mysql_fetch_array($result2, MYSQL_ASSOC)){
$idassign = $line2["idassign"];
$result3 = mysql_query("select nota.Nota as nota from nota
join submission on submission.IdSubmission=nota.IdSubmission
join assignment on assignment.IdAssignment=submission.IdAssignment
where assignment.IdAssignment=$idassign and submission.IdStudent=$idstud");
$line3 = mysql_fetch_array($result3, MYSQL_ASSOC);
if(is_null($line3["nota"])){
$nr=$nr+1;
}else{
$nr=$nr+1;
$medie=$medie+$line3["nota"];
}
}
$medie=$medie/$nr;
$this->SetXY(118,41+$y);
$this->Cell($w[1],6,round($medie,2),1,0,'C');
$this->Ln();
}
// Closing line
$y=$y+6;
$this->SetXY(65,41+$y);
$this->Cell(array_sum($w),0,'','T');
}
function CreateTableNrsub($header,$materie){
// Column widths
$w = array(53, 30);
// Header
for($i=0;$i<count($header);$i++)
$this->Cell($w[$i],7,$header[$i],1,0,'C');
$this->Ln();
$result = mysql_query("select student.IdStudent as idstud, student.Nume as n, student.Prenume as p from student
left join student_materie on student.IdStudent=student_materie.IdStudent
left join materie on student_materie.IdMaterie = materie.IdMaterie
where student_materie.Status='In Curs'
and materie.Nume='$materie'");
$y=0;
while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$y=$y+6;
$this->SetXY(65,41+$y);
$this->Cell($w[0],6,$line["n"]." ".$line["p"],1,0,'LR');
$idstud = $line["idstud"];
$result2=mysql_query("select count(submission.IdSubmission) as nr from submission
join assignment on submission.IdAssignment=assignment.IdAssignment
join materie on assignment.IdMaterie=materie.IdMaterie
where submission.IdStudent=$idstud and materie.Nume='$materie'");
$line2 = mysql_fetch_array($result2, MYSQL_ASSOC);
$this->SetXY(118,41+$y);
$this->Cell($w[1],6,$line2["nr"],1,0,'C');
$this->Ln();
}
// Closing line
$y=$y+6;
$this->SetXY(65,41+$y);
$this->Cell(array_sum($w),0,'','T');
}
function CreateTableMat($header){
// Column widths
$w = array(80, 45);
// Header
for($i=0;$i<count($header);$i++)
$this->Cell($w[$i],7,$header[$i],1,0,'C');
$this->Ln();
$y=0;
$result4=mysql_query("select nume from materie");
while($line4 = mysql_fetch_array($result4, MYSQL_ASSOC)){
$materie=$line4["nume"];
$nrstud=0;
$mediemat=0;
$y=$y+6;
$this->SetXY(40,41+$y);
$this->Cell($w[0],6,$materie,1,0,'LR');
$result = mysql_query("select student.IdStudent as idstud, student.Nume as n, student.Prenume as p from student
left join student_materie on student.IdStudent=student_materie.IdStudent
left join materie on student_materie.IdMaterie = materie.IdMaterie
where student_materie.Status='In Curs'
and materie.Nume='$materie'");
while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$nrstud=$nrstud+1;
$idstud = $line["idstud"];
$result2 = mysql_query("select assignment.IdAssignment as idassign from assignment
join materie on materie.idMaterie=assignment.idMaterie
where materie.nume = '$materie'");
$medie=0;
$nr=0;
while($line2 = mysql_fetch_array($result2, MYSQL_ASSOC)){
$idassign = $line2["idassign"];
$result3 = mysql_query("select nota.Nota as nota from nota
join submission on submission.IdSubmission=nota.IdSubmission
join assignment on assignment.IdAssignment=submission.IdAssignment
where assignment.IdAssignment=$idassign and submission.IdStudent=$idstud");
$line3 = mysql_fetch_array($result3, MYSQL_ASSOC);
if(is_null($line3["nota"])){
$nr=$nr+1;
}else{
$nr=$nr+1;
$medie=$medie+$line3["nota"];
}
}
if($nr>0){
$mediemat=$mediemat+$medie/$nr;
}
}
if($nrstud==0){
$mediemat=0;
}else{
$mediemat=$mediemat/$nrstud;
}
$this->SetXY(120,41+$y);
$this->Cell($w[1],6,round($mediemat,2),1,0,'C');
$this->Ln();
}
// Closing line
$y=$y+6;
$this->SetXY(40,41+$y);
$this->Cell(array_sum($w),0,'','T');
}
}
$mat = $_SESSION['numemat'];
$header = array('Nume Student', 'Media');
$pdf = new PDF( );
$pdf->AddPage();
$pdf->SetXY(100,10);
$pdf->SetFont('Arial','B',16);
$pdf->Cell(10,10,''.$mat, 0,0,'C');
$pdf->Cell(3,30,'Media temelor pentru fiecare student', 0,0,'C');
$pdf->SetXY(65,40);
$pdf->CreateTableMedii($header,$mat);
$header = array('Nume Student', 'Nr. Teme');
$pdf->AddPage();
$pdf->SetXY(100,10);
$pdf->Cell(10,10,''.$mat, 0,0,'C');
$pdf->Cell(3,30,'Nr. de rezolvari trimise', 0,0,'C');
$pdf->SetXY(65,40);
$pdf->CreateTableNrsub($header,$mat);
$header = array('Materie', 'Medie Studenti');
$pdf->AddPage();
$pdf->SetXY(100,10);
$pdf->Cell(10,10,''.$mat, 0,0,'C');
$pdf->Cell(3,30,'Statistici profesori', 0,0,'C');
$pdf->SetXY(40,40);
$pdf->CreateTableMat($header);
$pdf->Output();
?>