"./?state=mc");
        parent::__construct('formAddCinema',$op);
    } 
    protected function generaCamposFormulario($datos,$errores=array()){
        $html ="";
        if(!isset($_SESSION['message'])) {
            $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
            $errorId= self::createMensajeError($errores,'id','span',array('class'=>'error'));
            $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($datos['id']) ?? null;
       // if (is_null($id)) {
		//	$result['id'] = "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 -> existCinema($id);
		    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;	
	}
}
?>