This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
forked from danesino/Registro-elettronico
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVisualizzaUtenti.php
executable file
·143 lines (125 loc) · 6.15 KB
/
VisualizzaUtenti.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
<?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: VisualizzaUtenti.php
// Autore di questo file: Sophia Danesino, Puria Nafisi
// Descrizione: Visualizza l'elenco degli utenti con alcune informazioni
// (telefono, cellulare, e-mail, ruolo, codice utente
// 22/7/09 Aggiunto docente domiciliare (Sophia Danesino)
// ----------------------------------------------------------------------
// Autorizzazione: ruolo amministratore, operatori
// ----------------------------------------------------------------------
$title= "Visualizza utenti";
include("Testa.inc");
include("FunzioniDB.inc");
autorizza_ruoli(ID_ADMIN,ID_OPERATORE);
js_validazione();
if(isset($_POST['cancella'])){
if ($_POST['ruolo']==ID_OSPEDALIERO)
{
// verifico che non sia inserito in un Consiglio di Classe
$res =& $link->query("SELECT * FROM CdC WHERE (id_utente= ? )",$_POST['id_utente']);
$num_righe = $res->numRows();
if ( $num_righe != 0)
die("<dl><dd>Registro - Impossibile cancellare un docente inserito in un Consiglio di Classe</dd></dl>");
}
if ($_POST['ruolo']==ID_OSSERVATORE||$_POST['ruolo'] == ID_AFFIDATARIO)
{
// verifico che non sia inserito in un Consiglio di Classe
$res =& $link->query("SELECT * FROM Esterni WHERE (id_utente= ? )",$_POST['id_utente']);
$num_righe = $res->numRows();
if ( $num_righe != 0)
die("<dl><dd>Registro - Impossibile cancellare un utente associato ad uno studente</dd></dl>");
}
$res =& $link->query("DELETE FROM Utenti WHERE (id_utente= ? )",$_POST['id_utente']);
errore_DB($res);
echo "<dl><dt>Utente cancellato con successo</dt></dl>";
}
$res =& $link->query("SELECT * FROM Utenti,Ruoli WHERE Utenti.id_ruolo=Ruoli.id_ruolo ORDER BY cognome");
// $elenco = mysql_query($sql);
$num_righe = $res->numRows();
if ($num_righe==0)
print "<h3>La ricerca non ha individuato alcun elemento</h3>";
else
{
print "<h3>La ricerca ha rilevato $num_righe ";
echo ($num_righe>1) ? "elementi</h3>" : "elemento</h3>";
print "<table class=\"elenco\">";
print "<tr>";
print '<th>Cognome</th>';
print '<th>Nome </th>';
print '<th>Telefono</th>';
print '<th>Cellulare</th>';
print '<th>E-mail</th>';
print '<th>Note</th>';
print '<th>Ruolo</th>';
if ($profile == ID_ADMIN)
{
print '<th>Codice utente</th>';
print '<th colspan="4">Azione</th>';
}
print "</tr>";
$pari=1;
while ($riga =& $res->fetchRow())
{
$class = ($pari) ? "pari" : "dispari";
$pari=1-$pari;
echo "<tr class='$class'>";
print "<td nowrap='nowrap'>{$riga['cognome']}</td>";
print "<td nowrap='nowrap'>{$riga['nome']}</td>";
print "<td nowrap='nowrap'>{$riga['telefono']}</td>";
print "<td nowrap='nowrap'>{$riga['cellulare']}</td>";
print "<td nowrap='nowrap'>{$riga['email']}</td>";
print "<td nowrap='nowrap'>{$riga['note']}</td>";
print "<td nowrap='nowrap'>";
print " ".$riga['descrizione']." </td>";
if ($profile == ID_ADMIN)
{
print "<td nowrap='nowrap'>{$riga['username']}</td>";
// modifica dati utenti
print "<td align=\"center\" nowrap='nowrap'>"; //<a href='FormModificaUtente.php?id_utente={$riga['id_utente']}'>";
echo "<form method=\"post\" action=\"ModificaUtente.php\"><input type=\"hidden\" name=\"id_utente\" value=\"{$riga['id_utente']}\" />";
echo "<input type=\"image\" src=\"./immagini/button_edit.png\" alt=\"Modifica\" title=\"Modifica\"/></form></td>";
// print '<img hspace="7" src="./immagini/button_edit.png" alt="Modifica" title="Modifica" border="0" /></a></td>';
// elimina utente
print "<td align='center' nowrap='nowrap'>";
if (($riga['id_ruolo'] == ID_OSSERVATORE)||($riga['id_ruolo'] == ID_OSPEDALIERO)||($riga['id_ruolo'] == ID_DOMICILIARE)||($riga['id_ruolo'] == ID_AFFIDATARIO) ||($riga['id_ruolo'] == ID_OPERATORE))
{
echo "<form method=\"post\" action=\"{$_SERVER['PHP_SELF']}\" onSubmit=\"return validazione()\"><input type=\"hidden\" name=\"id_utente\" value=\"{$riga['id_utente']}\" />".
"<input type=\"hidden\" name=\"cancella\" value=\"1\" />".
"<input type=\"hidden\" name=\"ruolo\" value=\"{$riga['id_ruolo']}\" />".
"<input type=\"image\" src=\"./immagini/button_drop.png\" alt=\"Cancella\" title=\"Cancella\"/></form>";
}
print "</td>";
// associazione utente - studente (solo per insegnanti affidatari e genitori)
if ($riga['id_ruolo'] == ID_OSSERVATORE||$riga['id_ruolo'] == ID_AFFIDATARIO||$riga['id_ruolo'] == ID_DOMICILIARE)
{
// visualizza associazioni
print "<td align=\"center\" nowrap='nowrap'>";
echo "<form method=\"post\" action=\"VisualizzaAssociazioniStudenti.php\"><input type=\"hidden\" name=\"id_utente\" value=\"{$riga['id_utente']}\" />";
echo "<input type=\"image\" src=\"./immagini/button_index.png\" alt=\"Informazioni\" title=\"Visualizza associazione utente-studente\"/></form></td>";
// gestione associazioni
print "<td align=\"center\" nowrap='nowrap'>";
echo "<form method=\"post\" action=\"AssociaStudenti.php\"><input type=\"hidden\" name=\"id_utente\" value=\"{$riga['id_utente']}\" />";
echo "<input type=\"image\" src=\"./immagini/forum.png\" alt=\"Associa\" title=\"Gestione associazione utente-studente\"/></form></td>";
}
else
{
print "<td align=\"center\" nowrap='nowrap'> </td>";
print "<td align=\"center\" nowrap='nowrap'> </td>";
}
}
print "</tr>";
}
print "</table>";
}
$up="indice.php";
if(isset($up)) echo "<br><br><center><a href=\"$up\"><img src=\"immagini/menu.png\"></a><br>Pagina Iniziale</center>";
include "Coda.inc";
?>