Hello,
I hope you can help me. I am running PHP5 on Windows. I am new to PHP and object-oriented design.
I am creating an web-application that will allow users to upload images to a database. I would like each user to have his/her own user name and password. Additionally, I would like to be able to set up groups of users, which might have different permissions to view different files/folders.
Furthermore, I would like to be able to keep track of the actual person who took the photograph, which I will call a Contributor. A contributor might give his photos to an existing user (say on a CD) in order to upload, or a user might be a contributor themselves, in which case they would log in and upload their own photos.
So that is the scenario. I am having trouble designing the classes for this system.
My thinking so far is this:
1) Have a class of Member. This class will hold information like what permissions the member has.
2) Have a class of User which extends Member. Additional properties will include username and password.
3) Have a class of UserGroup which also extends Member. Additional properties will include a list of Users that belong to this group.
My first question is this: is the above good OO design? If not, why not?
Moving on...
I also need a Contributor class. This class will hold info about a contributor - like his name, contact details and his web-site address.
But sometimes users can also be contributors. However the User class can't extend more than once (it already extends Member). How do I deal with this situation?
Or maybe I'm going about this completely wrong??
Please help...