Tunable photonic crystal for THz radiation in layered superconductors: Strong magnetic-field dependence of the transmission coefficient