General Design Questions

I am working on a project for a Student Management System for my school (gradebook, attendance, classes etc…). I currently have it running with straight php/mysql/html/js/ajax.

I have roles set up (isStudent, isTeacher, isParent, isAdmin, isOffice & isGuidance) and each user can have 1 or more of these flags set in the db.

I have pages like Take Attendance = index.php?lev=teach&cat=attend and a corresponding page teach_attend.php. I test the role before displaying the page to make sure the user has rights to this page.

I have some tables that are simple to convert to Yii like “user” simply generate the model and CRUD. I edit users directly. What do I do with a table like student2section which maps a user_id to a section_id (I think this is called a relation table)? I don’t really need to create CRUD for student2class do I ?

Also, I have course table (the different subjects I teach this year) and a section table (a course for a specific term (also in a separate table)). Currently I create the course and the sections at the same time. I have a page where I enter the course name and check the terms it will run in. When I submit, it creates the course in the course table, retrieves the course_id and creates a section (course_id,term_id) foreach term checked off. How should I do this with Yii? Separate CRUD for course & section or a single for section like I currently have?

Disclaimer: I am not a programmer by trade, I am a HS teacher. I work on this project just because it interests me.

I appreciate any assistance you may provide in helping me understand Yii.


Hi jujubee, welcome to Yii!

The first thing that I have to say to you is “Don’t throw away your current running app. Keep it running along with your new app until you finally got every features implemented with Yii.”

Building a web app using Yii (or any other PHP framework) is a completely different thing from doing it with plain PHP. There’s almost no piece of code that you can copy from the one and paste to the other. Your knowledge in PHP/mysql/html/js will surely be a strong help and you can count on it, but you have to learn how to use the framework first. If you insist on doing it in the way you’ve done it so far, the framework will not give you the maximum benefit that it can provide.

For your first try, I recommend that you build a tiny app with Yii that uses the current database of your app. Remember that you can share the database among your current app and the new app that will be built with Yii.

Softark, thanks for the input. I have no plans to throw away the current site. I am using this as a learning experience. I guess I am looking for guidance as to how to convert my current thinking (right or wrong) into appropriate Yii thinking.

The Definitive Guide to Yii 2.0 is the best thing with which you start learning/using Yii.

You’d better forget your project at least for, say, a month or two, I don’t know, until you can’t hold yourself back from writing your own code any more. :)