SW/panel_admin/manage_films.php

97 lines
4.0 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('../assets/php/common/film_dto.php');
include_once(__DIR__.'/includes/formFilm.php');
2021-04-26 22:40:34 +02:00
/*$f1 = new FilmDTO(1000,"Los vengadores",183,"español","");
$f2 = new FilmDTO(2001,"Mecernarios",140,"español","");
$f3 = new FilmDTO(3022,"Monster hunter",104,"español","");
$f4 = new FilmDTO(4560,"Godzilla vs kong",113,"inglés","");
$f5 = new FilmDTO(4260,"Tom y Jerry",131,"inglés","");
$f6 = new FilmDTO(4606,"Pequeños Detalles",127,"inglés","");
$film= array($f1, $f2, $f3, $f4,$f5,$f6); */
$film = new FormFilm();
$film->processesForm(null, null, null, null, null, "show");
function drawFilms($films){
2021-04-30 20:49:21 +02:00
echo "<div class='column left'>
2021-04-26 22:40:34 +02:00
<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=uf">
<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=uf">
<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>
2021-04-30 20:49:21 +02:00
</table>
</div>';
2021-04-26 22:40:34 +02:00
}
function addFilm(){
2021-04-30 20:49:21 +02:00
echo'<div class="column right">
2021-04-26 22:40:34 +02:00
<h2>Añadir pelicula</h2>
<form method="post" action="update_film.php">
<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>';
}
drawFilms($film->getReply());
addFilm();
?>