Phonon-assisted trapping and detrapping of an electron in quantum wells and wires by ionized impurity