Teacher allegedly had sex with student before he attempted suicide