CodeIgniter

This commit is contained in:
Luc Dartois 2023-06-05 10:18:12 +02:00
parent 5ead461cc2
commit 41021293cf
7 changed files with 79 additions and 0 deletions

BIN
CM/MVC-Framework.pdf Normal file

Binary file not shown.

BIN
TP/TPCodeIgniter/TPCI.pdf Normal file

Binary file not shown.

View File

@ -0,0 +1,18 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Films extends CI_Controller{
public function Controlefilms(){
$this->load->model('Model_site');
$films=$this->Model_site->get_films();
$data=array('films' => $films);
$this->load->view('header');
$this->load->view('films',$data);
$this->load->view('footer');
}
public function index()
{
$this->Controlefilms();
}
}

View File

@ -0,0 +1,19 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Model_site extends CI_MODEL {
public function __construct(){
$this->load->database();
}
public function get_films()
{
$res=$this->db->query("SELECT Film.titre, Film.annee, Film.idFilm,
Film.genre, Artiste.nom, Artiste.prenom
from Film INNER JOIN Artiste
where Film.idMes=Artiste.idArtiste
ORDER by Film.titre");
return $res->result_array();
}
}

View File

@ -0,0 +1,27 @@
<h2>Films</h2>
<table>
<thead>
<tr>
<th>Titre</th>
<th>Année</th>
<th>Genre</th>
<th>Réalisateur</th>
</tr>
</thead>
<tbody>
<?php
foreach($films as $film){
echo "
<tr>
<td><a href='/CI3/index.php/Fiche/view/{$film['idFilm']}'>
{$film['titre']}</a></td>
<td>{$film['annee']}</td>
<td>{$film['genre']}</td>
<td>{$film['prenom']} {$film['nom']}</td>
</tr>";
}
?>

View File

@ -0,0 +1,3 @@
</body>
</html>

View File

@ -0,0 +1,12 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<title>Films</title>
<link rel="stylesheet" href="http://www.iut-fbleau.fr/css/tacit.css">
<link rel="stylesheet" href="./css/style.css">
</head>
<body container>