Created
June 21, 2013 13:27
-
-
Save rakotomandimby/5831113 to your computer and use it in GitHub Desktop.
Ennoncé exo PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require('Models/ModelPassage.php'); | |
require('Views/ViewPassage.php'); | |
$recherche=$_REQUEST['recherche']; | |
if( ! isset($_REQUEST['recherche'])) | |
{ | |
include('./formulaire.html'); | |
} | |
else | |
{ | |
$passage=new ModelPassage($recherche); | |
ViewPassage::html($passage); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ModelPassage | |
{ | |
public function __construct($recherche) | |
{ | |
$this->recherche=$recherche; | |
$this->bdd_en=new PDO('mysql:host=localhost; dbname=bible','dev','dev'); | |
$this->requete_existence_livre_en=$this->bdd_en->prepare('SELECT * FROM kjv WHERE bname = :chercher'); | |
$this->bdd_fr=new PDO('mysql:host=localhost; dbname=bible_fr','dev','dev'); | |
$this->requete_existence_livre_fr=$this->bdd_fr->prepare('SELECT * FROM ref_bible WHERE livre = :chercher'); | |
} | |
public function getListeDesVersetsFromRecherche() | |
{ | |
// | |
// | |
$this->liste_des_versets_fr= | |
} | |
public function checkBook() | |
{ | |
$result_en=$this->requete_existence_livre_en->execute(array('chercher' => $this->recherche)); | |
$result_fr=$this->requete_existence_livre_fr->execute(array('chercher' => $this->recherche)); | |
if ($this->requete_existence_livre_en->fetch() || $this->requete_existence_livre_fr->fetch()) | |
{ return true; } | |
else | |
{ return false; } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ViewPassage | |
{ | |
public static function html($passage) | |
{ | |
echo '<!DOCTYPE html> '; | |
echo '<html> '; | |
echo ' <head> '; | |
echo ' <title> Passage Biblique</title> '; | |
echo ' <head> '; | |
echo ' <body> '; | |
echo ' <form action="index.php" method="post"> '; | |
echo ' <label for="search"> Recherche </label> '; | |
echo ' <label for="text"> '; | |
echo ' <input type="text" name="recherche" /> '; | |
echo ' </label> '; | |
echo ' <label for="submit"> '; | |
echo ' <input type="submit" value="OK" /> '; | |
echo ' </label> '; | |
echo ' </form> '; | |
foreach($passage->liste_des_versets_fr as $f){$f->numero . $f->texte}; | |
foreach($passage->liste_des_versets_en as $e){}; | |
echo ' </body> '; | |
echo '</html> '; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment