"./?state=mf");
        parent::__construct('formEditFilm', $options);
    }
	protected function generaCamposFormulario($datos, $errores = array()){
       
        // Se generan los mensajes de error si existen.
        $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
        $errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
        $errorDuration = self::createMensajeError($errores, 'duration', 'span', array('class' => 'error'));
        $errorLanguage = self::createMensajeError($errores, 'language', 'span', array('class' => 'error'));
		$errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
		$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error'));
		$html = '
        
        
        ';
        return $html;
    }
	protected function procesaFormulario($datos){
        $result = array();
        $id =  $this->test_input($_POST['id']) ?? null;
        if ( empty($id)) {
			$result[] = "La pelicula seleccionada no existe.";
		}
        $tittle = $this->test_input($datos['tittle']) ?? null;
		//|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $tittle) 
        if ( empty($tittle) ) {
            $result['tittle'] = "El título no es válido";
        }
        $duration = $this->test_input($datos['duration']) ?? null;
		//||!mb_ereg_match(self::HTML5_EMAIL_REGEXP, $duration) 
        if ( empty($duration) || $duration <0) {
            $result['duration'] = "La duración no es válida";
        }
        
        $language = $this->test_input($datos['language']) ?? null;
		//|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $language)
        if ( empty($language)  ) {
            $result['language'] = "El idioma no es válido";
        }
		$description = $this->test_input($datos['description']) ?? null;
		//|| !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $description) 
        if ( empty($language)) {
            $result['language'] = "La descripcion no es válida";
        }
	
        if (count($result) === 0) {
        	$bd = new Film_DAO("complucine");
			$exist = $bd-> FilmData($id);
                if( mysqli_num_rows($exist) == 1){
                    $bd->editFilm($id,$tittle,$duration,$language,$description);
                    $_SESSION['message'] = "
                                            
                                            
                                                
                                                     Operacion realizada con exito 
                                                     Se ha editado la pelicula correctamente en la base de datos.
                                                    
                                                 
                                             
                                            
                                         
                                        ";
                     $result = './?state=mf';
                }
                else{
                    $result[] = "La pelicula seleccionada no existe.";
                }
                $exist->free();
		}
		return $result;
	}
    protected function test_input($input){
        return htmlspecialchars(trim(strip_tags($input)));
    }
}
?>