-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGestioneCdC.php
executable file
·175 lines (162 loc) · 6.73 KB
/
GestioneCdC.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
170
171
172
173
174
175
<?php
// ----------------------------------------------------------------------
// Registro elettronico scuole ospedaliere
// ----------------------------------------------------------------------
// LICENSE and CREDITS
// This program is free software and it's released under the terms of the
// GNU General Public License(GPL)
// Link: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
// ----------------------------------------------------------------------
// Nome file: GestioneCdC.php
// Autore di questo file: Sophia Danesino, Puria Nafisi
// Descrizione: consente di comporre i consigli di classe associati ad un
// gruppo di lavoro inserendo o togliendo i docenti e le materie insegnate
// 22/7/09 Aggiunto ruolo docente (Sophia Danesino)
// ----------------------------------------------------------------------
// Autorizzazione: ruolo amministratore
// ----------------------------------------------------------------------
$title = "Gestione Consiglio di Classe";
include "Testa.inc";
include "FunzioniDB.inc";
autorizza_ruoli(ID_ADMIN);
echo "<h2>Assegnazione docenti al Consiglio di Classe</h2>";
if(isset($_POST['inserisci']))
{
$sql =& $link->query("INSERT INTO CdC (id_classe , id_utente, id_materia ) VALUES ( ? , ? , ? )", array($_POST['id_classe'], $_POST['id_utente'], $_POST['id_materia']));
errore_DB($sql);
}
if (isset($_POST['cancella']))
{
$sql =& $link->query("DELETE FROM CdC WHERE (id_classe= ? ) AND (id_utente= ? ) AND (id_materia= ? )", array($_POST['id_classe'], $_POST['id_utente'], $_POST['id_materia']));
errore_DB($sql);
}
if (!isset($_POST['id_classe']))
{
print '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<table><tr> <td bgcolor="#C1DADF" align="center" > Gruppo di lavoro </td>';
print '<td><select name="id_classe">';
$sql =& $link->query("SELECT * FROM Classi ORDER BY classe");
while ( $id_classe =& $sql->fetchRow())
{
print '<option value="'.$id_classe['id_classe'].'">'.$id_classe['classe'];
switch ($id_classe['ordine'])
{
case "i": print " (Scuola dell'infanzia)"; break;
case "1": print " (Scuola primaria)"; break;
case "2": print " (Scuola secondaria di primo grado)"; break;
case "s": print " (Scuola secondaria)"; break;
}
print "</option>\n";
}
mysql_close($link);
print "</select></td></tr>\n";
print '<tr><td><input type="submit" value="Seleziona"></td></tr>';
print "</table></form>";
}
else
{
print '<table class="elenco"><tr><td bgcolor="#C1DADF" align="center" > Consiglio di classe </td>';
$sql =& $link->query("SELECT * FROM Classi WHERE (id_classe= ? )", $_POST['id_classe']);
$n = $sql->numRows();
if(!$n)
{
die("<dl><dd>Nessun Gruppo di lavoro inserito per inserirne uno cliccare <a href='InserimentoClasse.php'>qui</a></dd></dl>");
}
while ( $classe =& $sql->fetchRow())
{
print '<td bgcolor="#DDDDDD" ><strong>'.$classe['classe']." ";
switch ($classe['ordine'])
{
case "i": print "(Scuola dell'infanzia)"; break;
case "1": print "(Scuola primaria)"; break;
case "2": print "(Scuola secondaria di primo grado)"; break;
case "s": print "(Scuola secondaria)"; break;
}
print "</strong></td></tr>";
}
print "</table>";
$sql =& $link->query("SELECT * FROM Utenti, Ruoli, CdC WHERE ( Utenti.id_ruolo=Ruoli.id_ruolo AND Utenti.id_utente = CdC.id_utente AND CdC.id_classe = ? ) ORDER BY cognome",$_POST['id_classe']);
$num_righe = $sql->numRows();
if ($num_righe!=0)
{
print "<h3>Composizione del consiglio di classe:</h3>";
print "<table class=\"elenco\">";
print "<tr>";
print '<th>Cognome</th>';
print '<th>Nome </th>';
print '<th>Ruolo</th>';
print '<th>Materia </th>';
print '<th colspan="2">Azione</th></tr>';
$pari=1;
while ($riga =& $sql->fetchRow())
{
$class = ($pari) ? "pari" : "dispari";
$pari=1-$pari;
print "<tr class='$class'><td nowrap='nowrap'>".$riga['cognome']."</td>";
print "<td nowrap='nowrap'>".$riga['nome']."</td>";
print "<td nowrap='nowrap'>".$riga['descrizione']."</td>";
print "<td nowrap='nowrap'>";
$sql_materia =& $link->query("SELECT * FROM Materie WHERE (Materie.id_materia= ? )", $riga['id_materia']);
$riga_materia =& $sql_materia->fetchRow();
print $riga_materia['nome']."</td>";
print "<td nowrap='nowrap'>";
print "<form method=\"post\" action=\"{$_SERVER['PHP_SELF']}\">".
"<input type=\"hidden\" name=\"id_classe\" value=\"{$riga['id_classe']}\" />".
"<input type=\"hidden\" name=\"id_utente\" value=\"{$riga['id_utente']}\" />".
"<input type=\"hidden\" name=\"id_materia\" value=\"{$riga['id_materia']}\" />".
"<input type=\"hidden\" name=\"cancella\" value=\"1\" />".
"<input type=\"image\" src=\"./immagini/button_drop.png\" alt=\"Elimina\" title=\"Elimina dal consiglio di classe\"/></form></td>";
print "</td></tr>";
}
print "</table>";
}
// possono far parte del Consiglio di Classe gli utenti con ruolo di docente, amministratore e operatore
$sql =& $link->query("SELECT * FROM Utenti, Ruoli WHERE (Utenti.id_ruolo=Ruoli.id_ruolo AND Utenti.id_ruolo!=".ID_OSSERVATORE." ) ORDER BY cognome");
errore_DB($sql);
$titolo=1;
while ($riga =& $sql->fetchRow())
{
if ($titolo)
{
print "<h3>Inserisci nuovo docente nel Consiglio di Classe</h3>";
print "<table class=\"elenco\">";
print "<tr>";
print '<th>Cognome</th>';
print '<th>Nome </th>';
print '<th>Ruolo</th>';
print '<th>Materia</th>';
print '<th>Azione</th>';
$titolo=0;
}
print '<form action="GestioneCdC.php" method="post">';
print '<input type="hidden" name="id_classe" value="'.$_POST['id_classe'].'">';
print '<input type="hidden" name="id_utente" value="'.$riga['id_utente'].'">';
print '<input type="hidden" name="inserisci" value="1">';
print '<tr><td bgcolor="#DDDDDD" nowrap="nowrap">'.$riga['cognome']."</td>";
print '<td bgcolor="#DDDDDD" nowrap="nowrap">'.$riga['nome']."</td>";
print '<td bgcolor="#DDDDDD" nowrap="nowrap">'.$riga['descrizione']."</td>";
print '<td align="right">';
$sql_materie =& $link->query("SELECT * FROM Materie");
$num_righe = $sql_materie->numRows();
if ($num_righe!=0)
{
print '<select name="id_materia">';
while ($riga_materia =& $sql_materie->fetchRow())
{
$sql_mat =& $link->query("SELECT * FROM CdC WHERE CdC.id_utente= ? AND CdC.id_classe= ? AND CdC.id_materia= ?", array($riga['id_utente'],$_POST['id_classe'],$riga_materia['id_materia']));
if (!$sql_mat->fetchRow())
{
print '<option value="'.$riga_materia['id_materia'].'">'.$riga_materia['nome'].'</option>';
}
}
print "</select></td>";
}
else
print "Inserire prima le materie (Gestione materie)</td>";
print '<td><input type="submit" value="aggiungi"></td></form>';
}
print "</table>";
}
$up="index";
include "Coda.inc";
?>