Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recueil donnees #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 58 additions & 40 deletions ajout_pharma.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<title>Ajouter une pharmacie .:. EduPalu</title>
<link rel="icon" href="favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.blue-light_blue.min.css" />
<link rel="stylesheet" href="css/custom.css" />
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.blue-light_blue.min.css" />
<link rel="stylesheet" href="css/custom.css" />
<link rel="stylesheet" href="css/adresses.css" />
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
</head>
Expand All @@ -35,12 +35,12 @@
for="demo-menu-lower-right">
<li class="mdl-menu__item"><a href="comment.html">Comment</a></li>
<li class="mdl-menu__item"><a href="qui.html">A propos</a></li>
</ul>
</div>
</ul>
</div>
<!-- Navigation. We hide it in small screens. -->
<nav class="mdl-navigation mdl-layout--large-screen-only">
<a class="mdl-navigation__link" href="adresse.html">Rechercher une pharmacie/CSi</a>
<a class="mdl-navigation__link" href="adresse_near.html">La plus proche de moi</a>
<a class="mdl-navigation__link" href="adresse_near.html">La plus proche de moi</a>
<a class="mdl-navigation__link" href="ajout_pharma.html">Ajouter un centre de santé</a>
<a class="mdl-navigation__link" href="comment.html">Comment ?</a>
<a class="mdl-navigation__link" href="qui.html">A propos</a>
Expand All @@ -52,82 +52,100 @@
<nav class="mdl-navigation">
<a class="mdl-navigation__link" href="comprendre.html"><i class="material-icons">description</i>Comprendre</a>
<a class="mdl-navigation__link" href="se_proteger.html"><i class="material-icons">warning</i>Se protéger</a>
<a class="mdl-navigation__link" href="diagnostiquer.html"><i class="material-icons">find_in_page</i>Diagnostiquer</a>
<a class="mdl-navigation__link" href="diagnostiquer.html"><i class="material-icons">find_in_page</i>Diagnostiquer</a>
<a class="mdl-navigation__link" href=""><i class="material-icons">healing</i>Se soigner</a>
<a class="mdl-navigation__link" href="adresse.html"><i class="material-icons">search</i>Rechecher </a>
<a class="mdl-navigation__link" href="adresse.html"><i class="material-icons">search</i>Rechecher </a>
<a class="mdl-navigation__link" href="question_reponse.html"><i class="material-icons">forum</i>Questions / Réponses</a>
<a class="mdl-navigation__link" href="quiz_play.html"><i class="material-icons">games</i>Le quiz</a>
<a class="mdl-navigation__link" href=""><i class="material-icons">extension</i>Chasse aux parasites</a>
<a class="mdl-navigation__link" href=""><i class="material-icons">extension</i>Chasse aux parasites</a>
<a class="mdl-navigation__link" href="comment.html"><i class="material-icons">copyright</i>Comment ?</a>
<a class="mdl-navigation__link" href="qui.html"><i class="material-icons">info</i> A propos</a>
</nav>
</div>
<div class="page-content">
</div>
<div class="page-content">
<div class="mdl-grid bg_search">
<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone mdl-cell--8-col-tablet">
<div class="search">
<i class="material-icons blue_color">search</i>
<input type="text" placeholder="Rechercher une pharmacie, un CSI, un hôpital...">
</div>
</div>
</div>
</div>
</div>
</div>
<main class="mdl-layout__content">
<div class="page-content">
<div class="page-content">

<div class="mdl-grid mdl-container">
<h4 class="container_title">Ajouter une pharmacie</h4>
<div class="text_container">
<div class="mdl-container_text">
<span>Nom de la pharmacie </span><br>
<input class="search_page full_width" id="input_name" type="text" placeholder="Indiquez ici le nom de la pharmacie"><br><br>

<span>Adresse de la pharmacie </span><br>
<input class="search_page full_width" id="input_name" type="text" placeholder="Indiquez ici l'adresse de la pharmacie"><br><br>

<span>Ville </span><br>
<input class="search_page full_width" id="input_name" type="text" placeholder="Ville"><br><br>
<div class="mdl-container_text">
<form action="api/AddPharma.php" method="post" id="form_add_pharma">
<div class="text_container">
<div id="response_form"></div>
<div class="mdl-container_text">
<span>Nom de la pharmacie </span><br>
<input class="search_page full_width" id="nom_pharma" name="nom" type="text" placeholder="Indiquez ici le nom de la pharmacie"><br><br>

<span>Contact pharmacie</span><br>
<input class="search_page full_width" id="input_name" type="text" placeholder="Contact pharmacie"><br><br>
<span>Adresse de la pharmacie </span><br>
<input class="search_page full_width" id="adresse_pharma" name="adresse" type="text" placeholder="Indiquez ici l'adresse de la pharmacie"><br><br>
<span>Ville </span><br>
<select class="search_page full_width" id="ville_pharma" name="ville">
<option value="Brazzaville">Brazzaville</option>
<option value="Djambala">Djambala</option>
<option value="Dolisie">Dolisie</option>
<option value="Impfondo">Impfondo</option>
<option value="Kinkala">Kinkala</option>
<option value="Loango">Loango</option>
<option value="Madingou">Madingou</option>
<option value="Ouesso">Ouesso</option>
<option value="Owando">Owando</option>
<option value="Sibiti">Sibiti</option>
<option value="Pointe-Noire">Pointe-Noire</option>
</select>
<!--<input class="search_page full_width" id="ville_pharma" name="ville" type="text" placeholder="Ville"><br><br>-->
<br><br>
<span>Contact pharmacie</span><br>
<input class="search_page full_width" id="contact_pharma" name="contact" type="text" placeholder="Contact pharmacie"><br><br>

