Unrelated data

2013-09-14 Thread Jeremy Burns
A question that I perhaps I should know the answer to, but I am not clear 
on the recommended approach - I am open to ideas.

I want to add a wizard process to an app. A wizard takes a user through a 
series of steps by visiting pages in sequence. Wizard availability and 
progress is managed in the session. The wizards are configurable with the 
definitions stored in tables (wizards, wizard_types and wizard_steps) - I 
have all the MVC goodness sorted for managing those. The wizard tables are 
not associated with any other tables.

I want to make those wizards available to users. So first I need to grab 
the list of wizards from the Wizard model and store them in session. When a 
user chooses one, an element appears that gives them information about the 
wizard, shows the completed, current and next steps and takes them to a 
page. So I need to access the wizard data/models/controllers from other 
models/controllers that are not related to any others. Ideally this would 
be a plugin as it lays over other functionality that ought to be agnostic 
of it. I guess I could:

1) Make it a plugin - but I still have the same challenge - how do I call a 
plugin-controller function from another?
2) Do some clever plugin/component callback trickery that is beyond me.
3) Use loadModel - but then I don't have access to controller functions 
(for managing the session, for example) and need to stitch functions into 
core models.
4) User requestAction in elements - but that seems a bit hacky. In any 
case, I probably need something triggered in AppController-beforeFilter to 
check the wizard status and decide what to do next.

So - pardon my ignorance - but I am really not sure the preferred way of 
doing this. What are your recommendations?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Unrelated data

2013-09-14 Thread Ivan Rimac
i had similar cases in my apps. i usually handle this with creating a model
with custom made methods inside it. afterwards, just load the model and use
model methods. i dint ran into any troubles and i know this is pretty much
straight forward way of doing this kind of thing. i guess making a
component or a plugin gives some extra work, but im not sure is it a so
much better way worth those extra work.
hope this helps.
cheers


On Sat, Sep 14, 2013 at 3:34 PM, Jeremy Burns
jeremybu...@classoutfit.comwrote:

 A question that I perhaps I should know the answer to, but I am not clear
 on the recommended approach - I am open to ideas.

 I want to add a wizard process to an app. A wizard takes a user through a
 series of steps by visiting pages in sequence. Wizard availability and
 progress is managed in the session. The wizards are configurable with the
 definitions stored in tables (wizards, wizard_types and wizard_steps) - I
 have all the MVC goodness sorted for managing those. The wizard tables are
 not associated with any other tables.

 I want to make those wizards available to users. So first I need to grab
 the list of wizards from the Wizard model and store them in session. When a
 user chooses one, an element appears that gives them information about the
 wizard, shows the completed, current and next steps and takes them to a
 page. So I need to access the wizard data/models/controllers from other
 models/controllers that are not related to any others. Ideally this would
 be a plugin as it lays over other functionality that ought to be agnostic
 of it. I guess I could:

 1) Make it a plugin - but I still have the same challenge - how do I call
 a plugin-controller function from another?
 2) Do some clever plugin/component callback trickery that is beyond me.
 3) Use loadModel - but then I don't have access to controller functions
 (for managing the session, for example) and need to stitch functions into
 core models.
 4) User requestAction in elements - but that seems a bit hacky. In any
 case, I probably need something triggered in AppController-beforeFilter to
 check the wizard status and decide what to do next.

 So - pardon my ignorance - but I am really not sure the preferred way of
 doing this. What are your recommendations?

 --
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP

 ---
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
*Ivan Rimac***
mail: i...@rimac.hr
*tel: +385 95 555 99 66*
*http://ivanrimac.com*
*http://rimac.hr*

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.