Recommender systems (RS) are software tools that provide personalized recommendations of relevant items to individual users. However, most of them do not take into account additional contextual information that may affect user preferences, such as place, time, or weather. Context-aware recommender systems (CARS) have been proposed to solve this problem by providing recommendations for users based on their rating history in different situations. Although most have tried to identify the contextual variables that have the greatest effect on rating accuracy, they have not directly considered the relationships among context, users, and items before predicting the ratings. In the real world, different contextual factors tend to affect users and items differently. This work proposes a latent probabilistic model for contextual recommendation by extending the flexible mixture model to incorporate different contextual factors. This model has the flexibility to adjust the effects of contextual factors on users and items according to a variety of context-user-item relations to suit specific situations. Our evaluation has shown that the proposed model's recommendations are more accurate than those made by both latent probabilistic models and collaborative filtering-based CARS.