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

View File

@ -21,23 +21,55 @@ class FormCinema extends Form {
public function getReply() {
if($this->correct){
if($this->option == "new"){
$this->reply = "<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>";
$this->reply = "<div class='row'>
<div class='column side'></div>
<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"){
$this->reply = "<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>";
$this->reply = "<div class='row'>
<div class='column side'></div>
<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"){
$this->reply = "<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>";
$this->reply = "<div class='row'>
<div class='column side'></div>
<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 {
$this->reply = "<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>";
$this->reply = "<div class='row'>
<div class='column side'></div>
<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;

View File

@ -21,23 +21,52 @@ class FormFilm extends Form {
public function getReply() {
if($this->correct){
if($this->option == "new"){
$this->reply = "<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>";
$this->reply = "<div class='row'>
<div class='column side'></div>
<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"){
$this->reply = "<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>";
$this->reply = "<div class='row'>
<div class='column side'></div>
<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"){
$this->reply = "<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>";
$this->reply = "<div class='row'>
<div class='column side'></div>
<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 {
$this->reply = "<h1> ERROR </h1><hr />
<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>";
$this->reply = "<div class='column middle'>
<h1>ERROR</h1><hr />
<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;

View File

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

View File

@ -9,122 +9,85 @@
// 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(){
echo'<div class="column">
<h2>Añadir cine</h2>
<form method="post" action="index.php?state=mc">
<div class="row">
<fieldset id="cinema_form">
<legend>Datos del Cine</legend>
<div>
<input type="text" name="name" id="name" placeholder="Nombre" />
echo' <div class="column side"></div>
<div class="column middle">
<h2>Añadir cine</h2>
<form method="post" action="index.php?state=mc">
<fieldset id="cinema_form">
<legend>Datos del Cine</legend>
<div>
<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>
<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>
</div>
</form>
</div>';
<div class="column side"></div>
</div>
';
}
function deleteCinema() {
echo'<div class="column">
<h2>Editar cine</h2>
<form method="post" action="index.php?state=mc">
<div class="row">
<fieldset id="cinema_form">
<legend>¿Estás seguro de que quieres eliminar este cine?</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<p>Id: '.$_POST['id'].' </p>
<p>Nombre: '.$_POST['name'].' </p>
<p>Dirección: '.$_POST['direction'].' </p>
<p>Teléfono: '.$_POST['phone'].' </p>
</fieldset>
<div class="actions">
<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" />
echo'<div class="column side"></div>
<div class="column middle">
<h2>Eliminar cine</h2>
<form method="post" action="index.php?state=mc">
<div class="row">
<fieldset id="cinema_form">
<legend>¿Estás seguro de que quieres eliminar este cine?</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<p>Id: '.$_POST['id'].' </p>
<p>Nombre: '.$_POST['name'].' </p>
<p>Dirección: '.$_POST['direction'].' </p>
<p>Teléfono: '.$_POST['phone'].' </p>
</fieldset>
<div class="actions">
<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>
</form>
</div>';
</div>
<div class="column side"></div>
';
}
function editCinema() {
echo'<div class="column">
<h2>Editar cine</h2>
<form method="post" action="index.php?state=mc">
<div class="row">
<fieldset id="cinema_form">
<legend>Datos del cine</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<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="phone" value='.$_POST['phone'].' />
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Editar" name="confirm_edit_cinema" class="primary" />
<input type="reset" id="reset" value="Borrar" />
echo'<div class="column side"></div>
<div class="column middle">
<h2>Editar cine</h2>
<form method="post" action="index.php?state=mc">
<div class="row">
<fieldset id="cinema_form">
<legend>Datos del cine</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<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="phone" value='.$_POST['phone'].' />
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Editar" name="confirm_edit_cinema" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</div>
</form>
</div>';
</div>
<div class="column side"></div>
';
}
// Logic Functions

View File

@ -7,133 +7,93 @@
// 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(){
echo'<div class="column">
<h2>Añadir pelicula</h2>
<form method="post" action="index.php?state=mf">
<div class="row">
<fieldset id="film_form">
<legend>Datos de pelicula</legend>
<div>
<input type="text" name="tittle" id="tittle" placeholder="Título" />
echo'<div class="column side"></div>
<div class="column middle">
<h2>Añadir pelicula</h2>
<form method="post" action="index.php?state=mf">
<div class="row">
<fieldset id="film_form">
<legend>Datos de pelicula</legend>
<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>
<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 class="column side"></div>
';
}
function deleteFilm() {
echo'<div class="column">
<h2>Editar pelicula</h2>
<form method="post" action="index.php?state=mf">
<div class="row">
<fieldset id="film_form">
<legend>¿Estás seguro de que quieres eliminar esta pelicula?</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<p>Id: '.$_POST['id'].' </p>
<p>Título: '.$_POST['tittle'].' </p>
<p>Duración: '.$_POST['duration'].' </p>
<p>Idioma: '.$_POST['language'].' </p>
<p>Descripción: '.$_POST['description'].' </p>
</fieldset>
<div class="actions">
<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>
echo'<div class="column side"></div>
<div class="column middle">
<h2>Editar pelicula</h2>
<form method="post" action="index.php?state=mf">
<div class="row">
<fieldset id="film_form">
<legend>¿Estás seguro de que quieres eliminar esta pelicula?</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<p>Id: '.$_POST['id'].' </p>
<p>Título: '.$_POST['tittle'].' </p>
<p>Duración: '.$_POST['duration'].' </p>
<p>Idioma: '.$_POST['language'].' </p>
<p>Descripción: '.$_POST['description'].' </p>
</fieldset>
<div class="actions">
<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>
</form>
</div>
</form>
</div>';
<div class="column side"></div>
';
}
function editFilm() {
echo'<div class="column">
<h2>Editar pelicula</h2>
<form method="post" action="index.php?state=mf">
<div class="row">
<fieldset id="film_form">
<legend>Datos de pelicula</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<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="text" name="language" id="language" value="'.$_POST['language'].'" />
</div>
<div>
<input type="text" name="description" id="description" value="'.$_POST['description'].'"/>
</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" />
echo'<div class="column side"></div>
<div class="column middle">
<h2>Editar pelicula</h2>
<form method="post" action="index.php?state=mf">
<div class="row">
<fieldset id="film_form">
<legend>Datos de pelicula</legend>
<input type="hidden" name="id" value='.$_POST['id'].'/>
<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="text" name="language" id="language" value="'.$_POST['language'].'" />
</div>
<div>
<input type="text" name="description" id="description" value="'.$_POST['description'].'"/>
</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>
</form>
</div>';
<div class="column side"></div>
';
}
// Logic Functions