Add files via upload

This commit is contained in:
Fernando Méndez 2021-05-03 01:17:42 +02:00 committed by GitHub
parent 015b2ffcf8
commit 41000d9627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 283 additions and 297 deletions

View File

@ -218,7 +218,7 @@
//Print Films Cards: //Print Films Cards:
function print_fimls(){ function print_fimls(){
//List of the tittles of the movies: //List of the movies:
require_once(__DIR__.'/common/film_dao.php'); require_once(__DIR__.'/common/film_dao.php');
$prefix= $this->get_prefix(); $prefix= $this->get_prefix();
@ -360,7 +360,7 @@
} }
function print_cinemas(){ function print_cinemas(){
//List of the tittles of the movies: //List of the cinemas:
require_once(__DIR__.'/common/cinema_dao.php'); require_once(__DIR__.'/common/cinema_dao.php');
$prefix= $this->get_prefix(); $prefix= $this->get_prefix();
@ -381,48 +381,52 @@
switch($this->page){ switch($this->page){
case "Panel de Administrador": case "Panel de Administrador":
echo "<div class='column left'> echo "<div class='row'>
<table class='alt'> <div class='column side'></div>
<thead> <div class='column middle'>
<tr> <table class='alt'>
<th>Id</th> <thead>
<th>Nombre</th> <tr>
<th>Direccion</th> <th>Id</th>
<th>Telefono</th> <th>Nombre</th>
</tr> <th>Direccion</th>
</thead> <th>Telefono</th>
<tbody>"; </tr>
</thead>
<tbody>
";
for($i = 0; $i < count($cinemas); $i++){ for($i = 0; $i < count($cinemas); $i++){
echo ' echo '<tr>
<tr> <td>'. $ids[$i] .'</td>
<td>'. $ids[$i] .'</td> <td>'. $names[$i] .'</td>
<td>'. $names[$i] .'</td> <td>'. $directions[$i] .'</td>
<td>'. $directions[$i] .'</td> <td>'. $phones[$i] .'</td>
<td>'. $phones[$i] .'</td> <td>
<td> <form method="post" action="index.php?state=mc">
<form method="post" action="index.php?state=mc"> <input name="id" type="hidden" value="'.$ids[$i].'">
<input name="id" type="hidden" value="'.$ids[$i].'"> <input name="name" type="hidden" value="'.$names[$i].'">
<input name="name" type="hidden" value="'.$names[$i].'"> <input name="direction" type="hidden" value="'.$directions[$i].'">
<input name="direction" type="hidden" value="'.$directions[$i].'"> <input name="phone" type="hidden" value="'.$phones[$i].'">
<input name="phone" type="hidden" value="'.$phones[$i].'"> <input type="submit" id="submit" value="Editar" name="edit_cinema" class="primary" />
<input type="submit" id="submit" value="Editar" name="edit_cinema" class="primary" /> </form>
</form> </td>
</td> <td>
<td> <form method="post" action="index.php?state=mc">
<form method="post" action="index.php?state=mc"> <input name="id" type="hidden" value="'.$ids[$i].'">
<input name="id" type="hidden" value="'.$ids[$i].'"> <input name="name" type="hidden" value="'.$names[$i].'">
<input name="name" type="hidden" value="'.$names[$i].'"> <input name="direction" type="hidden" value="'.$directions[$i].'">
<input name="direction" type="hidden" value="'.$directions[$i].'"> <input name="phone" type="hidden" value="'.$phones[$i].'">
<input name="phone" type="hidden" value="'.$phones[$i].'"> <input type="submit" id="submit" value="Eliminar" name="delete_cinema" class="primary" />
<input type="submit" id="submit" value="Eliminar" name="delete_cinema" class="primary" /> </form>
</form> </td>
</td> </tr>
</tr>'; ';
} }
echo'<tbody> echo'</tbody>
</table> </table>
</div>'; </div>
echo "</div>\n"; <div class="column side"></div>
';
break; break;
} }

View File

@ -21,23 +21,55 @@ class FormCinema extends Form {
public function getReply() { public function getReply() {
if($this->correct){ if($this->correct){
if($this->option == "new"){ if($this->option == "new"){
$this->reply = "<h1> Operacion realizada con exito </h1><hr /> $this->reply = "<div class='row'>
<p> Se ha añadido el cine correctamente en la base de datos.</p> <div class='column side'></div>
<a href='../panel_admin/index.php?state=mc'><button>Cerrar Mensaje</button></a>"; <div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha añadido el cine correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mc'><button>Cerrar Mensaje</button></a>
</div>
<div class='column side'></div>
</div>
";
}else if($this->option == "edit"){ }else if($this->option == "edit"){
$this->reply = "<h1> Operacion realizada con exito </h1><hr /> $this->reply = "<div class='row'>
<p> Se ha editado el cine correctamente en la base de datos.</p> <div class='column side'></div>
<a href='../panel_admin/index.php?state=mc'><button>Cerrar Mensaje</button></a>"; <div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha editado el cine correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mc'><button>Cerrar Mensaje</button></a>
</div>
<div class='column side'></div>
</div>
";
}else if($this->option == "del"){ }else if($this->option == "del"){
$this->reply = "<h1> Operacion realizada con exito </h1><hr /> $this->reply = "<div class='row'>
<p> Se ha eliminado el cine correctamente en la base de datos.</p> <div class='column side'></div>
<a href='../panel_admin/index.php?state=mc'><button>Cerrar Mensaje</button></a>"; <div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha eliminado el cine correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mc'><button>Cerrar Mensaje</button></a>
</div>
<div class='column side'></div>
</div>
";
} }
} else { } else {
$this->reply = "<h1> ERROR </h1><hr /> $this->reply = "<div class='row'>
<p> Ha habido un error en la operacion. Revisa los datos introducidos</p> <div class='column side'></div>
<a href='../panel_admin/index.php?state=mc'><button>Panel Admin</button></a>"; <div class='column middle'>
<div class='code info'>
<h1> ERROR </h1><hr />
<p> Ha habido un error en la operacion. Revisa los datos introducidos</p>
<a href='../panel_admin/index.php?state=mc'><button>Panel Admin</button></a>
</div>
<div class='column side'></div>
</div>
";
} }
return $this->reply; return $this->reply;

View File

@ -21,23 +21,52 @@ class FormFilm extends Form {
public function getReply() { public function getReply() {
if($this->correct){ if($this->correct){
if($this->option == "new"){ if($this->option == "new"){
$this->reply = "<h1> Operacion realizada con exito </h1><hr /> $this->reply = "<div class='row'>
<p> Se ha añadido la pelicula correctamente en la base de datos.</p> <div class='column side'></div>
<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a>"; <div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha añadido la pelicula correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
";
}else if($this->option == "edit"){ }else if($this->option == "edit"){
$this->reply = "<h1> Operacion realizada con exito </h1><hr /> $this->reply = "<div class='row'>
<p> Se ha editado la pelicula correctamente en la base de datos.</p> <div class='column side'></div>
<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a>"; <div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha editado la pelicula correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
";
}else if($this->option == "del"){ }else if($this->option == "del"){
$this->reply = "<h1> Operacion realizada con exito </h1><hr /> $this->reply = "<div class='row'>
<p> Se ha eliminado la pelicula correctamente en la base de datos.</p> <div class='column side'></div>
<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a>"; <div class='column middle'>
<div class='code info'>
<h1> Operacion realizada con exito </h1><hr />
<p> Se ha eliminado la pelicula correctamente en la base de datos.</p>
<a href='../panel_admin/index.php?state=mf'><button>Cerrar Mensaje</button></a>
</div>
</div>
<div class='column side'></div>
</div>
";
} }
} else { } else {
$this->reply = "<h1> ERROR </h1><hr /> $this->reply = "<div class='column middle'>
<p> Ha habido un error en la operacion. Revisa los datos introducidos</p> <h1>ERROR</h1><hr />
<a href='../panel_admin/index.php?state=mf'><button>Panel Admin</button></a>"; <p> Ha habido un error en la operacion. Revisa los datos introducidos</p>
<a href='../panel_admin/index.php?state=mf'><button>Panel Admin</button></a>
</div>";
} }
return $this->reply; return $this->reply;

View File

@ -13,8 +13,6 @@
else { else {
$panel = new Panel('', $login); $panel = new Panel('', $login);
} }
// IMPORTANTE:
// VERIFICAR QUE ES ADMIN, SI NO, MOSTRAR MENSAJE DE "ERROR"
?> ?>
<!-- <!--
@ -45,10 +43,10 @@
?> ?>
<!-- Contents --> <!-- Contents -->
<div class="row"> <div class="row">
<?php <?php
$template->print_msg(); $template->print_msg();
$panel->showPanel($template); $panel->showPanel($template);
?> ?>
</div> </div>
</div> </div>
<!-- Footer --> <!-- Footer -->

View File

@ -9,122 +9,85 @@
// View functions // View functions
/*function drawCinema(){
$cine = new Cinema_DAO("complucine");
$cinemas = $cine->allCinemaData();
echo "<div class='column left'>
<table class='alt'>
<thead>
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Direccion</th>
<th>Telefono</th>
</tr>
</thead>
<tbody>";
foreach($cinemas as $f){
echo '
<tr>
<td>'. $f->getId() .'</td>
<td>'. $f->getName() .'</td>
<td>'. $f->getDirection() .'</td>
<td>'. $f->getPhone() .'</td>
<td>
<form method="post" action="index.php?state=mc">
<input name="id" type="hidden" value="'.$f->getId().'">
<input name="name" type="hidden" value="'.$f->getName().'">
<input name="direction" type="hidden" value="'.$f->getDirection().'">
<input name="phone" type="hidden" value="'.$f->getPhone().'">
<input type="submit" id="submit" value="Editar" name="edit_cinema" class="primary" />
</form>
</td>
<td>
<form method="post" action="index.php?state=mc">
<input name="id" type="hidden" value="'.$f->getId().'">
<input name="name" type="hidden" value="'.$f->getName().'">
<input name="direction" type="hidden" value="'.$f->getDirection().'">
<input name="phone" type="hidden" value="'.$f->getPhone().'">
<input type="submit" id="submit" value="Eliminar" name="delete_cinema" class="primary" />
</form>
</td>
</tr>';
}
echo'<tbody>
</table>
</div>';
}*/
function addCinema(){ function addCinema(){
echo'<div class="column"> echo' <div class="column side"></div>
<h2>Añadir cine</h2> <div class="column middle">
<form method="post" action="index.php?state=mc"> <h2>Añadir cine</h2>
<div class="row"> <form method="post" action="index.php?state=mc">
<fieldset id="cinema_form"> <fieldset id="cinema_form">
<legend>Datos del Cine</legend> <legend>Datos del Cine</legend>
<div> <div>
<input type="text" name="name" id="name" placeholder="Nombre" /> <input type="text" name="name" id="name" placeholder="Nombre" />
</div>
<div>
<input type="text" name="direction" id="direction" placeholder="Direccion" />
</div>
<div>
<input type="text" name="phone" id="phone" placeholder="Teléfono" />
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Añadir cine" name="add_cinema" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</form>
</div> </div>
<div> <div class="column side"></div>
<input type="text" name="direction" id="direction" placeholder="Direccion" /> </div>
</div> ';
<div>
<input type="text" name="phone" id="phone" placeholder="Teléfono" />
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Añadir cine" name="add_cinema" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</form>
</div>';
} }
function deleteCinema() { function deleteCinema() {
echo'<div class="column"> echo'<div class="column side"></div>
<h2>Editar cine</h2> <div class="column middle">
<form method="post" action="index.php?state=mc"> <h2>Eliminar cine</h2>
<div class="row"> <form method="post" action="index.php?state=mc">
<fieldset id="cinema_form"> <div class="row">
<legend>¿Estás seguro de que quieres eliminar este cine?</legend> <fieldset id="cinema_form">
<input type="hidden" name="id" value='.$_POST['id'].'/> <legend>¿Estás seguro de que quieres eliminar este cine?</legend>
<p>Id: '.$_POST['id'].' </p> <input type="hidden" name="id" value='.$_POST['id'].'/>
<p>Nombre: '.$_POST['name'].' </p> <p>Id: '.$_POST['id'].' </p>
<p>Dirección: '.$_POST['direction'].' </p> <p>Nombre: '.$_POST['name'].' </p>
<p>Teléfono: '.$_POST['phone'].' </p> <p>Dirección: '.$_POST['direction'].' </p>
</fieldset> <p>Teléfono: '.$_POST['phone'].' </p>
<div class="actions"> </fieldset>
<input type="submit" id="submit" value="Eliminar" name="confirm_delete_film" class="primary" /> <div class="actions">
<input type="submit" id="submit" value="Cancelar" name="cancel_delete_film" class="primary" /> <input type="submit" id="submit" value="Eliminar" name="confirm_delete_film" class="primary" />
<input type="submit" id="submit" value="Cancelar" name="cancel_delete_film" class="primary" />
</div>
</div> </div>
</div>
</form> </form>
</div>'; </div>
<div class="column side"></div>
';
} }
function editCinema() { function editCinema() {
echo'<div class="column"> echo'<div class="column side"></div>
<h2>Editar cine</h2> <div class="column middle">
<form method="post" action="index.php?state=mc"> <h2>Editar cine</h2>
<div class="row"> <form method="post" action="index.php?state=mc">
<fieldset id="cinema_form"> <div class="row">
<legend>Datos del cine</legend> <fieldset id="cinema_form">
<input type="hidden" name="id" value='.$_POST['id'].'/> <legend>Datos del cine</legend>
<div> <input type="hidden" name="id" value='.$_POST['id'].'/>
<input type="text" name="name" value="'.$_POST['name'].'" /> <div>
</div> <input type="text" name="name" value="'.$_POST['name'].'" />
<div> </div>
<input type="text" name="direction" value='.$_POST['direction'].' /> <div>
</div> <input type="text" name="direction" value='.$_POST['direction'].' />
<div> </div>
<input type="text" name="phone" value='.$_POST['phone'].' /> <div>
</div> <input type="text" name="phone" value='.$_POST['phone'].' />
</fieldset> </div>
<div class="actions"> </fieldset>
<input type="submit" id="submit" value="Editar" name="confirm_edit_cinema" class="primary" /> <div class="actions">
<input type="reset" id="reset" value="Borrar" /> <input type="submit" id="submit" value="Editar" name="confirm_edit_cinema" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div> </div>
</div>
</form> </form>
</div>'; </div>
<div class="column side"></div>
';
} }
// Logic Functions // Logic Functions

View File

@ -7,133 +7,93 @@
// View functions // View functions
/*function drawFilms(){
$film = new Film_DAO("complucine");
$films = $film->allFilmData();
echo "<div class='column left'>
<table class='alt'>
<thead>
<tr>
<th>Id</th>
<th>Título</th>
<th>Duracion</th>
<th>Idioma</th>
<th>Descripcion</th>
</tr>
</thead>
<tbody>";
foreach($films as $f){
echo '
<tr>
<td>'. $f->getId() .'</td>
<td>'. $f->getTittle() .'</td>
<td>'. $f->getDuration() .'</td>
<td>'. $f->getLanguage() .'</td>
<td>'. $f->getDescription().'</td>
<td>
<form method="post" action="index.php?state=mf">
<input name="id" type="hidden" value="'.$f->getId().'">
<input name="tittle" type="hidden" value="'.$f->getTittle().'">
<input name="duration" type="hidden" value="'.$f->getDuration().'">
<input name="language" type="hidden" value="'.$f->getLanguage().'">
<input name="description" type="hidden" value="'.$f->getDescription().'">
<input type="submit" id="submit" value="Editar" name="edit_film" class="primary" />
</form>
</td>
<td>
<form method="post" action="index.php?state=mf">
<input name="id" type="hidden" value="'.$f->getId().'">
<input name="tittle" type="hidden" value="'.$f->getTittle().'">
<input name="duration" type="hidden" value="'.$f->getDuration().'">
<input name="language" type="hidden" value="'.$f->getLanguage().'">
<input name="description" type="hidden" value="'.$f->getDescription().'">
<input type="submit" id="submit" value="Eliminar" name="delete_film" class="primary" />
</form>
</td>
</tr>';
}
echo'<tbody>
</table>
</div>';
}*/
function addFilm(){ function addFilm(){
echo'<div class="column"> echo'<div class="column side"></div>
<h2>Añadir pelicula</h2> <div class="column middle">
<form method="post" action="index.php?state=mf"> <h2>Añadir pelicula</h2>
<div class="row"> <form method="post" action="index.php?state=mf">
<fieldset id="film_form"> <div class="row">
<legend>Datos de pelicula</legend> <fieldset id="film_form">
<div> <legend>Datos de pelicula</legend>
<input type="text" name="tittle" id="tittle" placeholder="Título" /> <div>
<input type="text" name="tittle" id="tittle" placeholder="Título" />
</div>
<div>
<input type="number" name="duration" id="duration" placeholder="Duración" />
</div>
<div>
<input type="text" name="language" id="language" placeholder="Idioma" />
</div>
<div>
<input type="text" name="description" id="description" placeholder="Descripción" />
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Añadir pelicula" name="add_film" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</form>
</div> </div>
<div> <div class="column side"></div>
<input type="number" name="duration" id="duration" placeholder="Duración" /> ';
</div>
<div>
<input type="text" name="language" id="language" placeholder="Idioma" />
</div>
<div>
<input type="text" name="description" id="description" placeholder="Descripción" />
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Añadir pelicula" name="add_film" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</form>
</div>';
} }
function deleteFilm() { function deleteFilm() {
echo'<div class="column"> echo'<div class="column side"></div>
<h2>Editar pelicula</h2> <div class="column middle">
<form method="post" action="index.php?state=mf"> <h2>Editar pelicula</h2>
<div class="row"> <form method="post" action="index.php?state=mf">
<fieldset id="film_form"> <div class="row">
<legend>¿Estás seguro de que quieres eliminar esta pelicula?</legend> <fieldset id="film_form">
<input type="hidden" name="id" value='.$_POST['id'].'/> <legend>¿Estás seguro de que quieres eliminar esta pelicula?</legend>
<p>Id: '.$_POST['id'].' </p> <input type="hidden" name="id" value='.$_POST['id'].'/>
<p>Título: '.$_POST['tittle'].' </p> <p>Id: '.$_POST['id'].' </p>
<p>Duración: '.$_POST['duration'].' </p> <p>Título: '.$_POST['tittle'].' </p>
<p>Idioma: '.$_POST['language'].' </p> <p>Duración: '.$_POST['duration'].' </p>
<p>Descripción: '.$_POST['description'].' </p> <p>Idioma: '.$_POST['language'].' </p>
</fieldset> <p>Descripción: '.$_POST['description'].' </p>
<div class="actions"> </fieldset>
<input type="submit" id="submit" value="Eliminar" name="confirm_delete_film" class="primary" /> <div class="actions">
<input type="submit" id="submit" value="Cancelar" name="cancel_delete_film" class="primary" /> <input type="submit" id="submit" value="Eliminar" name="confirm_delete_film" class="primary" />
</div> <input type="submit" id="submit" value="Cancelar" name="cancel_delete_film" class="primary" />
</div>
</div>
</form>
</div> </div>
</form> <div class="column side"></div>
</div>'; ';
} }
function editFilm() { function editFilm() {
echo'<div class="column"> echo'<div class="column side"></div>
<h2>Editar pelicula</h2> <div class="column middle">
<form method="post" action="index.php?state=mf"> <h2>Editar pelicula</h2>
<div class="row"> <form method="post" action="index.php?state=mf">
<fieldset id="film_form"> <div class="row">
<legend>Datos de pelicula</legend> <fieldset id="film_form">
<input type="hidden" name="id" value='.$_POST['id'].'/> <legend>Datos de pelicula</legend>
<div> <input type="hidden" name="id" value='.$_POST['id'].'/>
<input type="text" name="tittle" value="'.$_POST['tittle'].'" /> <div>
</div> <input type="text" name="tittle" value="'.$_POST['tittle'].'" />
<div> </div>
<input type="number" name="duration" id="duration" value='.$_POST['duration'].' /> <div>
</div> <input type="number" name="duration" id="duration" value='.$_POST['duration'].' />
<div> </div>
<input type="text" name="language" id="language" value="'.$_POST['language'].'" /> <div>
</div> <input type="text" name="language" id="language" value="'.$_POST['language'].'" />
<div> </div>
<input type="text" name="description" id="description" value="'.$_POST['description'].'"/> <div>
</div> <input type="text" name="description" id="description" value="'.$_POST['description'].'"/>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Editar" name="confirm_edit_film" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div> </div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Editar" name="confirm_edit_film" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</form>
</div> </div>
</form> <div class="column side"></div>
</div>'; ';
} }
// Logic Functions // Logic Functions