[TASK] Remove DocumentTemplate section in Wizard controllers
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / View / Wizard / SaveWizardView.php
1 <?php
2 namespace TYPO3\CMS\Form\View\Wizard;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * The form wizard save view
19 */
20 class SaveWizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView
21 {
22 /**
23 * The main render method
24 *
25 * Gathers all content and echos it to the screen
26 *
27 * @return void
28 */
29 public function render()
30 {
31 $success = false;
32 // Check if the referenced record is available
33 $this->recordIsAvailable = $this->repository->hasRecord();
34 if ($this->recordIsAvailable) {
35 // Save the data
36 $success = $this->repository->save();
37 }
38 $this->headerOutput($success);
39 }
40
41 /**
42 * Construct the response header
43 *
44 * @param string $success JSON string
45 * @return void
46 */
47 protected function headerOutput($success)
48 {
49 if (!$success) {
50 header('HTTP/1.1 500 Internal Server Error');
51 $jsonArray = array('message' => $this->getLanguageService()->getLL('action_save_message_failed', false));
52 } else {
53 $jsonArray = array('message' => $this->getLanguageService()->getLL('action_save_message_saved', false));
54 }
55 $json = json_encode($jsonArray);
56 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
57 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
58 header('Cache-Control: no-cache, must-revalidate');
59 header('Pragma: no-cache');
60 header('Content-Length: ' . strlen($json));
61 header('Content-Type: application/json; charset=utf-8');
62 header('Content-Transfer-Encoding: 8bit');
63 echo $json;
64 die;
65 }
66 }