SW/panel_admin/manage_films.php

107 lines
5.5 KiB
PHP
Raw Normal View History

2021-04-26 22:40:34 +02:00
<?php
2021-04-28 21:46:10 +02:00
//General Config File:
include_once('../assets/php/config.php');
include_once('./includes/formFilm.php');
require_once($prefix.'assets/php/common/film_dao.php');
// View functions
2021-04-26 22:40:34 +02:00
function addFilm(){
2021-05-03 01:17:42 +02:00
echo'<div class="column side"></div>
<div class="column middle">
<h2>Añadir pelicula</h2>
2021-05-04 22:26:24 +02:00
<form method="post" enctype="multipart/form-data" action="index.php?state=mf">
2021-05-03 01:17:42 +02:00
<div class="row">
<fieldset id="film_form">
<legend>Datos de pelicula</legend>
<input type="text" name="tittle" id="tittle" placeholder="Título" />
<input type="number" name="duration" id="duration" placeholder="Duración" />
<input type="text" name="language" id="language" placeholder="Idioma" />
2021-05-04 22:26:24 +02:00
<input type="text" name="description" id="description" placeholder="Descripción" />
2021-05-06 10:40:56 +02:00
<div class="file">Imagen promocional:<input type="file" name="file" id="file" placeholder="Imagen promocional" /></div>
2021-05-03 01:17:42 +02:00
</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>
2021-05-04 22:26:24 +02:00
</div>
2021-05-03 01:17:42 +02:00
</form>
2021-04-26 22:40:34 +02:00
</div>
2021-05-03 01:17:42 +02:00
<div class="column side"></div>
';
}
function deleteFilm() {
2021-05-03 01:17:42 +02:00
echo'<div class="column side"></div>
<div class="column middle">
2021-05-04 22:26:24 +02:00
<h2>Eliminar pelicula</h2>
2021-05-03 01:17:42 +02:00
<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>
2021-05-03 01:17:42 +02:00
<div class="column side"></div>
';
}
function editFilm() {
2021-05-03 01:17:42 +02:00
echo'<div class="column side"></div>
<div class="column middle">
<h2>Editar pelicula</h2>
2021-05-06 10:40:56 +02:00
<form method="post" enctype="multipart/form-data" action="index.php?state=mf">
2021-05-03 01:17:42 +02:00
<div class="row">
<fieldset id="film_form">
<legend>Datos de pelicula</legend>
2021-05-04 22:26:24 +02:00
<input type="hidden" name="id" value='.$_POST['id'].'/>
2021-05-03 01:17:42 +02:00
<input type="text" name="tittle" value="'.$_POST['tittle'].'" />
<input type="number" name="duration" id="duration" value='.$_POST['duration'].' />
<input type="text" name="language" id="language" value="'.$_POST['language'].'" />
2021-05-04 22:26:24 +02:00
<input type="text" name="description" id="description" value="'.$_POST['description'].'"/>
2021-05-06 10:40:56 +02:00
<div class="file">Imagen promocional:<input type="file" name="file" id="file" placeholder="Imagen promocional" /></div>
2021-05-03 01:17:42 +02:00
</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>
2021-05-02 16:01:05 +02:00
</div>
2021-05-03 01:17:42 +02:00
<div class="column side"></div>
';
}
// Logic Functions
function confirmDelete() {
$film = new FormFilm();
2021-05-04 22:26:24 +02:00
$film->processesForm($_POST['id'],null,null,null,null,null,"del");
$_SESSION['message'] = $film->getReply();
header('Location: ../panel_admin/index.php?state=mf');
}
function confirmEdit() {
$film = new FormFilm();
2021-05-04 22:26:24 +02:00
$film->processesForm($_POST['id'], $_POST['tittle'], $_POST['duration'], $_POST['language'], $_POST['description'], $_POST['file'], "edit");
$_SESSION['message']= $film->getReply();
header('Location: ../panel_admin/index.php?state=mf');
2021-04-26 22:40:34 +02:00
}
function confirmAdd() {
$film = new FormFilm();
2021-05-04 22:26:24 +02:00
$film->processesForm(null, $_POST['tittle'], $_POST['duration'], $_POST['language'], $_POST['description'], $_POST['file'], "new");
$_SESSION['message'] = $film->getReply();
header('Location: ../panel_admin/index.php?state=mf');
}
2021-04-26 22:40:34 +02:00
?>