[TASK] BACK_PATH DocumentTemplate
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Controller / ContentElement / ElementHistoryController.php
1 <?php
2 namespace TYPO3\CMS\Backend\Controller\ContentElement;
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 use TYPO3\CMS\Core\Utility\GeneralUtility;
18
19 /**
20 * Script Class for showing the history module of TYPO3s backend
21 * @see \TYPO3\CMS\Backend\History\RecordHistory
22 */
23 class ElementHistoryController {
24
25 /**
26 * @var string
27 */
28 public $content;
29
30 /**
31 * Document template object
32 *
33 * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
34 */
35 public $doc;
36
37 /**
38 * @var array
39 */
40 protected $pageInfo;
41
42 /**
43 * Constructor
44 */
45 public function __construct() {
46 $this->getLanguageService()->includeLLFile('EXT:lang/locallang_show_rechis.xlf');
47 $GLOBALS['SOBE'] = $this;
48
49 $this->init();
50 }
51
52 /**
53 * Initialize the module output
54 *
55 * @return void
56 */
57 protected function init() {
58 // Create internal template object
59 $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
60 $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/show_rechis.html');
61 // Start the page header
62 $this->content .= $this->doc->header($this->getLanguageService()->getLL('title'));
63 }
64
65 /**
66 * Generate module output
67 *
68 * @return void
69 */
70 public function main() {
71 // Start history object
72 $historyObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\History\RecordHistory::class);
73 // Get content:
74 $this->content .= $historyObj->main();
75 // Setting up the buttons and markers for docheader
76 $docHeaderButtons = $this->getButtons();
77 $markers['CONTENT'] = $this->content;
78 $markers['CSH'] = $docHeaderButtons['csh'];
79 // Build the <body> for the module
80 $this->content = $this->doc->startPage($this->getLanguageService()->getLL('title'));
81 $this->content .= $this->doc->moduleBody($this->pageInfo, $docHeaderButtons, $markers);
82 }
83
84 /**
85 * Outputting the accumulated content to screen
86 *
87 * @return void
88 */
89 public function printContent() {
90 $this->content .= $this->doc->endPage();
91 $this->content = $this->doc->insertStylesAndJS($this->content);
92 echo $this->content;
93 }
94
95 /**
96 * Create the panel of buttons for submitting the form or otherwise perform operations.
97 *
98 * @return array All available buttons as an assoc. array
99 */
100 protected function getButtons() {
101 $buttons = array(
102 'csh' => '',
103 'back' => ''
104 );
105 // CSH
106 $buttons['csh'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'history_log');
107 // Start history object
108 $historyObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\History\RecordHistory::class);
109 if ($historyObj->returnUrl) {
110 $buttons['back'] = '<a href="' . htmlspecialchars($historyObj->returnUrl) . '" class="typo3-goBack">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
111 }
112 return $buttons;
113 }
114
115 /**
116 * Returns LanguageService
117 *
118 * @return \TYPO3\CMS\Lang\LanguageService
119 */
120 protected function getLanguageService() {
121 return $GLOBALS['LANG'];
122 }
123
124 }