Add files via upload
This commit is contained in:
		@@ -28,16 +28,7 @@
 | 
				
			|||||||
		public static function getListSessions($hall,$cinema,$date){
 | 
							public static function getListSessions($hall,$cinema,$date){
 | 
				
			||||||
			$bd = new SessionDAO('complucine');
 | 
								$bd = new SessionDAO('complucine');
 | 
				
			||||||
			if($bd ) {
 | 
								if($bd ) {
 | 
				
			||||||
				if($date)
 | 
									return $bd->getAllSessions($hall, $cinema, $date);
 | 
				
			||||||
					return $bd->getAllSessions($hall, $cinema, $date, null);
 | 
					 | 
				
			||||||
				else
 | 
					 | 
				
			||||||
					return $bd->getAllSessions($hall, $cinema, null, null);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		public static function getListSessionsBetween2Dates($hall,$cinema,$start,$end){
 | 
					 | 
				
			||||||
			$bd = new SessionDAO('complucine');
 | 
					 | 
				
			||||||
			if($bd ) {
 | 
					 | 
				
			||||||
				return $bd->getAllSessions($hall, $cinema, $start, $end);
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,36 +62,17 @@
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		//Returns a query to get all the session's data.
 | 
							//Returns a query to get all the session's data.
 | 
				
			||||||
		public function getAllSessions($hall, $cinema, $date, $end){
 | 
							public function getAllSessions($hall, $cinema, $date){
 | 
				
			||||||
			if($end){
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
				$date = $date->format("Y-m-d"); 
 | 
					 | 
				
			||||||
				$end = $end->format("Y-m-d");  
 | 
					 | 
				
			||||||
				
 | 
					 | 
				
			||||||
				// su output es date: 2021-05-30 end: 2021-07-11
 | 
					 | 
				
			||||||
				$sql = sprintf( "SELECT * FROM session WHERE 
 | 
					 | 
				
			||||||
								idcinema = '%s' AND idhall = '%s' AND date BETWEEN '%s' AND '%s' ORDER BY start_time ASC;", 
 | 
					 | 
				
			||||||
								$cinema, $hall, $date, $end);				
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			if($date && !$end){
 | 
					 | 
				
			||||||
			$date = date('Y-m-d', strtotime( $date ) ); 
 | 
								$date = date('Y-m-d', strtotime( $date ) ); 
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			$sql = sprintf( "SELECT * FROM session WHERE 
 | 
								$sql = sprintf( "SELECT * FROM session WHERE 
 | 
				
			||||||
							idcinema = '%s' AND idhall = '%s' AND date = '%s' ORDER BY start_time ASC;", 
 | 
												idcinema = '%s' AND idhall = '%s' AND date = '%s' ORDER BY start_time ASC;", 
 | 
				
			||||||
							$cinema, $hall, $date);	
 | 
												$cinema, $hall, $date);	
 | 
				
			||||||
			}else{
 | 
					 | 
				
			||||||
				$sql = sprintf( "SELECT * FROM session WHERE 
 | 
					 | 
				
			||||||
								idcinema = '%s' AND idhall = '%s' ORDER BY start_time ASC;", 
 | 
					 | 
				
			||||||
								$cinema, $hall);	
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
 | 
								$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			$sessions = null;
 | 
								$sessions = null;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			while($fila=$resul->fetch_assoc()){
 | 
								while($fila=mysqli_fetch_array($resul)){
 | 
				
			||||||
				$sessions[] = $this->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"], $fila["seats_full"]);
 | 
									$sessions[] = $this->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"], $fila["seats_full"]);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			mysqli_free_result($resul);
 | 
								mysqli_free_result($resul);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -119,8 +119,8 @@
 | 
				
			|||||||
                        <ul>
 | 
					                        <ul>
 | 
				
			||||||
                            <a href='{$prefix}'><li>Inicio</li></a>
 | 
					                            <a href='{$prefix}'><li>Inicio</li></a>
 | 
				
			||||||
                            <a href='{$prefix}showtimes/'><li>Cartelera</li></a>
 | 
					                            <a href='{$prefix}showtimes/'><li>Cartelera</li></a>
 | 
				
			||||||
                            <a href='{$prefix}promotions/'><li>Promociones</li></a>
 | 
					 | 
				
			||||||
                            <a href='{$prefix}cinemas/'><li>Nuestros Cines</li></a>
 | 
					                            <a href='{$prefix}cinemas/'><li>Nuestros Cines</li></a>
 | 
				
			||||||
 | 
					                            <a href='{$prefix}promotions/'><li>Promociones</li></a>
 | 
				
			||||||
                            <a href='{$prefix}fdicines/miembros/'><li>Quiénes somos</li></a>
 | 
					                            <a href='{$prefix}fdicines/miembros/'><li>Quiénes somos</li></a>
 | 
				
			||||||
                            <a href='{$prefix}contacto/'><li>Contacto</li></a>
 | 
					                            <a href='{$prefix}contacto/'><li>Contacto</li></a>
 | 
				
			||||||
                        </ul>
 | 
					                        </ul>
 | 
				
			||||||
@@ -228,7 +228,7 @@
 | 
				
			|||||||
                                break;
 | 
					                                break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                case "user": array_push($menus, "<a href='./?option=purchases'><li>Historial Compras</li></a>");
 | 
					                case "user": array_push($menus, "<a href='./?option=purchases'><li>Historial Compras</li></a>");
 | 
				
			||||||
                                array_push($menus, "<a href='./?option=payment'><li>Datos Pago</li></a>");
 | 
					                                //array_push($menus, "<a href='./?option=payment'><li>Datos Pago</li></a>");
 | 
				
			||||||
                                    array_push($menus, "<a href='./?option=delete_user'><li>Eliminar Usuario</li></a>");
 | 
					                                    array_push($menus, "<a href='./?option=delete_user'><li>Eliminar Usuario</li></a>");
 | 
				
			||||||
                                        break;
 | 
					                                        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,17 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					require_once __DIR__.'/includes/config.php';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require_once('../assets/php/config.php');
 | 
					use es\ucm\fdi\aw\eventos\Evento;
 | 
				
			||||||
require_once('./Evento.php');
 | 
					use es\ucm\fdi\aw\Aplicacion as App;
 | 
				
			||||||
 | 
					use es\ucm\fdi\aw\http\ContentTypeNoSoportadoException;
 | 
				
			||||||
 | 
					use es\ucm\fdi\aw\http\ParametroNoValidoException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Procesamos la cabecera Content-Type
 | 
					// Procesamos la cabecera Content-Type
 | 
				
			||||||
$contentType= $_SERVER['CONTENT_TYPE'] ?? 'application/json';
 | 
					$contentType= $_SERVER['CONTENT_TYPE'] ?? 'application/json';
 | 
				
			||||||
$contentType = strtolower(str_replace(' ', '', $contentType));
 | 
					$contentType = strtolower(str_replace(' ', '', $contentType));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Verificamos corresponde con uno de los tipos soportados
 | 
					// Verificamos corresponde con uno de los tipos soportados
 | 
				
			||||||
$acceptedContentTypes = array('application/json;charset=utf-8', 'application/json');
 | 
					$acceptedContentTypes = array('application/json;charset=utf-8', 'application/json');
 | 
				
			||||||
$found = false;
 | 
					$found = false;
 | 
				
			||||||
@@ -18,7 +23,7 @@ foreach ($acceptedContentTypes as $acceptedContentType) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (!$found) {
 | 
					if (!$found) {
 | 
				
			||||||
    // throw new ContentTypeNoSoportadoException('Este servicio REST sólo soporta el content-type application/json');
 | 
					    throw new ContentTypeNoSoportadoException('Este servicio REST sólo soporta el content-type application/json');
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$result = null;
 | 
					$result = null;
 | 
				
			||||||
@@ -40,7 +45,6 @@ switch($_SERVER['REQUEST_METHOD']) {
 | 
				
			|||||||
            $start = filter_input(INPUT_GET, 'start', FILTER_VALIDATE_REGEXP,  array("options" => array("regexp"=>"/\d{4}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3[0-1]))/")));
 | 
					            $start = filter_input(INPUT_GET, 'start', FILTER_VALIDATE_REGEXP,  array("options" => array("regexp"=>"/\d{4}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3[0-1]))/")));
 | 
				
			||||||
            $end = filter_input(INPUT_GET, 'end', FILTER_VALIDATE_REGEXP, array("options" => array("default" => null, "regexp"=>"/\d{4}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3[0-1]))/")));
 | 
					            $end = filter_input(INPUT_GET, 'end', FILTER_VALIDATE_REGEXP, array("options" => array("default" => null, "regexp"=>"/\d{4}-((0[1-9])|(1[0-2]))-((0[1-9])|([1-2][0-9])|(3[0-1]))/")));
 | 
				
			||||||
            if ($start) {              
 | 
					            if ($start) {              
 | 
				
			||||||
					
 | 
					 | 
				
			||||||
                $startDateTime = $start . ' 00:00:00';
 | 
					                $startDateTime = $start . ' 00:00:00';
 | 
				
			||||||
                $endDateTime = $end;
 | 
					                $endDateTime = $end;
 | 
				
			||||||
                if ($end) {
 | 
					                if ($end) {
 | 
				
			||||||
@@ -48,11 +52,11 @@ switch($_SERVER['REQUEST_METHOD']) {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                $result = Evento::buscaEntreFechas(1, $startDateTime, $endDateTime);
 | 
					                $result = Evento::buscaEntreFechas(1, $startDateTime, $endDateTime);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
				
 | 
					 | 
				
			||||||
                // Comprobamos si es una lista de eventos completa
 | 
					                // Comprobamos si es una lista de eventos completa
 | 
				
			||||||
                $result = Evento::buscaTodosEventos(1); // HACK: normalmente debería de ser App::getSingleton()->idUsuario();
 | 
					                $result = Evento::buscaTodosEventos(1); // HACK: normalmente debería de ser App::getSingleton()->idUsuario();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Generamos un array de eventos en formato JSON
 | 
					        // Generamos un array de eventos en formato JSON
 | 
				
			||||||
        $json = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
 | 
					        $json = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -66,17 +70,18 @@ switch($_SERVER['REQUEST_METHOD']) {
 | 
				
			|||||||
    case 'POST':
 | 
					    case 'POST':
 | 
				
			||||||
        // 1. Leemos el contenido que nos envían
 | 
					        // 1. Leemos el contenido que nos envían
 | 
				
			||||||
        $entityBody = file_get_contents('php://input');
 | 
					        $entityBody = file_get_contents('php://input');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 2. Verificamos que nos envían un objeto
 | 
					        // 2. Verificamos que nos envían un objeto
 | 
				
			||||||
        $dictionary = json_decode($entityBody);
 | 
					        $dictionary = json_decode($entityBody);
 | 
				
			||||||
        if (!is_object($dictionary)) {
 | 
					        if (!is_object($dictionary)) {
 | 
				
			||||||
            //throw new ParametroNoValidoException('El cuerpo de la petición no es valido');
 | 
					            throw new ParametroNoValidoException('El cuerpo de la petición no es valido');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        // 3. Reprocesamos el cuerpo de la petición como un array PHP
 | 
					        // 3. Reprocesamos el cuerpo de la petición como un array PHP
 | 
				
			||||||
        $dictionary = json_decode($entityBody, true);
 | 
					        $dictionary = json_decode($entityBody, true);
 | 
				
			||||||
        $dictionary['userId'] = 1;// HACK: normalmente debería de ser App::getSingleton()->idUsuario();
 | 
					        $dictionary['userId'] = 1;// HACK: normalmente debería de ser App::getSingleton()->idUsuario();
 | 
				
			||||||
        $e = Evento::creaDesdeDicionario($dictionary);
 | 
					        $e = Evento::creaDesdeDicionario($dictionary);
 | 
				
			||||||
        
 | 
					        error_log("hmmm");
 | 
				
			||||||
        // 4. Guardamos el evento en BD
 | 
					        // 4. Guardamos el evento en BD
 | 
				
			||||||
        $result = Evento::guardaOActualiza($e);
 | 
					        $result = Evento::guardaOActualiza($e);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
@@ -91,7 +96,6 @@ switch($_SERVER['REQUEST_METHOD']) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
    case 'PUT':
 | 
					    case 'PUT':
 | 
				
			||||||
		error_log("PUT");
 | 
					 | 
				
			||||||
        // 1. Comprobamos si es una consulta de un evento concreto -> eventos.php?idEvento=XXXXX
 | 
					        // 1. Comprobamos si es una consulta de un evento concreto -> eventos.php?idEvento=XXXXX
 | 
				
			||||||
        $idEvento = filter_input(INPUT_GET, 'idEvento', FILTER_VALIDATE_INT);
 | 
					        $idEvento = filter_input(INPUT_GET, 'idEvento', FILTER_VALIDATE_INT);
 | 
				
			||||||
        // 2. Leemos el contenido que nos envían
 | 
					        // 2. Leemos el contenido que nos envían
 | 
				
			||||||
@@ -99,10 +103,9 @@ switch($_SERVER['REQUEST_METHOD']) {
 | 
				
			|||||||
        // 3. Verificamos que nos envían un objeto
 | 
					        // 3. Verificamos que nos envían un objeto
 | 
				
			||||||
        $dictionary = json_decode($entityBody);
 | 
					        $dictionary = json_decode($entityBody);
 | 
				
			||||||
        if (!is_object($dictionary)) {
 | 
					        if (!is_object($dictionary)) {
 | 
				
			||||||
            //throw new ParametroNoValidoException('El cuerpo de la petición no es valido');
 | 
					            throw new ParametroNoValidoException('El cuerpo de la petición no es valido');
 | 
				
			||||||
        }    
 | 
					        }    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
        // 4. Reprocesamos el cuerpo de la petición como un array PHP
 | 
					        // 4. Reprocesamos el cuerpo de la petición como un array PHP
 | 
				
			||||||
        $dictionary = json_decode($entityBody, true);
 | 
					        $dictionary = json_decode($entityBody, true);
 | 
				
			||||||
        $e = Evento::buscaPorId($idEvento);
 | 
					        $e = Evento::buscaPorId($idEvento);
 | 
				
			||||||
@@ -129,6 +132,8 @@ switch($_SERVER['REQUEST_METHOD']) {
 | 
				
			|||||||
        header('Content-Length: 0');
 | 
					        header('Content-Length: 0');
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
        //throw new MetodoNoSoportadoException($_SERVER['REQUEST_METHOD']. ' no está soportado');
 | 
					        throw new MetodoNoSoportadoException($_SERVER['REQUEST_METHOD']. ' no está soportado');
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										65
									
								
								panel_manager/includes/processForm.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								panel_manager/includes/processForm.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
				
			|||||||
 | 
					<?php 
 | 
				
			||||||
 | 
						//General Config File:
 | 
				
			||||||
 | 
					    require_once('../../assets/php/config.php');
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						$prefix ="../../";
 | 
				
			||||||
 | 
						include_once('formHall.php');	
 | 
				
			||||||
 | 
						include_once('formSession.php');
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if(isset($_POST['new_hall'])){
 | 
				
			||||||
 | 
							$data = array("option" => "new_hall","number" => $_POST["number"],"cols" => $_POST["cols"],"rows" => $_POST["rows"], "cinema" => $_SESSION["cinema"], "seats" => 0);
 | 
				
			||||||
 | 
							//Check what checkboxs are seats or not
 | 
				
			||||||
 | 
							for($i = 1;$i<=$data["rows"];$i++){
 | 
				
			||||||
 | 
								for($j=1; $j<=$data["cols"]; $j++){
 | 
				
			||||||
 | 
									if(!empty($_POST['checkbox'.$i.$j.''])){
 | 
				
			||||||
 | 
										$data[$i][$j] = $_POST['checkbox'.$i.$j.''];
 | 
				
			||||||
 | 
										$data["seats"]++;
 | 
				
			||||||
 | 
									} else $data[$i][$j] = "-1";
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							FormHall::processesForm($data);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(isset($_POST['edit_hall'])){
 | 
				
			||||||
 | 
							$data = array("option" => "edit_hall","number" => $_POST["number"],"cols" => $_POST["cols"],"rows" => $_POST["rows"], "cinema" => $_SESSION["cinema"],"seats" => 0);
 | 
				
			||||||
 | 
							//Check what checkboxs are seats or not
 | 
				
			||||||
 | 
							for($i = 1;$i<=$data["rows"];$i++){
 | 
				
			||||||
 | 
								for($j=1; $j<=$data["cols"]; $j++){
 | 
				
			||||||
 | 
									if(!empty($_POST['checkbox'.$i.$j.''])){
 | 
				
			||||||
 | 
										$data[$i][$j] = $_POST['checkbox'.$i.$j.''];
 | 
				
			||||||
 | 
										$data["seats"]++;
 | 
				
			||||||
 | 
									} else $data[$i][$j] = "-1";
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							FormHall::processesForm($data);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(isset($_POST['delete_hall'])){
 | 
				
			||||||
 | 
							$data = array("option" => "delete_hall","number" => $_POST["number"], "cinema" => $_SESSION["cinema"]);
 | 
				
			||||||
 | 
							FormHall::processesForm($data);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if(isset($_POST['new_session'])){
 | 
				
			||||||
 | 
							$data = array("option" => "new_session","film" => $_POST["film"],"hall" => $_POST["hall"],"date" => $_POST["date"],"start" => $_POST["start"]
 | 
				
			||||||
 | 
								,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"]);
 | 
				
			||||||
 | 
							FormSession::processesForm($data);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(isset($_POST['edit_session'])){
 | 
				
			||||||
 | 
							$data = array("option" => "edit_session","film" => $_POST["film"],"hall" => $_POST["hall"],"date" => $_POST["date"],"start" => $_POST["start"]
 | 
				
			||||||
 | 
								,"price" => $_POST["price"],"format" => $_POST["format"],"repeat" => $_POST["repeat"], "cinema" => $_SESSION["cinema"]
 | 
				
			||||||
 | 
								, "origin_hall"=>$_SESSION["or_hall"],"origin_date"=> $_SESSION["or_date"],"origin_start"=> $_SESSION["or_start"]);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							$_SESSION["or_hall"] = "";
 | 
				
			||||||
 | 
							$_SESSION["or_date"] = "";
 | 
				
			||||||
 | 
							$_SESSION["or_start"] = "";
 | 
				
			||||||
 | 
							FormSession::processesForm($data);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(isset($_POST['delete_session'])){
 | 
				
			||||||
 | 
							$data = array("option" => "delete_session","cinema" => $_SESSION["cinema"], "hall"=> $_POST["origin_hall"]
 | 
				
			||||||
 | 
										 ,"date"=> $_POST["origin_date"],"start"=> $_POST["origin_start"]);
 | 
				
			||||||
 | 
							FormSession::processesForm($data);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					?>
 | 
				
			||||||
@@ -5,21 +5,20 @@
 | 
				
			|||||||
     header:{
 | 
					     header:{
 | 
				
			||||||
      left:'prev,next today',
 | 
					      left:'prev,next today',
 | 
				
			||||||
      center:'title',
 | 
					      center:'title',
 | 
				
			||||||
     right:'month,agendaWeek,agendaDay'
 | 
					    right:''
 | 
				
			||||||
     },
 | 
					     },
 | 
				
			||||||
     events: 'eventos.php',
 | 
					     events: 'eventos.php',
 | 
				
			||||||
     selectable:true,
 | 
					     selectable:true,
 | 
				
			||||||
     selectHelper:true,
 | 
					     selectHelper:true,
 | 
				
			||||||
	timeFormat: 'H:mm',
 | 
					 | 
				
			||||||
     select: function(start, end, allDay)
 | 
					     select: function(start, end, allDay)
 | 
				
			||||||
     {
 | 
					     {
 | 
				
			||||||
     var title = prompt("Enter Event Title");
 | 
					      var title = confirm("¿Estas son las fechas correctas?");
 | 
				
			||||||
      if(title)
 | 
					      if(title)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
       var e = {
 | 
					       var e = {
 | 
				
			||||||
         "start" : $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss"),
 | 
					         "start" : $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss"),
 | 
				
			||||||
         "end"   : $.fullCalendar.formatDate(end, "Y-MM-DD HH:mm:ss"),
 | 
					         "end"   : $.fullCalendar.formatDate(end, "Y-MM-DD HH:mm:ss"),
 | 
				
			||||||
        "title" : title
 | 
					 | 
				
			||||||
       };
 | 
					       };
 | 
				
			||||||
       $.ajax({
 | 
					       $.ajax({
 | 
				
			||||||
        url:"eventos.php",
 | 
					        url:"eventos.php",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,7 @@ class FormDeleteAccount extends Form {
 | 
				
			|||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class='actions'>
 | 
					                            <div class='actions'>
 | 
				
			||||||
                                <!-- <input type='submit' id='submit' value='Eliminar Cuenta de Usuario' class='primary' /> -->
 | 
					                                <!-- <input type='submit' id='submit' value='Eliminar Cuenta de Usuario' class='primary' /> -->
 | 
				
			||||||
                                <button class='danger' onclick='confirmDelete(event)'>Eliminar Cuenta de Usuario</button>
 | 
					                                <button class='danger' onclick='confirmDelete(event)'>Eliminar Usuario</button>
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                        </div>";
 | 
					                        </div>";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,13 +41,19 @@ class FormPurchase extends Form {
 | 
				
			|||||||
        $hallDAO = new HallDAO("complucine");
 | 
					        $hallDAO = new HallDAO("complucine");
 | 
				
			||||||
        $this->hall = $hallDAO->HallData($this->session->getIdhall());
 | 
					        $this->hall = $hallDAO->HallData($this->session->getIdhall());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->seat = array();
 | 
				
			||||||
 | 
					        $this->row = array();
 | 
				
			||||||
 | 
					        $this->col = array();
 | 
				
			||||||
        $rows = $this->hall->getNumRows();
 | 
					        $rows = $this->hall->getNumRows();
 | 
				
			||||||
        $cols = $this->hall->getNumCol();
 | 
					        $cols = $this->hall->getNumCol();
 | 
				
			||||||
        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])){ $this->seat = "(Fila) ".$i." - (Columna) ".$j; $this->row = $i; $this->col = $j; }
 | 
					                if(isset($_POST["checkbox".$seat])){ 
 | 
				
			||||||
 | 
					                    array_push($this->seat, $i."-".$j);
 | 
				
			||||||
 | 
					                    array_push($this->row, $i); 
 | 
				
			||||||
 | 
					                    array_push($this->col, $j); 
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -89,6 +95,11 @@ class FormPurchase extends Form {
 | 
				
			|||||||
                       <p>Vuelva atrás para selecionar otra sesión.</p>
 | 
					                       <p>Vuelva atrás para selecionar otra sesión.</p>
 | 
				
			||||||
                    </div>";
 | 
					                    </div>";
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
 | 
					            $seats = "";
 | 
				
			||||||
 | 
					            foreach($this->seat as $value){
 | 
				
			||||||
 | 
					                $seats .= $value.", ";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $html = "<div class='row'>
 | 
					            $html = "<div class='row'>
 | 
				
			||||||
                            <fieldset id='datos_entrada'>
 | 
					                            <fieldset id='datos_entrada'>
 | 
				
			||||||
                                <legend>Resumen de la Compra</legend>
 | 
					                                <legend>Resumen de la Compra</legend>
 | 
				
			||||||
@@ -96,10 +107,10 @@ class FormPurchase extends Form {
 | 
				
			|||||||
                                <p>Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."</p>
 | 
					                                <p>Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."</p>
 | 
				
			||||||
                                <p>Cine: ".$this->cinema->getName()."</p>
 | 
					                                <p>Cine: ".$this->cinema->getName()."</p>
 | 
				
			||||||
                                <p>Sala: ".$this->session->getIdhall()."</p>
 | 
					                                <p>Sala: ".$this->session->getIdhall()."</p>
 | 
				
			||||||
                                <p>Asiento: ".$this->seat."</p>
 | 
					                                <p>Asiento(s):".$seats."</p>
 | 
				
			||||||
                                <p>Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."</p>
 | 
					                                <p>Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."</p>
 | 
				
			||||||
                                <p>Hora: ".$this->session->getStartTime()."</p>
 | 
					                                <p>Hora: ".$this->session->getStartTime()."</p>
 | 
				
			||||||
                                <p>Precio: ".$this->session->getSeatPrice()."€</p>
 | 
					                                <p>Precio: ".$this->session->getSeatPrice()*count($this->seat)."€</p>
 | 
				
			||||||
                            </fieldset>
 | 
					                            </fieldset>
 | 
				
			||||||
                            <fieldset id='pagar_entrada'><pre>".$htmlErroresGlobales."</pre>
 | 
					                            <fieldset id='pagar_entrada'><pre>".$htmlErroresGlobales."</pre>
 | 
				
			||||||
                                <legend>Datos Bancarios</legend>
 | 
					                                <legend>Datos Bancarios</legend>
 | 
				
			||||||
@@ -124,8 +135,8 @@ class FormPurchase extends Form {
 | 
				
			|||||||
                            </fieldset>
 | 
					                            </fieldset>
 | 
				
			||||||
                            <div class='actions'> 
 | 
					                            <div class='actions'> 
 | 
				
			||||||
                                <input type='hidden' name='sessions' id='sessions' value='".$_POST["sessions"]."' />
 | 
					                                <input type='hidden' name='sessions' id='sessions' value='".$_POST["sessions"]."' />
 | 
				
			||||||
                                <input type='hidden' name='row' id='row' value='".$this->row."' />
 | 
					                                <input type='hidden' name='row' id='row' value='".serialize($this->row)."' />
 | 
				
			||||||
                                <input type='hidden' name='col' id='col' value='".$this->col."' />
 | 
					                                <input type='hidden' name='col' id='col' value='".serialize($this->col)."' />
 | 
				
			||||||
                                <input type='submit' id='submit' value='Pagar' class='primary' />
 | 
					                                <input type='submit' id='submit' value='Pagar' class='primary' />
 | 
				
			||||||
                                <input type='reset' id='reset' value='Borrar' />       
 | 
					                                <input type='reset' id='reset' value='Borrar' />       
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
@@ -168,7 +179,10 @@ class FormPurchase extends Form {
 | 
				
			|||||||
        if (count($result) === 0) {
 | 
					        if (count($result) === 0) {
 | 
				
			||||||
           if(isset($_SESSION["login"]) && $_SESSION["login"] == true){
 | 
					           if(isset($_SESSION["login"]) && $_SESSION["login"] == true){
 | 
				
			||||||
                $purchaseDAO = new PurchaseDAO("complucine");
 | 
					                $purchaseDAO = new PurchaseDAO("complucine");
 | 
				
			||||||
                if($purchaseDAO->createPurchase(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), $datos["row"], $datos["col"], date("Y-m-d H:i:s"))){
 | 
					                $count = count(unserialize($datos["row"]));
 | 
				
			||||||
 | 
					                $rows =  unserialize($datos["row"]); $cols =  unserialize($datos["col"]);
 | 
				
			||||||
 | 
					                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"))){
 | 
				
			||||||
                        $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"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        $_SESSION["purchase"] = serialize($purchase);
 | 
					                        $_SESSION["purchase"] = serialize($purchase);
 | 
				
			||||||
@@ -177,6 +191,7 @@ class FormPurchase extends Form {
 | 
				
			|||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        $result[] = "Error al realizar la compra.";
 | 
					                        $result[] = "Error al realizar la compra.";
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
           } 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"));
 | 
				
			||||||
                $_SESSION["purchase"] = serialize($purchase);
 | 
					                $_SESSION["purchase"] = serialize($purchase);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,11 @@
 | 
				
			|||||||
        $cinemaDAO = new Cinema_DAO("complucine");
 | 
					        $cinemaDAO = new Cinema_DAO("complucine");
 | 
				
			||||||
        $cinema = $cinemaDAO->cinemaData($purchase->getCinemaId());
 | 
					        $cinema = $cinemaDAO->cinemaData($purchase->getCinemaId());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $seat = 1; //$_POST[];
 | 
					        $seatsArray = array_combine(unserialize($purchase->getRow()), unserialize($purchase->getColumn()));
 | 
				
			||||||
 | 
					        $seats = "";
 | 
				
			||||||
 | 
					        foreach($seatsArray as $key=>$value){
 | 
				
			||||||
 | 
					            $seats .= $key."-".$value.", ";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        unset($_SESSION["purchase"]);
 | 
					        unset($_SESSION["purchase"]);
 | 
				
			||||||
        unset($_SESSION["film_purchase"]);
 | 
					        unset($_SESSION["film_purchase"]);
 | 
				
			||||||
@@ -29,16 +33,14 @@
 | 
				
			|||||||
                        <p>Película: ".str_replace('_', ' ', strtoupper($film_purchase->getTittle()))."</p>
 | 
					                        <p>Película: ".str_replace('_', ' ', strtoupper($film_purchase->getTittle()))."</p>
 | 
				
			||||||
                        <p>Duración: ".$film_purchase->getDuration()." minutos</p>
 | 
					                        <p>Duración: ".$film_purchase->getDuration()." minutos</p>
 | 
				
			||||||
                        <p>Idioma: ".$film_purchase->getLanguage()."</p>
 | 
					                        <p>Idioma: ".$film_purchase->getLanguage()."</p>
 | 
				
			||||||
                        <p>Precio: ".$session->getSeatPrice()." €</p>
 | 
					                        <p>Precio: ".$session->getSeatPrice()*count(unserialize($purchase->getRow()))." €</p>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    <div class='column right'>
 | 
					                    <div class='column right'>
 | 
				
			||||||
                        <p>Sesión (Fecha): ".$session->getDate()."</p>
 | 
					                        <p>Sesión (Fecha): ".$session->getDate()."</p>
 | 
				
			||||||
                        <p>Sesión (Hora): ".$session->getStartTime()."</p>
 | 
					                        <p>Sesión (Hora): ".$session->getStartTime()."</p>
 | 
				
			||||||
                        <p>Cine: ".$cinema->getName()."</p>
 | 
					                        <p>Cine: ".$cinema->getName()."</p>
 | 
				
			||||||
                        <p>Sala: ".$purchase->getHallId()."</p>
 | 
					                        <p>Sala: ".$purchase->getHallId()."</p>
 | 
				
			||||||
                        <p>Asiento: ".$seat."</p>
 | 
					                        <p>Asiento(s): ".$seats."</p>
 | 
				
			||||||
                        <p>Asiento (Columna): ".$purchase->getRow()."</p>
 | 
					 | 
				
			||||||
                        <p>Asiento (Fila): ".$purchase->getColumn()."</p>
 | 
					 | 
				
			||||||
                        <p>Fecha de la Compra: ".$purchase->getTime()."</p>
 | 
					                        <p>Fecha de la Compra: ".$purchase->getTime()."</p>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    ";
 | 
					                    ";
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user