Files
SAE_PHP_2024/CodeIgniter-3.1.13/application/controllers/Albums.php

47 lines
1.4 KiB
PHP
Raw Normal View History

2024-05-22 10:37:19 +02:00
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Albums extends CI_Controller {
public function __construct(){
parent::__construct();
$this->load->model('model_music');
2024-05-22 11:25:48 +02:00
$this->load->helper('html');
$this->load->helper('url');
2024-05-22 10:37:19 +02:00
}
public function index(){
2024-05-29 10:50:49 +02:00
if ($recherche=filter_input(INPUT_GET,'recherche') == false or $recherche=filter_input(INPUT_GET,'recherche') == null){
$albums = $this->model_music->getAlbums();
}else{
$recherche=filter_input(INPUT_GET,'recherche');
$albums = $this->model_music->getSearchAlbums($recherche);
}
2024-05-22 10:37:19 +02:00
$this->load->view('layout/header');
2024-05-29 10:50:49 +02:00
if ($albums == false){
//$page = preg_split('/[\/]/',$_SERVER['HTTP_REFERER']);
//$this->load->view('error',['page'=>$page[count($page)-1]]);
2024-05-29 10:50:49 +02:00
$albums = $this->model_music->getAlbums();
}
2024-05-22 10:37:19 +02:00
$this->load->view('albums_list',['albums'=>$albums]);
$this->load->view('layout/footer');
}
public function viewMusique($id) {
$albums = $this->model_music->getAlbumChoose($id);
if ($albums) {
$this->load->view('layout/header');
$this->load->view('albums_view', ['albums' => $albums]);
$this->load->view('layout/footer');
}
}
public function viewAlbum($Id) {
$albums = $this->model_music->getAlbumsByArtistId($Id);
$this->load->view('layout/header');
$this->load->view('albums_list', ['albums' => $albums]);
$this->load->view('layout/footer');
}
2024-05-22 10:37:19 +02:00
}