);
        parent::__construct('formEditCinema',$op)
    } 
    protected function generaCamposFormulario($datos,$errores=array()){
        $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
        $errorName = self::createMensajeError($errores,'name','span',array('class'=>'error'));
        $errorDirection = self::createMensajeError($errores,'direction','span',array('class'=>'error'));
        $errrorPhone = self ::createMensajeError($errores,'phone',array('class'=>'error'));
        $html = '
                    
                  ';
        return $html;
    }           
    
     //Process form:
	public function procesaFormulario($datos) {
        $result =array();
        
        
        $id =  $this->test_input($_POST['id']) ?? null;
        if ( empty($id)) {
			$result[] = "El cine seleccionado no existe.";
		}
        $name = $this->test_input($datos['name'])??null;
        
        if(empty($name)){
            $result['name']= "El nombre no es válido";
        }
        
        $direction = $this -> test_input($datos['direction']) ?? null;
        if(empty($direction)){
            $result['direction'] = "La dirección no es valida";
        }
        $phone = $this -> test_input($datos['phone']) ?? null;
        if(empty($phone)){
            $result['phone'] = "El teléfono no es valido";
        }
	
        if(count($result)===0){
        
		$bd = new Cinema_DAO('complucine');
        $exist = $bd -> GetCinema($name,$direction);
		    if(mysqli_num_rows($exist)==1){
               
                $bd->editCinema($id,$name,$direction,$phone);
                $_SESSION['message'] = "
                                        
                                        
                                            
                                                 Operacion realizada con exito 
                                                 Se ha editado el cine correctamente en la base de datos.
                                                
                                             
                                         
                                        
                                     
                                    ";
                $result = './?state=mc'; 
            }
            else{
                $result[] = "El cine seleccionado no existe.";	                  
            }	
            $exist->free();	
		}
        return $result;	
	}
	protected function test_input($input){
		return htmlspecialchars(trim(strip_tags($input)));
	}
}
?>