Deberia estar todo hecho

This commit is contained in:
Markines16
2021-04-15 22:34:33 +02:00
committed by GitHub
parent a3bc2311e5
commit 2a09ad18b9
6 changed files with 40 additions and 25 deletions

View File

@@ -21,7 +21,6 @@ class FormHall extends Form {
//Returns validation response:
public function getReply() {
echo "<p> se va a devolver una respuesta </p>";
if($this->correct){
if($this->option == "new"){
$this->reply = "<h1> Operacion realizada con exito </h1><hr />
@@ -36,7 +35,6 @@ class FormHall extends Form {
<p> Se ha eliminado la sala correctamente en la base de datos.</p>
<a href='../panel_manager/index.php'><button>Panel Gerente</button></a>";
}else if($this->option == "list"){
echo "<p> se va a devolver la lista </p>";
$this->reply = $this->halls;
}
} else {

View File

@@ -42,7 +42,7 @@ class FormSession extends Form {
return $this->reply;
}
public function processesForm($id, $film, $hall, $cinema, $date, $start, $price, $format, $repeat, $option) {
public function processesForm($film, $hall, $cinema, $date, $start, $price, $format, $repeat, $option) {
$this->option = $option;
$this->correct = true;
@@ -58,21 +58,21 @@ class FormSession extends Form {
if($searchSession) {
$this->correct = false;
} else{
$bd->createSession(null, $film, $hall,$cinema, $date, $start, $price, $format);
$bd->createSession(null,$film, $hall,$cinema, $date, $start, $price, $format);
}
} else if ($option == "del"){
$bd->deleteSession($id);
$bd->deleteSession($hall, $cinema, $date, $start);
} else if ($option == "edit"){
$bd->editSession($id, $film, $hall, $cinema, $date, $start, $price, $format);
$bd->editSession($film, $hall, $cinema, $date, $start, $price, $format);
}
if($repeat > "0"){
$repeat--;
$date = date('Y-m-d', strtotime( $date. ' +1 day') );
$this->processesForm($id, $film, $hall, $cinema, $date, $start, $price, $format, $repeat, $option);
$this->processesForm($film, $hall, $cinema, $date, $start, $price, $format, $repeat, $option);
}
}
} else {$this->correct = false;}

View File

@@ -1,7 +1,7 @@
<?php
require_once('../assets/php/dao.php');
include_once('session_dto.php');
class SessionDAO extends DAO {
//Constructor:
function __construct($bd_name){
@@ -68,7 +68,7 @@
return $sessions;
}
public function editSession($id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){
public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){
$format = $this->mysqli->real_escape_string($format);
$date = date('Y-m-d', strtotime( $date ) );
$startTime = date('H:i:s', strtotime( $startTime ) );
@@ -76,17 +76,20 @@
$sql = sprintf( "UPDATE `session`
SET `idfilm` = '%d' , `idhall` = '%d', `idcinema` = '%d', `date` = '%s',
`start_time` = '%s', `seat_price` = '%d', `format` = '%s'
WHERE `session`.`id` = '%d';",
$idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $id);
WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'",
$idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $_SESSION["cinema"],$_SESSION["hall"],$_SESSION["date"],$_SESSION["start"]);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
public function deleteSession($id){
public function deleteSession($hall, $cinema, $date, $startTime){
$sql = sprintf( "DELETE FROM `session` WHERE `session`.`id` = '%d';",$id);
$sql = sprintf( "DELETE FROM `session` WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'",
$cinema, $hall, $date, $startTime);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');