Yes, the school can do this: a school can assign projects to students which must be completed after school hours, and such projects can include performances, attendence at events, etc. They can enforce those project requirements with grades. While what you describe is unusual, it, however, is not illegal.