SW/panel_admin/manage_cinemas.php

114 lines
4.8 KiB
PHP
Raw Normal View History

<?php
2021-04-26 22:40:34 +02:00
//General Config File:
include_once('../assets/php/config.php');
2021-04-26 22:40:34 +02:00
include_once('../assets/php/common/cinema.php');
include_once(__DIR__.'/includes/formCinema.php');
2021-04-26 22:40:34 +02:00
// View functions
2021-05-03 09:49:58 +02:00
function addCinema(){
2021-05-03 14:12:38 +02:00
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>
2021-05-03 09:49:58 +02:00
</div>
2021-05-03 14:12:38 +02:00
<div class="column side"></div>
</div>
';
}
function deleteCinema() {
2021-05-03 14:12:38 +02:00
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>¿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_cinema" class="primary" />
<input type="submit" id="submit" value="Cancelar" name="cancel_delete_cinema" class="primary" />
</div>
2021-04-26 22:40:34 +02:00
</div>
</form>
2021-05-03 14:12:38 +02:00
</div>
<div class="column side"></div>
';
}
function editCinema() {
2021-05-03 14:12:38 +02:00
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>
</form>
2021-05-03 14:12:38 +02:00
</div>
<div class="column side"></div>
';
}
// Logic Functions
2021-05-03 14:12:38 +02:00
function confirmDelete() {
$cine = new FormCinema();
$cine->processesForm($_POST['id'],null,null,null,"del");
$_SESSION['message'] = $cine->getReply();
header('Location: ../panel_admin/index.php?state=mc');
}
function confirmEdit() {
$cine = new FormCinema();
$cine->processesForm($_POST['id'], $_POST['name'], $_POST['direction'], $_POST['phone'],"edit");
$_SESSION['message']= $cine->getReply();
header('Location: ../panel_admin/index.php?state=mc');
}
function confirmAdd() {
$cine = new FormCinema();
2021-05-02 17:57:23 +02:00
$cine->processesForm(null, $_POST['name'], $_POST['direction'], $_POST['phone'],"new");
$_SESSION['message'] = $cine->getReply();
header('Location: ../panel_admin/index.php?state=mc');
}
?>