[BUGFIX] EXT:form: Make hardcoded messages translatable
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / View / Wizard / LoadWizardView.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 load view
19 *
20 * @author Patrick Broens <patrick@patrickbroens.nl>
21 */
22 class LoadWizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
23
24 /**
25 * The main render method
26 *
27 * Gathers all content and echos it to the screen
28 *
29 * @return void
30 */
31 public function render() {
32 $jsonObject = $this->repository->getRecordAsJson();
33 $this->headerOutput($jsonObject);
34 }
35
36 /**
37 * Construct the response header
38 *
39 * @param mixed $jsonObject JSON string, FALSE if not succeeded
40 * @return void
41 */
42 protected function headerOutput($jsonObject) {
43 if (!$jsonObject) {
44 header('HTTP/1.1 500 Internal Server Error');
45 $jsonArray = array('message' => $this->getLanguageService()->getLL('action_load_message_failed', FALSE));
46 } else {
47 $jsonArray = array('configuration' => $jsonObject);
48 }
49 $json = json_encode($jsonArray);
50 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
51 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
52 header('Cache-Control: no-cache, must-revalidate');
53 header('Pragma: no-cache');
54 header('Content-Length: ' . strlen($json));
55 header('Content-Type: application/json; charset=utf-8');
56 header('Content-Transfer-Encoding: 8bit');
57 echo $json;
58 die;
59 }
60
61 }