Add functions
This commit is contained in:
parent
113a6413a8
commit
90f233fca9
@ -111,6 +111,17 @@
|
|||||||
return $resul;
|
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.
|
//Get cinemas associated with a movie.
|
||||||
public function getCinemas($id){
|
public function getCinemas($id){
|
||||||
include_once('cinema_dao.php');
|
include_once('cinema_dao.php');
|
||||||
|
@ -8,14 +8,16 @@
|
|||||||
private $_description; //Promotion description.
|
private $_description; //Promotion description.
|
||||||
private $_code; //Promotion code.
|
private $_code; //Promotion code.
|
||||||
private $_active; //Promotion is active?
|
private $_active; //Promotion is active?
|
||||||
|
private $_img;
|
||||||
|
|
||||||
//Constructor:
|
//Constructor:
|
||||||
function __construct($id, $tittle, $description, $code, $active){
|
function __construct($id, $tittle, $description, $code, $active, $img){
|
||||||
$this->_id = $id;
|
$this->_id = $id;
|
||||||
$this->_tittle = $tittle;
|
$this->_tittle = $tittle;
|
||||||
$this->_description = $description;
|
$this->_description = $description;
|
||||||
$this->_code = $code;
|
$this->_code = $code;
|
||||||
$this->_active = $active;
|
$this->_active = $active;
|
||||||
|
$this->_img= $img;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Methods:
|
//Methods:
|
||||||
@ -31,6 +33,8 @@
|
|||||||
public function getCode(){return $this->_code;}
|
public function getCode(){return $this->_code;}
|
||||||
public function setActive($active){ $this->_active = $active;}
|
public function setActive($active){ $this->_active = $active;}
|
||||||
public function getActive(){return $this->_active;}
|
public function getActive(){return $this->_active;}
|
||||||
|
public function setImg($img){ $this->_img = $img;}
|
||||||
|
public function getImg(){return $this->_img;}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
@ -11,10 +11,10 @@
|
|||||||
//Methods:
|
//Methods:
|
||||||
|
|
||||||
//Create a new Session.
|
//Create a new Session.
|
||||||
public function createPromotion($id, $tittle, $description, $code, $active){
|
public function createPromotion($id, $tittle, $description, $code, $active, $img){
|
||||||
$sql = sprintf( "INSERT INTO `promotion`( `id`, `tittle`, `description`, `code`, `active`)
|
$sql = sprintf( "INSERT INTO `promotion`( `id`, `tittle`, `description`, `code`, `active`, `img`)
|
||||||
VALUES ( '%d', '%s', '%s', '%s', '%s')",
|
VALUES ( '%d', '%s', '%s', '%s', '%s', '%s')",
|
||||||
$id, $tittle, $description, $code, $active);
|
$id, $tittle, $description, $code, $active, $img);
|
||||||
|
|
||||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||||
return $resul;
|
return $resul;
|
||||||
@ -27,7 +27,7 @@
|
|||||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||||
|
|
||||||
while($fila=$resul->fetch_assoc()){
|
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();
|
$resul->free();
|
||||||
return $promotions;
|
return $promotions;
|
||||||
@ -57,7 +57,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Edit a film.
|
//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'
|
$sql = sprintf( "UPDATE promotion SET tittle = '%s' , description = '%s', code ='%s' , active ='%s'
|
||||||
WHERE promotion.id = '%d';",
|
WHERE promotion.id = '%d';",
|
||||||
$tittle, $description, $code, $active, $id);
|
$tittle, $description, $code, $active, $id);
|
||||||
@ -68,8 +78,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Create a new film Data Transfer Object.
|
//Create a new film Data Transfer Object.
|
||||||
public function loadPromotion($id, $tittle, $description, $code, $active){
|
public function loadPromotion($id, $tittle, $description, $code, $active, $img){
|
||||||
return new Promotion($id, $tittle, $description, $code, $active);
|
return new Promotion($id, $tittle, $description, $code, $active, $img);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user