Actions

Controllers: Difference between revisions

From LimeSurvey Manual

No edit summary
(No difference)

Revision as of 12:28, 14 August 2012

This is a proposal for (re)organizing the controller structure for LS2.1

Currently we have very few but fat controllers. It is desirable to have skinny controllers for easier maintenance.

Several main tasks can be identified within LS.

- Survey taking

- Survey creation

- Token management

Since survey taking is what LS is all about we should try to decrease the complexity of this process.

A survey hasMany groups and a group hasMany questions. For taking a survey (which is creating a survey entry) four controllers should be used.

SurveyController

- Actions for creating and editing a survey.

GroupController

- Actions for creating and editing a group.

QuestionController

- Actions for creating and editing a question.

EntryController

- Responsible for managing the creation of new entries for surveys.

Example process:

- EntryController-> create entry for survey 1

- Redirect to SurveyController -> welcome screen (which has a post button that goes to entrycontroller)

- Redirect to GroupController -> welcome screen

And so on... This does not cause a lot of extra redirects since redirecting after a HTTP POST is standard procedure, we just change the POST ACTION.

This approach allows us to divide large complex controller(s) into smaller and easier to manage pieces.