diff --git a/assets/php/includes/film_dao.php b/assets/php/includes/film_dao.php index d4524f3..45d433b 100644 --- a/assets/php/includes/film_dao.php +++ b/assets/php/includes/film_dao.php @@ -111,6 +111,17 @@ return $resul; } + //Edit a film. + public function editFilmNoImg($id, $tittle, $duration, $language,$description){ + $sql = sprintf( "UPDATE film SET tittle = '%s' , duration = '%d', language ='%s' , description ='%s' + WHERE film.id = '%d';", + $tittle, $duration, $language, $description, $id); + + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); + + return $resul; + } + //Get cinemas associated with a movie. public function getCinemas($id){ include_once('cinema_dao.php'); diff --git a/assets/php/includes/promotion.php b/assets/php/includes/promotion.php index 40ab084..6125934 100644 --- a/assets/php/includes/promotion.php +++ b/assets/php/includes/promotion.php @@ -8,14 +8,16 @@ private $_description; //Promotion description. private $_code; //Promotion code. private $_active; //Promotion is active? + private $_img; //Constructor: - function __construct($id, $tittle, $description, $code, $active){ + function __construct($id, $tittle, $description, $code, $active, $img){ $this->_id = $id; $this->_tittle = $tittle; $this->_description = $description; $this->_code = $code; $this->_active = $active; + $this->_img= $img; } //Methods: @@ -31,6 +33,8 @@ public function getCode(){return $this->_code;} public function setActive($active){ $this->_active = $active;} public function getActive(){return $this->_active;} + public function setImg($img){ $this->_img = $img;} + public function getImg(){return $this->_img;} } ?> \ No newline at end of file diff --git a/assets/php/includes/promotion_dao.php b/assets/php/includes/promotion_dao.php index 02525bd..73605d2 100644 --- a/assets/php/includes/promotion_dao.php +++ b/assets/php/includes/promotion_dao.php @@ -11,10 +11,10 @@ //Methods: //Create a new Session. - public function createPromotion($id, $tittle, $description, $code, $active){ - $sql = sprintf( "INSERT INTO `promotion`( `id`, `tittle`, `description`, `code`, `active`) - VALUES ( '%d', '%s', '%s', '%s', '%s')", - $id, $tittle, $description, $code, $active); + public function createPromotion($id, $tittle, $description, $code, $active, $img){ + $sql = sprintf( "INSERT INTO `promotion`( `id`, `tittle`, `description`, `code`, `active`, `img`) + VALUES ( '%d', '%s', '%s', '%s', '%s', '%s')", + $id, $tittle, $description, $code, $active, $img); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); return $resul; @@ -27,7 +27,7 @@ $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); while($fila=$resul->fetch_assoc()){ - $promotions[] = $this->loadPromotion($fila["id"], $fila["tittle"], $fila["description"], $fila["code"], $fila["active"]); + $promotions[] = $this->loadPromotion($fila["id"], $fila["tittle"], $fila["description"], $fila["code"], $fila["active"], null); } $resul->free(); return $promotions; @@ -57,7 +57,17 @@ } //Edit a film. - public function editPromotion($id, $tittle, $description, $code, $active){ + public function editPromotion($id, $tittle, $description, $code, $active, $img){ + $sql = sprintf( "UPDATE promotion SET tittle = '%s' , description = '%s', code ='%s' , active ='%s', img = '%s' + WHERE promotion.id = '%d';", + $tittle, $description, $code, $active, $img, $id); + + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); + + return $resul; + } + + public function editPromotionNoImg($id, $tittle, $description, $code, $active){ $sql = sprintf( "UPDATE promotion SET tittle = '%s' , description = '%s', code ='%s' , active ='%s' WHERE promotion.id = '%d';", $tittle, $description, $code, $active, $id); @@ -68,8 +78,8 @@ } //Create a new film Data Transfer Object. - public function loadPromotion($id, $tittle, $description, $code, $active){ - return new Promotion($id, $tittle, $description, $code, $active); + public function loadPromotion($id, $tittle, $description, $code, $active, $img){ + return new Promotion($id, $tittle, $description, $code, $active, $img); } }