This commit is contained in:
marian1010 2021-04-13 20:21:27 +02:00
parent 04305d2c79
commit 997209ecf3
5 changed files with 13 additions and 11 deletions

View File

@ -20,7 +20,7 @@
<input type="text" name="language" id="language" value='.$_REQUEST['language'].' /> <input type="text" name="language" id="language" value='.$_REQUEST['language'].' />
</div> </div>
<div> <div>
<input type="text" name="description" id="description" value='.$_REQUEST['description'].'/> <input type="text" name="description" id="description" value="'.$_REQUEST['description'].'"/>
</div> </div>
</fieldset> </fieldset>
<div class="actions"> <div class="actions">

View File

@ -1,5 +1,5 @@
<?php <?php
require_once($prefix.'assets/php/dao.php'); require_once('../assets/php/dao.php');
include_once('film_dto.php'); include_once('film_dto.php');
class Film_DAO extends DAO { class Film_DAO extends DAO {
@ -12,11 +12,11 @@
//Methods: //Methods:
//Create a new Session. //Create a new Session.
public function createFilm($id, $tittle, $duration, $language){ public function createFilm($id, $tittle, $duration, $language,$description){
$sql = sprintf( "INSERT INTO film( $id, $tittle, $duration, $language) $sql = sprintf( "INSERT INTO `film`( `id`, `tittle`, `duration`, `language`,`description`)
VALUES ( '%d', '%s', '%d', '%s')", VALUES ( '%d', '%s', '%d', '%s','%s')",
$id, $tittle, $duration, $language); $id, $tittle, $duration, $language,$description);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
@ -40,7 +40,7 @@
$films[] = $this->loadFilm($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"]); $films[] = $this->loadFilm($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"]);
} }
return $resul; return $films;
} }
//Returns a query to get all films tittles. //Returns a query to get all films tittles.
@ -87,8 +87,8 @@
} }
//Create a new film Data Transfer Object. //Create a new film Data Transfer Object.
public function loadFilm($id, $tittle, $duration, $language){ public function loadFilm($id, $tittle, $duration, $language,$description){
return new FilmDTO( $id, $tittle, $duration, $language); return new Film_DTO( $id, $tittle, $duration, $language,$description);
} }
} }

View File

@ -52,7 +52,7 @@ class FormFilm extends Form {
//Habria que validar todo para que encaje en la base de datos //Habria que validar todo para que encaje en la base de datos
$bd = new FilmDAO('complucine'); $bd = new Film_DAO('complucine');
if($bd ){ if($bd ){
if($option == "new"){ if($option == "new"){
$bd->createFilm(null, $title,$duration,$languaje,$description); $bd->createFilm(null, $title,$duration,$languaje,$description);

View File

@ -6,6 +6,8 @@
require_once('../panel_admin/panelAdmin.php'); require_once('../panel_admin/panelAdmin.php');
$template = new Template(); $template = new Template();
if(isset($_SESSION["login"]) && $_SESSION["rol"] == "admin") $login = true;
if(isset($_REQUEST['state'])) { if(isset($_REQUEST['state'])) {
$panel = new Panel($_REQUEST['state']); $panel = new Panel($_REQUEST['state']);
} }

View File

@ -60,7 +60,7 @@
</table>'; </table>';
} }
function addFilm(){ function addFilm(){
echo'<div class="column size"> echo'<div class="column left">
<h2>Añadir pelicula</h2> <h2>Añadir pelicula</h2>
<form method="post" action="add_film.php"> <form method="post" action="add_film.php">
<div class="row"> <div class="row">