Add files via upload

This commit is contained in:
Fernando Méndez 2021-04-13 17:22:00 +02:00 committed by GitHub
parent 7e1eb2b977
commit 909f896acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 81 additions and 14 deletions

View File

@ -0,0 +1,68 @@
<?php
require_once($prefix.'panel_admin/includes/film_dao.php');
// ESTA CLASE SE HA CREADO PARA PODER INSTANCIAR ATRIBUTOS DE LA TABLA PELÍCULAS,
// SEGÚN VAYAN SIENDO RELEVANTES PARA MOSTRAR EN FUNCIÓN DE LA PÁGINA QUE LLAME A ESTA CLASE.
// NO TODAS LAS PÁGINAS DEL CINE NECESITAN CARGAR TODOS LOS ATRIBUTOS POR COMPLETO DE LA TABLA PELÍCULAS
// Y HEMOS CREIDO, QUE EN ESE CASO, MÁS EFICIENTE HACERLO A PETICIÓN.
class loadFilms {
//Atributes:
private $films; //Array of movie titles.
private $descriptions; //Array of movie descriptions.
//Constructor:
public function __construct() {
$this->load();
}
//Methods:
//Returns an array with the titles of the available movies.
public function getFilms(){
return $this->films;
}
//Returns an array with the descriptions of the available movies.
public function getDescription(){
$this->loadDescriptions();
return $this->descriptions;
}
//Load the list of tittles of the movies.
private function load(){
$this->films = array();
$tittles = new Film_DAO("complucine");
$reply = $tittles->tittleFilmData();
if($reply && $reply->num_rows>0){
$i = 0;
while ($row = $reply->fetch_assoc()){
foreach($row as $key => $value){
$this->films[$i] = $value;
}
$i++;
}
}
$reply->free();
}
private function loadDescriptions(){
$this->descriptions = array();
$desc = new Film_DAO("complucine");
$reply = $desc->descriptionFilmData();
if($reply && $reply->num_rows>0){
$i = 0;
while ($row = $reply->fetch_assoc()){
foreach($row as $key => $value){
$this->descriptions[$i] = $value;
}
$i++;
}
}
$reply->free();
}
}
?>

View File

@ -2,23 +2,17 @@
<?php
session_start();
//HTML template:
require_once('../assets/php/template.php');
$template = new Template();
$prefix = $template->get_prefix();
// BORRAR CUANDO TENGAMOS BBDD:
$films = array(
"iron_man",
"iron_man_2",
"iron_man_3",
"capitan_america_el_primer_vengador",
"capitan_america_el_soldado_de_invierno",
"capitan_america_civil_war",
"marvel_avengers",
"avengers_age_of_ultron",
"avengers_inifinity_war",
"avengers_end_game"
);
//List of the tittles and descriptions of the movies:
require_once('includes/loadFilms.php');
$loadFilms = new loadFilms();
$films = $loadFilms->getFilms();
$descriptions = $loadFilms->getDescription();
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
@ -46,6 +40,7 @@
<?php
for($i = 0; $i < count($films); $i++){
$title = str_replace('_', ' ', $films[$i]);
$description = $descriptions[$i];
if($i%2 === 0){
if($i != 0) echo "</div>
";
@ -60,9 +55,13 @@
}
echo "<section id='".$films[$i]."'>
<div class='zoom'>
<div class='code'>
<div class='code showtimes'>
<div class='image'><img src='".$prefix."img/".$films[$i].".jpg' alt='".$films[$i]."' /></div>
<h2>".$title."</h2>
<hr />
<div class='blockquote'>
<p>".$description."</p>
</div>
</div>
</div>
</section>