onfinfra
This commit is contained in:
parent
d1ea47881e
commit
4ffb4f5de8
53
AP4/onfinfra/rest/rest.sh
Executable file
53
AP4/onfinfra/rest/rest.sh
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
HOST=sio@onfarbo41
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo -e "Usage: $0 [-f] <compressed dumpfile>\n\t-f: force mode\n\t-h: this help\n" 1>&2; exit 1; }
|
||||||
|
|
||||||
|
restore() {
|
||||||
|
zcat "${filename}" | ssh "${HOST}" "mysql -u slam -pAzerty1+ bdarbre"
|
||||||
|
}
|
||||||
|
|
||||||
|
confirm() {
|
||||||
|
read -r -n 1 -p "${1:-Confirmer?} [o/n]: " REPLY
|
||||||
|
case "${REPLY}" in
|
||||||
|
[oO]) echo ; restore ;;
|
||||||
|
[nN]) echo ; exit 1 ;;
|
||||||
|
*) printf " \033[31m %s \n\033[0m" "Entrée non valide"
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts "fh" OPT
|
||||||
|
do
|
||||||
|
case "${OPT}" in
|
||||||
|
f)
|
||||||
|
forcemode=1
|
||||||
|
;;
|
||||||
|
|
||||||
|
h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
|
filename="${1}"
|
||||||
|
|
||||||
|
if [[ -z "${filename}" ]] ; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -r "${filename}" ]] ; then
|
||||||
|
echo "erreur ouverture fichier"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${forcemode}" == 1 ]]; then
|
||||||
|
restore
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
confirm
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 0
|
BIN
AP4/onfinfra/sv/hebdomadaires/bdarbre-2.sql.gz
Normal file
BIN
AP4/onfinfra/sv/hebdomadaires/bdarbre-2.sql.gz
Normal file
Binary file not shown.
BIN
AP4/onfinfra/sv/journalieres/bdarbre-5.sql.gz
Normal file
BIN
AP4/onfinfra/sv/journalieres/bdarbre-5.sql.gz
Normal file
Binary file not shown.
38
AP4/onfinfra/sv/sauvegardephp/Bucheron/affectation.php
Normal file
38
AP4/onfinfra/sv/sauvegardephp/Bucheron/affectation.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
To change this license header, choose License Headers in Project Properties.
|
||||||
|
To change this template file, choose Tools | Templates
|
||||||
|
and open the template in the editor.
|
||||||
|
-->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title></title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Affectation</h1>
|
||||||
|
<form id="formAffect" method="POST">
|
||||||
|
<div id="divCalendar">
|
||||||
|
<input type="date" id="selectD">
|
||||||
|
</div>
|
||||||
|
<div id="divBucheron">
|
||||||
|
<select name="selectBuch" id="selectBuch" size="15">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div name="divSecteur" id="divSecteur">
|
||||||
|
<select name="selectSecteur" id="selectSecteur" size="15">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div name="divEspece" id="divEspece">
|
||||||
|
<input type="text" id="choixEspece">
|
||||||
|
<select id="selectEspece" id="selectEspece">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script src="js/main.js"></script>
|
||||||
|
</html>
|
23
AP4/onfinfra/sv/sauvegardephp/Bucheron/bdd/BucheronSQL.php
Normal file
23
AP4/onfinfra/sv/sauvegardephp/Bucheron/bdd/BucheronSQL.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class BucheronSQL {
|
||||||
|
|
||||||
|
private $_laConnexion;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->_laConnexion = new Connexion();
|
||||||
|
}
|
||||||
|
|
||||||
|
function readAllBucheron() {
|
||||||
|
$stmt = $this->_laConnexion->dbh()->prepare("SELECT id, nom, prenom FROM bucheron");
|
||||||
|
$valid = $stmt->execute();
|
||||||
|
if (!$valid) {
|
||||||
|
$this->_laConnexion->afficherErreurSQL("Erreur recherche bucherons");
|
||||||
|
}
|
||||||
|
// Parcours du jeu d'enregistrement
|
||||||
|
//Retourne dans un array
|
||||||
|
$tabBuchron = array("lesBucherons" => $stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||||
|
return $tabBuchron;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
42
AP4/onfinfra/sv/sauvegardephp/Bucheron/bdd/Connexion.php
Normal file
42
AP4/onfinfra/sv/sauvegardephp/Bucheron/bdd/Connexion.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Description of Connexion *
|
||||||
|
* @author Dominique_2
|
||||||
|
*/
|
||||||
|
class Connexion {
|
||||||
|
|
||||||
|
private $_dbh; // Chaine de connexion
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connexion persistante au serveur
|
||||||
|
* @return \PDO Connexion
|
||||||
|
*/
|
||||||
|
public function __construct(){
|
||||||
|
// Définition des variables de connexion
|
||||||
|
$user = "adminbdarbre";
|
||||||
|
$pass = "mdpbdarbre";
|
||||||
|
$dsn ='mysql:host=localhost;dbname=bdarbre'; //Data Source Name
|
||||||
|
|
||||||
|
// Connexion
|
||||||
|
try {
|
||||||
|
$this->_dbh = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT=>true,
|
||||||
|
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'')); // Connexion persistante
|
||||||
|
}
|
||||||
|
catch (PDOException $e) {
|
||||||
|
die("Erreur : " . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** afficherErreurSQL :
|
||||||
|
* Affichage de messages lors l'accès à la bdd avec une requete SQL
|
||||||
|
* @param $message : message a afficher
|
||||||
|
*/
|
||||||
|
function afficherErreurSQL($message, $sql="") {
|
||||||
|
echo $message . "<br />" . $sql . "<br />";
|
||||||
|
$info = $this->_dbh->errorInfo();
|
||||||
|
echo "Code erreur : " . $info[0] . ", Message : " . $info[2];
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
function dbh() {
|
||||||
|
return $this->_dbh;
|
||||||
|
}
|
||||||
|
}
|
34
AP4/onfinfra/sv/sauvegardephp/Bucheron/bdd/EspeceSQL.php
Normal file
34
AP4/onfinfra/sv/sauvegardephp/Bucheron/bdd/EspeceSQL.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of EspeceSQL
|
||||||
|
*
|
||||||
|
* @author pierre.perdigues
|
||||||
|
*/
|
||||||
|
class EspeceSQL {
|
||||||
|
|
||||||
|
private $_laConnexion;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->_laConnexion = new Connexion();
|
||||||
|
}
|
||||||
|
|
||||||
|
function readEspeceAddr($adresse) {
|
||||||
|
$stmt = $this->_laConnexion->dbh()->prepare("SELECT DISTINCT libelle FROM espece INNER JOIN arbre ON espece.id = arbre.idEspece WHERE arbre.idAdresse=:adr");
|
||||||
|
$stmt->bindValue(':adr', $adresse);
|
||||||
|
$valid = $stmt->execute();
|
||||||
|
if (!$valid) {
|
||||||
|
$this->_laConnexion->afficherErreurSQL("Erreur recherche espece");
|
||||||
|
}
|
||||||
|
//Retourne dans un array
|
||||||
|
$tabEspece = array("lesEspeces" => $stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||||
|
return $tabEspece;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
34
AP4/onfinfra/sv/sauvegardephp/Bucheron/bdd/SecteurSQL.php
Normal file
34
AP4/onfinfra/sv/sauvegardephp/Bucheron/bdd/SecteurSQL.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of SecteurSQL
|
||||||
|
*
|
||||||
|
* @author pierre.perdigues
|
||||||
|
*/
|
||||||
|
class SecteurSQL {
|
||||||
|
|
||||||
|
private $_laConnexion;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->_laConnexion = new Connexion();
|
||||||
|
}
|
||||||
|
|
||||||
|
function readAllSecteur() {
|
||||||
|
$stmt = $this->_laConnexion->dbh()->prepare("SELECT * FROM adresse");
|
||||||
|
$valid = $stmt->execute();
|
||||||
|
if (!$valid) {
|
||||||
|
$this->_laConnexion->afficherErreurSQL("Erreur recherche bucherons");
|
||||||
|
}
|
||||||
|
// Parcours du jeu d'enregistrement
|
||||||
|
//Retourne dans un array
|
||||||
|
$tabSecteur = array("lesSecteurs" => $stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||||
|
return $tabSecteur;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
13
AP4/onfinfra/sv/sauvegardephp/Bucheron/css/style.css
Normal file
13
AP4/onfinfra/sv/sauvegardephp/Bucheron/css/style.css
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#divBucheron {
|
||||||
|
padding-top: 5vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#divSecteur{
|
||||||
|
float: left;
|
||||||
|
padding-top: 5vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dataListEspeces {
|
||||||
|
float: right;
|
||||||
|
margin-left: 80vw;
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
/* Chargement des classes nécessaies à partir des 2 répertoires possibles */
|
||||||
|
|
||||||
|
spl_autoload_register('chargerClasse');
|
||||||
|
/* $path_current = dirname( __FILE__ );
|
||||||
|
echo "Chemin : " . $path_current; */
|
||||||
|
function chargerClasse($class) {
|
||||||
|
$directorys = array(
|
||||||
|
'../bdd/',
|
||||||
|
'../metier/',
|
||||||
|
'bdd/',
|
||||||
|
'metier/'
|
||||||
|
);
|
||||||
|
foreach($directorys as $directory) {
|
||||||
|
//see if the file exists
|
||||||
|
if(file_exists($directory.$class.'.php')) {
|
||||||
|
require_once($directory.$class.'.php');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
date_default_timezone_set('Europe/Paris');
|
||||||
|
$day = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday");
|
||||||
|
//Si c'est la fin de la semaine
|
||||||
|
if (date('d-m-Y', strtotime("now")) == date('d-m-Y', strtotime("Friday"))) {
|
||||||
|
for ($i = 0; $i < count($day); $i++) {
|
||||||
|
echo '<option>' . date('d-m-Y', strtotime("next".$day[$i])) . "</option>";
|
||||||
|
}
|
||||||
|
} //Si c'est le début de la semaine
|
||||||
|
else{
|
||||||
|
for ($i = 0; $i < count($day); $i++) {
|
||||||
|
echo '<option>' . date('d-m-Y', strtotime("this week".$day[$i])) . "</option>";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*On peux comaprer les dates pour savoir si la date d'ajourd'hui est plus grande que celle d'hier
|
||||||
|
if (strtotime("now") > strtotime($day[0])) {
|
||||||
|
echo 'coucou';
|
||||||
|
};
|
||||||
|
echo date("d-m-y", strtotime("this week monday"));*/
|
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
/**************************************************************************
|
||||||
|
* getProduit.php : Recherche les produits *
|
||||||
|
* pour alimenter la liste deroulante zlProduit *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
header("Content-type:application/json");
|
||||||
|
include_once 'chargementClasses.php';
|
||||||
|
//Recupération des prodtuis
|
||||||
|
$buchSQL = new BucheronSQL();
|
||||||
|
$lesBucherons = $buchSQL->readAllBucheron();
|
||||||
|
//Mise en format JSON
|
||||||
|
echo(json_encode($lesBucherons));
|
||||||
|
?>
|
19
AP4/onfinfra/sv/sauvegardephp/Bucheron/include/getEspece.php
Normal file
19
AP4/onfinfra/sv/sauvegardephp/Bucheron/include/getEspece.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
header("Content-type:application/json");
|
||||||
|
include_once 'chargementClasses.php';
|
||||||
|
// Verification existence d'un produit selectionne
|
||||||
|
if (isset($_REQUEST['selectSecteur'])) {
|
||||||
|
recupEspece();
|
||||||
|
} else {
|
||||||
|
echo 'rien préciser';
|
||||||
|
}
|
||||||
|
|
||||||
|
function recupEspece() {
|
||||||
|
$idAddr = $_REQUEST['selectSecteur'];
|
||||||
|
$especeSQL = new EspeceSQL();
|
||||||
|
$lesEspeces = $especeSQL->readEspeceAddr($idAddr);
|
||||||
|
echo(json_encode($lesEspeces));
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
header("Content-type:application/json");
|
||||||
|
include_once 'chargementClasses.php';
|
||||||
|
//Recupération des prodtuis
|
||||||
|
$secteurSQL = new SecteurSQL();
|
||||||
|
$lesSecteurs = $secteurSQL->readAllSecteur();
|
||||||
|
//Mise en format JSON
|
||||||
|
echo(json_encode($lesSecteurs));
|
||||||
|
?>
|
93
AP4/onfinfra/sv/sauvegardephp/Bucheron/index.php
Normal file
93
AP4/onfinfra/sv/sauvegardephp/Bucheron/index.php
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
To change this license header, choose License Headers in Project Properties.
|
||||||
|
To change this template file, choose Tools | Templates
|
||||||
|
and open the template in the editor.
|
||||||
|
-->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Accueil</h1>
|
||||||
|
<button>Affectation</button>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<div>
|
||||||
|
<input type="checkbox" id="filtre1" />Affiche que class 1
|
||||||
|
<input type="checkbox" id="filtre2" />Affiche que class 2
|
||||||
|
<input type="checkbox" id="filtre3" />Affiche que class 3
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<form id="coucou">
|
||||||
|
<input type="checkbox" class="1" value="case2" ><a>Choix class 1</a><br>
|
||||||
|
<input type="checkbox" class="1" value="case3"><a>Choix class 1</a><br>
|
||||||
|
<input type="checkbox" class="2" value="case4"><a>Choix class 2</a><br>
|
||||||
|
<input type="checkbox" class="2" value="case5"><a>Choix class 2</a><br>
|
||||||
|
<input type="checkbox" class="2" value="case6"><a>Choix class 2</a><br>
|
||||||
|
<input type="checkbox" class="3" value="case7"><a>Choix class 3</a><br>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<button id="btn">COUCOU BOUTTON</button>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
var tableDonne = [];
|
||||||
|
|
||||||
|
document.querySelector('button').onclick = function () {
|
||||||
|
window.location.href = "affectation.php";
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = document.getElementById('coucou');
|
||||||
|
for (i = 0; i < list.length; i++) {
|
||||||
|
list[i].addEventListener("click", function () {
|
||||||
|
if (this.checked == true) {
|
||||||
|
tableDonne.push(this.value);
|
||||||
|
console.log(tableDonne);
|
||||||
|
console.log(this.checked);
|
||||||
|
}
|
||||||
|
if (this.checked == false) {
|
||||||
|
var pos = tableDonne.indexOf(this.value);
|
||||||
|
console.log(tableDonne.indexOf(this.value))
|
||||||
|
tableDonne.splice(pos, 1);
|
||||||
|
console.log(this.value);
|
||||||
|
console.log(tableDonne);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*document.getElementById("filtre1").onclick = function () {
|
||||||
|
console.log(document.getElementById("filtre1").checked);
|
||||||
|
var list = document.getElementById('coucou');
|
||||||
|
if (document.getElementById("filtre1").checked == true)
|
||||||
|
{
|
||||||
|
for (i = 0; i < list.length; i++) {
|
||||||
|
if (list[i].className != 1) {
|
||||||
|
list[i].hidden = true;
|
||||||
|
list[i].nextSibling.hidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < list.length; i++) {
|
||||||
|
if (list[i].className != 1) {
|
||||||
|
list[i].hidden = false;
|
||||||
|
list[i].nextSibling.hidden = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
document.getElementById("btn").onclick = function () {
|
||||||
|
var form = document.getElementById("coucou");
|
||||||
|
for (i = 0; i<form.length; i++) {
|
||||||
|
if (form[i].checked == true) {
|
||||||
|
console.log(form[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
</script>
|
||||||
|
</html>
|
210
AP4/onfinfra/sv/sauvegardephp/Bucheron/js/main.js
Normal file
210
AP4/onfinfra/sv/sauvegardephp/Bucheron/js/main.js
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
//Cache et Iniitilise les différents element graphique de selection
|
||||||
|
var zSelBuch = document.getElementById("selectBuch");
|
||||||
|
var zSelSect = document.getElementById("selectSecteur");
|
||||||
|
var searchEspece = document.getElementById("choixEspece");
|
||||||
|
var zAffichEspece = document.getElementById("selectEspece");
|
||||||
|
zSelBuch.hidden = true;
|
||||||
|
zSelSect.hidden = true;
|
||||||
|
searchEspece.hidden = true;
|
||||||
|
zAffichEspece.hidden = true;
|
||||||
|
|
||||||
|
|
||||||
|
//Script pour le calendrier
|
||||||
|
var verrif = 0;
|
||||||
|
var alertActive = 0;
|
||||||
|
document.getElementById('selectD').onchange = function () {
|
||||||
|
var dateSelect = document.getElementById('selectD').value;
|
||||||
|
var date = Date.now();
|
||||||
|
if (Date.parse(dateSelect) < date) {
|
||||||
|
alert("Date déjà passer")
|
||||||
|
alertActive = 1;
|
||||||
|
document.getElementById("selectBuch").hidden = true;
|
||||||
|
document.getElementById("selectSecteur").hidden = true;
|
||||||
|
}
|
||||||
|
if (verrif == 0 && alertActive == 0) {
|
||||||
|
getBucheron();
|
||||||
|
document.getElementById("selectBuch").hidden = false;
|
||||||
|
verrif = 1;
|
||||||
|
}
|
||||||
|
alertActive = 0
|
||||||
|
console.log(alertActive + "alert");
|
||||||
|
console.log(verrif + "verif");
|
||||||
|
}
|
||||||
|
//Fin calendrier
|
||||||
|
|
||||||
|
selectBuch.onclick = function () {
|
||||||
|
var bucheron = zSelBuch.options[zSelBuch.selectedIndex].value;
|
||||||
|
console.log("bucheron =" + bucheron);
|
||||||
|
getSecteur()
|
||||||
|
}
|
||||||
|
|
||||||
|
selectSecteur.onclick = function () {
|
||||||
|
var secteur = zSelSect.options[zSelSect.selectedIndex].value;
|
||||||
|
console.log("secteur = " + secteur)
|
||||||
|
getEspece(secteur);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cherche(catalog) {
|
||||||
|
//Appel la methode qui charge tous les produits
|
||||||
|
document.getElementById("choixEspece").addEventListener("keyup", function () {
|
||||||
|
//Initialise la variable options qui contiendra tout le html a integrer
|
||||||
|
AffichEspace(catalog, filtre.value);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBucheron() {
|
||||||
|
var file = "include/getBucheron.php"
|
||||||
|
var argument, valArgument = null;
|
||||||
|
getAll(zSelBuch, file, argument, valArgument);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSecteur() {
|
||||||
|
var file = "include/getSecteur.php";
|
||||||
|
var argument, valArgument = null;
|
||||||
|
getAll(zSelSect, file, argument, valArgument);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getEspece(secteur) {
|
||||||
|
var file = "include/getEspece.php"
|
||||||
|
var argument = "selectSecteur="
|
||||||
|
getAll(searchEspece, file, argument, secteur)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAll(placeHTML, fichierPHP, argument, valArgument) {
|
||||||
|
var options = "";
|
||||||
|
placeHTML.innerHTML = "";
|
||||||
|
// Construction de la requ<71>te
|
||||||
|
httpRequest = new XMLHttpRequest();
|
||||||
|
// Code s'ex<65>cutant quand la r<>ponse du serveur est arriv<69>e
|
||||||
|
httpRequest.onreadystatechange = function () {
|
||||||
|
if (httpRequest.readyState === XMLHttpRequest.DONE) {
|
||||||
|
// tout va bien, une r<>ponse a <20>t<EFBFBD> re<72>ue
|
||||||
|
if (httpRequest.status === 200) {
|
||||||
|
// Succ<63>s
|
||||||
|
//Recupération des données sous forme JSON
|
||||||
|
var json = JSON.parse(httpRequest.responseText);
|
||||||
|
/* Mise de ce résultat dans une autre fonction (ce qui évite d'utiliser la fonction de base
|
||||||
|
* qui effectue une requette a chaque fois*/
|
||||||
|
var file = json;
|
||||||
|
//Appel de la methode cherche qui met en place le système de recherche
|
||||||
|
//Appel de la methode d'affichage de tout les produits
|
||||||
|
//produitBase(file, filtre.value);
|
||||||
|
if (placeHTML == zSelBuch) {
|
||||||
|
afficheBucheron(file);
|
||||||
|
}
|
||||||
|
if (placeHTML == zSelSect) {
|
||||||
|
afficheSecteur(file);
|
||||||
|
}
|
||||||
|
if (placeHTML == searchEspece) {
|
||||||
|
console.log("search")
|
||||||
|
cherche(file);
|
||||||
|
zAffichEspece.hidden = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert("Erreur, status : " + httpRequest.status);
|
||||||
|
// il y a eu un probl<62>me avec la requ<71>te,
|
||||||
|
// par exemple la r<>ponse peut <20>tre un code 404 (Non trouv<75>e)
|
||||||
|
// ou 500 (Erreur interne au serveur)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// pas encore pr<70>te
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Initialisation et envoi de la requ<71>te
|
||||||
|
httpRequest.open('POST', fichierPHP, true);
|
||||||
|
httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||||
|
if (argument == null && valArgument == null) {
|
||||||
|
httpRequest.send();
|
||||||
|
} else {
|
||||||
|
httpRequest.send(argument + escape(valArgument));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function afficheBucheron(listB) {
|
||||||
|
verrif = 0;
|
||||||
|
//Initialisation de la variable affiche qui contiendra tout le html a intégrer
|
||||||
|
var options = "";
|
||||||
|
//parcours la liste des bucherons
|
||||||
|
for (var i = 0; i < listB.lesBucherons.length; i++) {
|
||||||
|
//Recupération des informations.
|
||||||
|
var id = listB.lesBucherons[i].id;
|
||||||
|
var nom = listB.lesBucherons[i].nom;
|
||||||
|
var prenom = listB.lesBucherons[i].prenom;
|
||||||
|
var complet = nom + " " + prenom;
|
||||||
|
//ajout du code HTML pour afficher les bucherons dans le select
|
||||||
|
options += "<option value='" + id + "'>" + complet + "</option>;"
|
||||||
|
}
|
||||||
|
//Insertion de la variable dans le html
|
||||||
|
document.getElementById("selectBuch").innerHTML = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
function afficheSecteur(listS) {
|
||||||
|
zSelSect.hidden = false;
|
||||||
|
//Initialisation de la variable affiche qui contiendra tout le html a intégrer
|
||||||
|
var options = "";
|
||||||
|
//parcours la liste des bucherons
|
||||||
|
for (var i = 0; i < listS.lesSecteurs.length; i++) {
|
||||||
|
//Recupération des informations.
|
||||||
|
var id = listS.lesSecteurs[i].id;
|
||||||
|
var libelle = listS.lesSecteurs[i].libelle;
|
||||||
|
//ajout du code HTML pour afficher les bucherons dans le select
|
||||||
|
options += "<option value='" + id + "'>" + libelle + "</option>;"
|
||||||
|
}
|
||||||
|
//Insertion de la variable dans le html
|
||||||
|
zSelSect.innerHTML = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*function cherche(listE) {
|
||||||
|
searchEspece.parentNode.hidden = false;
|
||||||
|
//Initialisation de la variable affiche qui contiendra tout le html a intégrer
|
||||||
|
var options = "";
|
||||||
|
//parcours la liste des bucherons
|
||||||
|
for (var i = 0; i < listE.lesEspeces.length; i++) {
|
||||||
|
//Recupération des informations.
|
||||||
|
var libelle = listE.lesEspeces[i].libelle;
|
||||||
|
//ajout du code HTML pour afficher les bucherons dans le select
|
||||||
|
options += "<option value='" + libelle + "'/>"
|
||||||
|
}
|
||||||
|
//Insertion de la variable dans le html
|
||||||
|
searchEspece.innerHTML = options;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function AffichEspace(catalog, saisie) {
|
||||||
|
//Initialisation de la variable affiche qui contiendra tout le html a intégrer
|
||||||
|
var options = "";
|
||||||
|
//si la zone de saisie n'est pas vide, continue la methode
|
||||||
|
if (saisie != "") {
|
||||||
|
//parcours la liste des produit
|
||||||
|
for (var i = 0; i < catalog.lesEpeces.length; i++) {
|
||||||
|
//Si la chaine est contenue au début d'un num d'un des elements js, n'affiche que celui ci
|
||||||
|
if (catalog.lesEpeces[i].libelle.toLowerCase().indexOf(saisie.toLowerCase()) == 0) {
|
||||||
|
//Recupération des informations.
|
||||||
|
var libelle = catalog.lesEpeces[i].libelle;
|
||||||
|
//ajout du code HTML pour afficher les produits dans la variable
|
||||||
|
opt = "<option value='" + libelle + "'>" + libelle + "</option>;"
|
||||||
|
/*Si l'id du produit est différent d'une des valeurs des balise option
|
||||||
|
* présent dans zlProduit alors ajoute ce dernier dans la variable qui servira pour
|
||||||
|
* integrer le html dans zlProduit*/
|
||||||
|
if (zAffichEspece.querySelectorAll("option").value != id)
|
||||||
|
//incrémenation de la variable
|
||||||
|
options += opt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Insertion de la variable dans le html
|
||||||
|
zAffichEspece.innerHTML = options;
|
||||||
|
} else {
|
||||||
|
var affiche = "";
|
||||||
|
for (var i = 0; i < catalog.lesEpeces.length; i++) {
|
||||||
|
//Recupération des informations
|
||||||
|
var id = catalog.lesEpeces[i].id;
|
||||||
|
var libelle = catalog.lesEpeces[i].libelle;
|
||||||
|
//ajout du code HTML pour afficher les produits dans la variable
|
||||||
|
affiche += "<option value='" + id + "'>" + libelle + "</option>;"
|
||||||
|
//le "+=" veux dire de prendre l'ancien résultat et de l'addition avec le nouveau
|
||||||
|
}
|
||||||
|
//Insertion dans le html
|
||||||
|
zAffichEspece.innerHTML = affiche;
|
||||||
|
}
|
||||||
|
}
|
70
AP4/onfinfra/sv/sauvegardephp/Bucheron/metier/Bucheron.php
Normal file
70
AP4/onfinfra/sv/sauvegardephp/Bucheron/metier/Bucheron.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of Bucheron
|
||||||
|
*
|
||||||
|
* @author pierre.perdigues
|
||||||
|
*/
|
||||||
|
class Bucheron {
|
||||||
|
|
||||||
|
private $_id;
|
||||||
|
private $_nom;
|
||||||
|
private $_prenom;
|
||||||
|
private $_login;
|
||||||
|
private $_mdp;
|
||||||
|
|
||||||
|
public function __construct($_id, $_nom, $_prenom, $_login, $_mdp) {
|
||||||
|
$this->_id = $_id;
|
||||||
|
$this->_nom = $_nom;
|
||||||
|
$this->_prenom = $_prenom;
|
||||||
|
$this->_login = $_login;
|
||||||
|
$this->_mdp = $_mdp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function id() {
|
||||||
|
return $this->_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nom() {
|
||||||
|
return $this->_nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prenom() {
|
||||||
|
return $this->_prenom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function login() {
|
||||||
|
return $this->_login;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function mdp() {
|
||||||
|
return $this->_mdp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setId($_id): void {
|
||||||
|
$this->_id = $_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNom($_nom): void {
|
||||||
|
$this->_nom = $_nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPrenom($_prenom): void {
|
||||||
|
$this->_prenom = $_prenom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLogin($_login): void {
|
||||||
|
$this->_login = $_login;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMdp($_mdp): void {
|
||||||
|
$this->_mdp = $_mdp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
copy.src.files=false
|
||||||
|
copy.src.on.open=false
|
||||||
|
copy.src.target=/var/www/PhpProject3
|
||||||
|
index.file=index.php
|
||||||
|
run.as=LOCAL
|
||||||
|
url=http://localhost/PHPProjects/Bucheron/
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||||
|
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||||
|
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||||
|
<group>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/css/style.css</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/index.php</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/include/getSecteur.php</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/bdd/BucheronSQL.php</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/affectation.php</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/include/chargementClasses.php</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/js/main.js</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/include/getBucheron.php</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/include/gestionDate.php</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/include/getEspece.php</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/bdd/EspeceSQL.php</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/bdd/SecteurSQL.php</file>
|
||||||
|
<file>file:/home/pierre.perdigues/PHPProjects/Bucheron/bdd/Connexion.php</file>
|
||||||
|
</group>
|
||||||
|
</open-files>
|
||||||
|
</project-private>
|
@ -0,0 +1,10 @@
|
|||||||
|
auxiliary.org-netbeans-modules-php-editor.fluent_2e_setter_2e_project_2e_property=false
|
||||||
|
auxiliary.org-netbeans-modules-php-editor.getter_2e_setter_2e_method_2e_name_2e_generation=AS_JAVA
|
||||||
|
auxiliary.org-netbeans-modules-php-editor.public_2e_modifier_2e_project_2e_property=true
|
||||||
|
include.path=${php.global.include.path}
|
||||||
|
php.version=PHP_80
|
||||||
|
source.encoding=UTF-8
|
||||||
|
src.dir=.
|
||||||
|
tags.asp=false
|
||||||
|
tags.short=false
|
||||||
|
web.root=.
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||||
|
<type>org.netbeans.modules.php.project</type>
|
||||||
|
<configuration>
|
||||||
|
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
||||||
|
<name>Bucheron</name>
|
||||||
|
</data>
|
||||||
|
</configuration>
|
||||||
|
</project>
|
10
AP4/onfinfra/sv/svbdd-h.sh
Executable file
10
AP4/onfinfra/sv/svbdd-h.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
datem=$(date +%W)
|
||||||
|
dates=$(($datem %4))
|
||||||
|
host=sio@10.121.38.95
|
||||||
|
|
||||||
|
#sv hebdomadaires avec rotation sur 4 semaines
|
||||||
|
scp $host:/home/frederic.duhin/PHPProjects/ProjetBucheron/bdarbre.sql /root/sv/bdarbre-$dates.sql
|
||||||
|
|
||||||
|
gzip bdarbre-$dates.sql;mv bdarbre-$dates.sql.gz hebdomadaires/
|
||||||
|
|
9
AP4/onfinfra/sv/svbdd-j.sh
Executable file
9
AP4/onfinfra/sv/svbdd-j.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
datej=$(date +%u)
|
||||||
|
host=sio@10.121.38.95
|
||||||
|
|
||||||
|
#sv journalières avec rotation sur 5 jours
|
||||||
|
scp $host:/home/frederic.duhin/PHPProjects/ProjetBucheron/bdarbre.sql /root/sv/bdarbre-$datej.sql
|
||||||
|
|
||||||
|
gzip bdarbre-$datej.sql;mv bdarbre-$datej.sql.gz journalieres/
|
||||||
|
|
5
AP4/onfinfra/sv/svphp.sh
Executable file
5
AP4/onfinfra/sv/svphp.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
host=sio@10.121.38.96
|
||||||
|
|
||||||
|
#sv de l'application PHP
|
||||||
|
scp -r $host:/home/pierre.perdigues/ProjetBucheron/Bucheron /root/sv/sauvegardephp/
|
Loading…
x
Reference in New Issue
Block a user