Generation of multi-atom entangled states and implementation of controlled-phase gating using photonic modules