[TASK] Clean up form system extension
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / Controller / Wizard.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010 Patrick Broens (patrick@patrickbroens.nl)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24 define('TYPO3_MOD_PATH', 'sysext/form/Classes/Controller/');
25 $BACK_PATH = '../../../../';
26 require($BACK_PATH . 'init.php');
27 require($BACK_PATH . 'template.php');
28
29 /**
30 * The form wizard controller
31 *
32 * @category Controller
33 * @package TYPO3
34 * @subpackage form
35 * @author Patrick Broens <patrick@patrickbroens.nl>
36 * @license http://www.gnu.org/copyleft/gpl.html
37 * @version $Id$
38 */
39 class tx_form_controller_wizard {
40 /**
41 * Dispatch on action
42 *
43 * Calls the requested action
44 *
45 * @return void
46 */
47 public function dispatch() {
48 switch(t3lib_div::_GP('action')) {
49 case 'save':
50 $this->saveAction();
51 break;
52 case 'load':
53 $this->loadAction();
54 break;
55 default:
56 $this->indexAction();
57 }
58 }
59
60 /**
61 * The index action
62 *
63 * The action which should be taken when the wizard is loaded
64 *
65 * @return void
66 */
67 protected function indexAction() {
68 /** @var $repository tx_form_domain_repository_content */
69 $repository = t3lib_div::makeInstance('tx_form_domain_repository_content');
70
71 /** @var $view tx_form_view_wizard_wizard */
72 $view = t3lib_div::makeInstance('tx_form_view_wizard_wizard');
73 $view->setRepository($repository);
74 $view->render();
75 }
76
77 /**
78 * The save action
79 *
80 * The action which should be taken when the form in the wizard is saved
81 *
82 * @return void
83 */
84 protected function saveAction() {
85 /** @var $repository tx_form_domain_repository_content */
86 $repository = t3lib_div::makeInstance('tx_form_domain_repository_content');
87
88 /** @var $view tx_form_view_wizard_save */
89 $view = t3lib_div::makeInstance('tx_form_view_wizard_save');
90 $view->setRepository($repository);
91 $view->render();
92 }
93
94 /**
95 * The load action
96 *
97 * The action which should be taken when the form in the wizard is loaded
98 *
99 * @return void
100 */
101 protected function loadAction() {
102 /** @var $repository tx_form_domain_repository_content */
103 $repository = t3lib_div::makeInstance('tx_form_domain_repository_content');
104
105 /** @var $view tx_form_view_wizard_load */
106 $view = t3lib_div::makeInstance('tx_form_view_wizard_load');
107 $view->setRepository($repository);
108 $view->render();
109 }
110 }
111
112 /** @var $wizard tx_form_controller_wizard */
113 $wizard = t3lib_div::makeInstance('tx_form_controller_wizard');
114 $wizard->dispatch();
115 ?>