can any one help me how to make schedule for school , i mean , how can i determine who the teachers will take place in sunday ,monday , tue ....etc.and how can i determine how many lesson will they take place in the day ,without repeating the name of the teacher and the name of the class more than one in each part of the day . in the same time can't exceed the number of lessons which determined for every teacher .

if any one can give me any idea or any help , i will be so thankful for you.if you don't understand me well , you can ask me , i will be answer .i don't have any ideas about javascript or others .i am dealing with only php .