Looking for Some Help new to Yii

Okay I will do my best to explain my issue as simply as possible.

I am attempting to create a School Management Website for my wife and possibly other teachers that will do/have the following:

  1. Teacher Logs in with her email and password (validated through Database)

  2. Teacher clicks on My Class Page

  3. Teacher can then place Students from the Students Table (sorted by gradelevel or some dbcriteria) into a Classroom (that she has created) of her choosing. She should be able to create more than one Classroom; and Students should be able to be placed into more than one Classroom, which implies a Many to Many Relationship? And how do I get this to work within Yii? ( Eventually, I would love to have a grid view of students on her classroom page that could be dragged into her classroom tables, assigning the studentid to that classroom) This can be done through jquery extensions I think??

  4. From that point, she should be able to access the specific Classroom she wants and create an Assignment and assign that Assignment to every Student or individual Students that was previously placed within that Classroom.

  5. Next, she would be able to Grade those Assignments.

My thoughts: Maybe install an extension like jeditable so she can edit/grade all the assignments at once. Is there a better Solution?? T

  1. Finally, After grading I will need to setup some type of canned reports, maybe with a print to excel feature or export to google docs if possible.

My tables in database:

User

ID, Email, Password, Name

Classroom

ID, Description, UserID (FK to User.ID)

Student

ID, Name, GradeLevel, ClassroomID (FK to Classroom.ID)

Assignment

ID, Description, StudentID (FK to Student.ID)

Grade

ID, Score, Letter, AssignmentID(FK to Assignment.ID)

I didn’t feel that I needed a seperate Teacher table since every User will be either a Teacher or Admin type User. Will probably need a Roles table as well something like Admin, Teacher, Para, Aid… Something like that.

[b]RelationShips (What I think) please tell me if I am correct?

[/b]

User to Classroom - One to Many

Classroom to Student - Many to Many

Student to Assignments - Many to Many

Assignments to Grades - Many to Many

Do I need a middle table between each Many to Many ???? like:

Classroom to ClassroomStudent to Student

ClassroomStudent would contain a foreign key for UserID to User.ID and ClassroomID to Classroom.ID ?? Is this the right way to do this?

Does the middle table just need the 2 columns: ClassroomID and StudentID as Foreign Keys linked to the primary keys(ID) of Classroom and Student tables?

So basically my Tables would end up like this:

User to Classroom - One to Many

Classroom to ClassroomStudent - One to Many

ClassroomStudent to Student - One to Many

Student to StudentAssignment - One to Many

StudentAssignment to Assignment - One to Many

Assignment to AssignmentGrade - One to Many

AssignmentGrade to Grade - One to Many

Whew Okay, so I know this is a long read, and it’s long because I have been stubborn and trying to bull my way through this, without asking for help.

Extensions I have (not sure if required):

Giix - I know this works and have used it

CAdvancedArBehavior - I Honestly don’t know how to check if this is working.

My Database is Connected.

A quick list of what I really need help with to move further:

1. Do my relationships in MySQL database matter at all? Or is it all defined through each model like:

public function relations() {

	return array(


		'assigns' => array(self::HAS_MANY, 'Assign', 'StudentID'),


	);


}

2. Assuming the Relationships are correct. What is the correct way to insert from a form a new Classoom and place the students into that Classroom. Do I use the Classroom form, or to use the ClassroomStudent form (if middle table) to do this? And if I do this, the form will ask for just the StudentID and ClassroomID, how do I pull the student name and classroom description in this form? Shouldn’t the foreign keys and the Crud do most of this work for me. What am I missing?

3. Should I be using Giix or just the original Gii Models/Crud here?

I am willing to upload anything, here. I havn’t orginally just because I have redone my database a couple times now and not sure on the better/correct ways to do handle the relationships.

[b]So if I could get some input on helping to correctly define the relationships on the database side, get the relationships working on the Yii application side, and get the data to show and input correctly from the yii forms and views.

[/b]

I have done tons of research and tried many things. So just providing me a link to http://www.yiiframework.com/doc/guide/1.1/en/database.arr will not help me unless you do some explaining to go along with it.

I would appreciate really any help with this so I can continue to make progress. Also if I can clarify anything please let me know. Thanks for your time.