$M$ is a graph manifold if and only if $\phi$ is not pseudo-Anosov and, in the reducible case, no component of the complete reduction of $\phi$ is pseudo-Anosov.