Add files via upload

This commit is contained in:
Fernando Méndez 2021-06-06 22:16:15 +02:00 committed by GitHub
parent b90cbcd074
commit df9f8176d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 3 deletions

View File

@ -39,6 +39,7 @@
return $seat_map; return $seat_map;
} }
//Delete a Seat whit the primary key //Delete a Seat whit the primary key
public function deletemapSeats($hall, $cinema){ public function deletemapSeats($hall, $cinema){
$sql = sprintf( "DELETE FROM `seat` WHERE $sql = sprintf( "DELETE FROM `seat` WHERE
@ -49,6 +50,19 @@
return $resul; return $resul;
} }
//Change state of the seat.
public function changeSeatState($hall, $cinema, $row, $col, $state){
$id = $this->mysqli->real_escape_string($idHall);
$state = $this->mysqli->real_escape_string($state);
$sql = sprintf( "UPDATE seat SET active = '%d' WHERE idhall = '%d' AND idcinema = '%d' AND numrow = '%d' AND numcolum = '%d'",
$state, $hall, $cinema, $row, $col );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Create a new Seat Data Transfer Object. //Create a new Seat Data Transfer Object.
public function loadSeat($idhall, $idcinema, $numRow, $numCol, $state){ public function loadSeat($idhall, $idcinema, $numRow, $numCol, $state){

View File

@ -712,8 +712,7 @@
if($page === "Comprar Entrada") echo"<script type='text/javascript' src='{$prefix}assets/js/selectTicket.js'></script> if($page === "Comprar Entrada") echo"<script type='text/javascript' src='{$prefix}assets/js/selectTicket.js'></script>
<script type='text/javascript' src='{$prefix}assets/js/checkPay.js'></script> <script type='text/javascript' src='{$prefix}assets/js/checkPay.js'></script>
<script type='text/javascript' src='{$prefix}assets/js/goBack.js'></script>\n"; <script type='text/javascript' src='{$prefix}assets/js/goBack.js'></script>\n";
if($page === "Panel de Gerente") echo"<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script> if($page === "Panel de Gerente") echo"<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js'></script> <script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js'></script> <script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js'></script>
<script type='text/javascript' src='{$prefix}assets/js/sessionCalendar.js'></script> <script type='text/javascript' src='{$prefix}assets/js/sessionCalendar.js'></script>

View File

@ -8,6 +8,8 @@ include_once($prefix.'assets/php/includes/cinema_dao.php');
include_once($prefix.'assets/php/includes/cinema.php'); include_once($prefix.'assets/php/includes/cinema.php');
include_once($prefix.'assets/php/includes/hall_dao.php'); include_once($prefix.'assets/php/includes/hall_dao.php');
include_once($prefix.'assets/php/includes/hall.php'); include_once($prefix.'assets/php/includes/hall.php');
include_once($prefix.'assets/php/includes/seat_dao.php');
include_once($prefix.'assets/php/includes/seat.php');
include_once($prefix.'assets/php/includes/purchase_dao.php'); include_once($prefix.'assets/php/includes/purchase_dao.php');
include_once($prefix.'assets/php/includes/purchase.php'); include_once($prefix.'assets/php/includes/purchase.php');
include_once($prefix.'assets/php/includes/promotion_dao.php'); include_once($prefix.'assets/php/includes/promotion_dao.php');
@ -51,7 +53,7 @@ class FormPurchase extends Form {
for($i = 0; $i <= $rows; $i++){ for($i = 0; $i <= $rows; $i++){
for($j = 0; $j <= $cols; $j++){ for($j = 0; $j <= $cols; $j++){
$seat = $i.$j; $seat = $i.$j;
if(isset($_POST["checkbox".$seat])){ if(isset($_POST["checkbox".$seat])){
array_push($this->seat, $i."-".$j); array_push($this->seat, $i."-".$j);
array_push($this->row, $i); array_push($this->row, $i);
array_push($this->col, $j); array_push($this->col, $j);
@ -208,6 +210,16 @@ class FormPurchase extends Form {
for($i = 0; $i < $count; $i++){ for($i = 0; $i < $count; $i++){
if($purchaseDAO->createPurchase(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), $rows[$i], $cols[$i], date("Y-m-d H:i:s"))){ if($purchaseDAO->createPurchase(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), $rows[$i], $cols[$i], date("Y-m-d H:i:s"))){
$purchase = new Purchase(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), $datos["row"], $datos["col"], strftime("%A %e de %B de %Y a las %H:%M")); $purchase = new Purchase(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), $datos["row"], $datos["col"], strftime("%A %e de %B de %Y a las %H:%M"));
$seatDAO = new SeatDAO("complucine");
$seats_list = $seatDAO->getAllSeats($this->session->getIdhall(), $this->cinema->getId());
foreach($seats_list as $key=>$value){
if( $seats_list[$key]->getNumRows() === $datos["row"][11] &&
$seats_list[$key]->getNumCol() === $datos["col"][11] ){
$seats_list[$key]->setState(intval(-1));
$seatDAO->changeSeatState( $seats_list[$key]->getNumber(), $seats_list[$key]->getIdcinema(), $seats_list[$key]->getNumRows(), $seats_list[$key]->getNumCol(), $seats_list[$key]->getState());
}
}
$_SESSION["purchase"] = serialize($purchase); $_SESSION["purchase"] = serialize($purchase);
$_SESSION["film_purchase"] = serialize($this->film); $_SESSION["film_purchase"] = serialize($this->film);
@ -218,6 +230,17 @@ class FormPurchase extends Form {
} }
} else { } else {
$purchase = new Purchase("null", $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), $datos["row"], $datos["col"], strftime("%A %e de %B de %Y a las %H:%M")); $purchase = new Purchase("null", $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), $datos["row"], $datos["col"], strftime("%A %e de %B de %Y a las %H:%M"));
$seatDAO = new SeatDAO("complucine");
$seats_list = $seatDAO->getAllSeats($this->session->getIdhall(), $this->cinema->getId());
foreach($seats_list as $key=>$value){
if( $seats_list[$key]->getNumRows() === $datos["row"][11] &&
$seats_list[$key]->getNumCol() === $datos["col"][11] ){
$seats_list[$key]->setState(intval(-1));
$seatDAO->changeSeatState( $seats_list[$key]->getNumber(), $seats_list[$key]->getIdcinema(), $seats_list[$key]->getNumRows(), $seats_list[$key]->getNumCol(), $seats_list[$key]->getState());
}
}
$_SESSION["purchase"] = serialize($purchase); $_SESSION["purchase"] = serialize($purchase);
$_SESSION["film_purchase"] = serialize($this->film); $_SESSION["film_purchase"] = serialize($this->film);
$result = "resume.php"; $result = "resume.php";