Deberia estar todo hecho
This commit is contained in:
parent
a3bc2311e5
commit
2a09ad18b9
@ -10,10 +10,11 @@
|
|||||||
|
|
||||||
require_once('../panel_admin/includes/film_dto.php');
|
require_once('../panel_admin/includes/film_dto.php');
|
||||||
include_once('../panel_admin/includes/film_dao.php');
|
include_once('../panel_admin/includes/film_dao.php');
|
||||||
$cinema = "1";
|
|
||||||
|
|
||||||
$formHall = new FormHall();
|
$formHall = new FormHall();
|
||||||
$formHall->processesForm(null, $cinema, null, null, "list");
|
$formHall->processesForm(null, $_SESSION["cinema"], null, null, "list");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$filmList = new Film_DAO('complucine');
|
$filmList = new Film_DAO('complucine');
|
||||||
|
|
||||||
@ -24,14 +25,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_REQUEST['option']) && $_REQUEST['option'] == 'edit') {
|
if(isset($_REQUEST['option']) && $_REQUEST['option'] == 'edit') {
|
||||||
|
$_SESSION["hall"] = $_POST['hall'];
|
||||||
|
$_SESSION["date"] = $_POST['date'];
|
||||||
|
$_SESSION["start"] = $_POST['start'];
|
||||||
|
|
||||||
echo " <div class = \"column middle\">
|
echo " <div class = \"column middle\">
|
||||||
<h2>Editar/Eliminar Sesion</h2>
|
<h2>Editar/Eliminar Sesion</h2>
|
||||||
<form method=\"post\" id=\"edit_ses\" action=\"validateSession.php\">
|
<form method=\"post\" id=\"edit_ses\" action=\"validateSession.php\">
|
||||||
<div class=\"row\">
|
<div class=\"row\">
|
||||||
<fieldset id=\"datos\">
|
<fieldset id=\"datos\">
|
||||||
<legend>Datos</legend>
|
<legend>Datos</legend>
|
||||||
<input name=\"cinema\" type=\"hidden\" value=\"". $_POST['idcinema']."\">
|
|
||||||
<input name=\"id\" type=\"hidden\" value=\"". $_POST['id']."\">
|
|
||||||
<div class=\"_price\">
|
<div class=\"_price\">
|
||||||
<input type=\"number\" name=\"price\" id=\"price\" value=\"". $_POST['price'] ."\"min=\"0\" placeholder=\"Precio de la entrada\" required/>
|
<input type=\"number\" name=\"price\" id=\"price\" value=\"". $_POST['price'] ."\"min=\"0\" placeholder=\"Precio de la entrada\" required/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,7 +21,6 @@ class FormHall extends Form {
|
|||||||
//Returns validation response:
|
//Returns validation response:
|
||||||
public function getReply() {
|
public function getReply() {
|
||||||
|
|
||||||
echo "<p> se va a devolver una respuesta </p>";
|
|
||||||
if($this->correct){
|
if($this->correct){
|
||||||
if($this->option == "new"){
|
if($this->option == "new"){
|
||||||
$this->reply = "<h1> Operacion realizada con exito </h1><hr />
|
$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>
|
<p> Se ha eliminado la sala correctamente en la base de datos.</p>
|
||||||
<a href='../panel_manager/index.php'><button>Panel Gerente</button></a>";
|
<a href='../panel_manager/index.php'><button>Panel Gerente</button></a>";
|
||||||
}else if($this->option == "list"){
|
}else if($this->option == "list"){
|
||||||
echo "<p> se va a devolver la lista </p>";
|
|
||||||
$this->reply = $this->halls;
|
$this->reply = $this->halls;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -42,7 +42,7 @@ class FormSession extends Form {
|
|||||||
return $this->reply;
|
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->option = $option;
|
||||||
$this->correct = true;
|
$this->correct = true;
|
||||||
|
|
||||||
@ -58,21 +58,21 @@ class FormSession extends Form {
|
|||||||
if($searchSession) {
|
if($searchSession) {
|
||||||
$this->correct = false;
|
$this->correct = false;
|
||||||
} else{
|
} 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"){
|
} else if ($option == "del"){
|
||||||
$bd->deleteSession($id);
|
$bd->deleteSession($hall, $cinema, $date, $start);
|
||||||
|
|
||||||
} else if ($option == "edit"){
|
} 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"){
|
if($repeat > "0"){
|
||||||
$repeat--;
|
$repeat--;
|
||||||
$date = date('Y-m-d', strtotime( $date. ' +1 day') );
|
$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;}
|
} else {$this->correct = false;}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('../assets/php/dao.php');
|
require_once('../assets/php/dao.php');
|
||||||
include_once('session_dto.php');
|
include_once('session_dto.php');
|
||||||
|
|
||||||
class SessionDAO extends DAO {
|
class SessionDAO extends DAO {
|
||||||
//Constructor:
|
//Constructor:
|
||||||
function __construct($bd_name){
|
function __construct($bd_name){
|
||||||
@ -68,7 +68,7 @@
|
|||||||
return $sessions;
|
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);
|
$format = $this->mysqli->real_escape_string($format);
|
||||||
$date = date('Y-m-d', strtotime( $date ) );
|
$date = date('Y-m-d', strtotime( $date ) );
|
||||||
$startTime = date('H:i:s', strtotime( $startTime ) );
|
$startTime = date('H:i:s', strtotime( $startTime ) );
|
||||||
@ -76,17 +76,20 @@
|
|||||||
$sql = sprintf( "UPDATE `session`
|
$sql = sprintf( "UPDATE `session`
|
||||||
SET `idfilm` = '%d' , `idhall` = '%d', `idcinema` = '%d', `date` = '%s',
|
SET `idfilm` = '%d' , `idhall` = '%d', `idcinema` = '%d', `date` = '%s',
|
||||||
`start_time` = '%s', `seat_price` = '%d', `format` = '%s'
|
`start_time` = '%s', `seat_price` = '%d', `format` = '%s'
|
||||||
WHERE `session`.`id` = '%d';",
|
WHERE
|
||||||
$idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $id);
|
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');
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||||
|
|
||||||
return $resul;
|
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');
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||||
|
|
||||||
|
@ -16,15 +16,16 @@
|
|||||||
|
|
||||||
$placeholder_date = date("Y-m-d");
|
$placeholder_date = date("Y-m-d");
|
||||||
$placeholder_hall = "1";
|
$placeholder_hall = "1";
|
||||||
$cinema = "1";
|
|
||||||
|
$_SESSION["cinema"] = "1";
|
||||||
|
|
||||||
if(isset($_POST['filter'])) {
|
if(isset($_POST['filter'])) {
|
||||||
$placeholder_date = $_POST["date"];
|
$placeholder_date = $_POST["date"];
|
||||||
$placeholder_hall = $_POST["hall"];
|
$placeholder_hall = $_POST["hall"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$formHall->processesForm(null, $cinema, null, null, "list");
|
$formHall->processesForm(null, $_SESSION["cinema"], null, null, "list");
|
||||||
$formSession->processesForm(null, null, $placeholder_hall, $cinema, $placeholder_date, null, null, null, null, "list");
|
$formSession->processesForm(null, $placeholder_hall, $_SESSION["cinema"], $placeholder_date, null, null, null, null, "list");
|
||||||
|
|
||||||
echo"
|
echo"
|
||||||
<!--Session Filter -->
|
<!--Session Filter -->
|
||||||
@ -72,10 +73,8 @@
|
|||||||
<td> " . $s->getFormat() . "</a></td>
|
<td> " . $s->getFormat() . "</a></td>
|
||||||
<td> " . $s->getSeatPrice() . "</a></td>
|
<td> " . $s->getSeatPrice() . "</a></td>
|
||||||
<form method=\"post\" action=\"./?state=edit_session&option=edit\">
|
<form method=\"post\" action=\"./?state=edit_session&option=edit\">
|
||||||
<input name=\"id\" type=\"hidden\" value=\"".$s->getId()."\">
|
|
||||||
<input name=\"idfilm\" type=\"hidden\" value=\"".$s->getIdfilm()."\">
|
<input name=\"idfilm\" type=\"hidden\" value=\"".$s->getIdfilm()."\">
|
||||||
<input name=\"hall\" type=\"hidden\" value=\"".$s->getIdhall()."\">
|
<input name=\"hall\" type=\"hidden\" value=\"".$s->getIdhall()."\">
|
||||||
<input name=\"idcinema\" type=\"hidden\" value=\"".$s->getIdcinema()."\">
|
|
||||||
<input name=\"date\" type=\"hidden\" value=\"".$s->getDate()."\">
|
<input name=\"date\" type=\"hidden\" value=\"".$s->getDate()."\">
|
||||||
<input name=\"start\" type=\"hidden\" value=\"".$s->getStartTime()."\">
|
<input name=\"start\" type=\"hidden\" value=\"".$s->getStartTime()."\">
|
||||||
<input name=\"price\" type=\"hidden\" value=\"".$s->getSeatPrice()."\">
|
<input name=\"price\" type=\"hidden\" value=\"".$s->getSeatPrice()."\">
|
||||||
|
@ -6,16 +6,28 @@
|
|||||||
$reply = "<p> ERROR DE ACCESO </p>" ;
|
$reply = "<p> ERROR DE ACCESO </p>" ;
|
||||||
|
|
||||||
if(isset($_POST['new'])){
|
if(isset($_POST['new'])){
|
||||||
$session->processesForm(null, $_POST["film"], $_POST["hall"], $_POST["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],$_POST["repeat"], "new");
|
$session->processesForm($_POST["film"], $_POST["hall"], $_SESSION["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],$_POST["repeat"], "new");
|
||||||
$reply = $session->getReply();
|
$reply = $session->getReply();
|
||||||
|
$_SESSION["cinema"] = "";
|
||||||
|
$_SESSION["hall"] = "";
|
||||||
|
$_SESSION["date"] = "";
|
||||||
|
$_SESSION["start"] = "";
|
||||||
|
|
||||||
} else if (isset($_POST['edit'])){
|
} else if (isset($_POST['edit'])){
|
||||||
$session->processesForm($_POST["id"], $_POST["film"], $_POST["hall"], $_POST["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],"0", "edit");
|
$session->processesForm($_POST["film"], $_POST["hall"], $_SESSION["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],"0", "edit");
|
||||||
$reply = $session->getReply();
|
$reply = $session->getReply();
|
||||||
|
$_SESSION["cinema"] = "";
|
||||||
|
$_SESSION["hall"] = "";
|
||||||
|
$_SESSION["date"] = "";
|
||||||
|
$_SESSION["start"] = "";
|
||||||
|
|
||||||
} else if (isset($_POST['del'])){
|
} else if (isset($_POST['del'])){
|
||||||
$session->processesForm($_POST["id"], $_POST["film"], $_POST["hall"], $_POST["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],"0", "del");
|
$session->processesForm($_POST["film"], $_POST["hall"], $_SESSION["cinema"],$_POST["date"],$_POST["start"],$_POST["price"],$_POST["format"],"0", "del");
|
||||||
$reply = $session->getReply();
|
$reply = $session->getReply();
|
||||||
|
$_SESSION["cinema"] = "";
|
||||||
|
$_SESSION["hall"] = "";
|
||||||
|
$_SESSION["date"] = "";
|
||||||
|
$_SESSION["start"] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user