public function findBySelection()
 {
     if (isset($_POST["id_console"])) {
         $id_console = $_POST["id_console"];
         $data = T_E_JEUVIDEO_JEU::findBySelection($id_console);
         if ($data == null) {
             $m = new message();
             $m->setFlash("Aucun résultat pour cette recherche.", "warning");
         }
         $this->render("find", T_E_JEUVIDEO_JEU::findBySelection($id_console));
     } else {
         $this->render("find");
     }
 }
 public static function findBySelection($id_console)
 {
     $class = get_called_class();
     $table = strtolower($class);
     $idtable = substr($table, -3) . "_id";
     $list = array();
     foreach (T_E_JEUVIDEO_JEU::findAll() as $row) {
         if ($row->T_R_CONSOLE_CON->con_id == $id_console) {
             $game = new T_E_JEUVIDEO_JEU($row->jeu_id);
             foreach (T_E_PHOTO_PHO::findByGame($row->jeu_id) as $key => $value) {
                 $game->photo = $value->pho_url;
                 break;
             }
             $list[] = $game;
         }
     }
     return $list;
 }
 public function addvideo()
 {
     $m = new message();
     if (isset(parameters()["input"])) {
         if (preg_match('/youtube/', parameters()['input'])) {
             $video = new T_E_VIDEO_VID();
             $videos = $video->findByGame(parameters()['jeu']);
             if (count($videos) != 0) {
                 $m->setFlash("Il y a déjà une video pour ce jeu");
             } else {
                 preg_match('/[\\?\\&]v=([^\\?\\&]+)/', parameters()['input'], $matches);
                 $video->addVideo(parameters()['jeu'], 'https://www.youtube.com/embed/' . $matches[1] . '?rel=0&showinfo=0&color=white&iv_load_policy=3');
             }
         } else {
             $m->setFlash("Ce n'est pas une url de youtube");
         }
     }
     $this->render("addvideo", T_E_JEUVIDEO_JEU::findAll());
 }