No, they shouldn't have went through your phone, but he did, so learn from this lesson and don't make that mistake again.

Once you are registered in their school, they own you, and if you were playing with your phone during class, then they have that right to take it away, but going through your phone is going a step further that I don't agree with.

Oh well, lesson learned.