Newbie question about my project architecture

Hello everybody :) ,

I am not an English native speaker, so please forgive my mistakes ;)

I am glad to use Yii framework but I don’t know how to resolve my problem:

My project is a teacher schedule manager website. It stores the list of teachers, classes, subjects, etc.

Then, there are combinations with a teacher, its class, the number of students, how many hours per week…

The website must be able to do calculations to know how many students per teacher there is when they do their internships.

My database look like:

>Class

ID

Name

NumberOfStudents

>Internship

ID

ID_Class

StartDate

EndDate

>Teacher

ID

Name

ID_Subject

>Subject

ID

Name

>Teacher_Class

ID

ID_Teacher

ID_Class

>Hoursperweek

ID

ID_Teacher_Class

Value

I am able to initialize every tables with the PHP pages generated by Yii but I don’t how to do the calculations I need.

Basically, the caculations use the different tables to check who are the teachers that teach to this class, how many students

should they take care of (based on their teaching ration…), etc.

My final result would be a page with:

Internship date / Class

Teacher list with number of students for each

(In a CGridView for instance)

Should I create another Yii class for this? The results should be dynamic (function to teacher, hoursperweek updates).

I am lost with this object oriented programming approach. Feel free to criticize my technical choices.

Thank you!

Only some rough guideline, maybe it helps:

You could try to put that calculations into the model classes (AR). For each calculation you should find out, which is the best class for it (or: which feels most natural to you). You should end up with e.g. $teacher->getStudentCount() or something. Then create a new action for the page you want, retrieve the required models and push them into a view for rendering.