This is the representation of the "spacetime propagtor" in terms of energy eigenfunctions. It's quite easy to prove. I'd like to write ##\tilde{G}^+(x,y,E)##, because it's a different function than ##G^+(x,t,x',t')##. You have of course
$$G^+(x,t,x',t')=G^+(x,x',t-t'),$$
because obviously the textbook author considers a Hamiltonian that's not explicitly time dependent and thus the system is time-translation invariant. Then you have
$$G^+(x,t,x',t')=\int_{\mathbb{R}} \frac{\mathrm{d} E}{2 \pi} G^+(x,x',E) \exp[-\mathrm{i} E(t-t')]. \qquad (**)$$
Further I also guess that ##G^+## is the retarded propagator. It's necessary to know that, because the definition of ##\tilde{G}^+## is incomplete without telling, how to deal with the poles at ##E=E_n##. For the retarded propgator you get
$$\tilde{G}^{+}(x,y,E)=\sum_n \frac{\mathrm{i} \phi_n(x) \phi_n^*(y)}{E-E_n+\mathrm{i} 0^+}. \qquad (*)$$
Then you have
$$(\mathrm{i} \partial_t -\hat{H}) G^+(x,t,x',t') = \int_{\mathrm{R}} \frac{\mathrm{d} E}{2 \pi} \exp[-\mathrm{i} E (t-t')] [E-\hat{H}] \sum_n \frac{\mathrm{i} \phi_n(x) \phi_n(x')}{E-E_n + \mathrm{i} 0^+} =\int_{\mathrm{R}} \frac{\mathrm{d} E}{2 \pi} \exp[-\mathrm{i} E (t-t')] \sum_n \mathrm{i} \psi_n(x) \psi_n^*(x') = \mathrm{i} \delta(t-t') \delta^{(3)}(\vec{x}-\vec{x}').$$
In the last step I've used the completeness of the energy eigenbasis.
With the choice of the regularization of the poles given (*), ##G^+## is choosen to be the retarded Green's function, i.e.,
$$G^+(x,t,x',t') \propto \Theta(t-t'),$$
as one can see, when taking the Fourier integral in (**) by closing the integration path in the complex energy plane with a large circle. For ##t-t'>0## you have to close the circle in the lower plane, including all the poles. So there you get some non-zero value, but for ##t-t'<0## you have to close the contour in the upper plane, and this gives 0, because there are no poles in the upper plane (thanks to the ##+\mathrm{i} 0^+## in the denominator). For ##t-t'<0## you can solve the integral very easily using the Theorem of Residues, leading finally to
$$G^+(x,t,x',t')=\Theta(t-t') \sum_{n} \phi_n(x) \phi_n^*(x') \exp[-\mathrm{i} E_n(t-t')].$$
Using ##\partial_t \Theta(t-t')=\delta(t-t')## it's easy to show again that this is indeed the retarded Green's function using the completeness of the energy eigenbasis.