Influence of environment on the luminescence of rare earths