From e1fe17d695cdf8ab3056aac5511899fd7c3bbcd7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fernando=20M=C3=A9ndez?=
 <45081533+FerMdez@users.noreply.github.com>
Date: Fri, 2 Jul 2021 17:54:39 +0200
Subject: [PATCH] Delete panel_manager directory
---
 panel_manager/eventsProcess.php        | 258 -------------------------
 panel_manager/includes/SessionForm.php | 103 ----------
 panel_manager/includes/formHall.php    | 226 ----------------------
 panel_manager/index.php                | 159 ---------------
 panel_manager/panel_manager.php        | 223 ---------------------
 5 files changed, 969 deletions(-)
 delete mode 100644 panel_manager/eventsProcess.php
 delete mode 100644 panel_manager/includes/SessionForm.php
 delete mode 100644 panel_manager/includes/formHall.php
 delete mode 100644 panel_manager/index.php
 delete mode 100644 panel_manager/panel_manager.php
diff --git a/panel_manager/eventsProcess.php b/panel_manager/eventsProcess.php
deleted file mode 100644
index ff215f6..0000000
--- a/panel_manager/eventsProcess.php
+++ /dev/null
@@ -1,258 +0,0 @@
-{"price"} ?? "";
-		$format = $dictionary->{"format"} ?? "";
-		$hall = $dictionary->{"hall"} ?? "";		
-		$startDate = $dictionary->{"startDate"} ?? "";
-		$endDate = $dictionary->{"endDate"} ?? "";		
-		$startHour = $dictionary->{"startHour"} ?? "";		
-		$idfilm = $dictionary->{"idFilm"} ?? "";	
-		
-		//Check errors in inputs
-		if (empty($price) || $price <= 0 ) 
-			$errors['price'] = 'El precio no puede ser 0.';
-		if (empty($format)) 
-			$errors['format'] = 'El formato no puede estar vacio. Ej: 3D, 2D, voz original';
-		if (empty($hall) || $hall<=0 ) 
-			$errors['hall'] = 'La sala no puede ser 0 o menor';
-		if (empty($startDate)) 
-			$errors['startDate'] = 'Las sesiones tienen que empezar algun dia.';
-		else if (empty($endDate)) 
-			$errors['endDate'] = 'Las sesiones tienen que teminar algun dia.';
-		else {
-			$start = strtotime($startDate);
-			$end = strtotime($endDate);
-			$start = date('Y-m-d', $start);
-			$end = date('Y-m-d', $end);
-			
-			if($start > $end)
-				$errors['date'] = 'La fecha inicial no puede ser antes o el mismo dia que la final.';
-		}
-		if (empty($startHour)) 
-			$errors['startHour'] = 'Es necesario escoger el horario de la sesion.';
-		
-		if (!is_numeric($idfilm) && $idfilm <= 0 ) 
-			$errors['idfilm'] = 'No se ha seleccionado una pelicula.';
-		
-		//Create as many sessions as the diference between start and end date tell us. 1 session per day
-		while($startDate < $endDate && empty($errors)){
-				$msg = Session::create_session($_SESSION["cinema"], $hall, $startHour, $startDate, $idfilm, $price, $format);
-				
-				if(strcmp($msg,$correct_response)!== 0)
-					$errors['global'] = $msg;
-				else
-					$data['message'] = $msg;
-				
-				$startDate = date('Y-m-d H:i:s', strtotime( $startDate . ' +1 day'));
-		}
-		
-		if (!empty($errors)) {
-			$data['success'] = false;
-			$data['errors'] = $errors;
-		} else {
-			$data['success'] = true;
-		}
-		
-		echo json_encode($data);
-
-    break;
-	//Edit session
-    case 'PUT':
-		//Correct reply to verify the session has been correctly edited
-		$correct_response = 'Se ha editado la session con exito';
-		
-		$errors = [];
-		$data = [];
-		
-		//Check if the body is ok
-		$entityBody = file_get_contents('php://input');
-		$dictionary = json_decode($entityBody);
-		
-		if (!is_object($dictionary))
-            $errors['global'] = 'El cuerpo de la petición no es valido';
-		
-		//Check if the user is droping an event in a new date
-		if(isset($_GET["drop"]) && $_GET["drop"]){
-
-			$or_hall = $dictionary->{"idhall"} ?? "";		
-			$or_date = $dictionary->{"startDate"} ?? "";		
-			$or_start = $dictionary->{"startHour"} ?? "";	
-			$price = $dictionary->{"price"} ?? "";		
-			$idfilm = $dictionary->{"idfilm"} ?? "";	
-			$format = $dictionary->{"format"} ?? "";	
-			
-			$new_date = $dictionary->{"newDate"} ?? "";	
-		
-			$msg = Session::edit_session($_SESSION["cinema"], $or_hall, $or_date, $or_start, $or_hall, $new_date, $new_date, $idfilm, $price, $format);
-			
-			if(strcmp($msg,$correct_response)!== 0)
-				http_response_code(400);
-			 else
-				http_response_code(200);
-		}else{	
-			//Edit session from a form
-			$price = $dictionary->{"price"} ?? "";
-			$format = $dictionary->{"format"} ?? "";
-			$hall = $dictionary->{"hall"} ?? "";		
-			$startDate = $dictionary->{"startDate"} ?? "";
-			
-			$endDate = $dictionary->{"endDate"} ?? "";		
-			$startHour = $dictionary->{"startHour"} ?? "";	
-			
-			$idfilm = $dictionary->{"idFilm"} ?? "";	
-			
-			$or_hall = $dictionary->{"og_hall"} ?? "";		
-			$or_date = $dictionary->{"og_date"} ?? "";		
-			$or_start = $dictionary->{"og_start"} ?? "";	
-			
-			//Check errors in inputs
-			if (empty($price) || $price <= 0 ) 
-				$errors['price'] = 'El precio no puede ser 0.';
-			if (empty($format)) 
-				$errors['format'] = 'El formato no puede estar vacio. Ej: 3D, 2D, voz original';
-			if (empty($hall) || $hall<=0 ) 
-				$errors['hall'] = 'La sala no puede ser 0 o menor';
-			if (empty($startDate)) 
-				$errors['startDate'] = 'Las sesiones tienen que empezar algun dia.';
-			else if (empty($endDate)) 
-				$errors['endDate'] = 'Las sesiones tienen que teminar algun dia.';
-			else {
-				$start = strtotime($startDate);
-				$end = strtotime($endDate);
-				$start = date('Y-m-d', $start);
-				$end = date('Y-m-d', $end);
-				if($start > $end)
-					$errors['date'] = 'La fecha inicial no puede ser antes o el mismo dia que la final.';
-			}
-			if (empty($startHour)) 
-				$errors['startHour'] = 'Es necesario escoger el horario de la sesion.';
-			
-			if (!is_numeric($idfilm) && $idfilm <= 0 ) 
-				$errors['idfilm'] = 'No se ha seleccionado una pelicula.';
-			
-			if(empty($errors)){		
-		
-					$msg = Session::edit_session($_SESSION["cinema"], $or_hall, $or_date, $or_start, $hall, $startHour, $startDate, $idfilm, $price, $format);
-					
-					if(strcmp($msg,$correct_response)!== 0)
-						$errors['global'] = $msg;
-					else
-						$data['message'] = $msg;
-			}
-			
-			if (!empty($errors)) {
-				$data['success'] = false;
-				$data['errors'] = $errors;
-			} else {
-				$data['success'] = true;
-			}
-		}
-	
-		echo json_encode($data);
-        break;
-	//Delete a session
-    case 'DELETE':
-		$errors = [];
-		$data = [];
-		
-		//Correct reply to verify the session has been correctly edited
-		$correct_response = 'Se ha eliminado la session con exito';
-			
-       	//Check if the body is ok
-		$entityBody = file_get_contents('php://input');
-		$dictionary = json_decode($entityBody);
-		
-		if (!is_object($dictionary))
-				$errors['global'] = 'El cuerpo de la petición no es valido';
-		
-		$or_hall = $dictionary->{"og_hall"} ?? "";		
-		$or_date = $dictionary->{"og_date"} ?? "";		
-		$or_start = $dictionary->{"og_start"} ?? "";
-		
-		//Check errors in inputs
-		if(empty($or_hall))
-				$errors['global'] = 'El nº de sala a borrar no existe';
-		if(empty($or_date))
-				$errors['global'] = 'La fecha de donde borrar no existe';
-		if(empty($or_start))
-				$errors['global'] = 'La hora de donde borrar no existe';
-			
-		if(empty($errors)){	
-			$msg = Session::delete_session($_SESSION["cinema"], $or_hall, $or_start, $or_date);
-
-			if(strcmp($msg,$correct_response)!== 0)
-				$errors['global'] = $msg;
-			else
-				$data['message'] = $msg;
-		}
-			
-		if (!empty($errors)) {
-			$data['success'] = false;
-			$data['errors'] = $errors;
-		} else {
-			$data['success'] = true;
-		}
-		
-		echo json_encode($data);
-		
-        break;
-    default:
-    break;
-}
\ No newline at end of file
diff --git a/panel_manager/includes/SessionForm.php b/panel_manager/includes/SessionForm.php
deleted file mode 100644
index dfdb8dc..0000000
--- a/panel_manager/includes/SessionForm.php
+++ /dev/null
@@ -1,103 +0,0 @@
-allFilmData();
-		
-		$form='
-		
 
