On Mon, Apr 13, 2009 at 2:06 PM, Joseph Roberts <josephjtrobe...@gmail.com> wrote: > > Greetings fellow bakers, > > I need help with a development project where I work at a rescue > mission. I am creating a volunteer management system that involves > many models such as: groups, jobs, volunteers, skeleton_jobs and > scheduled_jobs. Being new to CakePHP, this is my quandary: How do I > implement MVC in this case? > > I would like to have one view, let's call it volunteer_manager.ctp, > that accesses information from all these aforementioned models and > displays the data in <div> tags in an iTunes-esque display so that > everything is on one screen (i.e. mini calendar, scrollable divs for > lists of groups, volunteers and jobs). I have a prototype working with > drag and drop capability, but am running into issues with > requestAction. Some resources I've read have said requestAction is a > "bad practice." > > That being said, how to I utilize data from a number of MVC > relationships in a single view without using requestAction? Should I > turn the groups, departments, volunteers, and jobs into elements that > are included within volunteer_manager.ctp? Each of these elements > requires the basic CRUD functions. Perhaps I'm not conceptualizing > elements properly, but from the Cookbook's description they seem to be > rather limited display aids rather than full blown MVC relationships. > I need help understanding elements or a viable alternative because the > relationships in this app are getting complicated and I don't want to > design myself into a corner. > > For instance, when I click on a date in the mini calendar not only is > the calendar div updated, but the jobs div should be updated to > reflect all available jobs for that day AND the groups, volunteers, > and scheduled jobs should be updated as well. This requires a number > of requestAction calls as it now stands. > > Perhaps I should get away from Ajax calls to update the individual > <div> tags in volunteer_manager.ctp, but I don't want to reload the > screen (and reload every bit of data in the divs) just because one div > element needs to change. >
You can use a generalised manager ontroller to fetch the data from several models. Whether you include those other models in the controller's $uses array or use ClassRegistry::init() as needed is up to you (maybe you don't want all of the models loaded for every action). You can still use ajax to make changes. Just point the requests to the appropriate controller. The link may be in a view for volunteer_manager but it can point to any other controller. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---