[TASK] Move and Namespace classes
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / Controller / WizardController.php
1 <?php
2 namespace TYPO3\CMS\Form\Controller;
3
4 /**
5 * The form wizard controller
6 *
7 * @category Controller
8 * @package TYPO3
9 * @subpackage form
10 * @author Patrick Broens <patrick@patrickbroens.nl>
11 */
12 class WizardController {
13
14 /**
15 * Dispatch on action
16 *
17 * Calls the requested action
18 *
19 * @return void
20 */
21 public function dispatch() {
22 switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) {
23 case 'save':
24 $this->saveAction();
25 break;
26 case 'load':
27 $this->loadAction();
28 break;
29 default:
30 $this->indexAction();
31 }
32 }
33
34 /**
35 * The index action
36 *
37 * The action which should be taken when the wizard is loaded
38 *
39 * @return void
40 */
41 protected function indexAction() {
42 /** @var $view \TYPO3\CMS\Form\View\Wizard\WizardView */
43 $view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\View\\Wizard\\WizardView', $this->getRepository());
44 $view->render();
45 }
46
47 /**
48 * The save action
49 *
50 * The action which should be taken when the form in the wizard is saved
51 *
52 * @return void
53 */
54 protected function saveAction() {
55 /** @var $view \TYPO3\CMS\Form\View\Wizard\SaveWizardView */
56 $view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\View\\Wizard\\SaveWizardView', $this->getRepository());
57 $view->render();
58 }
59
60 /**
61 * The load action
62 *
63 * The action which should be taken when the form in the wizard is loaded
64 *
65 * @return void
66 */
67 protected function loadAction() {
68 /** @var $view \TYPO3\CMS\Form\View\Wizard\LoadWizardView */
69 $view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\View\\Wizard\\LoadWizardView', $this->getRepository());
70 $view->render();
71 }
72
73 /**
74 * Gets the repository object.
75 *
76 * @return \TYPO3\CMS\Form\Domain\Repository\ContentRepository
77 */
78 protected function getRepository() {
79 return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Domain\\Repository\\ContentRepository');
80 }
81
82 }
83
84
85 ?>