-		
-		';
-
-		return $form;
-	}
-
-}
-?>
\ No newline at end of file
diff --git a/panel_manager/includes/formHall.php b/panel_manager/includes/formHall.php
deleted file mode 100644
index c0baea2..0000000
--- a/panel_manager/includes/formHall.php
+++ /dev/null
@@ -1,226 +0,0 @@
-option = $option;
-		$this->cinema = $cinema;
-		if($hall)
-			$this->og_hall = $hall;
-		
-		if($option == "edit_hall" && $hall)
-			$options = array("action" => "./?state=".$option."&number=".$hall->getNumber()."&editing=true");
-		else
-			$options = array("action" => "./?state=".$option."&editing=false");
-        parent::__construct('formHall',$options);
-    }
-	
-	protected function generaCamposFormulario($data, $errores = array()){
-		//Prepare the data
-		$number = $data['number'] ?? $this->og_hall->getNumber() ?? "";
-		$rows = $data['rows'] ?? $this->og_hall->getNumRows() ?? "12";
-		$cols = $data['cols'] ?? $this->og_hall->getNumCol() ?? "8";
-		
-		//Init Seats_map
-		$seats = 0;
-		$seats_map = array();
-		for($i = 1;$i <= $rows; $i++){
-			for($j = 1; $j <= $cols; $j++){ 
-				$seats_map[$i][$j] = "-1";
-			}
-		}
-		$alltozero = $_POST["alltozero"] ?? 0;
-		//Show the original seats_map once u click restart or the first time u enter this form from manage_halls's form
-		if($this->option == "edit_hall" && !isset($_GET["editing"])){
-			$rows = $this->og_hall->getNumRows();
-			$cols = $this->og_hall->getNumCol();
-			$seat_list = Seat::getSeatsMap($this->og_hall->getNumber(), $this->cinema);
-			if($seat_list){
-				foreach($seat_list as $seat){
-					$seats_map[$seat->getNumRows()][$seat->getNumCol()] = $seat->getState();
-					if($seat->getState()>=0){
-						$seats++;
-					}
-				}
-			}
-		}//Show the checkbox seats_map updated and everything to selected if alltoone was pressed 
-		else if(!$alltozero){
-			$alltoone = $_POST["alltoone"] ?? 0;
-			for($i = 1;$i <= $rows; $i++){
-				for($j = 1; $j <= $cols; $j++){ 
-					if($alltoone || isset($data["checkbox".$i.$j])) {
-						$seats_map[$i][$j] = $data["checkbox".$i.$j] ?? "0";
-						$seats++;
-						if($seats_map[$i][$j] == "-1"){
-							$seats_map[$i][$j] = "0";
-						}
-					}else 
-						$seats_map[$i][$j] = "-1";
-				}	
-			}
-		}
-		
-		$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
-		$errorNumber = self::createMensajeError($errores, 'number', 'span', array('class' => 'error'));
-		$errorSeats = self::createMensajeError($errores, 'seats', 'span', array('class' => 'error'));
-		$errorRows = self::createMensajeError($errores, 'rows', 'span', array('class' => 'error'));
-		$errorCols = self::createMensajeError($errores, 'cols', 'span', array('class' => 'error'));
-		
-		$html = '
-				'.$htmlErroresGlobales.' 
-					
-						Mapa de Asientos 
-						'.$errorSeats.' '.$errorRows.' '.$errorCols.'
-						 Filas:    Columnas:    Asientos totales:'.$seats.'     Numero de sala:  
-						 No puede haber 0 asientos disponibles.    No puede haber 0 o menos filas.    No puede haber 0 o menos columnas.    El numero de sala tiene que ser mayor que 0.   
-							
-								
-									
 ¡ATENCIÓN!  
-									
Está viendo la web como un Usuario NO Registrado.
-									
Cerrar Mensaje 
-								
-							
-						
-						";
-				break;
-			case "view_ruser":
-				$_SESSION["rol"] = "user";
-				unset($_SESSION["cinema"]);
-				$panel .= "
-							
-							
-								
-									
 ¡ATENCIÓN!  
-									
Está viendo la web como un Usuario Registrado.
-									
Cerrar Mensaje 
-								
-							
-							
-						
-							
-							
-								
-									
 ¡ATENCIÓN!  
-									
Está viendo la web como un Usuario NO Registrado.
-									
Cerrar Mensaje 
-								
-							
-							
-						
-							
-							
-								
-									
 ¡ATENCIÓN!  
-									
Está viendo la web como un Usuario Registrado.
-									
Cerrar Mensaje 
-								
-							
-							
-						
-                   
-						
-                            
Debes iniciar sesión para ver el Panel de Manager. 
-                            
Inicia Sesión con una cuenta de Gerente.
-                            
Iniciar Sesión 
-						
-					
'."\n";
-    }
-
-    //Specific page content:
-        $section = '
-
-	
-		
-					
Bienvenido '.$name.' a tu Panel de Manager. 
-            
-            
-            
'.strftime("%A %e de %B de %Y | %H:%M").' 
-			
Usuario: '.$name.'
  
