<?php $ms_controller = new MovieSeriesController(); if ($_POST['r'] == 'movieserie-delete' && !isset($_POST['crud'])) { $ms = $ms_controller->get($_POST['imdb_id']); $template = ' <h2 class="p1">Eliminar MovieSerie</h2> <form method="POST" class="item"> <div class="p_25"> ¿Estas seguro de eliminar la MovieSerie: <mark class="p1">%s</mark>? </div> <div class="p_25"> <input class="button delete" type="submit" value="SI"> <input class="button add" type="button" value="NO" onclick="history.back()"> <input type="hidden" name="r" value="movieserie-delete"> <input type="hidden" name="crud" value="del"> <input type="hidden" name="imdb_id" value="%s"> </div> </form> '; printf($template, $ms[0]['imdb_id'], $ms[0]['imdb_id']); } else { if ($_POST['r'] == 'movieserie-delete' && $_POST['crud'] == 'del') { $ms = $ms_controller->del($_POST['imdb_id']); $template = ' <div class="container"> <p class="item add"> MovieSerie <b>%s</b> eliminada </p> </div>
<?php print '<h2 class="p1">GESTIÓN DE MOVIESERIES</h2>'; $ms_controller = new MovieSeriesController(); $ms = $ms_controller->get(); //var_dump($ms); if (empty($ms)) { print ' <div class="container"> <p class="item error">No hay MovieSeries</p> </div> '; } else { $template_ms = ' <div class="item"> <table> <tr> <th>IMDB Id</th> <th>Título</th> <th>Estreno</th> <th>Géneros</th> <th>Categoría</th> <th colspan="3"> <form method="POST"> <input type="hidden" name="r" value="movieserie-add"> <input type="submit" class="button add" value="Agregar"> </form> </th> </tr> '; for ($n = 0; $n < count($ms); $n++) {