Add files via upload
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
include_once('../assets/php/common/hall_dao.php');
 | 
					include_once($prefix.'assets/php/common/hall_dao.php');
 | 
				
			||||||
include_once('../assets/php/form.php');
 | 
					include_once($prefix.'assets/php/form.php');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FormHall extends Form {
 | 
					class FormHall extends Form {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -16,14 +16,8 @@ class FormHall extends Form {
 | 
				
			|||||||
        $this->reply = array();
 | 
					        $this->reply = array();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	protected function generaCamposFormulario($datos, $errores = array()){
 | 
						public static function generaCampoFormulario($datos, $errores = array(), $option){
 | 
				
			||||||
		$this->option = $_SESSION['option'];
 | 
							if($option == "new"){
 | 
				
			||||||
		$_SESSION['option'] = "";
 | 
					 | 
				
			||||||
		$htmlform = "";
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if($this->option == "new"){
 | 
					 | 
				
			||||||
			$number = $datos['number'] ?? '';
 | 
								$number = $datos['number'] ?? '';
 | 
				
			||||||
			$rows = $datos['rows'] ?? '';
 | 
								$rows = $datos['rows'] ?? '';
 | 
				
			||||||
			$cols = $datos['cols'] ?? '';
 | 
								$cols = $datos['cols'] ?? '';
 | 
				
			||||||
@@ -31,13 +25,15 @@ class FormHall extends Form {
 | 
				
			|||||||
			
 | 
								
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			$htmlform .= '
 | 
								$htmlform .= '
 | 
				
			||||||
 | 
									<form method="post" id="new_hall" action="./includes/processForm.php"\>
 | 
				
			||||||
					<fieldset>
 | 
										<fieldset>
 | 
				
			||||||
					<label>Numero de sala:</label> <input type="text" name="number" value="'.$number.'"/> <br>
 | 
											<label>Numero de sala:</label> <input type="number" name="number" value="'.$number.'" required/> <br>
 | 
				
			||||||
					<label>Filas:</label> <input type="text" name="rows" value= "'.$rows.'"/><br>
 | 
											<label>Filas:</label> <input type="number" name="rows" value= "'.$rows.'" required/><br>
 | 
				
			||||||
					<label>Columnas:</label> <input type="text" name="cols" value= "'.$cols.'"/><br>
 | 
											<label>Columnas:</label> <input type="number" name="cols" value= "'.$cols.'" required/><br>
 | 
				
			||||||
					<label>Butacas totales:</label> <input type="text" name="seats" value= "'.$seats.'"/><br>
 | 
											<label>Butacas totales:</label> <input type="number" name="seats" value= "'.$seats.'"/><br>
 | 
				
			||||||
					<button type="submit" name="newHall">Crear</button></div><br>
 | 
											<button type="submit" name="new_hall" class="button large">Crear</button></div><br>
 | 
				
			||||||
					</fieldset>
 | 
										</fieldset>
 | 
				
			||||||
 | 
									</form>
 | 
				
			||||||
				';
 | 
									';
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
@@ -74,14 +70,11 @@ class FormHall extends Form {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //Process form:
 | 
					    //Process form:
 | 
				
			||||||
    public function processesForm($datos){
 | 
					    public static function processesForm($data){
 | 
				
			||||||
		$this->correct = true;
 | 
							if($data["option"] == "new"){
 | 
				
			||||||
		$bd = new HallDAO('complucine');
 | 
								Hall::create_hall($data);
 | 
				
			||||||
		
 | 
								$_SESSION['msg'] = "La sala se ha añadido correctamente";
 | 
				
			||||||
		
 | 
								header( "Location: ../?state=success" );
 | 
				
			||||||
		if($bd ){
 | 
					 | 
				
			||||||
			if($option == "list"){
 | 
					 | 
				
			||||||
				$this->halls = $bd->getAllHalls($cinema);
 | 
					 | 
				
			||||||
		}else {
 | 
							}else {
 | 
				
			||||||
			/* TODO
 | 
								/* TODO
 | 
				
			||||||
			$start = date('H:i:s', strtotime( $start ) );
 | 
								$start = date('H:i:s', strtotime( $start ) );
 | 
				
			||||||
@@ -111,8 +104,6 @@ class FormHall extends Form {
 | 
				
			|||||||
			}		
 | 
								}		
 | 
				
			||||||
			*/
 | 
								*/
 | 
				
			||||||
		}			
 | 
							}			
 | 
				
			||||||
			
 | 
					 | 
				
			||||||
		} else {$this->correct = false;}	
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								panel_manager/includes/processForm.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								panel_manager/includes/processForm.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					<?php 
 | 
				
			||||||
 | 
						   //General Config File:
 | 
				
			||||||
 | 
					    require_once('../../assets/php/config.php');
 | 
				
			||||||
 | 
						$prefix ="../../";
 | 
				
			||||||
 | 
						include_once('formHall.php');	
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if(isset($_POST['new_hall'])){
 | 
				
			||||||
 | 
							$data = array("option" => "new","number" => $_POST["number"],"cols" => $_POST["cols"],"rows" => $_POST["rows"], "cinema" => "1");
 | 
				
			||||||
 | 
							FormHall::processesForm($data);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					?>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user