Add files via upload

This commit is contained in:
Fernando Méndez 2021-05-02 16:01:05 +02:00 committed by GitHub
parent 3d144738c8
commit d85e933c73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 186 additions and 110 deletions

View File

@ -116,7 +116,7 @@ button:hover, .button:hover {
} }
/* Responsive layout */ /* Responsive layout */
@media (max-width: 850px) { @media (max-width: 850px) {
.menu nav li:hover>ul{ .header.sub .menu nav li:hover>ul{
display: block; display: block;
position: relative; position: relative;
top: 5px; top: 5px;

View File

@ -216,6 +216,149 @@
} }
} }
//Print Films Cards:
function print_fimls(){
//List of the tittles of the movies:
require_once(__DIR__.'/common/film_dao.php');
$prefix= $this->get_prefix();
$films = new Film_DAO("complucine");
$films_array = $films->allFilmData();
$ids = array();
$tittles = array();
$descriptions = array();
$times = array();
$languages = array();
foreach($films_array as $key => $value){
$ids[$key] = $value->getId();
$tittles[$key] = $value->getTittle();
$descriptions[$key] = $value->getDescription();
$times[$key] = $value->getDuration();
$languages[$key] = $value->getLanguage();
}
switch($this->page){
case "Cartelera":
for($i = 0; $i < count($films_array); $i++){
$tittle = str_replace('_', ' ', $tittles[$i]);
if($i%2 === 0){
if($i != 0) echo "</div>
";
echo "<div class='column side'>
";
}
else{
if($i != 0) echo "</div>
";
echo "<div class='column middle'>
";
}
echo "<section id='".$tittles[$i]."'>
<div class='zoom'>
<div class='code showtimes'>
<div class='image'><img src='".$prefix."img/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div>
<h2>".$tittle."</h2>
<hr />
<div class='blockquote'>
<p>".$descriptions[$i]."</p>
</div>
<p>Duración: ".$times[$i]." minutos</p>
</div>
</div>
</section>
";
}
echo "</div>\n";
break;
case "Panel de Administrador":
echo"<div class='column'>";
for($i = 0; $i < count($films_array); $i++){
$tittle = str_replace('_', ' ', $tittles[$i]);
if($i%2 === 0){
if($i != 0) echo "</div>
";
echo "<div class='column side'>
";
}
else{
if($i != 0) echo "</div>
";
echo "<div class='column middle'>
";
}
echo "<section id='".$tittles[$i]."'>
<div class='zoom'>
<div class='code showtimes'>
<div class='image'><img src='".$prefix."img/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div>
<h2>".$tittle."</h2>
<hr />
<form method='post' action='./index.php?state=uf'>
<input name='id' type='hidden' value='".$ids[$i]."'>
<input name='tittle' type='hidden' value='".$tittles[$i]."'>
<input name='duration' type='hidden' value='".$times[$i]."'>
<input name='language' type='hidden' value='".$languages[$i]."'>
<input name='description' type='hidden' value='".$descriptions[$i]."'>
<input type='submit' id='submit' value='Editar' name='edit_film' class='primary' />
</form>
<form method='post' action='./index.php?state=uf'>
<input name='id' type='hidden' value='".$ids[$i]."'>
<input name='tittle' type='hidden' value='".$tittles[$i]."'>
<input name='duration' type='hidden' value='".$times[$i]."'>
<input name='language' type='hidden' value='".$languages[$i]."'>
<input name='description' type='hidden' value='".$descriptions[$i]."'>
<input type='submit' id='submit' value='Eliminar' name='delete_film' class='primary' />
</form>
</div>
</div>
</section>
";
}
echo "</div>
</div>\n";
break;
default:
echo'<div class="column left">
<div class="galery">
<h1>Últimos Estrenos</h1><hr />';
$count = 0;
for($i = count($tittles)-4; $i < count($tittles); $i++){
if($count%2===0){
if($count != 0) echo "
</div>";
echo "
<div class='fila'>";
}
echo "
<div class='zoom'>
<div class='columna'>
<a href='".$prefix."showtimes/#".$tittles[$i]."'><div class='image'><img src='img/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div></a>
</div>
</div>";
$count++;
}
echo "
</div>
</div>
</div>
<div class='column right'>
<div class='galery'>";
$count = rand(0, count($tittles)-1);
$title = str_replace('_', ' ', $tittles[$count]);
echo "
<h1>{$title}</h1><hr />
<div class='zoom'>
<a href='".$prefix."showtimes/#".$tittles[$count]."'><div class='image main'><img src='img/".$tittles[$count].".jpg' alt='".$tittles[$count]."' /></div></a>
</div>
</div>
</div>\n";
break;
}
}
//Print session MSG: //Print session MSG:
function print_msg() { function print_msg() {
if(isset($_SESSION['message'])){ if(isset($_SESSION['message'])){

View File

@ -3,14 +3,7 @@
//General Config File: //General Config File:
require_once(__DIR__.'/assets/php/config.php'); require_once(__DIR__.'/assets/php/config.php');
//List of the tittles of the movies:
require_once($prefix.'assets/php/common/film_dao.php');
$films = new Film_DAO("complucine");
$films_array = $films->allFilmData();
$tittles = array();
foreach($films_array as $key => $value){
$tittles[$key] = $value->getTittle();
}
?> ?>
<!-- <!--
Práctica 2 - Sistemas Web | Grupo D Práctica 2 - Sistemas Web | Grupo D
@ -45,42 +38,9 @@
<section id="cartelera"> <section id="cartelera">
<div class="row"> <div class="row">
<div class="code"> <div class="code">
<div class="column left"> <?php
<div class="galery"> $template->print_fimls();
<h1>Últimos Estrenos</h1><hr /> ?>
<?php
$count = 0;
for($i = count($tittles)-4; $i < count($tittles); $i++){
if($count%2===0){
if($count != 0) echo "</div>
";
echo "<div class='fila'>
";
}
echo "<div class='zoom'>
<div class='columna'>
<a href='".$prefix."showtimes/#".$tittles[$i]."'><div class='image'><img src='img/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div></a>
</div>
</div>
";
$count++;
}
echo "</div>\n";
?>
</div>
</div>
<div class="column right">
<div class="galery">
<?php
$count = rand(0, count($tittles)-1);
$title = str_replace('_', ' ', $tittles[$count]);
echo "<h1>{$title}</h1><hr />
<div class='zoom'>
<a href='".$prefix."showtimes/#".$tittles[$count]."'><div class='image main'><img src='img/".$tittles[$count].".jpg' alt='".$tittles[$count]."' /></div></a>
</div>\n";
?>
</div>
</div>
</div> </div>
</div> </div>
</section> </section>

View File

@ -47,7 +47,7 @@
<div class="row"> <div class="row">
<?php <?php
$template->print_msg(); $template->print_msg();
$panel->showPanel(); $panel->showPanel($template);
?> ?>
</div> </div>
</div> </div>

View File

@ -1,8 +1,5 @@
<?php <?php
//General Config File:
include_once('../assets/php/config.php');
include_once('../assets/php/common/film_dto.php'); include_once('../assets/php/common/film_dto.php');
include_once(__DIR__.'/includes/formFilm.php'); include_once(__DIR__.'/includes/formFilm.php');
/*$f1 = new FilmDTO(1000,"Los vengadores",183,"español",""); /*$f1 = new FilmDTO(1000,"Los vengadores",183,"español","");
@ -16,8 +13,9 @@
$film = new FormFilm(); $film = new FormFilm();
$film->processesForm(null, null, null, null, null, "show"); $film->processesForm(null, null, null, null, null, "show");
/*
function drawFilms($films){ function drawFilms($films){
echo "<div class='column left'> echo "<div class='column'>
<table class='alt'> <table class='alt'>
<thead> <thead>
<tr> <tr>
@ -63,8 +61,11 @@
</table> </table>
</div>'; </div>';
} }
*/
function addFilm(){ function addFilm(){
echo'<div class="column right"> echo'<div class="column side"></div>
<div class="column middle">
<h2>Añadir pelicula</h2> <h2>Añadir pelicula</h2>
<form method="post" action="update_film.php"> <form method="post" action="update_film.php">
<div class="row"> <div class="row">
@ -89,9 +90,11 @@
</div> </div>
</div> </div>
</form> </form>
</div>'; </div>
<div class="column side"></div>';
} }
drawFilms($film->getReply()); //addFilm();
addFilm(); //drawFilms($film->getReply());
?> ?>

View File

@ -1,18 +1,22 @@
<?php <?php
class Panel { class Panel {
public $state; private $state;
public $login; private $login;
function __construct($panel, $login){ function __construct($panel, $login){
$this->state = $panel; $this->state = $panel;
$this->login= $login; $this->login= $login;
} }
function showPanel() { function showPanel($template) {
if($this->login){ if($this->login){
switch($this->state) { switch($this->state) {
case 'uf': require_once('updateFilm.php');break; case 'uf': require_once('updateFilm.php'); break;
case 'mc': /*require_once('manage_cinemas.php')*/;echo"<h1>En construcción</h1>"; break; case 'mc': /*require_once('manage_cinemas.php')*/;echo"<h1>En construcción</h1>"; break;
case 'mf': require_once('manage_films.php'); break; case 'mf': require_once('manage_films.php');
addFilm();
$template->print_fimls();
break;
case 'md': /*require_once('manage_discounts.php')*/;echo"<h1>En construcción</h1>"; break; case 'md': /*require_once('manage_discounts.php')*/;echo"<h1>En construcción</h1>"; break;
case 'mm': /*require_once('manage_managers.php')*/;echo"<h1>En construcción</h1>"; break; case 'mm': /*require_once('manage_managers.php')*/;echo"<h1>En construcción</h1>"; break;
case 'un': echo"<h1>En construcción</h1>"; break; case 'un': echo"<h1>En construcción</h1>"; break;
@ -25,6 +29,10 @@
echo "<h1>NO TIENES PERMISOS DE ADMINISTRADOR</h1>"; echo "<h1>NO TIENES PERMISOS DE ADMINISTRADOR</h1>";
} }
} }
function getTemplate(){
return $this->template;
}
} }
?> ?>

View File

@ -1,9 +1,10 @@
<?php <?php
require_once($prefix.'assets/php/dao.php'); require_once('../assets/php/dao.php');
include_once('./includes/formFilm.php'); include_once('./includes/formFilm.php');
if(isset($_POST['edit_film'])) { if(isset($_POST['edit_film'])) {
echo'<div class="column size"> echo'<div class="column side"></div>
<div class="column middle">
<h2>Editar pelicula</h2> <h2>Editar pelicula</h2>
<form method="post" action="update_film.php"> <form method="post" action="update_film.php">
<div class="row"> <div class="row">
@ -29,10 +30,12 @@
</div> </div>
</div> </div>
</form> </form>
</div>'; </div>
<div class="column side"></div>';
} }
else if(isset($_POST['delete_film'])) { else if(isset($_POST['delete_film'])) {
echo'<div class="column size"> echo'<div class="column side"></div>
<div class="column middle">
<h2>Editar pelicula</h2> <h2>Editar pelicula</h2>
<form method="post" action="update_film.php"> <form method="post" action="update_film.php">
<div class="row"> <div class="row">
@ -51,7 +54,8 @@
</div> </div>
</div> </div>
</form> </form>
</div>'; </div>
<div class="column side"></div>';
} }

View File

@ -2,19 +2,6 @@
<?php <?php
//General Config File: //General Config File:
require_once('../assets/php/config.php'); require_once('../assets/php/config.php');
//List of the tittles and descriptions of the movies:
require_once($prefix.'assets/php/common/film_dao.php');
$loadFilms = new Film_DAO("complucine");
$films = $loadFilms->allFilmData();
$titles = array();
$descriptions = array();
$times = array();
foreach($films as $key => $value){
$titles[$key] = $value->getTittle();
$descriptions[$key] = $value->getDescription();
$times[$key] = $value->getDuration();
}
?> ?>
<!-- <!--
Práctica 2 - Sistemas Web | Grupo D Práctica 2 - Sistemas Web | Grupo D
@ -39,38 +26,9 @@
<!-- Films --> <!-- Films -->
<section id="films_billboard"> <section id="films_billboard">
<div class='row'> <div class='row'>
<?php <?php
for($i = 0; $i < count($films); $i++){ $template->print_fimls();
$title = str_replace('_', ' ', $titles[$i]); ?>
if($i%2 === 0){
if($i != 0) echo "</div>
";
echo "<div class='column side'>
";
}
else{
if($i != 0) echo "</div>
";
echo "<div class='column middle'>
";
}
echo "<section id='".$titles[$i]."'>
<div class='zoom'>
<div class='code showtimes'>
<div class='image'><img src='".$prefix."img/".$titles[$i].".jpg' alt='".$titles[$i]."' /></div>
<h2>".$title."</h2>
<hr />
<div class='blockquote'>
<p>".$descriptions[$i]."</p>
</div>
<p>Duración: ".$times[$i]." minutos</p>
</div>
</div>
</section>
";
}
echo "</div>\n";
?>
</div> </div>
</section> </section>