From 01cb12075eedd9d84a365c02ed0d7f781c77e4fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Bousqui=C3=A9?= Date: Mon, 26 Nov 2018 11:00:41 +0100 Subject: [PATCH] trombino sur wifi et recherches --- admin/recherche.php | 46 ++++++++++++++++++++++++++++++++++++++++--- admin/reload_wifi.php | 13 +++++++++++- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/admin/recherche.php b/admin/recherche.php index 466a353..4b3e254 100644 --- a/admin/recherche.php +++ b/admin/recherche.php @@ -13,6 +13,12 @@ FiltreProfil($profil); function RechercheConnexions(&$db) { global $_POST; global $liste_const; + + global $trombino; + global $trombino_url; + global $trombino_defaut_url; + global $trombino_extension_fichier; + $machine = db_escape_string($db, $_POST["machine"]); $compte = db_escape_string($db, $_POST["compte"]); $salle = db_escape_string($db, $_POST["salle"]); @@ -246,7 +252,7 @@ function RechercheWifi(&$db) { $date_fin = db_escape_string($db, $_POST["date_fin"]); $contrainte = false; - $req_wifi = "SELECT nom AS 'Nom', prenom AS 'Prénom', wifi_username AS 'Compte', groupe AS 'Groupe', wifi_ip AS 'Adresse IP', wifi_browser AS 'Browser/Device', wifi_deb_conn AS 'Heure connexion', close AS 'Fermée ?'"; + $req_wifi = "SELECT wifi_username AS 'Compte', nom AS 'Nom', prenom AS 'Prénom', groupe AS 'Groupe', wifi_ip AS 'Adresse IP', wifi_browser AS 'Browser/Device', wifi_deb_conn AS 'Heure connexion', close AS 'Fermée ?'"; $req_wifi = $req_wifi." FROM wifi, comptes WHERE wifi_username = username "; $where = ""; if ($compte != "") { @@ -320,17 +326,51 @@ function FormatteResultats(&$db, &$res) { $r = "n°"; $resultats = "La recherche n'a abouti à aucun résultat."; $nb = db_num_rows($res); + $a_trombiner = array(); // tableau des index des champs trombinables + $cols_username = array(); // tableau des index des champs désignant un username + $noms_trombinables = ["Compte", "Prénom", "Nom"]; // quelles colonnes peuvent afficher la photo ? + $noms_username = ["Compte"]; // quelles colonnes désignent le username ? if ($nb != 0) { $cols = db_fetch_column_names($res); foreach($cols as $name) { $r = $r . "$name"; + $trombo = false; + if (in_array($name, $noms_trombinables)) { + $trombo = true; + } + $a_trombiner[] = $trombo; + $usn = false; + if (in_array($name, $noms_username)) { + $usn = true; + } + $cols_username[] = $usn; } + + global $trombino_url; + global $trombino_defaut_url; + global $trombino_extension_fichier; + $trombino = false; + if ($trombino_url != "") { + $trombino = true; + } + $cpt = 1; while ($li = db_fetch_row($res)) { $li_coul = ($cpt % 2 == 0) ? "odd" : "even"; $r = $r . "$cpt"; - foreach($li as $col) { - $r = $r . "$col"; + $username = ""; + foreach($li as $id => $col) { + $div_trombi = "
"; + $fin_div = "
"; + if ($trombino && $a_trombiner[$id]) { + if ($cols_username[$id]) { + $username = $col; // récupère le username, cette colonne doit précéder les autres colonnes trombinables + } + $url_photo = $trombino_url."/".$username.$trombino_extension_fichier; + $div_trombi = "
"; + } + + $r = $r . "" . $div_trombi. $col . $fin_div. ""; } $r = $r . "\n"; $cpt = $cpt + 1; diff --git a/admin/reload_wifi.php b/admin/reload_wifi.php index 6f5372a..a328b0d 100644 --- a/admin/reload_wifi.php +++ b/admin/reload_wifi.php @@ -9,6 +9,11 @@ $username = Username(); $profil = Profil($username); FiltreProfil($profil); +$trombino = false; +if ($trombino_url != "") { + $trombino = true; +} + $connexions_wifi = Connexions_wifi(); $html = "

Nb connexions déjà établies : ". count($connexions_wifi); $html = $html . "\n\n"; @@ -25,8 +30,14 @@ foreach ($connexions_wifi as $i => $con_wifi) { $browser = $con_wifi["browser"]; $id = $con_wifi["id"]; $style = ($pair) ? "even" : "odd"; + $div_trombi = "
"; + $fin_div = "
"; + if ($trombino) { + $url_photo = $trombino_url."/".$username.$trombino_extension_fichier; + $div_trombi = "
"; + } $weight = ($groupe == $lib_personnel) ? $bold : ""; - $lignes = $lignes . "
\n"; + $lignes = $lignes . "\n"; $pair = !$pair; }
nomprénomcomptegroupeheure connexionadresse IPbrowserid connexion
$nom$prenom$username$groupe$debut$ip$browser$id
$div_trombi$nom$fin_div$div_trombi$prenom$fin_div$div_trombi$username$fin_div$groupe$debut$ip$browser$id