It looks like you're new here. If you want to get involved, click one of these buttons!
I'm developing my very first plugin for Vanilla, and I'm fairly confused due to the lack of documentation. My target is (relatively) simple: I need to show a list of Users based on some criteria.
So far I have the Plugin's skeleton working and I'm creating a View that should show the list of Users, and I'm stuck. Here's what I've done and, in bold, my questions.
* I created a View file.
* I created a Controller method and called the Render on the View.
* Now, the View has to contain a form to allow filtering by Year range. I added two fields in the view, Year_From and Year_To.
* Form should use GET method, as it's a query and it doesn't post any data. Note: To achieve this, I forced
Form->Method = 'get' in the controller. Is it the correct approach?
* Validation: how do I do it? Since the form will be public, I use the
Form->IsPostBack() method to figure out when I actually have data. Then I should validate that both Years are Integers greater than a configured value (e.g. 2010), but I can't make it work. I analyzed other plugins, but they all just validate configuration data and use the Configuration Model. In my case, I don't have a Model, since the data will be used to build a query which, in turn, will query some Database Views. There's no Add/Edit/Delete possible. Should I have a Model anyway?
* Once I receive the correct arguments, where should I perform the Query? As stated previously, I'll need to build an SQL Query which will aggregate data from Database Views. No update operations will be possible, just a "simple" SELECT. I was therefore wondering if I should run the Query in the Controller, or, again, if I should build a Model. In both cases, what is the correct approach to produce a DataSet to feed to the View? I examined some plugins to find an answer, but I've noticed they all tackle the problem differently and, sometimes, in very "dirty" ways.
Apologies for the long post, but I tried to find the answers myself and, for every answer I found, two more questions came out... So I figured out that it would probably be quicker to ask to some experts.
Thanks in advance for the help.