The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Confused about datamanagers
I have been looking at datamanagers and trying to write a custom one based upon Alan@CIT's article .
I have been looking at the simplest datamanager in vbulletin which seems to be class_dm_announcement.php and have the following question which i hope to have answered by someone as the following issue makes no sense to me... In looking at the class file, the $validfields array is as follows: PHP Code:
PHP Code:
And the fields in the table `announcement` are as follows: Code:
announcementid title userid startdate enddate pagetext forumid views announcementoptions Since the class needs considers 'allowhtml', 'allowbbcode', and 'allowsmilies' valid fields, but since the fields do not exist within the announcement table, how does the class use these fields to get the data into the post table? Also, how does the class know to utilize any other table than announcement? |
#2
|
||||
|
||||
Quote:
in pseudo code: PHP Code:
try starting with this... PHP Code:
|
#3
|
||||
|
||||
ah, i didn't notice those being in bitfields. Thanks for pointing that out.
Is it possible then to use a datamanager to save data into 2 different tables at the same time? Would the primary info be inserted into the table through the class's normal functions of class vB_DataManager, then the repeating data (1 or more details related to the primary data) be inserted by including the actual query info within the class vB_DataManager_Multiple? Here's the class in progress: PHP Code:
|
#4
|
||||
|
||||
The idea of a data manager is that it...manages data. It takes a request, such as building a forum, and updates all the tables and fields and whatever so that the update takes place. Note for instance that the vb forum datamanager does something to update the datastore (I don't know what, I have never looked).
In summary then your one data manager should manage all the data. If the secondary table is fixed, just hard wire it into your code. PHP Code:
|
#5
|
||||
|
||||
Forgive me, I couldn't find any info on the datastore within class_dm_forum.php but I do see that it does update the forum table (for applying forum password to child forums) within function post_save_each so i know i'm on the right track - i just have to keep trying to understand how the datamanager works. OOP is still somewhat confusing to me, i usually write straight code, but the project i am working on now is at a point where I need to use a DM to simplify things, so until i can grasp it well enough i'll just keep asking questions, reading the vbulletin manual Appendix 4, and experimenting, thanks!
|
#6
|
||||
|
||||
Have a read through class_dm.php, it will give you some ideas.
|
#7
|
||||
|
||||
yeah, I have been looking at that. It seems that class_dm.php is the base class, and in any datamanagers that "extend" the main class, if there's a function with the same name as the one in the main class, override it with the new function, and also declares new functions for doing anything unique within the new class.
I have creades some simple dms for handling things with just a few fields, but I think for my situation i explained above, it would be easier to create 2 different datamanagers, one for the main record, and another to handle the related records because even after looking at class_dm.php for an entire day (along with just about every other dm, I cant figure out how the class knows to loop through related records , i.e. the way class_multiple is called for the specific multiple records. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|