corrections de toute les vue et maj du journal

This commit is contained in:
2026-06-10 22:01:21 +02:00
parent 2b2445e704
commit dbbc0c9401
14 changed files with 191 additions and 187 deletions
@@ -8,27 +8,20 @@ class Category_model extends CI_Model {
$this->load->database();
}
/**
* Récupère toutes les catégories de la base de données
*/
public function get_all() {
$query = $this->db->get('category');
return $query->result_array();
}
public function get_by_game($game_id) {
$this->db->select('category.*');
$this->db->from('category');
$this->db->join('game_category', 'game_category.categoryId = category.categoryId');
$this->db->where('game_category.gameId', $game_id);
$query = $this->db->get();
return $query->result_array();
}
public function get_by_game($game_id) {
$this->db->select('category.*');
$this->db->from('category');
$this->db->join('game_category', 'game_category.categoryId = category.id');
$this->db->where('game_category.gameId', $game_id);
$query = $this->db->get();
return $query->result_array();
}
}
@@ -1,66 +1,52 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Game_model extends CI_Model {
public function search_by_title($keyword) {
$this->db->select('*');
$this->db->from('game');
$this->db->like('name', $keyword);
$query = $this->db->get('game');
return $query->result();
$query = $this->db->get();
return $query->result_array();
}
}
/**
* Récupère les jeux appartenant à une catégorie spécifique
*/
public function get_by_category($category_id) {
$this->db->select('game.*');
$this->db->from('game');
$this->db->join('game_category', 'game_category.gameId = game.gameId');
$this->db->join('game_category', 'game_category.gameId = game.id'); // C'était ICI l'erreur !
$this->db->where('game_category.categoryId', $category_id);
$query = $this->db->get();
return $query->result_array();
}
/**
* Récupère les jeux appartenant à un genre spécifique
*/
public function get_by_genre($genre_id) {
$this->db->select('game.*');
$this->db->from('game');
$this->db->join('game_genre', 'game_genre.gameId = game.gameId');
$this->db->join('game_genre', 'game_genre.gameId = game.id'); // Et ICI !
$this->db->where('game_genre.genreId', $genre_id);
$query = $this->db->get();
return $query->result_array();
}
/**
* Récupère les détails complets d'un jeu (avec développeur et poster)
*/
public function get_by_id($game_id) {
$this->db->select('game.*, developer.name as developer_name, poster.url as poster_url');
$this->db->from('game');
$this->db->join('developer', 'developer.developerId = game.developerId', 'left');
$this->db->join('poster', 'poster.posterId = game.posterId', 'left');
$this->db->where('game.gameId', $game_id);
$query = $this->db->get();
return $query->row_array();
}
public function get_by_id($game_id) {
$this->db->select('game.*, developer.name as developer_name, poster.jpeg as poster_url');
$this->db->from('game');
$this->db->join('developer', 'developer.id = game.developerId', 'left');
$this->db->join('poster', 'poster.id = game.posterId', 'left');
$this->db->where('game.id', $game_id);
$query = $this->db->get();
return $query->row_array();
}
public function ajouter_jeu($titre, $annee, $description, $prix) {
$donnees = array(
@@ -73,11 +59,11 @@ class Game_model extends CI_Model {
}
public function supprimer_jeu($id) {
return $this->db->delete('game', array('gameId' => $id));
return $this->db->delete('game', array('id' => $id));
}
public function get_jeu($id) {
$leJeu = $this->db->get_where('game', array('gameId' => $id));
$leJeu = $this->db->get_where('game', array('id' => $id));
return $leJeu->row_array();
}
@@ -89,10 +75,11 @@ class Game_model extends CI_Model {
'price' => empty($prix) ? NULL : $prix
);
$this->db->where('gameId', $id);
$this->db->where('id', $id);
return $this->db->update('game', $donnees);
}
public function get_tous_les_jeux($critere_tri = 'id') {
$tris_autorises = array('id', 'name', 'releaseYear', 'price');
@@ -101,23 +88,12 @@ class Game_model extends CI_Model {
}
$this->db->order_by($critere_tri, 'ASC');
$query = $this->db->get('game');
return $query->result_array();
}
public function search_by_title($keyword) {
$this->db->select('*');
$this->db->from('game');
$this->db->like('title', $keyword);
$query = $this->db->get();
return $query->result_array();
public function get_all_games() {
return $this->get_tous_les_jeux();
}
}
}
@@ -17,7 +17,7 @@ class Genre_model extends CI_Model {
$this->db->select('genre.*');
$this->db->from('genre');
$this->db->join('game_genre', 'game_genre.genreId = genre.genreId');
$this->db->join('game_genre', 'game_genre.genreId = genre.id');
$this->db->where('game_genre.gameId', $game_id);