Example #1
0
 /**
  * Page d'accueil par défaut
  */
 public function home()
 {
     // Je crée un gestionnaire dans le CountryManager;
     $countryManager = new CountryManager();
     // SELECT * FROM `country` WHERE `name` = $country;
     // on va chercher les infos dans la table 'voyages' via le CountryManager
     $countryManager->setTable('voyages');
     // On cherche avec la méthode ramdomTravel des voyages au hasard
     $randomTravel = $countryManager->randomTravel();
     // print_r($randomTravel);
     // die();
     // On réaffiche notre page home en lui envoyant les données  des voyages choisit au hasard
     $this->show('default/home', ['randomTravel' => $randomTravel]);
 }
Example #2
0
 public function showSearchResult()
 {
     $countryName = trim(htmlentities($_POST['search']));
     // Je crée un gestionnaire
     $countryManager = new CountryManager();
     // SELECT * FROM `country` WHERE `name` = $country;
     $countryManager->setTable('country');
     $country = $countryManager->findByName($countryName);
     if ($country) {
         $this->show('destination/showCountry', ['country' => $country]);
     } else {
         $errors['countryNotFind'] = $countryName;
         $this->show('destination/showCountry', ['errors' => $errors]);
     }
 }