-
Notifications
You must be signed in to change notification settings - Fork 1
/
profcatalog.php
77 lines (77 loc) · 2.51 KB
/
profcatalog.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
<!DOCTYPE html>
<?php
session_start();
include('connection.php');
if (!isset($_SESSION['username']) || empty($_SESSION['username'])) {
exit();
}
$username = $_SESSION['username'];
$numemat=$_SESSION['numemat'];
?>
<head>
<link href="table.css" rel="stylesheet" type="text/css" />
<title>Catalog</title>
</head>
<body>
<table>
<thead>
<tr>
<th>Student Name</th>
<?php
$result = mysql_query("select assignment.titlu as titlu from assignment
join materie on materie.idMaterie=assignment.idMaterie
where materie.nume = '$numemat'");
while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<th>',$line["titlu"],'</th>';
}
?>
</tr>
</thead>
<tbody>
<?php
//$result = mysql_query("select idStudent, nume, prenume from Student order by nume");
$result = mysql_query("select student.IdStudent as idstud, student.Nume as nume, student.prenume as prenume 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='$numemat'");
$rand=0;
while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$rand=$rand+1;
if($rand % 2 == 0){
echo '<tr><td style="font-weight: bold;">',$line["nume"],' ',$line["prenume"],'</td>';
}else{
echo '<tr><td bgcolor="#C4E6E6" style="font-weight: bold;">',$line["nume"],' ',$line["prenume"],'</td>';
}
$idstud = $line["idstud"];
$result2 = mysql_query("select assignment.IdAssignment as idassign from assignment
join materie on materie.idMaterie=assignment.idMaterie
where materie.nume = '$numemat'");
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($rand % 2 == 0){
if(is_null($line3["nota"])){
echo '<td></td>';
}else{
echo '<td>',$line3["nota"],'</td>';
}
}else{
if(is_null($line3["nota"])){
echo '<td bgcolor="#C4E6E6"></td>';
}else{
echo '<td bgcolor="#C4E6E6">',$line3["nota"],'</td>';
}
}
}
echo '</tr>';
}
?>
</tbody>
</table>
</body>
</html>