This commit is contained in:
Daniel Muñoz Garcia 2021-05-03 09:49:58 +02:00 committed by GitHub
parent 9d1869023a
commit d7cbedc524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,89 +9,126 @@
// View functions // View functions
function addCinema(){ /*function drawCinema(){
echo' <div class="column side"></div> $cine = new Cinema_DAO("complucine");
<div class="column middle"> $cinemas = $cine->allCinemaData();
<h2>Añadir cine</h2> 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"> <form method="post" action="index.php?state=mc">
<fieldset id="cinema_form"> <input name="id" type="hidden" value="'.$f->getId().'">
<legend>Datos del Cine</legend> <input name="name" type="hidden" value="'.$f->getName().'">
<div> <input name="direction" type="hidden" value="'.$f->getDirection().'">
<input type="text" name="name" id="name" placeholder="Nombre" /> <input name="phone" type="hidden" value="'.$f->getPhone().'">
</div> <input type="submit" id="submit" value="Editar" name="edit_cinema" class="primary" />
<div> </form>
<input type="text" name="direction" id="direction" placeholder="Direccion" /> </td>
</div> <td>
<div> <form method="post" action="index.php?state=mc">
<input type="text" name="phone" id="phone" placeholder="Teléfono" /> <input name="id" type="hidden" value="'.$f->getId().'">
</div> <input name="name" type="hidden" value="'.$f->getName().'">
</fieldset> <input name="direction" type="hidden" value="'.$f->getDirection().'">
<div class="actions"> <input name="phone" type="hidden" value="'.$f->getPhone().'">
<input type="submit" id="submit" value="Añadir cine" name="add_cinema" class="primary" /> <input type="submit" id="submit" value="Eliminar" name="delete_cinema" class="primary" />
<input type="reset" id="reset" value="Borrar" /> </form>
</div> </td>
</form> </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" />
</div> </div>
<div class="column side"></div> <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>';
} }
function deleteCinema() { function deleteCinema() {
echo'<div class="column side"></div> echo'<div class="column">
<div class="column middle"> <h2>Editar cine</h2>
<h2>Eliminar cine</h2> <form method="post" action="index.php?state=mc">
<form method="post" action="index.php?state=mc"> <div class="row">
<div class="row"> <fieldset id="cinema_form">
<fieldset id="cinema_form"> <legend>¿Estás seguro de que quieres eliminar este cine?</legend>
<legend>¿Estás seguro de que quieres eliminar este cine?</legend> <input type="hidden" name="id" value='.$_POST['id'].'/>
<input type="hidden" name="id" value='.$_POST['id'].'/> <p>Id: '.$_POST['id'].' </p>
<p>Id: '.$_POST['id'].' </p> <p>Nombre: '.$_POST['name'].' </p>
<p>Nombre: '.$_POST['name'].' </p> <p>Dirección: '.$_POST['direction'].' </p>
<p>Dirección: '.$_POST['direction'].' </p> <p>Teléfono: '.$_POST['phone'].' </p>
<p>Teléfono: '.$_POST['phone'].' </p> </fieldset>
</fieldset> <div class="actions">
<div class="actions"> <input type="submit" id="submit" value="Eliminar" name="confirm_delete_cinema" 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_cinema" 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 side"></div> echo'<div class="column">
<div class="column middle"> <h2>Editar cine</h2>
<h2>Editar cine</h2> <form method="post" action="index.php?state=mc">
<form method="post" action="index.php?state=mc"> <div class="row">
<div class="row"> <fieldset id="cinema_form">
<fieldset id="cinema_form"> <legend>Datos del cine</legend>
<legend>Datos del cine</legend> <input type="hidden" name="id" value='.$_POST['id'].'/>
<input type="hidden" name="id" value='.$_POST['id'].'/> <div>
<div> <input type="text" name="name" value="'.$_POST['name'].'" />
<input type="text" name="name" value="'.$_POST['name'].'" /> </div>
</div> <div>
<div> <input type="text" name="direction" value='.$_POST['direction'].' />
<input type="text" name="direction" value='.$_POST['direction'].' /> </div>
</div> <div>
<div> <input type="text" name="phone" value='.$_POST['phone'].' />
<input type="text" name="phone" value='.$_POST['phone'].' /> </div>
</div> </fieldset>
</fieldset> <div class="actions">
<div class="actions"> <input type="submit" id="submit" value="Editar" name="confirm_edit_cinema" class="primary" />
<input type="submit" id="submit" value="Editar" name="confirm_edit_cinema" class="primary" /> <input type="reset" id="reset" value="Borrar" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div> </div>
</div>
</form> </form>
</div> </div>';
<div class="column side"></div>
';
} }
// Logic Functions // Logic Functions
function confirmDelete() { function confirmDelete() {
$cine = new FormCinema(); $cine = new FormCinema();
$cine->processesForm($_POST['id'],null,null,null,"del"); $cine->processesForm($_POST['id'],null,null,null,"del");
$_SESSION['message'] = $cine->getReply(); $_SESSION['message'] = $cine->getReply();