[eluser]Vince Stross[/eluser]
I'm actually building something like this right now. I am stuck on how to store the data though. My architecture is the same as yours for [categories], [forms], and [fields]. However, the only way I could think of to get the [data] table to work right would be to add a field as a unique identifier which would indicate an instance of data. So if a user submitted a form, the [data] table would look something like this:
Code:
//Row 1
data_id = 1
form_id = 1
instance_id = 1
field_id = 1
data_value = 'New Site Launched!'
//Row 2
data_id = 2
form_id = 1
instance_id = 1
field_id = 2
data_value = '05/08/2008'
//Row 3
data_id = 3
form_id = 1
instance_id = 1
field_id = 3
data_value = 'user_name'
The next time the form was saved, the data would look like this:
Code:
//Row 4
data_id = 4
form_id = 1
instance_id = 2
field_id = 1
data_value = 'Another Site Launched!'
//Row 5
data_id = 5
form_id = 1
instance_id = 2
field_id = 2
data_value = '05/11/2008'
//Row 6
data_id = 6
form_id = 1
instance_id = 2
field_id = 3
data_value = 'user_name'
The only other way I could come up with involves using the $dbforge() library to create a table in the database for each form. The architecture would be basically the same, except instead of a [data] table you would have a [form_events] table and a [form_xYz] table. The [forms] table would still exist and just include another column for "form_table" which would be used to know which table the CMS should query for data.
I am happy to bounce ideas back and forth on this because I am trying to build it as we speak!
What are your thoughts?