mirror of
https://gitlab.aliens-lyon.fr/savrillo/gpens.git
synced 2026-03-18 03:01:04 +01:00
Merge branch 'master' of https://gitlab.aliens-lyon.fr/savrillo/gpens
This commit is contained in:
commit
d70402ec56
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
|||||||
svg-pan-zoom.min.js
|
svg-pan-zoom.min.js
|
||||||
tinycolor-min.js
|
tinycolor-min.js
|
||||||
|
|
||||||
bddpass.php
|
api/dbinit.php
|
||||||
|
|||||||
@ -1,18 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Connection à la BDD:
|
// Active les erreurs PHP.
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
ini_set('display_startup_errors', 1);
|
ini_set('display_startup_errors', 1);
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
include 'bddpass.php';
|
// Se connecte à la BDD (identifiants cachés)
|
||||||
try {
|
include 'dbinit.php';
|
||||||
$conn = new PDO("mysql:host=localhost;dbname=savrillo", "savrillo", $bddpass, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
|
|
||||||
// set the PDO error mode to exception
|
|
||||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
} catch(PDOException $e) {
|
|
||||||
echo "Connection failed: " . $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(isset($_GET["salle"])) {
|
if(isset($_GET["salle"])) {
|
||||||
@ -28,9 +23,18 @@ if(isset($_GET["salle"])) {
|
|||||||
for($i=0;$i<count($resA);$i++)
|
for($i=0;$i<count($resA);$i++)
|
||||||
$aliaz[$i] = $resA[$i]['nom'];
|
$aliaz[$i] = $resA[$i]['nom'];
|
||||||
|
|
||||||
|
$fichiers = array();
|
||||||
|
|
||||||
|
$stmt = $conn->prepare("SELECT fichier FROM salleFichier WHERE salleID=?");
|
||||||
|
$stmt->execute([$idSalle]);
|
||||||
|
$resF = $stmt->fetchAll();
|
||||||
|
|
||||||
|
for($i=0;$i<count($resF);$i++)
|
||||||
|
$fichiers[$i] = $resF[$i]['fichier'];
|
||||||
|
|
||||||
$locataires = array();
|
$locataires = array();
|
||||||
|
|
||||||
$stmt = $conn->prepare("SELECT personne FROM locataires WHERE salle=?");
|
$stmt = $conn->prepare("SELECT personne FROM locataires WHERE salleID=?");
|
||||||
$stmt->execute([$idSalle]);
|
$stmt->execute([$idSalle]);
|
||||||
$resP = $stmt->fetchAll();
|
$resP = $stmt->fetchAll();
|
||||||
|
|
||||||
@ -38,7 +42,7 @@ if(isset($_GET["salle"])) {
|
|||||||
$locataires[$i] = $resP[$i]['personne'];
|
$locataires[$i] = $resP[$i]['personne'];
|
||||||
|
|
||||||
|
|
||||||
$stmt = $conn->prepare("SELECT id, nom, description FROM salles WHERE id=?");
|
$stmt = $conn->prepare("SELECT id, description FROM salles WHERE id=?");
|
||||||
$stmt->execute([$idSalle]);
|
$stmt->execute([$idSalle]);
|
||||||
$resS = $stmt->fetchAll();
|
$resS = $stmt->fetchAll();
|
||||||
|
|
||||||
@ -46,7 +50,7 @@ if(isset($_GET["salle"])) {
|
|||||||
if(count($resS)==0){
|
if(count($resS)==0){
|
||||||
echo "404";
|
echo "404";
|
||||||
}else {
|
}else {
|
||||||
$out = array("id" => $resS[0]["id"], "nom" => $resS[0]["nom"], "description" => $resS[0]["description"], "aliaz" => $aliaz, "locataires" => $locataires);
|
$out = array("id" => $resS[0]["id"], "description" => $resS[0]["description"], "aliaz" => $aliaz, "locataires" => $locataires, "fichiers" => $fichiers);
|
||||||
echo (json_encode($out));
|
echo (json_encode($out));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,14 +58,14 @@ if(isset($_GET["salle"])) {
|
|||||||
|
|
||||||
$salleNameSearch = $_GET["salleNameSearch"];
|
$salleNameSearch = $_GET["salleNameSearch"];
|
||||||
|
|
||||||
$stmt = $conn->prepare("(SELECT id, nom FROM `salles` WHERE MATCH nom AGAINST (? IN BOOLEAN MODE)) UNION (SELECT salleID, nom FROM salleAlias WHERE MATCH nom AGAINST (? IN BOOLEAN MODE))");
|
$stmt = $conn->prepare("SELECT salleID, nom FROM salleAlias WHERE MATCH nom AGAINST (? IN BOOLEAN MODE)");
|
||||||
$stmt->execute([$salleNameSearch, $salleNameSearch]);
|
$stmt->execute([$salleNameSearch]);
|
||||||
$res = $stmt->fetchAll();
|
$res = $stmt->fetchAll();
|
||||||
|
|
||||||
$out = array();
|
$out = array();
|
||||||
|
|
||||||
for($i=0;$i<count($res);$i++)
|
for($i=0;$i<count($res);$i++)
|
||||||
$out[$i] = array("id" => $res[$i]['id'], "nom" => $res[$i]["nom"]);
|
$out[$i] = array("salleID" => $res[$i]['salleID'], "nom" => $res[$i]["nom"]);
|
||||||
|
|
||||||
echo (json_encode($out));
|
echo (json_encode($out));
|
||||||
|
|
||||||
@ -69,17 +73,17 @@ if(isset($_GET["salle"])) {
|
|||||||
|
|
||||||
$salleLocSearch = $_GET["salleLocSearch"];
|
$salleLocSearch = $_GET["salleLocSearch"];
|
||||||
|
|
||||||
$stmt = $conn->prepare("SELECT salle, personne FROM `locataires` WHERE MATCH personne AGAINST (? IN BOOLEAN MODE)");
|
$stmt = $conn->prepare("SELECT salleID, personne FROM `locataires` WHERE MATCH personne AGAINST (? IN BOOLEAN MODE)");
|
||||||
$stmt->execute([$salleLocSearch]);
|
$stmt->execute([$salleLocSearch]);
|
||||||
$res = $stmt->fetchAll();
|
$res = $stmt->fetchAll();
|
||||||
|
|
||||||
$out = array();
|
$out = array();
|
||||||
|
|
||||||
for($i=0;$i<count($res);$i++)
|
for($i=0;$i<count($res);$i++)
|
||||||
$out[$i] = array("salle" => $res[$i]['salle'], "personne" => $res[$i]["personne"]);
|
$out[$i] = array("salleID" => $res[$i]['salleID'], "personne" => $res[$i]["personne"]);
|
||||||
|
|
||||||
echo (json_encode($out));
|
echo (json_encode($out));
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
echo "Je ne connais pas cette commande ...";
|
echo "Je ne connais pas cette commande ...";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user