Todo funcional
This commit is contained in:
		| @@ -6,10 +6,12 @@ include_once($prefix.'assets/php/form.php'); | |||||||
| class FormHall extends Form { | class FormHall extends Form { | ||||||
| 	 | 	 | ||||||
| 	private $option; | 	private $option; | ||||||
|  | 	private $cinema; | ||||||
| 	 | 	 | ||||||
|     //Constructor: |     //Constructor: | ||||||
|     public function __construct($option) { |     public function __construct($option, $cinema) { | ||||||
| 		$this->option = $option; | 		$this->option = $option; | ||||||
|  | 		$this->cinema = $cinema; | ||||||
| 		$options = array("action" => "./?state=".$option); | 		$options = array("action" => "./?state=".$option); | ||||||
|         parent::__construct('formHall',$options); |         parent::__construct('formHall',$options); | ||||||
|     } |     } | ||||||
| @@ -25,6 +27,7 @@ class FormHall extends Form { | |||||||
| 			$rows = $data['rows'] ?? $_POST["rows"]; | 			$rows = $data['rows'] ?? $_POST["rows"]; | ||||||
| 			$cols = $data['cols'] ?? $_POST["cols"]; | 			$cols = $data['cols'] ?? $_POST["cols"]; | ||||||
| 		} | 		} | ||||||
|  | 		 | ||||||
| 		$og_number = $data['og_number'] ?? $number; | 		$og_number = $data['og_number'] ?? $number; | ||||||
| 			 | 			 | ||||||
| 		//Seats_map | 		//Seats_map | ||||||
| @@ -33,7 +36,7 @@ class FormHall extends Form { | |||||||
|  |  | ||||||
| 		//Show the original seats_map once u click restart or the first time u enter this form from manage_halls's form | 		//Show the original seats_map once u click restart or the first time u enter this form from manage_halls's form | ||||||
| 		if($data["restart"] || $_POST["edit_hall"] ){ | 		if($data["restart"] || $_POST["edit_hall"] ){ | ||||||
| 			foreach(Seat::getSeatsMap($og_number, $_SESSION["cinema"]) as $seat){ | 			foreach(Seat::getSeatsMap($og_number, $this->cinema) as $seat){ | ||||||
| 				$seats_map[$seat->getNumRows()][$seat->getNumCol()] = $seat->getState(); | 				$seats_map[$seat->getNumRows()][$seat->getNumCol()] = $seat->getState(); | ||||||
| 				if($seat->getState()>=0){ | 				if($seat->getState()>=0){ | ||||||
| 					$seats++; | 					$seats++; | ||||||
| @@ -44,48 +47,47 @@ class FormHall extends Form { | |||||||
| 			$alltoone = $_POST["alltoone"] ?? 0; | 			$alltoone = $_POST["alltoone"] ?? 0; | ||||||
| 			for($i = 1;$i <= $rows; $i++){ | 			for($i = 1;$i <= $rows; $i++){ | ||||||
| 				for($j = 1; $j <= $cols; $j++){  | 				for($j = 1; $j <= $cols; $j++){  | ||||||
| 					echo "El valor de la data: ".$data["checkbox".$i.$j]; | 					if($alltoone || isset($data["checkbox".$i.$j])) { | ||||||
| 					if($alltoone || ( $data["checkbox".$i.$j] >= "0")){ |  | ||||||
| 						$seats_map[$i][$j] = $data["checkbox".$i.$j] ?? "0"; | 						$seats_map[$i][$j] = $data["checkbox".$i.$j] ?? "0"; | ||||||
| 						$seats++; | 						$seats++; | ||||||
|  | 						if($seats_map[$i][$j] == "-1"){ | ||||||
|  | 							$seats_map[$i][$j] = "0"; | ||||||
|  | 						} | ||||||
| 					}else  | 					}else  | ||||||
| 						$seats_map[$i][$j] = "-1"; | 						$seats_map[$i][$j] = "-1"; | ||||||
| 				}	 | 				}	 | ||||||
| 			} | 			} | ||||||
| 			 |  | ||||||
| 			 |  | ||||||
| 			 |  | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		$htmlErroresGlobales = self::generaListaErroresGlobales($errores); | 		$htmlErroresGlobales = self::generaListaErroresGlobales($errores); | ||||||
| 		$errorNumber = self::createMensajeError($errores, 'number', 'span', array('class' => 'error')); | 		$errorNumber = self::createMensajeError($errores, 'number', 'span', array('class' => 'error')); | ||||||
| 		$errorSeats = self::createMensajeError($errores, 'seats', 'span', array('class' => 'error')); | 		$errorSeats = self::createMensajeError($errores, 'seats', 'span', array('class' => 'error')); | ||||||
|  |  | ||||||
| 		$html = '<div class="column left"> | 		$html = ' | ||||||
| 				'.$htmlErroresGlobales.' | 				<div class="column left">'.$htmlErroresGlobales.' '.$errorSeats.' '. $errorManager.' | ||||||
| 					'.$errorSeats.' |  | ||||||
| 					<fieldset> | 					<fieldset> | ||||||
| 						<legend>Configuracion</legend> | 						<legend>Mapa de Asientos</legend> | ||||||
| 						<label> Filas: </label> <input type="number" name="rows" min="1" id="rows" value="'.$rows.'" required/> <br> | 						<label> Filas: </label> <input type="number" name="rows" min="1" id="rows" value="'.$rows.'" required/> <br> | ||||||
| 						<label> Columnas: </label> <input type="number" name="cols" min="1" id="cols" value="'.$cols.'"required/> <br> | 						<label> Columnas: </label> <input type="number" name="cols" min="1" id="cols" value="'.$cols.'"required/> <br> | ||||||
| 						<label> Asientos totales:'.$seats.' </label> <input type="hidden" name="seats" id="seats" value="'.$seats.'"readonly/> <br> | 						<label> Asientos totales:'.$seats.' </label> <input type="hidden" name="seats" id="seats" value="'.$seats.'"readonly/> <br> | ||||||
| 						<input type="submit" id="submit" name="alltoone" value="Activar todos los asientos" class="primary" />'; | 						<input type="submit" name="alltoone" value="Activar todos los asientos" class="button large" />'; | ||||||
| 						if($this->option == "edit_hall") | 						if($this->option == "edit_hall") | ||||||
| 								$html .= '<input type="submit" id="restart" name="restart" value="Restaurar mapa original" class="primary" /> ';						 | 								$html .= ' <input type="submit" id="restart" name="restart" value="Restaurar mapa original" class="black button" />';						 | ||||||
| 					$html .='</fieldset> | 					$html .=' | ||||||
| 					<input type="submit" name="filter" value="Actualizar mapa de la sala" class="button large" />  | 					</fieldset> | ||||||
| 					'.$errorNumber.' | 					<input type="submit" name="filter" value="Actualizar mapa de la sala" class="button large" /> '.$errorNumber.' | ||||||
| 					<fieldset> | 					<fieldset> | ||||||
| 						<label> Numero de sala: </label> | 						<label> Numero de sala: </label> | ||||||
| 						<input type="number" min="1" name="number" id="number" value="'.$number.'" placeholder="Numero de la Sala" /><br>		 | 						<input type="number" min="1" name="number" id="number" value="'.$number.'" placeholder="Numero de la Sala" /><br>		 | ||||||
| 						<input type="hidden" min="1" name="og_number" value="'.$og_number.'" /><br>	 | 						<input type="hidden" name="og_number" value="'.$og_number.'" /><br>	 | ||||||
| 					</fieldset>	 | 					</fieldset>	 | ||||||
| 					'; | 					'; | ||||||
| 		if($this->option == "new_hall") | 		if($this->option == "new_hall") | ||||||
| 				$html .='<input type="submit" id="submit" name="sumbit" value="Crear Sala" class="primary" />'; | 				$html .='<input type="submit" id="submit" name="sumbit" value="Crear Sala" class="primary" /> | ||||||
|  | 				'; | ||||||
| 		if($this->option == "edit_hall"){ | 		if($this->option == "edit_hall"){ | ||||||
| 				$html .='<input type="submit" id="submit" name="sumbit" value="Editar Sala" class="primary" /> | 				$html .='<input type="submit" id="submit" name="sumbit" value="Editar Sala" class="primary" /> | ||||||
| 						<input type="submit" id="submit" name="delete" value="Eliminar Sala" class="primary" />   | 					<input type="submit" id="submit" name="delete" onclick="return confirm(\'Seguro que quieres borrar esta sala?\')" value="Eliminar Sala" class="black button" />   | ||||||
| 				';	 | 				';	 | ||||||
| 		} | 		} | ||||||
| 			$html .='</div> | 			$html .='</div> | ||||||
| @@ -94,9 +96,11 @@ class FormHall extends Form { | |||||||
| 					<table class="seat"> | 					<table class="seat"> | ||||||
| 						<thead> | 						<thead> | ||||||
| 							<tr> | 							<tr> | ||||||
| 							<th></th>'; | 								<th> </th> | ||||||
|  | 								'; | ||||||
| 			for($j = 1; $j<=$cols; $j++){ | 			for($j = 1; $j<=$cols; $j++){ | ||||||
| 				$html .= '<th>'.$j.'</th>';	 | 				$html .= '<th>'.$j.'</th> | ||||||
|  | 								';	 | ||||||
| 			} | 			} | ||||||
| 			$html .= '</tr> | 			$html .= '</tr> | ||||||
| 						</thead> | 						</thead> | ||||||
| @@ -114,15 +118,13 @@ class FormHall extends Form { | |||||||
| 							$html .= '<td> <input type="checkbox" class="check_box" name="checkbox'.$i.$j.'" value="'.$seats_map[$i][$j].'" id="checkbox'.$i.$j.'" > <label for="checkbox'.$i.$j.'"> </td> | 							$html .= '<td> <input type="checkbox" class="check_box" name="checkbox'.$i.$j.'" value="'.$seats_map[$i][$j].'" id="checkbox'.$i.$j.'" > <label for="checkbox'.$i.$j.'"> </td> | ||||||
| 								';} | 								';} | ||||||
| 					} | 					} | ||||||
| 						$html .=' | 						$html .='</tr>'; | ||||||
| 						</tr>'; |  | ||||||
| 				} | 				} | ||||||
| 					 | 					 | ||||||
| 		$html .= ' | 		$html .= ' | ||||||
| 						</tbody> | 						</tbody> | ||||||
| 					</table> | 					</table> | ||||||
| 				</div> | 				</div>';		 | ||||||
| 				';		 |  | ||||||
|  |  | ||||||
| 		return $html; | 		return $html; | ||||||
| 	} | 	} | ||||||
| @@ -158,6 +160,7 @@ class FormHall extends Form { | |||||||
|             $result['seats'] = "<li> No puede haber 0 asientos disponibles. </li> <br>"; |             $result['seats'] = "<li> No puede haber 0 asientos disponibles. </li> <br>"; | ||||||
|         } |         } | ||||||
| 		 | 		 | ||||||
|  | 		 | ||||||
|         $number = $datos['number'] ?? null; |         $number = $datos['number'] ?? null; | ||||||
| 		if (empty($number) && isset($datos["sumbit"])) { | 		if (empty($number) && isset($datos["sumbit"])) { | ||||||
|             $result['number'] = "<li> El numero de sala tiene que ser mayor que 0. </li> <br>"; |             $result['number'] = "<li> El numero de sala tiene que ser mayor que 0. </li> <br>"; | ||||||
| @@ -165,18 +168,18 @@ class FormHall extends Form { | |||||||
| 		 | 		 | ||||||
|         if (count($result) === 0 && isset($datos["sumbit"]) ) { |         if (count($result) === 0 && isset($datos["sumbit"]) ) { | ||||||
| 				if($this->option == "new_hall"){ | 				if($this->option == "new_hall"){ | ||||||
|                 $_SESSION['msg'] = Hall::create_hall($number, $_SESSION["cinema"], $rows, $cols, $seats, $seats_map); | 					$_SESSION['msg'] = Hall::create_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map); | ||||||
| 					$result = './?state=success'; | 					$result = './?state=success'; | ||||||
| 				} | 				} | ||||||
| 				if($this->option == "edit_hall"){ | 				if($this->option == "edit_hall"){ | ||||||
|                 $_SESSION['msg'] = Hall::edit_hall($number, $_SESSION["cinema"], $rows, $cols, $seats, $seats_map, $og_number); | 					$_SESSION['msg'] = Hall::edit_hall($number,$this->cinema, $rows, $cols, $seats, $seats_map, $og_number); | ||||||
| 					$result = './?state=success'; | 					$result = './?state=success'; | ||||||
| 				} | 				} | ||||||
|         } |         } | ||||||
| 		 | 		 | ||||||
| 		if (!isset($result['number']) && isset($datos["delete"]) ) { | 		if (!isset($result['number']) && isset($datos["delete"]) ) { | ||||||
| 			if($this->option == "edit_hall"){ | 			if($this->option == "edit_hall"){ | ||||||
|                 $_SESSION['msg'] = Hall::delete_hall($number, $_SESSION["cinema"], $rows, $cols, $seats, $seats_map, $og_number); |                 $_SESSION['msg'] = Hall::delete_hall($number, $this->cinema, $rows, $cols, $seats, $seats_map, $og_number); | ||||||
|                 $result = './?state=success'; |                 $result = './?state=success'; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -8,10 +8,12 @@ require_once($prefix.'assets/php/form.php'); | |||||||
| class FormSession extends Form { | class FormSession extends Form { | ||||||
|  |  | ||||||
| 	private $option; | 	private $option; | ||||||
|  | 	private $cinema; | ||||||
| 	 | 	 | ||||||
|     //Constructor: |     //Constructor: | ||||||
|     public function __construct($option) { |     public function __construct($option, $cinema) { | ||||||
| 		$this->option = $option; | 		$this->option = $option; | ||||||
|  | 		$this->cinema = $cinema; | ||||||
| 		$options = array("action" => "./?state=".$option); | 		$options = array("action" => "./?state=".$option); | ||||||
|         parent::__construct('formSession',$options); |         parent::__construct('formSession',$options); | ||||||
|     } |     } | ||||||
| @@ -23,16 +25,14 @@ class FormSession extends Form { | |||||||
| 		$films = $filmList->allFilmData();	 | 		$films = $filmList->allFilmData();	 | ||||||
| 		 | 		 | ||||||
| 		if($this->option == "new_session") { | 		if($this->option == "new_session") { | ||||||
| 			$cinema = $data['cinema'] ?? $_SESSION["cinema"]; |  | ||||||
| 			$film = $data['film'] ?? 1; | 			$film = $data['film'] ?? 1; | ||||||
| 			$hall = $data['hall'] ?? ''; | 			$hall = $data['hall'] ?? $_POST["hall"]; | ||||||
| 			$date = $data['date'] ?? ''; | 			$date = $data['date'] ?? $_POST["date"]; | ||||||
| 			$start = $data['start'] ?? ''; | 			$start = $data['start'] ?? ''; | ||||||
| 			$price = $data['price'] ?? ''; | 			$price = $data['price'] ?? ''; | ||||||
| 			$format = $data['format'] ?? ''; | 			$format = $data['format'] ?? ''; | ||||||
| 		}  | 		}  | ||||||
| 		else { | 		else { | ||||||
| 			$cinema = $data['cinema'] ?? $_SESSION["cinema"]; |  | ||||||
| 			$film = $data['film'] ?? $_POST["film"]; | 			$film = $data['film'] ?? $_POST["film"]; | ||||||
| 			$hall = $data['hall'] ?? $_POST["hall"]; | 			$hall = $data['hall'] ?? $_POST["hall"]; | ||||||
| 			$date = $data['date'] ?? $_POST["date"]; | 			$date = $data['date'] ?? $_POST["date"]; | ||||||
| @@ -47,17 +47,15 @@ class FormSession extends Form { | |||||||
| 		$htmlErroresGlobales = self::generaListaErroresGlobales($errores); | 		$htmlErroresGlobales = self::generaListaErroresGlobales($errores); | ||||||
| 		$errorPrice = self::createMensajeError($errores, 'price', 'span', array('class' => 'error')); | 		$errorPrice = self::createMensajeError($errores, 'price', 'span', array('class' => 'error')); | ||||||
|  |  | ||||||
| 		$html .= '<div class="column left"> | 		$html .= ' | ||||||
| 				 '.$htmlErroresGlobales.' | 				<div class="column left">'.$htmlErroresGlobales.' '.$errorPrice.' | ||||||
| 				 '.$errorPrice.' |  | ||||||
| 					<fieldset> | 					<fieldset> | ||||||
| 						<legend>Datos</legend> | 						<legend>Datos</legend> | ||||||
| 						<input type="number" step="0.01" name="price" value="'.$price.'" min="0" placeholder="Precio de la entrada" required/> <br> | 						<input type="number" step="0.01" name="price" value="'.$price.'" min="0" placeholder="Precio de la entrada" required/> <br>'.$errorFormat.' | ||||||
| 						'.$errorFormat.' |  | ||||||
| 						<input type="text" name="format" value="'.$format.'" placeholder="Formato de pelicula" required/> <br> | 						<input type="text" name="format" value="'.$format.'" placeholder="Formato de pelicula" required/> <br> | ||||||
| 						<input type="hidden" name="film" value="'.$film.'"/>  | 						<input type="hidden" name="film" value="'.$film.'"/>  | ||||||
| 						<select name="hall" class="button large">'; | 						<select name="hall" class="button large">'; | ||||||
| 			foreach(Hall::getListHalls($cinema) as $hll){ | 			foreach(Hall::getListHalls($this->cinema) as $hll){ | ||||||
| 				if($hll->getNumber() == $hall){ | 				if($hll->getNumber() == $hall){ | ||||||
| 					$html.= ' | 					$html.= ' | ||||||
| 							<option value="'. $hll->getNumber() .'"selected> Sala '. $hll->getNumber() .'</option> '; | 							<option value="'. $hll->getNumber() .'"selected> Sala '. $hll->getNumber() .'</option> '; | ||||||
| @@ -81,27 +79,29 @@ class FormSession extends Form { | |||||||
| 		if($film){ | 		if($film){ | ||||||
| 			if($this->option == "new_session") | 			if($this->option == "new_session") | ||||||
| 				$html .= '<input type="number" name="repeat" value="" min="0" title="Añadir esta sesion durante los proximos X dias" min="0" max="31" placeholder="Añadir X dias"/> <br> | 				$html .= '<input type="number" name="repeat" value="" min="0" title="Añadir esta sesion durante los proximos X dias" min="0" max="31" placeholder="Añadir X dias"/> <br> | ||||||
| 				<button type="submit" id="submit" name="sumbit" class="button large">Crear</button><br>'; | 					<input type="submit" id="submit" name="sumbit" class="primary" value="Crear" /> <br>'; | ||||||
| 				 | 				 | ||||||
| 			if($this->option == "edit_session"){			 | 			if($this->option == "edit_session"){			 | ||||||
| 				$html .= ' | 				$html .= '<input type="submit" id="submit" name="sumbit" class="primary" value="Editar" /><br> | ||||||
| 				<button type="submit" id="submit" name="sumbit" class="button large">Editar</button><br> | 					<input type="submit" name="delete" class="black button" onclick="return confirm(\'Seguro que quieres borrar esta sesion?\')"  value="Borrar" /><br>'; | ||||||
| 				<button type="submit" id="submit" name="delete" class="primary">Borrar</button><br>'; |  | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		$html .= ' | 		$html .= ' | ||||||
| 		<input type="reset" value="Limpiar Campos" > | 					<input type="reset" id="reset" value="Limpiar Campos" /> | ||||||
| 				</div> | 				</div> | ||||||
| 				<div class="column side"> | 				<div class="column rigth"> | ||||||
| 				<select name="film" class="button large">'; | 					<select name="film" class="button large"> | ||||||
|  | 						'; | ||||||
| 				foreach($films as $f){  | 				foreach($films as $f){  | ||||||
| 					if($f->getId() == $film){ | 					if($f->getId() == $film){ | ||||||
| 						$html .=  "<option value=\"". $f->getId() ." \"selected> " . $f->getId() . "|" . $f->getTittle() ." Idioma: " . $f->getLanguage() . "</option>"; | 						$html .=  "<option value=\"". $f->getId() ." \"selected> " . $f->getId() . "|" . $f->getTittle() ." Idioma: " . $f->getLanguage() . "</option> | ||||||
|  | 						"; | ||||||
| 					}else{ | 					}else{ | ||||||
| 						$html .=  "<option value=\"". $f->getId() ." \"> " . $f->getId() . "|" . $f->getTittle() ." Idioma: " . $f->getLanguage() . "</option>"; | 						$html .=  "<option value=\"". $f->getId() ." \"> " . $f->getId() . "|" . $f->getTittle() ." Idioma: " . $f->getLanguage() . "</option> | ||||||
|  | 						"; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				 | 		$html .= '</select>'; | ||||||
| 		return $html;	 | 		return $html;	 | ||||||
| 	} | 	} | ||||||
|     //Methods: |     //Methods: | ||||||
| @@ -128,17 +128,17 @@ class FormSession extends Form { | |||||||
| 		 | 		 | ||||||
|         if (count($result) === 0 && isset($data["sumbit"]) ) { |         if (count($result) === 0 && isset($data["sumbit"]) ) { | ||||||
| 			if($this->option == "new_session"){ | 			if($this->option == "new_session"){ | ||||||
|                 $_SESSION['msg'] = Session::create_session($_SESSION["cinema"], $hall, $start, $date, $film, $price, $format,$repeat); |                 $_SESSION['msg'] = Session::create_session($this->cinema, $hall, $start, $date, $film, $price, $format,$repeat); | ||||||
|                 $result = './?state=success'; |                 $result = './?state=success'; | ||||||
|             } |             } | ||||||
| 			if($this->option == "edit_session"){ | 			if($this->option == "edit_session"){ | ||||||
|                 $_SESSION['msg'] = Session::edit_session($_SESSION["cinema"], $or_hall, $or_date, $or_start, $hall, $start, $date, $film, $price, $format); |                 $_SESSION['msg'] = Session::edit_session($this->cinema, $or_hall, $or_date, $or_start, $hall, $start, $date, $film, $price, $format); | ||||||
|                 $result = './?state=success'; |                 $result = './?state=success'; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
| 		if(!isset($result['hall']) && !isset($result['start']) && !isset($result['date']) && isset($data["delete"])) { | 		if(!isset($result['hall']) && !isset($result['start']) && !isset($result['date']) && isset($data["delete"])) { | ||||||
| 			$_SESSION['msg'] = Session::delete_session($_SESSION["cinema"], $or_hall, $or_start, $or_date); | 			$_SESSION['msg'] = Session::delete_session($this->cinema, $or_hall, $or_start, $or_date); | ||||||
| 			$result = './?state=success'; | 			$result = './?state=success'; | ||||||
| 		} | 		} | ||||||
|   |   | ||||||
|   | |||||||
| @@ -1,15 +1,28 @@ | |||||||
| <?php | <?php | ||||||
|  |  | ||||||
| 	ini_set('display_errors', 0); |  | ||||||
| 	error_reporting(E_ERROR | E_WARNING | E_PARSE); |  | ||||||
|  |  | ||||||
|     //General Config File: |     //General Config File: | ||||||
|     require_once('../assets/php/config.php'); |     require_once('../assets/php/config.php'); | ||||||
|     //Controller file: |     //Controller file: | ||||||
|     include_once('panel_manager.php'); |     require_once('panel_manager.php'); | ||||||
|  | 	require_once('../assets/php/common/manager_dao.php'); | ||||||
|  | 	require_once('../assets/php/common/manager.php'); | ||||||
|  | 	require_once('../assets/php/common/user.php'); | ||||||
| 	 | 	 | ||||||
|     if($_SESSION["login"] && $_SESSION["rol"] === "manager"){ |     if($_SESSION["login"] && $_SESSION["rol"] === "manager"){ | ||||||
| 		$_SESSION["cinema"] = 1; | 		$bd = new Manager_DAO('complucine'); | ||||||
|  | 		$manager = false; | ||||||
|  | 		if($bd && !$manager){ | ||||||
|  | 			$user = unserialize($_SESSION["user"]); | ||||||
|  | 			$manager = $bd->GetManager($user->getId()); | ||||||
|  | 			 | ||||||
|  | 			if($manager){ | ||||||
|  | 				if($manager->num_rows == 1){ | ||||||
|  | 					$fila = $manager->fetch_assoc(); | ||||||
|  | 					$manager = new Manager($fila["id"], $fila["idcinema"], $fila["username"], $fila["email"], $fila["rol"]); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|         switch($_GET["state"]){ |         switch($_GET["state"]){ | ||||||
| 			case "view_ruser": | 			case "view_ruser": | ||||||
| 			case "view_user": | 			case "view_user": | ||||||
| @@ -22,31 +35,31 @@ | |||||||
|                 <div class="column side"></div>'."\n"; |                 <div class="column side"></div>'."\n"; | ||||||
|                 break;			 |                 break;			 | ||||||
| 			case "manage_halls": | 			case "manage_halls": | ||||||
|                 $panel = Manager_panel::manage_halls(); |                 $panel = Manager_panel::manage_halls($manager); | ||||||
|                 break; |                 break; | ||||||
| 			case "new_hall": | 			case "new_hall": | ||||||
|                 $panel = Manager_panel::new_hall(); |                 $panel = Manager_panel::new_hall($manager); | ||||||
|                 break;	 |                 break;	 | ||||||
| 			case "edit_hall": | 			case "edit_hall": | ||||||
|                 $panel = Manager_panel::edit_hall(); |                 $panel = Manager_panel::edit_hall($manager); | ||||||
|                 break;	 |                 break;	 | ||||||
|             case "manage_sessions": |             case "manage_sessions": | ||||||
|                 $panel = Manager_panel::manage_sessions(); |                 $panel = Manager_panel::manage_sessions($manager); | ||||||
|                 break; |                 break; | ||||||
| 			case "new_session": | 			case "new_session": | ||||||
|                 $panel = Manager_panel::new_session(); |                 $panel = Manager_panel::new_session($manager); | ||||||
|                 break; |                 break; | ||||||
| 			case "edit_session": | 			case "edit_session": | ||||||
|                 $panel = Manager_panel::edit_session(); |                 $panel = Manager_panel::edit_session($manager); | ||||||
|                 break; |                 break; | ||||||
| 			case "select_film": | 			case "select_film": | ||||||
|                 $panel = Manager_panel::select_film($template); |                 $panel = Manager_panel::select_film($template,$manager); | ||||||
|                 break; |                 break; | ||||||
| 			case "success": | 			case "success": | ||||||
|                 $panel = Manager_panel::success(); |                 $panel = Manager_panel::success(); | ||||||
|                 break; |                 break; | ||||||
|             default:   |             default:   | ||||||
|                 $panel = Manager_panel::welcome(); |                 $panel = Manager_panel::welcome($manager); | ||||||
|                 break; |                 break; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -64,13 +77,12 @@ | |||||||
|  |  | ||||||
|     //Specific page content: |     //Specific page content: | ||||||
|         $section = '<!-- Manager Panel --> |         $section = '<!-- Manager Panel --> | ||||||
|  | 		<link rel="stylesheet" href="../assets/css/manager.css"> | ||||||
|         <section id="manager_panel"> |         <section id="manager_panel"> | ||||||
|             <div class="row"> |  | ||||||
| 			<!-- Contents --> | 			<!-- Contents --> | ||||||
| 			<div class="row"> | 			<div class="row"> | ||||||
| 				'.$panel.' | 				'.$panel.' | ||||||
| 			</div> | 			</div> | ||||||
|             </div> |  | ||||||
|         </section>'; |         </section>'; | ||||||
|  |  | ||||||
|     //General page content: |     //General page content: | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| <?php | <?php | ||||||
| 	include_once($prefix.'assets/php/common/hall.php'); | 	include_once($prefix.'assets/php/common/hall.php'); | ||||||
| 	include_once($prefix.'assets/php/common/session.php'); | 	include_once($prefix.'assets/php/common/session.php'); | ||||||
|  | 	require_once($prefix.'assets/php/common/manager.php'); | ||||||
| 	include_once('./includes/formHall.php');	 | 	include_once('./includes/formHall.php');	 | ||||||
| 	include_once('./includes/formSession.php');	 | 	include_once('./includes/formSession.php');	 | ||||||
|  |  | ||||||
| @@ -9,9 +10,9 @@ | |||||||
| 		 | 		 | ||||||
|         function __construct(){} |         function __construct(){} | ||||||
|  |  | ||||||
| 		static function welcome(){ | 		static function welcome($manager){ | ||||||
|             $name = strtoupper($_SESSION['nombre']); |             $name = strtoupper($_SESSION["nombre"]); | ||||||
| 			$cinema = strtoupper($_SESSION['cinema']); | 			$cinema = strtoupper( $manager->getIdcinema()); | ||||||
|  |  | ||||||
|             $panel = '<div class="code info"> |             $panel = '<div class="code info"> | ||||||
| 						<h1>Bienvenido '.$name.' a tu Panel de Manager.</h1> | 						<h1>Bienvenido '.$name.' a tu Panel de Manager.</h1> | ||||||
| @@ -19,7 +20,7 @@ | |||||||
| 						<p>Usuario: '.$name.'</p> | 						<p>Usuario: '.$name.'</p> | ||||||
| 						<p>Cine: '.$cinema.'</p> | 						<p>Cine: '.$cinema.'</p> | ||||||
| 						<p>Espero que estes pasando un buen dia</p> | 						<p>Espero que estes pasando un buen dia</p> | ||||||
|                 </div>'."\n"; | 					</div>'; | ||||||
| 				 | 				 | ||||||
| 			return $panel; | 			return $panel; | ||||||
|         } |         } | ||||||
| @@ -35,16 +36,15 @@ | |||||||
| 			return $panel; | 			return $panel; | ||||||
|         } |         } | ||||||
| 		 | 		 | ||||||
| 		static function manage_halls(){	 | 		static function manage_halls($manager){	 | ||||||
| 			 | 			 | ||||||
| 			$panel = '<div class="column side"></div> | 			$panel = '<div class="column side"></div> | ||||||
| 					<div class="column middle">'; | 					<div class="column middle">'; | ||||||
| 			$listhall = Hall::getListHalls($_SESSION["cinema"]); | 			$listhall = Hall::getListHalls($manager->getIdcinema()); | ||||||
| 			if(!$listhall){ | 			if(!$listhall){ | ||||||
| 				$panel .= "<h2> No hay ninguna sala en este cine"; | 				$panel .= "<h2> No hay ninguna sala en este cine"; | ||||||
| 			}else{ | 			}else{ | ||||||
| 			$panel .= ' | 			$panel .= ' | ||||||
| 			 |  | ||||||
| 						<table class="alt"> | 						<table class="alt"> | ||||||
| 							<thead> | 							<thead> | ||||||
| 								<tr> | 								<tr> | ||||||
| @@ -64,47 +64,45 @@ | |||||||
| 									<td> '. $hall->getNumCol().'</td> | 									<td> '. $hall->getNumCol().'</td> | ||||||
| 									<td> '.$hall->getTotalSeats().' </td> | 									<td> '.$hall->getTotalSeats().' </td> | ||||||
| 									<form method="post" action="./?state=edit_session"> | 									<form method="post" action="./?state=edit_session"> | ||||||
| 								<input  name="number" type="hidden" value="'. $hall->getNumber().'"> | 										<input  name="number" type="hidden" value="'. $hall->getNumber().'"/> | ||||||
| 								<input  name="rows" type="hidden" value="'. $hall->getNumRows().'"> | 										<input  name="rows" type="hidden" value="'. $hall->getNumRows().'"/> | ||||||
| 								<input  name="cols" type="hidden" value="'. $hall->getNumCol().'"> | 										<input  name="cols" type="hidden" value="'. $hall->getNumCol().'"/> | ||||||
| 								<input  name="seats" type="hidden" value="'.$hall->getTotalSeats().'"> | 										<input  name="seats" type="hidden" value="'.$hall->getTotalSeats().'"/> | ||||||
| 								<input  name="object" type="hidden" value="'.serialize($cinema).'"> | 									<td> <input type="submit" id="submit" name ="edit_hall" formaction="./?state=edit_hall&number='.$hall->getNumber().'" value="Editar" class="primary" /> </td> | ||||||
| 							<td> <input type="submit" name="edit_hall" value="Editar" class="button" formaction="./?state=edit_hall&number='.$hall->getNumber().'" ></td> |  | ||||||
| 									</form> | 									</form> | ||||||
| 								</tr>'; | 								</tr>'; | ||||||
| 				} | 				} | ||||||
| 			$panel.=' | 			$panel.=' | ||||||
| 							</tbody> | 							</tbody> | ||||||
| 				</table> | 						</table>'; | ||||||
| 			'; |  | ||||||
| 			} | 			} | ||||||
| 			$panel.='	<form method="post" action="./?state=new_hall"> | 			$panel.=' | ||||||
| 							<input type="submit" name="new_hall" value="Añadir Sala" class="button large" > | 						<form method="post" action="./?state=new_hall"> | ||||||
|  | 							<input type="submit" name="new_hall" value="Añadir Sala" class="button large" /> | ||||||
| 						</form> | 						</form> | ||||||
| 				</div> | 				</div> | ||||||
| 			<div class="column side"></div> | 				<div class="column side"></div>';			 | ||||||
| 			';			 |  | ||||||
| 			return $panel; | 			return $panel; | ||||||
|         } |         } | ||||||
| 		 | 		 | ||||||
| 		static function new_hall(){		 | 		static function new_hall($manager){		 | ||||||
| 		 | 		 | ||||||
| 			$formHall = new FormHall("new_hall"); | 			$formHall = new FormHall("new_hall",$manager->getIdcinema()); | ||||||
| 		 | 		 | ||||||
| 			$panel = '<h1>Crear una sala.</h1><hr/></br>' | 			$panel = '<h1>Crear una sala.</h1><hr/></br> | ||||||
| 				.$formHall->gestiona(); | 				'.$formHall->gestiona(); | ||||||
| 			return $panel; | 			return $panel; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		static function edit_hall(){		 | 		static function edit_hall($manager){		 | ||||||
| 			$formHall = new FormHall("edit_hall"); | 			$formHall = new FormHall("edit_hall",$manager->getIdcinema()); | ||||||
| 		 | 		 | ||||||
| 			$panel = '<h1>Editar una sala.</h1><hr/></br>' | 			$panel = '<h1>Editar una sala.</h1><hr/></br> | ||||||
| 				.$formHall->gestiona(); | 				'.$formHall->gestiona(); | ||||||
| 			return $panel; | 			return $panel; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		static function manage_sessions(){ | 		static function manage_sessions($manager){ | ||||||
| 			//Base filtering values | 			//Base filtering values | ||||||
| 			$date = isset($_POST['date']) ? $_POST['date'] : date("Y-m-d"); | 			$date = isset($_POST['date']) ? $_POST['date'] : date("Y-m-d"); | ||||||
| 			$hall = isset($_POST['hall']) ? $_POST['hall'] : "1"; | 			$hall = isset($_POST['hall']) ? $_POST['hall'] : "1"; | ||||||
| @@ -115,7 +113,7 @@ | |||||||
| 						<input type="date" name="date" value="'.$date.'" min="2021-01-01" max="2031-12-31"> | 						<input type="date" name="date" value="'.$date.'" min="2021-01-01" max="2031-12-31"> | ||||||
| 							<select name="hall" class="button large">'; | 							<select name="hall" class="button large">'; | ||||||
| 						 | 						 | ||||||
| 			foreach(Hall::getListHalls($_SESSION["cinema"]) as $hll){ | 			foreach(Hall::getListHalls($manager->getIdcinema()) as $hll){ | ||||||
| 				if($hll->getNumber() == $hall){ | 				if($hll->getNumber() == $hall){ | ||||||
| 					$panel.= ' | 					$panel.= ' | ||||||
| 								<option value="'. $hll->getNumber() .'"selected> Sala '. $hll->getNumber() .'</option> '; | 								<option value="'. $hll->getNumber() .'"selected> Sala '. $hll->getNumber() .'</option> '; | ||||||
| @@ -132,7 +130,7 @@ | |||||||
| 			'; | 			'; | ||||||
| 			//Session list | 			//Session list | ||||||
| 			$panel .='	<div class = "column right">'; | 			$panel .='	<div class = "column right">'; | ||||||
| 			$sessions = Session::getListSessions($hall,$_SESSION["cinema"],$date); | 			$sessions = Session::getListSessions($hall,$manager->getIdcinema(),$date); | ||||||
| 			 | 			 | ||||||
| 			if($sessions) { | 			if($sessions) { | ||||||
| 				$panel .=' | 				$panel .=' | ||||||
| @@ -163,7 +161,7 @@ | |||||||
| 										<input  name="start" type="hidden" value="'.$session->getStartTime().'"> | 										<input  name="start" type="hidden" value="'.$session->getStartTime().'"> | ||||||
| 										<input  name="price" type="hidden" value="'.$session->getSeatPrice().'"> | 										<input  name="price" type="hidden" value="'.$session->getSeatPrice().'"> | ||||||
| 										<input  name="format" type="hidden" value="'.$session->getFormat().'">	 | 										<input  name="format" type="hidden" value="'.$session->getFormat().'">	 | ||||||
| 								<td> <input type="submit" name="edit_session" value="Editar" class="button" ></td> | 									<td> <input type="submit" id="submit" name ="edit_session"  value="Editar" class="primary" /> </td> | ||||||
| 									</form> | 									</form> | ||||||
| 								</tr>'; | 								</tr>'; | ||||||
| 					} | 					} | ||||||
| @@ -176,29 +174,29 @@ | |||||||
| 			} | 			} | ||||||
| 			$panel.=' | 			$panel.=' | ||||||
| 					<input type="submit" name="new_session" form="filter"  value="Añadir" class="button large" formaction="./?state=new_session"> | 					<input type="submit" name="new_session" form="filter"  value="Añadir" class="button large" formaction="./?state=new_session"> | ||||||
| 			</div> | 				</div>'; | ||||||
| '; |  | ||||||
| 			 | 			 | ||||||
| 			return $panel; | 			return $panel; | ||||||
|         } |         } | ||||||
| 		 | 		 | ||||||
| 		static function new_session(){	 | 		static function new_session($manager){	 | ||||||
| 			$formSession = new FormSession("new_session"); | 			$formSession = new FormSession("new_session", $manager->getIdcinema() ); | ||||||
| 			 | 			 | ||||||
| 			$panel = '<h1>Crear una sesion.</h1><hr/></br>' | 			$panel = '<h1>Crear una sesion.</h1> <hr/> </br> | ||||||
| 				.$formSession->gestiona(); | 				'.$formSession->gestiona(); | ||||||
| 			return $panel; | 			return $panel; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		static function edit_session(){	 | 		static function edit_session($manager){	 | ||||||
| 			$formSession = new FormSession("edit_session"); | 			$formSession = new FormSession("edit_session", $manager->getIdcinema() ); | ||||||
| 		 | 		 | ||||||
| 			$panel = '<h1>Editar una sesion.</h1><hr/></br>' | 			$panel = '<h1>Editar una sesion.</h1><hr/></br> | ||||||
| 				.$formSession->gestiona(); | 				'.$formSession->gestiona(); | ||||||
| 			return $panel; | 			return $panel; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		static function select_film($template){		 | 		//TODO: estado al modificar sesiones para la seleccion de peliculas usando el template->print films | ||||||
|  | 		static function select_film($template,$manager){		 | ||||||
| 			if(isset($_GET["option"])){ | 			if(isset($_GET["option"])){ | ||||||
| 				$_SESSION["option"] = $_GET["option"]; | 				$_SESSION["option"] = $_GET["option"]; | ||||||
| 				$panel = '<h1>Seleccionar Pelicula.</h1><hr /></br>'; | 				$panel = '<h1>Seleccionar Pelicula.</h1><hr /></br>'; | ||||||
| @@ -210,7 +208,7 @@ | |||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		//Funcion que se envia cuando hay inconsistencia en el panel manager, principalmente por tocar cosas con la ulr | 		//Funcion que se envia cuando hay inconsistencia en el panel manager, principalmente por tocar cosas con la ulr | ||||||
| 		static function warning(){ | 		static function warning($manager){ | ||||||
| 			$panel = '<div class="code info"> | 			$panel = '<div class="code info"> | ||||||
|                     <h1>No deberias poder acceder aqui.</h1> |                     <h1>No deberias poder acceder aqui.</h1> | ||||||
|                     <hr /> |                     <hr /> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user