mirror of
https://grond.iut-fbleau.fr/stiti/SAE_2.02
synced 2024-12-27 01:12:18 +01:00
Tests
This commit is contained in:
parent
3664e46686
commit
31abb723a9
@ -6,8 +6,10 @@ class Albums extends CI_Controller {
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('model_music');
|
||||
$this->load->model('model_playlist');
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('html');
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
public function index($page = 1){
|
||||
@ -44,11 +46,21 @@ class Albums extends CI_Controller {
|
||||
$album = $this->model_music->get_album_by_id($id);
|
||||
$data['album'] = $album;
|
||||
|
||||
$data['title'] = $album->name." - Details";
|
||||
$data['css']='assets/css/album_view';
|
||||
// Récupérer les playlists de l'utilisateur connecté
|
||||
$data['playlist'] = $this->model_playlist->get_user_playlists($this->session->userdata('user_id'));
|
||||
|
||||
// Définir le playlist_id si la playlist est définie
|
||||
if(isset($data['playlist']) && !empty($data['playlist'])){
|
||||
$data['playlist_id'] = isset($data['playlist']->id) ? $data['playlist']->id : null;
|
||||
} else {
|
||||
$data['playlist_id'] = null; // Gérer le cas où aucune playlist n'est disponible
|
||||
}
|
||||
|
||||
$data['title'] = $album->name . " - Details";
|
||||
$data['css'] = 'assets/css/album_view';
|
||||
|
||||
$this->load->view('layout/header_dark', $data);
|
||||
$this->load->view('album_view');
|
||||
$this->load->view('album_view', $data); // Transmettre les données à la vue
|
||||
$this->load->view('layout/footer_dark');
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ class Playlists extends CI_Controller {
|
||||
$this->load->model('Model_music');
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('html');
|
||||
$this->load->library('session'); // Charger la bibliothèque de sessions
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
public function index(){
|
||||
@ -269,6 +269,10 @@ class Playlists extends CI_Controller {
|
||||
// Charger les chansons de la playlist spécifique
|
||||
$data['songs'] = $this->Model_playlist->get_songs_by_playlist($playlist_id);
|
||||
|
||||
// Charger la liste des playlists de l'utilisateur
|
||||
$user_id = $this->session->userdata('user_id');
|
||||
$data['user_playlists'] = $this->Model_playlist->get_user_playlists($user_id);
|
||||
|
||||
$data['title'] = "Détails de la Playlist - Onzeur";
|
||||
$data['css'] = "assets/css/playlist_view";
|
||||
|
||||
|
@ -471,11 +471,8 @@ class Utilisateur extends CI_Controller {
|
||||
$this->load->view('layout/footer_dark');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function modifier(){
|
||||
if(!$this->session->userdata('user_id')){
|
||||
public function modifier() {
|
||||
if (!$this->session->userdata('user_id')) {
|
||||
redirect('utilisateur/connexion');
|
||||
}
|
||||
|
||||
@ -487,8 +484,25 @@ class Utilisateur extends CI_Controller {
|
||||
$this->dashboard();
|
||||
} else {
|
||||
$user_id = $this->session->userdata('user_id');
|
||||
$new_email = $this->input->post('email');
|
||||
|
||||
// Vérifie si l'email est déjà utilisé par un autre utilisateur
|
||||
$existing_user = $this->Utilisateur_model->get_user_by_email($new_email);
|
||||
if ($existing_user && $existing_user->id != $user_id) {
|
||||
$data['error'] = 'Cet email est déjà utilisé par un autre utilisateur.';
|
||||
$data['user'] = $this->Utilisateur_model->get_user_by_id($user_id);
|
||||
$data['avis'] = $this->Utilisateur_model->get_avis_by_user($user_id);
|
||||
$data['title'] = "Dashboard - Onzeur";
|
||||
$data['css'] = "assets/css/dashboard";
|
||||
|
||||
$this->load->view('layout/header_dark', $data);
|
||||
$this->load->view('dashboard', $data);
|
||||
$this->load->view('layout/footer_dark');
|
||||
return; // Sortie de la méthode
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'email' => $this->input->post('email'),
|
||||
'email' => $new_email,
|
||||
'nom' => $this->input->post('nom'),
|
||||
'prenom' => $this->input->post('prenom')
|
||||
);
|
||||
@ -504,15 +518,16 @@ class Utilisateur extends CI_Controller {
|
||||
$data['user'] = $this->Utilisateur_model->get_user_by_id($user_id);
|
||||
$data['avis'] = $this->Utilisateur_model->get_avis_by_user($user_id);
|
||||
|
||||
$data['title']="Dashboard - Onzeur";
|
||||
$data['css']="assets/css/dashboard";
|
||||
$data['title'] = "Dashboard - Onzeur";
|
||||
$data['css'] = "assets/css/dashboard";
|
||||
|
||||
$this->load->view('layout/header_dark',$data);
|
||||
$this->load->view('layout/header_dark', $data);
|
||||
$this->load->view('dashboard', $data);
|
||||
$this->load->view('layout/footer_dark');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function modifier_mot_de_passe() {
|
||||
if (!$this->session->userdata('user_id')) {
|
||||
redirect('utilisateur/connexion');
|
||||
|
@ -150,8 +150,6 @@ class Model_music extends CI_Model {
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function get_all_songs() {
|
||||
return $this->db->get('song')->result();
|
||||
}
|
||||
|
@ -17,6 +17,12 @@ class Utilisateur_model extends CI_Model {
|
||||
return $query->row();
|
||||
}
|
||||
|
||||
public function get_user_by_email($email) {
|
||||
$this->db->where('email', $email);
|
||||
$query = $this->db->get('utilisateur'); // Assurez-vous que 'utilisateurs' est le nom de votre table d'utilisateurs
|
||||
return $query->row(); // Retourne le premier résultat
|
||||
}
|
||||
|
||||
public function get_user_by_id($id) {
|
||||
$query = $this->db->get_where('utilisateur', array('id' => $id));
|
||||
return $query->row();
|
||||
|
@ -10,7 +10,7 @@
|
||||
<div>
|
||||
<video width="100%" controls>
|
||||
<source src="<?php echo base_url('assets/mp4/videoOnzeur.mp4'); ?>" type="video/mp4">
|
||||
Your browser does not support the video tag.
|
||||
Votre navigateur ne supporte pas les vidéos.
|
||||
</video>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user