From db55c58b9592554259e5cc5d3b968717b5e45031 Mon Sep 17 00:00:00 2001 From: Sandra MICHAUT <sandra.michaut@ensiie.fr> Date: Sun, 8 May 2016 19:57:06 +0200 Subject: [PATCH] Ajout fonction vue complete arbre --- Code/affichage_arbre.php | 19 +++++++++++++++++++ Code/profil_vision.php | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/Code/affichage_arbre.php b/Code/affichage_arbre.php index 83b229a..7683c95 100644 --- a/Code/affichage_arbre.php +++ b/Code/affichage_arbre.php @@ -6,3 +6,22 @@ * Time: 15:31 */ +session_start(); +include_once("config_s.php"); +include_once("mise_en_page.php"); +require_once ("profil_vision.php"); + + +/* Variables de session */ +$nomUser=$_SESSION['nomUser']; +$admin = $_SESSION['admin']; +$co = $_SESSION['co']; + + +enTete("Affichage arbre", $nomUser); + +affichage_total($nomHost, $nomBase, $nomRoot, $mdpRoot); + +retourAuMenu(); +pied(); +?> \ No newline at end of file diff --git a/Code/profil_vision.php b/Code/profil_vision.php index ff171e3..2ec36c2 100644 --- a/Code/profil_vision.php +++ b/Code/profil_vision.php @@ -1066,3 +1066,43 @@ function modifierAssoc_eleve($ajout, $login, $id, $nomHost, $nomBase, $nomRoot, return $retour; } + + + +function affichage_total ($nomHost, $nomBase, $nomRoot, $mdpRoot) { + /* On se connecte a la base */ + if ( $DB = pg_connect("host=$nomHost user=$nomRoot dbname=$nomBase password=$mdpRoot" ) ) { + $query = "SELECT parr.nom_eleve AS nomParr, parr.prenom AS prenomParr, fill.nom_eleve AS nomFill, fill.prenom AS prenomFill + FROM liens + JOIN eleve AS parr ON (parr.login_eleve=liens.parrain) + JOIN eleve AS fill ON (fill.login_eleve=liens.filleul) + WHERE liens.valide='y'"; + $commande = pg_query($DB, $query); + + if ($commande) { + $ligne = pg_fetch_array($commande); + + while ($ligne) { + $nomParr = $ligne['nomparr']; + $prenomParr = $ligne['prenomparr']; + $nomFill = $ligne['nomfill']; + $prenomFill = $ligne['prenomfill']; + + $affich = "$nomParr $prenomParr-> $nomFill $prenomFill"; + print $affich; + print "<br/>"; + $ligne = pg_fetch_array($commande); + } + } + else print "ERREUR"; + } + + else { + /* Impossible de se connecter a la BD */ + $retour = -2; + } + + +} + + -- GitLab