Welcome Guest, Not a member yet? Register   Sign In
How to split the controller / model workload
#1

[eluser]Dave Stewart[/eluser]
Hi All,

I've some questions about the best way to structure classes in order to be flexible, and true to the MVC pattern, within the way that CI likes to work.

So, here's what I'm doing.

1 - I've a bunch of tables, including users, services, products, invoices, etc.
2 - A user can select any one of a number of report types, each of which will call up a fairly different SQL multiple join, returning different-sized and structured datasets
3 - Next, a table is created (although this could be a graph) and it is handed to the view
4 - Additionally some JavaScript related to the table is handed to the view (to allow such things as sorting etc)
5 - Depending on the report chosen, there may also be other HTML options that will be sent to the view

In summary:
1 - report type
2 - data
3 - view
4 - javascript
5 - further options

So, questions:
- Should I build a single model per report, or a master model with a function per report?
- What should the model contain: only database functionality, or the functionality for the JavaScript and HTML as well, or should this be in a controller?
- or should I just be including the actual javascript and such like in custom views per report?

As you can see, I'm not sure where to put everything in order to retain the MVC spirit.

Cheers,
Dave


Messages In This Thread
How to split the controller / model workload - by El Forum - 06-24-2008, 03:23 AM
How to split the controller / model workload - by El Forum - 06-24-2008, 03:38 AM
How to split the controller / model workload - by El Forum - 06-24-2008, 03:56 AM
How to split the controller / model workload - by El Forum - 06-24-2008, 04:03 AM
How to split the controller / model workload - by El Forum - 06-24-2008, 04:17 AM
How to split the controller / model workload - by El Forum - 06-24-2008, 04:39 AM
How to split the controller / model workload - by El Forum - 06-24-2008, 04:56 AM
How to split the controller / model workload - by El Forum - 06-24-2008, 05:27 AM
How to split the controller / model workload - by El Forum - 06-24-2008, 05:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB