Dynamic Movement Primitives (DMPs) as a robust and efficient framework has been studied widely for robot learning from demonstration. Classical DMPs framework mainly focuses on the movement learning in Cartesian or joint space, and can't properly represent end-effector orientation. In this paper, we present an Extended DMPs framework (EDMPs) both in Cartesian space and Riemannian manifolds for Quaternion-based orientations learning and generalization. Gaussian Mixture Model and Gaussian Mixture Regression are adopted as the initialization phase of EDMPs to handle multi-demonstrations and obtain their mean and covariance. Additionally, some evaluation indicators including reachability and similarity are defined to characterize the learning and generalization abilities of EDMPs. Finally, the quaternion-based orientations are successfully transferred from human to the robot, and a real-world experiment is conducted to verify the effectiveness of the proposed method. The experimental results reveal that the presented approach can learn and generalize multi-space parameters under multi-demonstrations.