Generalization of the Franck-Condon model for phonon excitations by resonant inelastic x-ray scattering