CodeIgniter
This commit is contained in:
parent
5ead461cc2
commit
41021293cf
BIN
CM/MVC-Framework.pdf
Normal file
BIN
CM/MVC-Framework.pdf
Normal file
Binary file not shown.
BIN
TP/TPCodeIgniter/TPCI.pdf
Normal file
BIN
TP/TPCodeIgniter/TPCI.pdf
Normal file
Binary file not shown.
18
TP/TPCodeIgniter/src/controllers/Films.php
Normal file
18
TP/TPCodeIgniter/src/controllers/Films.php
Normal 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();
|
||||
}
|
||||
}
|
19
TP/TPCodeIgniter/src/models/Model_site.php
Normal file
19
TP/TPCodeIgniter/src/models/Model_site.php
Normal 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();
|
||||
}
|
||||
}
|
27
TP/TPCodeIgniter/src/views/films.php
Normal file
27
TP/TPCodeIgniter/src/views/films.php
Normal 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>";
|
||||
|
||||
}
|
||||
|
||||
?>
|
3
TP/TPCodeIgniter/src/views/footer.php
Normal file
3
TP/TPCodeIgniter/src/views/footer.php
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
</body>
|
||||
</html>
|
12
TP/TPCodeIgniter/src/views/header.php
Normal file
12
TP/TPCodeIgniter/src/views/header.php
Normal 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>
|
Loading…
Reference in New Issue
Block a user