This is an old revision of the document!
Table of Contents
Suggestion on class structure for PunBB2.0
example can be found here http://cereal.box.sk/punbbclass/
Explanation
There will be 2 versions of each class:
- the normal class (Read only)
- the _write version (extension of normal class) which will allow storage into the database
The classes
- PunBB: This is the parent calss for all other classes, all other classes will use this class as a basic data structure. This class will read the basic config from the db and config file, it will have a member object thats storing the db connection. actually this class will replace all current global variables.
- PunBB-category: This is basicly a wrapper class (read and write) around the forum categories
- PunBB-forum: This is basicly a wrapper class (read and write) around the forums
- PunBB-Topic: This is basicly a wrapper class (read and write) around the topics
- PunBB-Posts: This is basicly a wrapper class (read and write) around the Posts
- PunBB-User: This class will handly all user specifick tasks, login, logout, update profile, …. there will be a PunBB-User-Abstract class to make it easy for people to design there own class for user handling
Classes
PunBB
This class will hold all global vars needed for punbb to be run it will also keep references to the db builder object, the user array (will later be an object) and other stuff thats currently defined as globals …
PunBB-Category
- construct(id): the id of the category, must be bigger then 0
- getId
- getName
- getPosition
- getForums( outputmethode ): this wil either be an array of ids or an array of forum objects
PunBB-Category-write
- construct(id): id can be 0 (add a new category) or > 0 (edit a category)
- setName( val )
- setPosition( val )
- delete: only allow this if the id is not 0 and no forums are added to this category, or add a force option to recursively delete all forums
PunBB-Forum
- construct(id): the forum id, must be bigger then 0
- getName
- getDesc
- getRedirect
- getModerators
- getStats
- getCategory(outputmethode): get it as an id, or as an object
PunBB-Forum-write
- construct(id): id can be 0 (add a new forum) or > 0 (edit a forum)