-			
Cine: '.$c_name.'
-			
Dirección: '.$c_dir.'
-            
-					
Bienvenido '.$name.' a tu Panel de Manager. 
-					
-					
 
-					
-					
-					
'.strftime("%A %e de %B de %Y | %H:%M").' 
-					
Usuario: '.$name.'
  
-					
Como administrador puedes escoger el cine que gestionar 
-					
Cine: '.$c_name.'
-             
-						
-					
-					
 
-					';
-
-			return $panel;
-		}
-		//Manage the sessions using full calendar js events and a pop up form which is constantly edited with more js
-		static function calendar(){
-			if(isset($_SESSION["cinema"])){
-				$hall = $_POST['hall'] ?? $_GET['hall'] ?? "1";
-				$halls = Hall::getListHalls($_SESSION["cinema"]);
-				
-				if($halls){
-					$panel ='
-					
-						
-						
-							';
-					foreach(Hall::getListHalls($_SESSION["cinema"]) as $hll){
-						if($hll->getNumber() == $hall){
-							$panel.= '
-										 Sala '. $hll->getNumber() .'  ';
-						}else{ 
-							$panel.= '
-										 Sala '. $hll->getNumber() .' ';
-						}
-					}
-					$panel.='
-							 
-						
		
-						
	
-					
-						
-							
-								
-
-								
-								×  
-							
-							
';
-				}else{
-					$panel ='
';
-				}
-			}else{
-				$panel = '
-				
Aun no se ha seleccionado un cine. 
-				
-				
 >.< 
-				
 Selecciona un cine en el panel principal 
-				
'."\n";
-			}
-				return $panel;
-
-		}
-		
-		static function manage_halls(){	
-			if(isset($_SESSION["cinema"])){
-				$panel = '
-						
';
-				$listhall = Hall::getListHalls($_SESSION["cinema"]);
-				if(!$listhall){
-					$panel .= "
 No hay ninguna sala en este cine";
-				}else{
-				$panel .= '
-					
-						 Sala  
-						 Asientos  
-						 Sesión  
-								'; 
-				$parity = "odd";
-				foreach($listhall as $hall){ 
-					$panel .='
-							';
-					$parity = ($parity == "odd") ? "even" : "odd";
-					}
-				$panel.='
-					 ';
-				}
-				$panel.='
-							 
-					
-					
';			
-			}else{
-				$panel = '
-				
Aun no se ha seleccionado un cine. 
-				
-				
 >.< 
-				
 Selecciona un cine en el panel principal 
-				
'."\n";
-			}
-			return $panel;
-        }
-		
-		static function new_hall(){		
-		
-			$formHall = new FormHall("new_hall",$_SESSION["cinema"],new Hall(null, null, null, null, null, null));
-		
-			$panel = '
Crear una sala. 
-				'.$formHall->gestiona();
-			return $panel;
-		}
-		
-		static function edit_hall(){	
-			$hall = Hall::search_hall($_GET["number"], $_SESSION["cinema"]);
-			
-			if($hall || isset($_POST["restart"]) || isset($_POST["filter"]) || isset($_POST["sumbit"]) ){
-				
-				$formHall = new FormHall("edit_hall",$_SESSION["cinema"], $hall);
-				$panel = '
Editar una sala. 
-					'.$formHall->gestiona();
-				return $panel;
-			} else{
-				return Manager_panel::warning();
-			}
-		}
-		
-		//this function is used as an answer to wrong url parameters accesing a formhall edit. The formsession version has been replaced by other js error replys
-		static function warning(){
-			$panel = '
-                    
Ha habido un error. 
-                    
-                    
 >.< 
-                
'."\n";
-				
-			return $panel;
-		}
-    }
-?>