Substitute teacher accused of ‘fondling himself’ in court