The classroom discipline comes from the students' respect I believe. And love of the subject. I'm not a school teacher, but I have been a student, and I remember the days when I was in HS. I respected and worked hard for my teachers, always did my homework, especially Physics class which was my favorite. I was several chapters ahead on my own at the end of the year, made an A for the course, and was given a two week vacation from class along with everyone else who passed Senior year.
I remember one time the Physics teacher gave us an optional weekend project. It was a tough calculus problem, and I don't think the teacher had an answer himself. Just so happened I was visiting my brother that weekend and I showed it to him, and he worked out the problem in ten minutes.
On Monday I came back to school and handed in the problem and solution. It was satisfying to me because the teacher said, "How did you figure this out?" I never told him my brother figured it out.
Les