<span>Quartier ou Arrondissement </span><br>
<input class="search_page full_width" id="input_name" type="text" placeholder="Indiquez ici le quartier ou l'arrondissement"><br><br>
<span>Quartier ou Arrondissement </span><br>
<input class="search_page full_width" id="quartier_pharma" name="quartier" type="text" placeholder="Indiquez ici le quartier ou l'arrondissement"><br><br>

<span>Numéro ou e-mail de l'envoyeur </span><br>
<input class="search_page full_width" id="input_name" type="text" placeholder="Numéro ou e-mail de l'envoyeur"><br><br>
<span>Numéro ou e-mail de l'envoyeur </span><br>
<input class="search_page full_width" id="contact_sender_pharma" name="numero" type="text" placeholder="Numéro ou e-mail de l'envoyeur"><br><br>

<button id="btn_search" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored full_width">Ajouter</button><br><br>

<button id="btn_search" type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored full_width">Ajouter</button><br><br>

</div>
</div>
</form>
</div>
</div>
</div>

</div>
<div class="page-content mdl-container">
<div class="mdl-grid container">

<div class="page-content mdl-container">
<div class="mdl-grid container">
<footer class="mdl-mini-footer mdl-layout--large-screen-only">
<div class="mdl-mini-footer__left-section">
<ul class="mdl-mini-footer__link-list">
<li><a href="#">Fongwama - 2017</a></li>
</ul>
</div>
</footer>
</footer>
</div>
</div>
</div>

</main>
</div>

<!-- inclusion des fichiers javascript -->
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<!-- Bootstrap JavaScript File Include -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/json_query.min.js"></script>
<script type="text/javascript" src="data/places_db.json"></script>
<script type="text/javascript" src="js/adresses_search.js"></script>
<script type="text/javascript" src="js/adresses_search.js"></script>
<script type="text/javascript" src="js/add_pharma.js"></script>

</body>
</html>
87 changes: 73 additions & 14 deletions api/AddPharma.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,84 @@
$quartier = filter_input(INPUT_POST,'quartier', FILTER_SANITIZE_STRING);
$numero = filter_input(INPUT_POST,'numero', FILTER_SANITIZE_STRING);

if($nom != "" || $adresse != "" || $ville != "" || $quartier){
if(!empty($nom) && !empty($adresse) && !empty($ville) && !empty($quartier) && !empty($contact) && !empty($numero)){

$pharma = new Pharmacie();
$pharma->setNom($nom);
$pharma->setAdresse($adresse);
$pharma->setVille($ville);
$pharma->setContact($contact);
$pharma->setQuartier($quartier);
$pharma->setNumero($numero);
$result = [];

echo('Nom: '+$pharma->getNom());
//vérifie si le numéro entréest valide
if(!is_numeric($contact) || strlen($contact) < 9 || strlen($contact) > 9){
$result['is_valid'] ='
<div class="response_form_warnig">
<strong>Veuillez entrer un numero valide de 9 caractères \'il vous plait!</strong>
</div>
';
}else{
if(existPharma($nom,$adresse) == true){
$result['exist'] = "<div class='response_form_warnig'>
<button type=\"button\" class=\"close\">×</button>
<strong>Désolé cette pharmacie existe déjà</strong>
</div>";
}else{

$dao = new PharmaciesDao();
$pharma = new Pharmacie();
$pharma->setNom($nom);
$pharma->setAdresse($adresse);
$pharma->setVille($ville);
$pharma->setContact('+242'.$contact);
$pharma->setQuartier($quartier);
$pharma->setNumero($numero);

$_pharmaId = $dao->addPharmacie($pharma);
//echo('Nom: '+$pharma->getNom());

if($_pharmaId > 0){
$result = Array("message" => "Pharmacie ajouter avec succès");
//json_encode($result);
$dao = new PharmaciesDao();

$_pharmaId = $dao->addPharmacie($pharma);

if($_pharmaId > 0){
$result['success'] = '
<div class="response_form_success">
<button type="button" class="close">×</button>
<strong>Pharmacie ajouter avec succès</strong>
</div>
';

//json_encode($result);
}

}
}



}else{
$result['empty'] = "
<div class='response_form_failed'>
<button type=\"button\" class=\"close\">×</button>
<strong>Désolé Tous les champs ne peuvent pas être vide</strong>
</div>";
}

if(!empty($result)){
foreach($result as $msg):
echo $msg;
endforeach;
}


//function de verification si la pharmacie existe deja
function existPharma($nom,$adresse){
global $pdo;
$q = "
SELECT nom,adresse
FROM tab_pharmacie
WHERE nom = :nom AND adresse = :adresse
";

$req =$pdo->prepare($q);
$req->bindValue(':nom', $nom);
$req->bindValue(':adresse',$adresse);
$req->execute();
$exist = $req->rowCount();
return $exist;

}
9 changes: 9 additions & 0 deletions api/IInformation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
require_once ('Information.php');

interface IInformation
{
public function addInformation(Information $information);
public function deleteInformation(Information $information);
public function updateInformation(Information $information);
}
1 change: 1 addition & 0 deletions api/IPharmacie.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ interface IPharmacie
public function addPharmacie(Pharmacie $pharmacie);
public function deletePharmacie(Pharmacie $pharmacie);
public function updatePharmacie(Pharmacie $pharmacie);
public function existPharma(Pharmacie $pharmacie);
}
Loading