"; $count_root ++; break; case 3: $room['img'] = ""; $count_admin ++; break; case 4: $room['img'] = ""; $count_membre_ca ++; break; case 5: $room['img'] = ""; $count_tresorier ++; break; default: $room['img'] = ""; break; } } if($a['special_case'] == 't') { $room['special_case'] = "*"; $count_special_case ++; } else { $room['special_case'] = ""; } if(strtotime(date("Y-m", strtotime($a['datedeco']." +1 month"))) < time()) { $room['class'] = "red"; $count_datedeco ++; } else if((date("n") < 9 || date("n") > 10) && $a['certif'] != 't') { $room['class'] = "orange"; $count_no_cert ++; } else { $room['class'] = "green"; $count_green ++; } } else { $count_empty ++; } switch($room['name'][0]) { case 0: case '0': $floor0[] = $room; break; case 1: case '1': $floor1[] = $room; break; case 2: case '2': $floor2[] = $room; break; case 3: case '3': $floor3[] = $room; break; case 4: case '4': $floor4[] = $room; break; default: $floor0[] = $room; break; } } ?> "; echo ""; echo ""; echo ""; echo ""; echo "\n"; $bline = !$bline; } ?>
rdc1er2e3e4e
".$floor0[$i]['name'].($floor0[$i]['special_case']).$floor0[$i]['img']."".$floor1[$i]['name'].($floor1[$i]['special_case']).$floor1[$i]['img']."".$floor2[$i]['name'].($floor2[$i]['special_case']).$floor2[$i]['img']."".$floor3[$i]['name'].($floor3[$i]['special_case']).$floor3[$i]['img']."".$floor4[$i]['name'].($floor4[$i]['special_case']).$floor4[$i]['img']."
rdc1er2e3e4e
Liste des $count_all_rooms chambres\n"; // Tables dans une table, c'est pas beau, comme le PHP et l'HTML ?>
SudNord
Légende
Chambre connectée
Date de fin de connexion passée
Certificat non rendu
Chambre vide
*Cas particulier
Responsable réseau
Admin
Membre CA
Trésorier et président
Chambre ".$a['name']."\n
"; $r = pg_query("SELECT iduser, nom, prenom FROM user_pac WHERE idroom = ".$a['idroom']); if($a2 = pg_fetch_array($r)) echo "

Occupée par ".$a2['nom']." ".$a2['prenom'].""; else echo "

Vide"; if($roles['inscription']) echo "
\n[Nouveau]"; echo "

"; return true; } else { echo "

Erreur : cet id n'existe pas

\n"; return false; } } function DisplayRoomInterface($id) { global $roles; $r = pg_query("SELECT idroom, idinterface, name FROM room WHERE idroom = ".$id); $a = pg_fetch_array($r); $r = pg_query("SELECT ifname, i.idmateriel AS idm, hostname FROM interface i, materiel m WHERE i.idmateriel = m.idmateriel AND idinterface = ".$a['idinterface']); $a2 = pg_fetch_array($r); echo "

Sur l'interface ".$a2['hostname']." / "; echo "".$a2['ifname'].""; if($roles['root']) echo " - [Changer]"; if($roles['inscription']) echo " - [Déménager]"; echo "

\n"; } function DisplayInterfaceForm($id) { global $roles; if(!$roles['root']) return; $r = pg_query("SELECT idroom, idinterface, name FROM room WHERE idroom = ".$id); $a = pg_fetch_array($r); if(isset($_GET['idint'])) { pg_query("UPDATE room SET idinterface = ".$_GET['idint']." WHERE idroom = ".$a['idroom']); DisplayRoomInterface($id); } else { $r = pg_query("SELECT idinterface, ifname, m.idmateriel AS idm, hostname FROM interface i, materiel m WHERE i.idmateriel = m.idmateriel ORDER BY m.idmateriel, ifnumber"); $last_id = 0; echo "

Sur l'interface "; echo "

\n"; } } function DisplayRoomForm($id) { global $roles; global $auth_user; if(!$roles['inscription']) return; $r = pg_query("SELECT idroom, idinterface, name FROM room WHERE idroom = ".$id); $a = pg_fetch_array($r); if(isset($_GET['idr'])) { RemoveUser($_GET['idr']); pg_query("UPDATE user_pac SET idroom = ".$_GET['idr']." WHERE idroom = ".$a['idroom']); // récupérer les infos de l'interface de idroom $r2 = pg_query("SELECT ifdescription, portsecmaxmac FROM interface WHERE idinterface = (SELECT idinterface FROM room WHERE idroom = ".$a['idroom'].")"); $a2 = pg_fetch_array($r2); // effacer l'interface de idroom (mais pas les ordi ni l'utilisateur) RemoveInterface($a['idroom']); // configurer l'interface de idr $r3 = pg_query("SELECT iduser FROM user_pac WHERE idroom = ".$_GET['idr']); $a3 = pg_fetch_array($r3); UpdateInterfaceForUser($a3['iduser']); // configurer a2 cf $mode == "conf" au début de interface.php $r = pg_query("SELECT MAX(idaction) FROM action"); if($am = pg_fetch_array($r)) $newid = $am[0]+1; else $newid = 1; $r4 = pg_query("SELECT idinterface FROM room WHERE idroom = ".$_GET['idr']); $a4 = pg_fetch_array($r4); $idint = $a4['idinterface']; $opt = $a2['portsecmaxmac']; pg_query("INSERT INTO action VALUES($newid, $idint, 3, '10')"); // logging_action "déménagement" $r = pg_query("SELECT MAX(idlog) FROM action_log"); if($am = pg_fetch_array($r)) $newid = $am[0]+1; else $newid = 1; $oldopt = $a2['ifdescription']; $r = pg_query("SELECT ifdescription FROM interface WHERE idinterface = ".$idint); $a = pg_fetch_array($r); $opt = $a['ifdescription']; pg_query("INSERT INTO action_log VALUES($newid, '$auth_user', ".time().", $idint, 6, '$oldopt', '$opt')"); echo ""; } else { $r = pg_query("SELECT name, idroom FROM room ORDER BY idroom ASC"); $last_id = 0; echo "

Vers la chambre "; echo "

\n"; } } if(isset($_GET['id'])) { $ok = DisplayRoomInfo($_GET['id']); if($ok) { if(isset($_GET['change']) && $roles['root']) DisplayInterfaceForm($_GET['id']); elseif(isset($_GET['move']) && $roles['inscription']) DisplayRoomForm($_GET['id']); else DisplayRoomInterface($_GET['id']); echo "
\n"; //ouvert dans DisplayRoomInfo } } DisplayRoomList(); include "inc/inc.footer.php"; ?>