A secondary school has banned smartphones for Year 7 to 11 pupils and will only allow basic "brick" phones from September.