i’m going to develop an online tool similar to ‘blackboard’ if anyone’s used it; this site will contain grades and whatever else the teachers happen to post. behind the teachers will be several admin accounts that manage not only teachers, but students as well.
i’ve never created a site of this size. because i’d like for the code to be clean, efficiently done, and using the best programming concepts, i’ve decided to use OOP with this project. i am familiar with the syntax of it all (i’ve taken several C++ courses), instead i am unsure how i’d utilize OOP in the web development world.
i’ve read several tutorials and most used a shopping cart as an example. the first question that arose was:
1) what’s the variable scope of a class instance; does it automatically span from page to page or does it need to be in a session variable in order to do that?
now that some background is given in regards to the project, i was wondering how i should set up the classes, this is what i had in mind.
[code=php]
<?php
class Teacher {
function add_student() { /*add student*/t }
function delete_student() { /*delete student*/ }
function modify_student() { /*modify student*/ }
function post_documents() { /*postdocuments*/ }
function edit_gradebook() { /*edit gradebook*/ }
}
class Admin extends Teacher
{
function add_teacher() { /*add teacher*/ }
function remove_teacher() { /*remove teacher*/ } ;
function add_admin() { /*add admin*/ } ;
function remove_admin() { /*remove admin*/ } ;
}
class Student
{
function show_homework() { /*show homework*/ }
function show_grades() { /*show grades*/ }
function change_info() { /*change pw or email*/ }
}
?>
2) how much of the php code should be on the page using the class.php include and how much code should be in the class.php itself (the code pasted above)?
3) do classes generally include functions that echo html fields and content?
any tips regarding this would be highly appreciated. thanks.