2024-05-19 15:27:13 +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');
|
|
|
|
$this->load->helper('url');
|
|
|
|
}
|
2024-05-20 18:18:00 +02:00
|
|
|
|
2024-05-20 16:31:29 +02:00
|
|
|
public function index($page = 1){
|
2024-05-22 20:03:53 +02:00
|
|
|
$limit = 21; // Nombre d'albums max par page
|
2024-05-19 15:27:13 +02:00
|
|
|
$offset = ($page - 1) * $limit;
|
|
|
|
$albums = $this->model_music->getAlbums($limit, $offset);
|
2024-05-20 18:18:00 +02:00
|
|
|
|
2024-05-19 15:27:13 +02:00
|
|
|
$total_albums = $this->model_music->get_total_albums();
|
|
|
|
$data['total_pages'] = ceil($total_albums / $limit);
|
|
|
|
$data['current_page'] = $page;
|
2024-05-19 15:57:25 +02:00
|
|
|
$data['albums'] = $albums;
|
2024-05-20 18:18:00 +02:00
|
|
|
|
2024-05-19 15:27:13 +02:00
|
|
|
$this->load->view('layout/header_not_logged_dark');
|
|
|
|
$this->load->view('albums_list', $data);
|
|
|
|
$this->load->view('layout/footer_dark');
|
|
|
|
}
|
2024-05-20 18:18:00 +02:00
|
|
|
|
|
|
|
public function view($id){
|
|
|
|
$album = $this->model_music->get_album_by_id($id);
|
|
|
|
$data['album'] = $album;
|
|
|
|
|
|
|
|
$this->load->view('layout/header_not_logged_dark');
|
|
|
|
$this->load->view('album_view', $data);
|
|
|
|
$this->load->view('layout/footer_dark');
|
|
|
|
}
|
2024-05-20 21:59:37 +02:00
|
|
|
|
2024-05-19 15:27:13 +02:00
|
|
|
}
|
2024-05-20 18:18:00 +02:00
|
|
|
?>
|