mirror of
https://grond.iut-fbleau.fr/stiti/SAE_2.02
synced 2024-11-09 13:01:42 +01:00
Tests
This commit is contained in:
parent
3664e46686
commit
31abb723a9
@ -6,8 +6,10 @@ class Albums extends CI_Controller {
|
|||||||
public function __construct(){
|
public function __construct(){
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->load->model('model_music');
|
$this->load->model('model_music');
|
||||||
|
$this->load->model('model_playlist');
|
||||||
$this->load->helper('url');
|
$this->load->helper('url');
|
||||||
$this->load->helper('html');
|
$this->load->helper('html');
|
||||||
|
$this->load->library('session');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index($page = 1){
|
public function index($page = 1){
|
||||||
@ -44,13 +46,23 @@ class Albums extends CI_Controller {
|
|||||||
$album = $this->model_music->get_album_by_id($id);
|
$album = $this->model_music->get_album_by_id($id);
|
||||||
$data['album'] = $album;
|
$data['album'] = $album;
|
||||||
|
|
||||||
$data['title'] = $album->name." - Details";
|
// Récupérer les playlists de l'utilisateur connecté
|
||||||
$data['css']='assets/css/album_view';
|
$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('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');
|
$this->load->view('layout/footer_dark');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -9,7 +9,7 @@ class Playlists extends CI_Controller {
|
|||||||
$this->load->model('Model_music');
|
$this->load->model('Model_music');
|
||||||
$this->load->helper('url');
|
$this->load->helper('url');
|
||||||
$this->load->helper('html');
|
$this->load->helper('html');
|
||||||
$this->load->library('session'); // Charger la bibliothèque de sessions
|
$this->load->library('session');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index(){
|
public function index(){
|
||||||
@ -269,6 +269,10 @@ class Playlists extends CI_Controller {
|
|||||||
// Charger les chansons de la playlist spécifique
|
// Charger les chansons de la playlist spécifique
|
||||||
$data['songs'] = $this->Model_playlist->get_songs_by_playlist($playlist_id);
|
$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['title'] = "Détails de la Playlist - Onzeur";
|
||||||
$data['css'] = "assets/css/playlist_view";
|
$data['css'] = "assets/css/playlist_view";
|
||||||
|
|
||||||
@ -276,7 +280,7 @@ class Playlists extends CI_Controller {
|
|||||||
$this->load->view('layout/header_dark', $data);
|
$this->load->view('layout/header_dark', $data);
|
||||||
$this->load->view('playlist_view', $data);
|
$this->load->view('playlist_view', $data);
|
||||||
$this->load->view('layout/footer_dark');
|
$this->load->view('layout/footer_dark');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function verify_playlist_accessibility($playlist_id) {
|
private function verify_playlist_accessibility($playlist_id) {
|
||||||
// Récupérer l'ID de l'utilisateur connecté
|
// Récupérer l'ID de l'utilisateur connecté
|
||||||
|
@ -471,11 +471,8 @@ class Utilisateur extends CI_Controller {
|
|||||||
$this->load->view('layout/footer_dark');
|
$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');
|
redirect('utilisateur/connexion');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,8 +484,25 @@ class Utilisateur extends CI_Controller {
|
|||||||
$this->dashboard();
|
$this->dashboard();
|
||||||
} else {
|
} else {
|
||||||
$user_id = $this->session->userdata('user_id');
|
$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(
|
$data = array(
|
||||||
'email' => $this->input->post('email'),
|
'email' => $new_email,
|
||||||
'nom' => $this->input->post('nom'),
|
'nom' => $this->input->post('nom'),
|
||||||
'prenom' => $this->input->post('prenom')
|
'prenom' => $this->input->post('prenom')
|
||||||
);
|
);
|
||||||
@ -503,15 +517,16 @@ class Utilisateur extends CI_Controller {
|
|||||||
// Récupérer à nouveau les données d'avis pour cet utilisateur
|
// Récupérer à nouveau les données d'avis pour cet utilisateur
|
||||||
$data['user'] = $this->Utilisateur_model->get_user_by_id($user_id);
|
$data['user'] = $this->Utilisateur_model->get_user_by_id($user_id);
|
||||||
$data['avis'] = $this->Utilisateur_model->get_avis_by_user($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);
|
$data['title'] = "Dashboard - Onzeur";
|
||||||
|
$data['css'] = "assets/css/dashboard";
|
||||||
|
|
||||||
|
$this->load->view('layout/header_dark', $data);
|
||||||
$this->load->view('dashboard', $data);
|
$this->load->view('dashboard', $data);
|
||||||
$this->load->view('layout/footer_dark');
|
$this->load->view('layout/footer_dark');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function modifier_mot_de_passe() {
|
public function modifier_mot_de_passe() {
|
||||||
if (!$this->session->userdata('user_id')) {
|
if (!$this->session->userdata('user_id')) {
|
||||||
|
@ -150,8 +150,6 @@ class Model_music extends CI_Model {
|
|||||||
return $query->result();
|
return $query->result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function get_all_songs() {
|
public function get_all_songs() {
|
||||||
return $this->db->get('song')->result();
|
return $this->db->get('song')->result();
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,12 @@ class Utilisateur_model extends CI_Model {
|
|||||||
return $query->row();
|
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) {
|
public function get_user_by_id($id) {
|
||||||
$query = $this->db->get_where('utilisateur', array('id' => $id));
|
$query = $this->db->get_where('utilisateur', array('id' => $id));
|
||||||
return $query->row();
|
return $query->row();
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<video width="100%" controls>
|
<video width="100%" controls>
|
||||||
<source src="<?php echo base_url('assets/mp4/videoOnzeur.mp4'); ?>" type="video/mp4">
|
<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>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -82,4 +82,4 @@
|
|||||||
<a href="<?php echo site_url('playlists/add_artist/' . $playlist->id); ?>" class="btn btn-primary">Ajouter les musiques d'un artiste</a>
|
<a href="<?php echo site_url('playlists/add_artist/' . $playlist->id); ?>" class="btn btn-primary">Ajouter les musiques d'un artiste</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<a href="<?php echo site_url('playlists'); ?>" class="btn btn-secondary">Retour</a>
|
<a href="<?php echo site_url('playlists'); ?>" class="btn btn-secondary">Retour</a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user